contractCwzj.js 44 KB

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