contractCwzy.js 45 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537
  1. import React from "react";
  2. import { Button, Input, Spin, Table, message, Form, Modal, Tabs, Select, DatePicker } from "antd";
  3. import $ from "jquery/src/ajax";
  4. import {
  5. getNewOrderStatus,
  6. getProcessStatusNew,
  7. splitUrl,
  8. getjiedian,
  9. getboutique,
  10. getCuikuan,
  11. getProjectStatus,
  12. ShowModal,
  13. getType
  14. } from "@/tools.js";
  15. import "./customer.less";
  16. import { ChangeDetail } from "./changeComponent/changeDetailCwzy.js";
  17. import { SearchInput } from "./changeComponent/searchInput.js";
  18. import OrderDetail from "./changeComponent/orderDetail";
  19. import { ChooseList } from "./chooseList.jsx";
  20. import ShowModalDiv from "@/showModal.jsx";
  21. const { RangePicker } = DatePicker;
  22. import ReactToPrint from "react-to-print";
  23. import OrderRiZi from "@/orderRiZi.jsx";
  24. const contractChange = Form.create()(
  25. React.createClass({
  26. loadData(pageNo) {
  27. this.setState({
  28. loading: true
  29. });
  30. $.ajax({
  31. method: "get",
  32. dataType: "json",
  33. crossDomain: false,
  34. url: globalConfig.context + "/api/admin/orderChange/orderChangeList",
  35. data: {
  36. pageNo: pageNo || 1,
  37. pageSize: this.state.pagination.pageSize,
  38. userName: this.state.searchData.userNameSearch,
  39. processState: this.props.processState,
  40. timeType: this.state.searchData.timeTypeSearch,
  41. startTime: this.state.searchData.releaseDate[0],
  42. endTime: this.state.searchData.releaseDate[1],
  43. salesmanName: this.state.searchData.salesmanNameSearch,
  44. complete: this.state.searchData.completeSearch || 1,
  45. depId: this.state.searchData.depIdSearch,
  46. orderNo: this.state.searchData.orderNoSearch,
  47. contractNo: this.state.searchData.contractNoSearch,
  48. type: this.state.searchData.changeSearch
  49. },
  50. success: function(data) {
  51. ShowModal(this);
  52. let theArr = [];
  53. if (data.error.length || data.data.list == "") {
  54. if (data.error && data.error.length) {
  55. message.warning(data.error[0].message);
  56. }
  57. } else {
  58. for (let i = 0; i < data.data.list.length; i++) {
  59. let thisdata = data.data.list[i];
  60. theArr.push({
  61. key: i,
  62. orderNo: thisdata.orderNo,
  63. createTimes: thisdata.createTimes,
  64. nickname: thisdata.nickname,
  65. orderType: thisdata.orderType,
  66. establishTimes: thisdata.establishTimes,
  67. orderStatus: thisdata.orderStatus,
  68. totalAmount: thisdata.totalAmount,
  69. settlementAmount: thisdata.settlementAmount,
  70. arrears: thisdata.arrears,
  71. salesmanName: thisdata.salesmanName,
  72. depName: thisdata.depName,
  73. processState: thisdata.processState,
  74. type: thisdata.type,
  75. status: thisdata.status,
  76. id: thisdata.id,
  77. contractNo: thisdata.contractNo,
  78. processStateText: getProcessStatusNew(
  79. thisdata.processState,
  80. thisdata.status
  81. )
  82. });
  83. }
  84. this.state.pagination.total = data.data.totalCount;
  85. this.state.pagination.current = data.data.pageNo;
  86. }
  87. if (data.data && data.data.list && !data.data.list.length) {
  88. this.state.pagination.total = 0;
  89. }
  90. this.setState({
  91. dataSource: theArr,
  92. pageNo: pageNo,
  93. pagination: this.state.pagination
  94. });
  95. }.bind(this)
  96. }).always(
  97. function() {
  98. this.setState({
  99. loading: false
  100. });
  101. }.bind(this)
  102. );
  103. },
  104. getInitialState() {
  105. return {
  106. dvisible: false,
  107. page: 1,
  108. searchData: {
  109. releaseDate: []
  110. },
  111. primaryOrderData: {}, //原订单数据
  112. orderData: {}, //现订单数据
  113. pictureUrl: [],
  114. voucherUrl: [],
  115. attachmentUrl: [],
  116. //收款数据
  117. proceedsData: {},
  118. proTotal: 0,
  119. invTotal: 0,
  120. contractData: {},
  121. // 回收退票数据
  122. refundInvoice: [],
  123. RefundInvoice: [],
  124. additionalOrderData: {},
  125. paginations: false,
  126. activeKey: "1",
  127. confirmLoading: false,
  128. aloading: false,
  129. pagination: {
  130. defaultCurrent: 1,
  131. defaultPageSize: 10,
  132. showQuickJumper: true,
  133. pageSize: 10,
  134. onChange: function(page) {
  135. this.loadData(page);
  136. }.bind(this),
  137. showTotal: function(total) {
  138. return "共" + total + "条数据";
  139. }
  140. },
  141. columns: [
  142. {
  143. title: "合同编号",
  144. dataIndex: "contractNo",
  145. key: "contractNo"
  146. },
  147. {
  148. title: "订单编号",
  149. dataIndex: "orderNo",
  150. key: "orderNo"
  151. },
  152. {
  153. title: "客户名称",
  154. dataIndex: "nickname",
  155. key: "nickname"
  156. },
  157. {
  158. title: "订单部门",
  159. dataIndex: "depName",
  160. key: "depName"
  161. },
  162. {
  163. title: "订单类型",
  164. dataIndex: "orderType",
  165. key: "orderType",
  166. render: text => {
  167. return text ? "科技项目" : "认证项目";
  168. }
  169. },
  170. {
  171. title: "下单时间",
  172. dataIndex: "establishTimes",
  173. key: "establishTimes"
  174. },
  175. {
  176. title: "订单状态",
  177. dataIndex: "orderStatus",
  178. key: "orderStatus",
  179. render: text => {
  180. return getNewOrderStatus(text);
  181. }
  182. },
  183. {
  184. title: "合同额(万元)",
  185. dataIndex: "totalAmount",
  186. key: "totalAmount"
  187. },
  188. {
  189. title: "已付额(万元)",
  190. dataIndex: "settlementAmount",
  191. key: "settlementAmount"
  192. },
  193. {
  194. title: "欠款(万元)",
  195. dataIndex: "arrears",
  196. key: "arrears"
  197. },
  198. {
  199. title: "订单负责人",
  200. dataIndex: "salesmanName",
  201. key: "salesmanName"
  202. },
  203. {
  204. title: "变更类型",
  205. dataIndex: "type",
  206. key: "type",
  207. render: text => {
  208. return getType(text);
  209. }
  210. },
  211. {
  212. title: "审核状态",
  213. dataIndex: "processStateText",
  214. key: "processStateText"
  215. },
  216. {
  217. title: "提交时间",
  218. dataIndex: "createTimes",
  219. key: "createTimes"
  220. }
  221. ],
  222. dataSource: [],
  223. // 传递给子组件的
  224. dataProps: [],
  225. columnsX: [
  226. {
  227. title: "业务项目名称",
  228. dataIndex: "commodityName",
  229. key: "commodityName"
  230. },
  231. {
  232. title: "项目类别",
  233. dataIndex: "cname",
  234. key: "cname"
  235. },
  236. {
  237. title: "项目数量",
  238. dataIndex: "commodityQuantity",
  239. key: "commodityQuantity"
  240. },
  241. {
  242. title: "金额(万元)",
  243. dataIndex: "commodityPrice",
  244. key: "commodityPrice"
  245. },
  246. {
  247. title: "负责人",
  248. dataIndex: "contacts",
  249. key: "contacts"
  250. },
  251. {
  252. title: "负责人电话",
  253. dataIndex: "contactsMobile",
  254. key: "contactsMobile"
  255. },
  256. {
  257. title: "项目状态",
  258. dataIndex: "projectStatus",
  259. key: "projectStatus",
  260. render: text => {
  261. return getProjectStatus(text);
  262. }
  263. },
  264. {
  265. title: "主要项目",
  266. dataIndex: "main",
  267. key: "main",
  268. render: text => {
  269. return text ? "是" : "否";
  270. }
  271. },
  272. {
  273. title: "项目说明",
  274. dataIndex: "taskComment",
  275. key: "taskComment",
  276. render: text => {
  277. return text && text.length > 8 ? text.substr(0, 8) + "…" : text;
  278. }
  279. }
  280. ],
  281. // 子组件改变的表格title数组
  282. changeList: undefined,
  283. columnsrizhi: [
  284. {
  285. title: "流程",
  286. dataIndex: "processName",
  287. key: "processName"
  288. },
  289. {
  290. title: "操作人",
  291. dataIndex: "adminName",
  292. key: "adminName"
  293. },
  294. {
  295. title: "时间",
  296. dataIndex: "createDate",
  297. key: "createDate"
  298. }
  299. ],
  300. dataSourceX: [],
  301. ContactsLists: [
  302. {
  303. title: "催款科目",
  304. dataIndex: "dunSubject",
  305. key: "dunSubject",
  306. render: text => {
  307. return getjiedian(text);
  308. }
  309. },
  310. {
  311. title: "金额(万)",
  312. dataIndex: "money",
  313. key: "money"
  314. },
  315. {
  316. title: "催款状态",
  317. dataIndex: "dunStatus",
  318. key: "dunStatus",
  319. render: text => {
  320. return getCuikuan(text);
  321. }
  322. }
  323. ]
  324. };
  325. },
  326. departmentList() {
  327. this.setState({
  328. loading: true
  329. });
  330. $.ajax({
  331. method: "get",
  332. dataType: "json",
  333. crossDomain: false,
  334. url: globalConfig.context + "/api/admin/organization/selectSuperId",
  335. data: {},
  336. success: function(data) {
  337. let thedata = data.data;
  338. let theArr = [];
  339. if (!thedata) {
  340. if (data.error && data.error.length) {
  341. message.warning(data.error[0].message);
  342. }
  343. } else {
  344. thedata.map(function(item, index) {
  345. theArr.push({
  346. key: index,
  347. name: item.name,
  348. id: item.id
  349. });
  350. });
  351. }
  352. this.setState({
  353. departmentArr: theArr
  354. });
  355. }.bind(this)
  356. }).always(
  357. function() {
  358. this.setState({
  359. loading: false
  360. });
  361. }.bind(this)
  362. );
  363. },
  364. //页面加载函数
  365. componentWillMount() {
  366. this.loadData();
  367. },
  368. //整行点击
  369. tableRowClick(record) {
  370. this.setState(
  371. {
  372. visible: true,
  373. type: record.type,
  374. status: record.status,
  375. buttonStatus: true,
  376. orderStatus: record.orderStatus,
  377. processStateText: record.processStateText,
  378. id: record.id,
  379. orderNo: record.orderNo
  380. },
  381. () => {
  382. this.xiangqing(record.orderNo);
  383. this.xiangmu(record.orderNo);
  384. this.jiedian(record.orderNo);
  385. }
  386. );
  387. },
  388. //点击打卡项目详情
  389. tableRowClickX(record) {
  390. this.setState({
  391. jid: record.id, //项目ID
  392. kid: record.commodityId, //商品ID
  393. commodityName: record.commodityName, //金额
  394. commodityPrice: record.commodityPrice, //金额
  395. commodityQuantity: record.commodityQuantity, //数量
  396. taskComment: record.taskComment, //备注
  397. main: record.main.toString(), //是否为主要
  398. addnextVisible: true,
  399. addState: 0
  400. });
  401. },
  402. //项目详情关闭
  403. nextCancel() {
  404. this.setState({
  405. addnextVisible: false
  406. });
  407. },
  408. // 合同变更详情
  409. ChangeDetail(id) {
  410. let url = window.location.href.substring(7);
  411. $.ajax({
  412. method: "get",
  413. dataType: "json",
  414. crossDomain: false,
  415. url:
  416. globalConfig.context +
  417. "/api/admin/orderChange/orderChangeDetailsById",
  418. data: {
  419. id: id
  420. },
  421. success: function(data) {
  422. if (data.data) {
  423. let thisdata = data.data;
  424. Object.assign(thisdata, {
  425. processStateText: this.state.processStateText,
  426. userName: this.state.userName,
  427. contractNo: this.state.contractNo
  428. });
  429. // console.log("888",data);
  430. this.setState({
  431. contractData: thisdata,
  432. voucherUrl: thisdata.voucherUrl
  433. ? splitUrl(
  434. thisdata.voucherUrl,
  435. ",",
  436. globalConfig.avatarHost + "/upload",
  437. url
  438. )
  439. : []
  440. });
  441. console.log("url", this.state.voucherUrl);
  442. }
  443. }.bind(this)
  444. });
  445. $.ajax({
  446. method: "get",
  447. dataType: "json",
  448. crossDomain: false,
  449. url:
  450. globalConfig.context +
  451. "/api/admin/orderChange/listOrderInvoiceAndBill",
  452. data: {
  453. orderNo: this.state.orderNo
  454. },
  455. success: function(data) {
  456. if (!data.data) return;
  457. let proTotal = 0;
  458. let invTotal = 0;
  459. data.data.bill.forEach(item => {
  460. proTotal += item.transactionAmount;
  461. });
  462. data.data.invoice.forEach(item => {
  463. invTotal += item.amount;
  464. });
  465. this.setState({
  466. proceedsData: data.data,
  467. proTotal,
  468. invTotal
  469. });
  470. }.bind(this)
  471. });
  472. $.ajax({
  473. method: "get",
  474. dataType: "json",
  475. crossDomain: false,
  476. url:
  477. globalConfig.context +
  478. "/api/admin/orderChange/listOrderRefundInvoice",
  479. data: {
  480. orderNo: this.state.orderNo
  481. },
  482. success: data => {
  483. if (!data) return;
  484. data.data.forEach(item => {
  485. item.load = true;
  486. });
  487. this.setState({
  488. refundInvoice: data.data
  489. });
  490. }
  491. });
  492. },
  493. //订单详情
  494. xiangqing(orderNos) {
  495. $.ajax({
  496. method: "get",
  497. dataType: "json",
  498. crossDomain: false,
  499. url: globalConfig.context + "/api/admin/newOrder/getOrderNewDetail",
  500. data: {
  501. orderNo: orderNos
  502. },
  503. success: function(data) {
  504. if (data.error.length || data.data.list == "") {
  505. if (data.error && data.error.length) {
  506. message.warning(data.error[0].message);
  507. }
  508. } else {
  509. let thisdata = data.data;
  510. this.setState({
  511. userName: thisdata.userName,
  512. primaryOrderNo: thisdata.primaryOrder,
  513. additionalOrder: thisdata.additionalOrder,
  514. contractNo: thisdata.contractNo,
  515. // arrears: thisdata.arrears,
  516. orderData: thisdata,
  517. contractPictureUrl: thisdata.contractPictureUrl
  518. ? splitUrl(
  519. thisdata.contractPictureUrl,
  520. ",",
  521. globalConfig.avatarHost + "/upload"
  522. )
  523. : []
  524. });
  525. // console.log(thisdata.contractPictureUrl);
  526. }
  527. }.bind(this)
  528. });
  529. },
  530. // 原订单数据
  531. primaryOrder(primaryOrder) {
  532. $.ajax({
  533. method: "get",
  534. dataType: "json",
  535. crossDomain: false,
  536. url: globalConfig.context + "/api/admin/newOrder/getOrderNewDetail",
  537. data: {
  538. orderNo: primaryOrder
  539. },
  540. success: function(data) {
  541. if (data.error.length || data.data.list == "") {
  542. if (data.error && data.error.length) {
  543. message.warning(data.error[0].message);
  544. }
  545. } else {
  546. let thisdata = data.data;
  547. this.setState({
  548. primaryOrderData: thisdata
  549. });
  550. }
  551. }.bind(this)
  552. });
  553. },
  554. // 附加订单数据
  555. additionalOrder(additionalOrder) {
  556. $.ajax({
  557. method: "get",
  558. dataType: "json",
  559. crossDomain: false,
  560. url: globalConfig.context + "/api/admin/newOrder/getOrderNewDetail",
  561. data: {
  562. orderNo: additionalOrder
  563. },
  564. success: function(data) {
  565. if (data.error.length || data.data.list == "") {
  566. if (data.error && data.error.length) {
  567. message.warning(data.error[0].message);
  568. }
  569. } else {
  570. let thisdata = data.data;
  571. this.setState({
  572. additionalOrderData: thisdata
  573. });
  574. }
  575. }.bind(this)
  576. });
  577. },
  578. //项目列表
  579. xiangmu(orderNos) {
  580. $.ajax({
  581. method: "get",
  582. dataType: "json",
  583. crossDomain: false,
  584. url: globalConfig.context + "/api/admin/newOrder/getOrderTask",
  585. data: {
  586. orderNo: orderNos
  587. },
  588. success: function(data) {
  589. let theArr = [];
  590. if (data.error.length || data.data.list == "") {
  591. if (data.error && data.error.length) {
  592. message.warning(data.error[0].message);
  593. }
  594. } else {
  595. for (let i = 0; i < data.data.length; i++) {
  596. let thisdata = data.data[i];
  597. theArr.push({
  598. key: i,
  599. id: thisdata.id,
  600. orderNo: thisdata.orderNo, //订单编号
  601. commodityId: thisdata.commodityId, //项目ID
  602. commodityName: thisdata.commodityName, //项目名称
  603. cname: thisdata.cname, //项目类别
  604. commodityPrice: thisdata.commodityPrice, //项目价格
  605. commodityQuantity: thisdata.commodityQuantity, //项目数量
  606. main: thisdata.main, //是否为主要任务
  607. taskComment: thisdata.taskComment, //任务说明
  608. contacts: thisdata.contacts, //联系人
  609. contactsMobile: thisdata.contactsMobile, //联系人电话
  610. projectStatus: thisdata.projectStatus //项目状态
  611. });
  612. }
  613. }
  614. this.setState({
  615. dataSourceX: theArr
  616. });
  617. }.bind(this)
  618. });
  619. },
  620. // 查看收款金额
  621. getProceeds(id) {
  622. $.ajax({
  623. method: "get",
  624. dataType: "json",
  625. crossDomain: false,
  626. url:
  627. globalConfig.context +
  628. "/api/admin/orderChange/orderChangeDetailsById",
  629. data: {
  630. id: id
  631. },
  632. success: function(data) {
  633. if (data.error.length || data.data.list == "") {
  634. if (data.error && data.error.length) {
  635. message.warning(data.error[0].message);
  636. }
  637. } else {
  638. // let thisdata = data.data;
  639. }
  640. }.bind(this)
  641. });
  642. },
  643. search(obj) {
  644. this.setState(
  645. {
  646. searchData: obj
  647. },
  648. () => {
  649. this.loadData(1);
  650. }
  651. );
  652. },
  653. rizhi(orderNo) {
  654. $.ajax({
  655. method: "get",
  656. dataType: "json",
  657. crossDomain: false,
  658. url: "/api/admin/newOrder/selectOrderLog",
  659. data: {
  660. orderNo: orderNo
  661. },
  662. success: function(data) {
  663. let theArr = [];
  664. let thisData = data.data;
  665. if (!thisData.length) {
  666. if (data.error && data.error.length) {
  667. message.warning(data.error[0].message);
  668. }
  669. thisData = {};
  670. } else {
  671. for (let i = 0; i < data.data.length; i++) {
  672. let thisdata = data.data[i];
  673. theArr.push({
  674. processName: thisdata.processName,
  675. adminName: thisdata.adminName,
  676. createDate: thisdata.createDate
  677. });
  678. }
  679. }
  680. this.setState({
  681. dataSourcerizhi: theArr
  682. });
  683. }.bind(this)
  684. });
  685. },
  686. getOrderLog(orderNo) {
  687. this.setState({
  688. rizhivisible: true
  689. });
  690. this.rizhi(orderNo);
  691. },
  692. closeOrderLog() {
  693. this.setState({
  694. rizhivisible: false
  695. });
  696. },
  697. //节点列表
  698. jiedian(orderNos) {
  699. $.ajax({
  700. method: "get",
  701. dataType: "json",
  702. crossDomain: false,
  703. url: globalConfig.context + "/api/admin/newOrder/selectOrderDun",
  704. data: {
  705. orderNo: orderNos
  706. },
  707. success: function(data) {
  708. let theArr = [];
  709. let thisData = [];
  710. if (data.error.length || data.data.list == "") {
  711. if (data.error && data.error.length) {
  712. message.warning(data.error[0].message);
  713. }
  714. } else {
  715. for (let i = 0; i < data.data.length; i++) {
  716. thisData = data.data[i];
  717. theArr.push({
  718. key: i,
  719. dunSubject: thisData.dunSubject
  720. ? thisData.dunSubject.toString()
  721. : "", //催款科目
  722. id: thisData.id, //节点Id
  723. money: thisData.money, //催款金额
  724. dunStatus: thisData.dunStatus //催款状态
  725. });
  726. }
  727. this.setState({
  728. contactList: theArr
  729. });
  730. }
  731. }.bind(this)
  732. });
  733. },
  734. //审核通过
  735. examOk() {
  736. $.ajax({
  737. method: "post",
  738. dataType: "json",
  739. crossDomain: false,
  740. url: globalConfig.context + "/api/admin/newOrder/auditOrderNew",
  741. data: {
  742. orderNo: this.state.orderNo,
  743. orderStatus: 2
  744. },
  745. success: function(data) {
  746. if (data.error.length || data.data.list == "") {
  747. if (data.error && data.error.length) {
  748. message.warning(data.error[0].message);
  749. }
  750. } else {
  751. message.success("该订单已通过审核~");
  752. this.setState({
  753. visible: false
  754. });
  755. this.reset();
  756. }
  757. }.bind(this)
  758. }).always(
  759. function() {
  760. this.setState({
  761. loading: false
  762. });
  763. }.bind(this)
  764. );
  765. },
  766. //通过发给外包
  767. outsourcing() {
  768. $.ajax({
  769. method: "post",
  770. dataType: "json",
  771. crossDomain: false,
  772. url: globalConfig.context + "/api/admin/newOrder/auditOrderNew",
  773. data: {
  774. orderNo: this.state.orderNo,
  775. orderStatus: 2,
  776. outsource: 1
  777. },
  778. success: function(data) {
  779. if (data.error.length || data.data.list == "") {
  780. if (data.error && data.error.length) {
  781. message.warning(data.error[0].message);
  782. }
  783. } else {
  784. message.success("该订单已通过审核~");
  785. this.setState({
  786. visible: false
  787. });
  788. this.reset();
  789. }
  790. }.bind(this)
  791. }).always(
  792. function() {
  793. this.setState({
  794. loading: false
  795. });
  796. }.bind(this)
  797. );
  798. },
  799. //审核不通过
  800. examOks() {
  801. this.setState({
  802. aloading: true
  803. });
  804. $.ajax({
  805. method: "post",
  806. dataType: "json",
  807. crossDomain: false,
  808. url: globalConfig.context + "/api/admin/newOrder/auditOrderNew",
  809. data: {
  810. orderNo: this.state.orderNo,
  811. orderStatus: 3,
  812. reason: this.state.reason
  813. },
  814. success: function(data) {
  815. if (data.error.length || data.data.list == "") {
  816. if (data.error && data.error.length) {
  817. message.warning(data.error[0].message);
  818. this.setState({
  819. aloading: true
  820. });
  821. }
  822. } else {
  823. message.success("该订单已被拒绝~");
  824. this.setState({
  825. visible: false,
  826. aloading: false,
  827. noVisible: false,
  828. reason: ""
  829. });
  830. this.reset();
  831. }
  832. }.bind(this)
  833. }).always(
  834. function() {
  835. this.setState({
  836. loading: false
  837. });
  838. }.bind(this)
  839. );
  840. },
  841. //点击拒绝
  842. examNo() {
  843. this.setState({
  844. noVisible: true
  845. });
  846. },
  847. loadDataChange() {
  848. $.ajax({
  849. method: "get",
  850. dataType: "json",
  851. async: false,
  852. crossDomain: false,
  853. url: globalConfig.context + "/api/admin/orderChange/orderChangeLogList",
  854. data: {
  855. changeId: this.state.id
  856. },
  857. success: function(data) {
  858. if (data.error.length || data.data.list == "") {
  859. if (data.error && data.error.length) {
  860. message.warning(data.error[0].message);
  861. }
  862. } else {
  863. // console.log("拿到历史", data);
  864. this.setState({
  865. dataProps: data.data
  866. });
  867. }
  868. }.bind(this)
  869. });
  870. },
  871. callback(key) {
  872. this.setState({
  873. activeKey: key
  874. });
  875. if (key === "1") {
  876. this.xiangmu(this.state.orderNo);
  877. this.jiedian(this.state.orderNo);
  878. }
  879. if (key === "2") {
  880. this.ChangeDetail(this.state.id);
  881. this.loadDataChange();
  882. this.getProceeds(this.state.id);
  883. }
  884. if (key === "3") {
  885. this.primaryOrder(this.state.primaryOrderNo);
  886. this.xiangmu(this.state.primaryOrderNo);
  887. this.jiedian(this.state.primaryOrderNo);
  888. }
  889. if (key === "4") {
  890. this.additionalOrder(this.state.additionalOrder);
  891. this.xiangmu(this.state.additionalOrder);
  892. this.jiedian(this.state.additionalOrder);
  893. this.setState({
  894. buttonStatusA: false
  895. });
  896. } else {
  897. this.setState({
  898. buttonStatusA: true
  899. });
  900. }
  901. },
  902. closeDesc(e, s) {
  903. this.state.activeKey = "1";
  904. this.state.userDetaile = false;
  905. this.state.signBillVisible = false;
  906. this.state.visible = e;
  907. if (s) {
  908. this.loadData(this.state.pageNo);
  909. }
  910. },
  911. // 获取原订单编号
  912. getPrimaryOrder(value) {
  913. this.setState({
  914. primaryOrder: value
  915. });
  916. },
  917. getAdditionalOrder(value) {
  918. this.setState({
  919. additionalOrder: value
  920. });
  921. },
  922. getUrl(url) {
  923. let theorgCodeUrl = [];
  924. if (url.length) {
  925. let picArr = [];
  926. url.map(function(item) {
  927. if (
  928. item.response &&
  929. item.response.data &&
  930. item.response.data.length
  931. ) {
  932. picArr.push(item.response.data);
  933. }
  934. });
  935. theorgCodeUrl = picArr.join(",");
  936. }
  937. return theorgCodeUrl;
  938. },
  939. sureOut() {
  940. if (!this.state.companyName) {
  941. message.warning("公司名称不能为空");
  942. return;
  943. }
  944. if (!this.state.unitPrice) {
  945. message.warning("单价不能为空");
  946. return;
  947. }
  948. if (!this.state.unitNumber) {
  949. message.warning("数量不能为空");
  950. return;
  951. }
  952. if (!this.state.amount) {
  953. message.warning("总金额不能为空");
  954. return;
  955. }
  956. if (!this.state.outsourceRemarks) {
  957. message.warning("备注不能为空");
  958. return;
  959. }
  960. if (this.state.pictureUrl.length === 0) {
  961. message.warning("合同扫描件不能为空");
  962. return;
  963. }
  964. $.ajax({
  965. method: "POST",
  966. dataType: "json",
  967. crossDomain: false,
  968. url: globalConfig.context + "/api/admin/outsourceOrg/auditOutsource",
  969. data: {
  970. id: this.state.id,
  971. orderNo: this.state.orderNo,
  972. companyName: this.state.companyName,
  973. amount: this.state.amount,
  974. outsourceRemarks: this.state.outsourceRemarks,
  975. unitNumber: this.state.unitNumber,
  976. unitPrice: this.state.unitPrice,
  977. attachmentUrl: this.getUrl(this.state.attachmentUrl).length
  978. ? this.getUrl(this.state.attachmentUrl)
  979. : "",
  980. orderStatus: 2,
  981. pictureUrl: this.getUrl(this.state.pictureUrl).length
  982. ? this.getUrl(this.state.pictureUrl)
  983. : ""
  984. }
  985. }).done(
  986. function(data) {
  987. this.setState({
  988. loading: false
  989. });
  990. if (!data.error.length) {
  991. message.success("发起成功!");
  992. this.outReset();
  993. this.visitCancel();
  994. } else {
  995. message.warning(data.error[0].message);
  996. }
  997. }.bind(this)
  998. );
  999. },
  1000. //关闭输入理由框
  1001. noCancel() {
  1002. this.setState({
  1003. noVisible: false,
  1004. aloading: false,
  1005. reason: ""
  1006. });
  1007. },
  1008. //重置
  1009. reset() {
  1010. this.setState({
  1011. signBillVisible: false
  1012. });
  1013. this.state.orderNo = "";
  1014. this.state.customerName = "";
  1015. this.state.releaseDate[0] = undefined;
  1016. this.state.releaseDate[1] = undefined;
  1017. this.state.approval = undefined;
  1018. this.loadData(1);
  1019. },
  1020. outReset() {
  1021. this.setState({
  1022. companyName: "",
  1023. amount: "",
  1024. unitPrice: "",
  1025. unitNumber: "",
  1026. outsourceRemarks: "",
  1027. attachmentUrl: [],
  1028. pictureUrl: []
  1029. });
  1030. },
  1031. getOrgCodeUrl(e) {
  1032. this.setState({ pictureUrl: e });
  1033. },
  1034. //关闭详情
  1035. visitCancel() {
  1036. this.setState(
  1037. {
  1038. activeKey: "1"
  1039. },
  1040. () => {
  1041. this.setState({
  1042. visible: false
  1043. });
  1044. }
  1045. );
  1046. this.loadData(this.state.pageNo);
  1047. },
  1048. visitOk() {
  1049. this.setState({
  1050. visible: false
  1051. });
  1052. },
  1053. changeList(arr) {
  1054. const newArr = [];
  1055. this.state.columns.forEach(item => {
  1056. arr.forEach(val => {
  1057. if (val === item.title) {
  1058. newArr.push(item);
  1059. }
  1060. });
  1061. });
  1062. this.setState({
  1063. changeList: newArr
  1064. });
  1065. },
  1066. printAll() {
  1067. this.setState({
  1068. dvisible: true
  1069. // loading: true
  1070. });
  1071. this.state.pagination.pageSize = 9999;
  1072. this.setState({
  1073. pagination: this.state.pagination
  1074. });
  1075. this.loadData();
  1076. },
  1077. exportAll() {
  1078. window.location.href =
  1079. globalConfig.context +
  1080. "/api/admin/orderChange/exportMyChange?" +
  1081. `orderNo=${
  1082. this.state.searchData.orderNoSearch
  1083. ? this.state.searchData.orderNoSearch
  1084. : ""
  1085. }&processState=${
  1086. this.props.processState ? this.props.processState : ""
  1087. }&userName=${
  1088. this.state.searchData.userNameSearch
  1089. ? this.state.searchData.userNameSearch
  1090. : ""
  1091. }&contractNo=${
  1092. this.state.searchData.contractNoSearch
  1093. ? this.state.searchData.contractNoSearch
  1094. : ""
  1095. }
  1096. &timeType=${
  1097. this.state.searchData.timeTypeSearch
  1098. ? this.state.searchData.timeTypeSearch
  1099. : ""
  1100. }
  1101. &startTime=${
  1102. this.state.searchData.releaseDate[0]
  1103. ? this.state.searchData.releaseDate[0]
  1104. : ""
  1105. }
  1106. &endTime=${
  1107. this.state.searchData.releaseDate[1]
  1108. ? this.state.searchData.releaseDate[1]
  1109. : ""
  1110. }
  1111. &salesmanName=${
  1112. this.state.searchData.salesmanNameSearch
  1113. ? this.state.searchData.salesmanNameSearch
  1114. : ""
  1115. }
  1116. &complete=${this.state.searchData.completeSearch || 1}
  1117. &depId=${
  1118. this.state.searchData.depIdSearch
  1119. ? this.state.searchData.depIdSearch
  1120. : ""
  1121. }
  1122. &type=${
  1123. this.state.searchData.changeSearch
  1124. ? this.state.searchData.changeSearch
  1125. : ""
  1126. }`;
  1127. },
  1128. render() {
  1129. const formItemLayout = {
  1130. labelCol: { span: 8 },
  1131. wrapperCol: { span: 14 }
  1132. };
  1133. const FormItem = Form.Item;
  1134. const { TabPane } = Tabs;
  1135. const departmentArr = this.state.departmentArr || [];
  1136. return (
  1137. <div className="user-content" style={{ position: "relative" }}>
  1138. <ShowModalDiv ShowModal={this.state.showModal} />
  1139. <div className="content-title" style={{ marginBottom: 10 }}>
  1140. <span style={{ fontWeight: 900, fontSize: 16 }}>
  1141. 合同变更审核订单
  1142. </span>
  1143. </div>
  1144. <div className="user-search">
  1145. {/* <SearchInput search={this.search} /> */}
  1146. {/* <ChooseList
  1147. columns={this.state.columns}
  1148. changeFn={this.changeList}
  1149. changeList={this.state.changeList}
  1150. top={55}
  1151. /> */}
  1152. <Tabs
  1153. defaultActiveKey="2"
  1154. onChange={this.callbackTab}
  1155. className="test"
  1156. >
  1157. <TabPane tab="更改表格显示数据" key="1">
  1158. <div style={{ marginLeft: 10 }}>
  1159. <ChooseList
  1160. columns={this.state.columns}
  1161. changeFn={this.changeList}
  1162. changeList={this.state.changeList}
  1163. top={55}
  1164. margin={11}
  1165. />
  1166. </div>
  1167. </TabPane>
  1168. <TabPane tab="搜索" key="2">
  1169. <div style={{ marginLeft: 10 }}>
  1170. <SearchInput search={this.search} />
  1171. </div>
  1172. </TabPane>
  1173. <TabPane tab="打印" key="3">
  1174. <Button
  1175. type="primary"
  1176. style={{ margin: "11px 0px 10px 10px" }}
  1177. onClick={this.printAll}
  1178. disabled={!this.state.dataSource.length}
  1179. >
  1180. 打印所有列表信息
  1181. </Button>
  1182. </TabPane>
  1183. <TabPane tab="导出Excel" key="4">
  1184. <Button
  1185. type="primary"
  1186. style={{ margin: "11px 0px 10px 10px" }}
  1187. onClick={this.exportAll}
  1188. >
  1189. 导出当前列表
  1190. </Button>
  1191. </TabPane>
  1192. {/* <TabPane tab="批量操作" key="6">
  1193. <Button
  1194. type="primary"
  1195. disabled={this.state.selectedRowKeys.length == 0}
  1196. style={{ margin: "0px 0px 10px 10px" }}
  1197. onClick={e => {
  1198. e.stopPropagation(),
  1199. this.evaluateY(this.state.selectedRowKeys, "财务专员");
  1200. }}
  1201. >
  1202. 转交
  1203. </Button>
  1204. </TabPane> */}
  1205. </Tabs>
  1206. <div className="patent-table">
  1207. <Spin spinning={this.state.loading}>
  1208. <Table
  1209. bordered
  1210. columns={
  1211. this.state.changeList == undefined
  1212. ? this.state.columns
  1213. : this.state.changeList
  1214. }
  1215. scroll={{ x: "max-content", y: 0 }}
  1216. dataSource={this.state.dataSource}
  1217. pagination={this.state.pagination}
  1218. onRowClick={this.tableRowClick}
  1219. // scroll={{ y: 140 }}
  1220. />
  1221. </Spin>
  1222. </div>
  1223. <Modal
  1224. className="customeDetails"
  1225. footer=""
  1226. maskClosable={false}
  1227. width="900px"
  1228. visible={this.state.visible}
  1229. onOk={this.visitOk}
  1230. onCancel={this.visitCancel}
  1231. >
  1232. <Tabs activeKey={this.state.activeKey} onChange={this.callback}>
  1233. <TabPane tab="订单详情" key="1">
  1234. <Form
  1235. layout="horizontal"
  1236. onSubmit={this.handleSubmit}
  1237. id="demand-form"
  1238. style={{ paddingBottom: "40px" }}
  1239. >
  1240. <Spin spinning={this.state.loading}>
  1241. <OrderDetail
  1242. orderData={this.state.orderData}
  1243. getOrderLog={this.getOrderLog}
  1244. dataSourceX={this.state.dataSourceX}
  1245. contactList={this.state.contactList}
  1246. orderNo={this.state.orderNo}
  1247. pictureUrl={this.state.contractPictureUrl}
  1248. isCaiWu={true}
  1249. />
  1250. </Spin>
  1251. </Form>
  1252. </TabPane>
  1253. <TabPane tab="合同变更记录" key="2">
  1254. <ChangeDetail
  1255. data={this.state.contractData}
  1256. txt={this.state.processStateText}
  1257. pictureUrl={this.state.voucherUrl}
  1258. processState={this.props.processState}
  1259. loadData={this.callback}
  1260. reset={this.state.visible}
  1261. dataSource={this.state.dataProps}
  1262. proceedsData={this.state.proceedsData}
  1263. proceedsTotal={this.state.proTotal}
  1264. invoiceTotal={this.state.invTotal}
  1265. contactList={this.state.refundInvoice}
  1266. onCancel={this.visitCancel}
  1267. />
  1268. </TabPane>
  1269. {this.state.status === 4 ? (
  1270. <TabPane tab="原订单" key="3">
  1271. <Form
  1272. layout="horizontal"
  1273. onSubmit={this.handleSubmit}
  1274. id="demand-form"
  1275. style={{ paddingBottom: "40px" }}
  1276. >
  1277. <Spin spinning={this.state.loading}>
  1278. <OrderDetail
  1279. orderData={this.state.primaryOrderData}
  1280. getOrderLog={this.getOrderLog}
  1281. dataSourceX={this.state.dataSourceX}
  1282. contactList={this.state.contactList}
  1283. orderNo={this.state.primaryOrderNo}
  1284. isCaiWu={true}
  1285. />
  1286. </Spin>
  1287. </Form>
  1288. </TabPane>
  1289. ) : (
  1290. ""
  1291. )}
  1292. {this.state.status === 4 ? (
  1293. this.state.type === 4 || this.state.type === 5 ? (
  1294. <TabPane tab="附加订单" key="4">
  1295. <OrderDetail
  1296. orderData={this.state.additionalOrderData}
  1297. getOrderLog={this.getOrderLog}
  1298. dataSourceX={this.state.dataSourceX}
  1299. contactList={this.state.contactList}
  1300. orderNo={this.state.additionalOrder}
  1301. isCaiWu={true}
  1302. />
  1303. </TabPane>
  1304. ) : (
  1305. ""
  1306. )
  1307. ) : (
  1308. ""
  1309. )}
  1310. </Tabs>
  1311. </Modal>
  1312. <Modal
  1313. maskClosable={false}
  1314. visible={this.state.addnextVisible}
  1315. onOk={this.nextCancel}
  1316. onCancel={this.nextCancel}
  1317. confirmLoading={this.state.confirmLoading}
  1318. width="800px"
  1319. title={"项目任务详情"}
  1320. footer=""
  1321. className="admin-desc-content"
  1322. >
  1323. <Form layout="horizontal" id="demand-form">
  1324. <Spin spinning={this.state.loading}>
  1325. <div className="clearfix">
  1326. <FormItem
  1327. className="half-item"
  1328. {...formItemLayout}
  1329. label="项目名称"
  1330. >
  1331. <span>{this.state.commodityName}</span>
  1332. </FormItem>
  1333. <FormItem
  1334. className="half-item"
  1335. {...formItemLayout}
  1336. label="项目数量"
  1337. >
  1338. <span>{this.state.commodityQuantity}</span>
  1339. </FormItem>
  1340. <FormItem
  1341. className="half-item"
  1342. {...formItemLayout}
  1343. label="金额(万元)"
  1344. >
  1345. <span>{this.state.commodityPrice}</span>
  1346. </FormItem>
  1347. <FormItem
  1348. className="half-item"
  1349. {...formItemLayout}
  1350. label="主要项目"
  1351. >
  1352. <span>{getboutique(this.state.main)}</span>
  1353. </FormItem>
  1354. <div className="clearfix">
  1355. <FormItem
  1356. labelCol={{ span: 4 }}
  1357. wrapperCol={{ span: 16 }}
  1358. label="服务说明"
  1359. >
  1360. <span>{this.state.taskComment}</span>
  1361. </FormItem>
  1362. </div>
  1363. </div>
  1364. </Spin>
  1365. </Form>
  1366. </Modal>
  1367. <Modal
  1368. maskClosable={false}
  1369. visible={this.state.noVisible}
  1370. onOk={this.handleOk}
  1371. onCancel={this.noCancel}
  1372. width="400px"
  1373. title={"拒绝理由"}
  1374. footer=""
  1375. className="admin-desc-content"
  1376. confirmLoading={this.state.confirmLoading}
  1377. >
  1378. <Form layout="horizontal" id="demand-form">
  1379. <Spin spinning={this.state.loading}>
  1380. <div className="clearfix">
  1381. <FormItem
  1382. labelCol={{ span: 4 }}
  1383. wrapperCol={{ span: 16 }}
  1384. label="拒绝理由"
  1385. >
  1386. <Input
  1387. type="textarea"
  1388. placeholder="请输入拒绝理由"
  1389. rows={4}
  1390. value={this.state.reason}
  1391. onChange={e => {
  1392. this.setState({ reason: e.target.value });
  1393. }}
  1394. />
  1395. </FormItem>
  1396. </div>
  1397. <div className="clearfix">
  1398. <Button
  1399. className="cancel"
  1400. type="primary"
  1401. onClick={this.examOks}
  1402. style={{ marginLeft: "50px" }}
  1403. htmlType="submit"
  1404. loading={this.state.aloading}
  1405. >
  1406. 确定
  1407. </Button>
  1408. <Button
  1409. className="cancel"
  1410. type="ghost"
  1411. onClick={this.noCancel}
  1412. style={{ marginLeft: "50px" }}
  1413. >
  1414. 取消
  1415. </Button>
  1416. </div>
  1417. </Spin>
  1418. </Form>
  1419. </Modal>
  1420. {/* <Modal
  1421. visible={this.state.rizhivisible}
  1422. className="admin-desc-content"
  1423. width="800px"
  1424. maskClosable={false}
  1425. title="订单日志"
  1426. footer={null}
  1427. onCancel={this.closeOrderLog}
  1428. >
  1429. <div className="patent-table">
  1430. <Spin spinning={this.state.loading}>
  1431. <Table
  1432. bordered
  1433. columns={this.state.columnsrizhi}
  1434. dataSource={this.state.dataSourcerizhi}
  1435. pagination={false}
  1436. />
  1437. </Spin>
  1438. </div>
  1439. </Modal> */}
  1440. <OrderRiZi
  1441. dataSourcerizhi={this.state.dataSourcerizhi}
  1442. closeOrderLog={this.closeOrderLog}
  1443. visible={this.state.rizhivisible}
  1444. loading={this.state.loading}
  1445. />
  1446. <Modal
  1447. visible={this.state.dvisible}
  1448. footer=""
  1449. title="所有列表信息"
  1450. className="admin-desc-content"
  1451. width="1300px"
  1452. onCancel={() => {
  1453. this.setState({
  1454. dvisible: false
  1455. });
  1456. this.state.pagination.pageSize = 10;
  1457. this.setState({
  1458. pagination: this.state.pagination
  1459. });
  1460. this.loadData();
  1461. }}
  1462. >
  1463. <Spin spinning={this.state.loading}>
  1464. <div
  1465. className="patent-table"
  1466. style={{
  1467. // width: 900,
  1468. // position: "relative",
  1469. // left: "50%",
  1470. // transform: "translate(-50%)",
  1471. padding: "25px 30px 30px 30px"
  1472. }}
  1473. ref={e => {
  1474. this.refs.all = e;
  1475. }}
  1476. >
  1477. <Table
  1478. columns={this.state.columns}
  1479. dataSource={this.state.dataSource}
  1480. pagination={false}
  1481. bordered
  1482. size="small"
  1483. />
  1484. </div>
  1485. </Spin>
  1486. <ReactToPrint
  1487. trigger={() => (
  1488. <Button
  1489. type="primary"
  1490. style={{
  1491. float: "right",
  1492. marginTop: 10,
  1493. position: "absolute",
  1494. top: 0,
  1495. right: 30
  1496. }}
  1497. >
  1498. 打印
  1499. </Button>
  1500. )}
  1501. content={() => this.refs.all}
  1502. />
  1503. </Modal>
  1504. </div>
  1505. </div>
  1506. );
  1507. }
  1508. })
  1509. );
  1510. export default contractChange;