contractCwzj.js 44 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465
  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 * 10000) / 10000).toFixed(4),
  427. invTotal: (Math.round(invTotal * 10000) / 10000).toFixed(4),
  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. $.ajax({
  455. method: "get",
  456. dataType: "json",
  457. crossDomain: false,
  458. url: globalConfig.context + "/api/admin/newOrder/getOrderNewDetail",
  459. data: {
  460. orderNo: orderNos
  461. },
  462. success: function (data) {
  463. if (data.error.length || data.data.list == "") {
  464. if (data.error && data.error.length) {
  465. message.warning(data.error[0].message);
  466. }
  467. } else {
  468. let thisdata = data.data;
  469. this.setState({
  470. userName: thisdata.userName,
  471. primaryOrderNo: thisdata.primaryOrder,
  472. additionalOrder: thisdata.additionalOrder,
  473. contractNo: thisdata.contractNo,
  474. // arrears: thisdata.arrears,
  475. orderData: thisdata,
  476. isAddition: thisdata.additionalOrder ? true : false
  477. });
  478. }
  479. }.bind(this)
  480. });
  481. },
  482. // 原订单数据
  483. primaryOrder(primaryOrder) {
  484. $.ajax({
  485. method: "get",
  486. dataType: "json",
  487. crossDomain: false,
  488. url: globalConfig.context + "/api/admin/newOrder/getOrderNewDetail",
  489. data: {
  490. orderNo: primaryOrder
  491. },
  492. success: function (data) {
  493. if (data.error.length || data.data.list == "") {
  494. if (data.error && data.error.length) {
  495. message.warning(data.error[0].message);
  496. }
  497. } else {
  498. let thisdata = data.data;
  499. this.setState({
  500. primaryOrderData: thisdata
  501. });
  502. }
  503. }.bind(this)
  504. });
  505. },
  506. // 附加订单数据
  507. additionalOrder(additionalOrder) {
  508. $.ajax({
  509. method: "get",
  510. dataType: "json",
  511. crossDomain: false,
  512. url: globalConfig.context + "/api/admin/newOrder/getOrderNewDetail",
  513. data: {
  514. orderNo: additionalOrder
  515. },
  516. success: function (data) {
  517. if (data.error.length || data.data.list == "") {
  518. if (data.error && data.error.length) {
  519. message.warning(data.error[0].message);
  520. }
  521. } else {
  522. let thisdata = data.data;
  523. this.setState({
  524. additionalOrderData: thisdata
  525. });
  526. }
  527. }.bind(this)
  528. });
  529. },
  530. //项目列表
  531. xiangmu(orderNos) {
  532. $.ajax({
  533. method: "get",
  534. dataType: "json",
  535. crossDomain: false,
  536. url: globalConfig.context + "/api/admin/newOrder/getOrderTask",
  537. data: {
  538. orderNo: orderNos
  539. },
  540. success: function (data) {
  541. let theArr = [];
  542. if (data.error.length || data.data.list == "") {
  543. if (data.error && data.error.length) {
  544. message.warning(data.error[0].message);
  545. }
  546. } else {
  547. for (let i = 0; i < data.data.length; i++) {
  548. let thisdata = data.data[i];
  549. theArr.push({
  550. key: i,
  551. id: thisdata.id,
  552. orderNo: thisdata.orderNo, //订单编号
  553. commodityId: thisdata.commodityId, //项目ID
  554. commodityName: thisdata.commodityName, //项目名称
  555. cname: thisdata.cname, //项目类别
  556. commodityPrice: thisdata.commodityPrice, //项目价格
  557. commodityQuantity: thisdata.commodityQuantity, //项目数量
  558. main: thisdata.main, //是否为主要任务
  559. taskComment: thisdata.taskComment, //任务说明
  560. contacts: thisdata.contacts, //联系人
  561. contactsMobile: thisdata.contactsMobile, //联系人电话
  562. projectStatus: thisdata.projectStatus, //项目状态
  563. sort: thisdata.cSort,
  564. splitStatus: thisdata.splitStatus
  565. });
  566. }
  567. }
  568. this.setState({
  569. dataSourceX: theArr
  570. });
  571. }.bind(this)
  572. });
  573. },
  574. search(obj) {
  575. this.setState(
  576. {
  577. searchData: obj
  578. },
  579. () => {
  580. this.loadData(1);
  581. }
  582. );
  583. },
  584. rizhi(orderNo) {
  585. $.ajax({
  586. method: "get",
  587. dataType: "json",
  588. crossDomain: false,
  589. url: "/api/admin/newOrder/selectOrderLog",
  590. data: {
  591. orderNo: orderNo
  592. },
  593. success: function (data) {
  594. let theArr = [];
  595. let thisData = data.data;
  596. if (!thisData.length) {
  597. if (data.error && data.error.length) {
  598. message.warning(data.error[0].message);
  599. }
  600. thisData = {};
  601. } else {
  602. for (let i = 0; i < data.data.length; i++) {
  603. let thisdata = data.data[i];
  604. theArr.push({
  605. processName: thisdata.processName,
  606. adminName: thisdata.adminName,
  607. createDate: thisdata.createDate,
  608. remarks: thisdata.remarks
  609. });
  610. }
  611. }
  612. this.setState({
  613. dataSourcerizhi: theArr
  614. });
  615. }.bind(this)
  616. });
  617. },
  618. getOrderLog(orderNo) {
  619. this.setState({
  620. rizhivisible: true
  621. });
  622. this.rizhi(orderNo);
  623. },
  624. closeOrderLog() {
  625. this.setState({
  626. rizhivisible: false
  627. });
  628. },
  629. //节点列表
  630. jiedian(orderNos) {
  631. $.ajax({
  632. method: "get",
  633. dataType: "json",
  634. crossDomain: false,
  635. url: globalConfig.context + "/api/admin/newOrder/selectOrderDun",
  636. data: {
  637. orderNo: orderNos
  638. },
  639. success: function (data) {
  640. let theArr = [];
  641. let thisData = [];
  642. if (data.error.length || data.data.list == "") {
  643. if (data.error && data.error.length) {
  644. message.warning(data.error[0].message);
  645. }
  646. } else {
  647. for (let i = 0; i < data.data.length; i++) {
  648. thisData = data.data[i];
  649. theArr.push({
  650. key: i,
  651. dunSubject: thisData.dunSubject
  652. ? thisData.dunSubject.toString()
  653. : "", //催款科目
  654. id: thisData.id, //节点Id
  655. money: thisData.money, //催款金额
  656. dunStatus: thisData.dunStatus //催款状态
  657. });
  658. }
  659. this.setState({
  660. contactList: theArr
  661. });
  662. }
  663. }.bind(this)
  664. });
  665. },
  666. jiedianNew(orderNos) {
  667. $.ajax({
  668. method: "get",
  669. dataType: "json",
  670. crossDomain: false,
  671. url:
  672. globalConfig.context + "/api/admin/newOrderDun/selectListNewOrderDun",
  673. data: {
  674. orderNo: orderNos
  675. },
  676. success: function (data) {
  677. if (data.error && data.error.length) {
  678. message.warning(data.error[0].message);
  679. } else {
  680. let theArr = [];
  681. let thisData = [];
  682. let arr = data.data || [];
  683. let totalCui = 0;
  684. for (let i = 0; i < arr.length; i++) {
  685. thisData = arr[i];
  686. totalCui += +thisData.money;
  687. theArr.push({
  688. key: i,
  689. dunSubject: thisData.dunSubject
  690. ? thisData.dunSubject.toString()
  691. : "", //催款科目
  692. id: thisData.id, //节点Id
  693. money: thisData.money, //催款金额
  694. // orderNo: record ? record.orderNo : this.props.datauser.orderNo,
  695. commodityName: thisData.commodityName,
  696. projectType: thisData.projectType,
  697. dunTypeName: thisData.dunTypeName,
  698. status: thisData.status,
  699. waitDay: thisData.waitDay,
  700. effectiveCount: thisData.effectiveCount,
  701. startDate: thisData.startDate,
  702. dunType: thisData.dunType,
  703. appropriationRatio: thisData.appropriationRatio,
  704. customizeName: thisData.customizeName,
  705. customizeTimes: thisData.customizeTimes,
  706. tid: thisData.tid,
  707. });
  708. }
  709. if (!totalCui) {
  710. totalCui = 0;
  711. }
  712. totalCui = (Math.round(totalCui * 10000) / 10000).toFixed(4);
  713. this.setState({
  714. contactListNew: theArr,
  715. totalCui
  716. });
  717. }
  718. }.bind(this)
  719. }).always(
  720. function () {
  721. this.setState({
  722. loading: false
  723. });
  724. }.bind(this)
  725. );
  726. },
  727. //审核通过
  728. examOk() {
  729. $.ajax({
  730. method: "post",
  731. dataType: "json",
  732. crossDomain: false,
  733. url: globalConfig.context + "/api/admin/newOrder/auditOrderNew",
  734. data: {
  735. orderNo: this.state.orderNo,
  736. orderStatus: 2
  737. },
  738. success: function (data) {
  739. if (data.error.length || data.data.list == "") {
  740. if (data.error && data.error.length) {
  741. message.warning(data.error[0].message);
  742. }
  743. } else {
  744. message.success("该订单已通过审核~");
  745. this.setState({
  746. visible: false
  747. });
  748. this.reset();
  749. }
  750. }.bind(this)
  751. }).always(
  752. function () {
  753. this.setState({
  754. loading: false
  755. });
  756. }.bind(this)
  757. );
  758. },
  759. //通过发给外包
  760. outsourcing() {
  761. $.ajax({
  762. method: "post",
  763. dataType: "json",
  764. crossDomain: false,
  765. url: globalConfig.context + "/api/admin/newOrder/auditOrderNew",
  766. data: {
  767. orderNo: this.state.orderNo,
  768. orderStatus: 2,
  769. outsource: 1
  770. },
  771. success: function (data) {
  772. if (data.error.length || data.data.list == "") {
  773. if (data.error && data.error.length) {
  774. message.warning(data.error[0].message);
  775. }
  776. } else {
  777. message.success("该订单已通过审核~");
  778. this.setState({
  779. visible: false
  780. });
  781. this.reset();
  782. }
  783. }.bind(this)
  784. }).always(
  785. function () {
  786. this.setState({
  787. loading: false
  788. });
  789. }.bind(this)
  790. );
  791. },
  792. //审核不通过
  793. examOks() {
  794. this.setState({
  795. aloading: true
  796. });
  797. $.ajax({
  798. method: "post",
  799. dataType: "json",
  800. crossDomain: false,
  801. url: globalConfig.context + "/api/admin/newOrder/auditOrderNew",
  802. data: {
  803. orderNo: this.state.orderNo,
  804. orderStatus: 3,
  805. reason: this.state.reason
  806. },
  807. success: function (data) {
  808. if (data.error.length || data.data.list == "") {
  809. if (data.error && data.error.length) {
  810. message.warning(data.error[0].message);
  811. this.setState({
  812. aloading: true
  813. });
  814. }
  815. } else {
  816. message.success("该订单已被拒绝~");
  817. this.setState({
  818. visible: false,
  819. aloading: false,
  820. noVisible: false,
  821. reason: ""
  822. });
  823. this.reset();
  824. // window.location.reload()
  825. }
  826. }.bind(this)
  827. }).always(
  828. function () {
  829. this.setState({
  830. loading: false
  831. });
  832. }.bind(this)
  833. );
  834. },
  835. //点击拒绝
  836. examNo() {
  837. this.setState({
  838. noVisible: true
  839. });
  840. },
  841. loadDataChange(key) {
  842. $.ajax({
  843. method: "get",
  844. dataType: "json",
  845. async: false,
  846. crossDomain: false,
  847. url: globalConfig.context + "/api/admin/orderChange/orderChangeLogList",
  848. data: {
  849. changeId: key
  850. },
  851. success: function (data) {
  852. if (data.error.length || data.data.list == "") {
  853. if (data.error && data.error.length) {
  854. message.warning(data.error[0].message);
  855. }
  856. } else {
  857. // console.log("拿到历史", data.data);
  858. this.setState({
  859. dataProps: data.data
  860. });
  861. }
  862. }.bind(this)
  863. });
  864. },
  865. callback(key) {
  866. this.setState(
  867. {
  868. activeKey: key
  869. },
  870. () => {
  871. if (key != "a" && key != "c" && key.length < 10) {
  872. this.ChangeDetail(key);
  873. this.loadDataChange(key);
  874. } else if (key != "a" && key != "c" && key.length > 10) {
  875. this.primaryOrder(key);
  876. this.xiangmu(key);
  877. this.jiedian(key);
  878. this.jiedianNew(key);
  879. this.loadDataChange(key);
  880. }
  881. }
  882. );
  883. if (key === "a") {
  884. this.xiangmu(this.state.orderNo);
  885. this.jiedian(this.state.orderNo);
  886. this.jiedianNew(this.state.orderNo);
  887. }
  888. // if (key === "2") {
  889. // this.ChangeDetail(this.state.id);
  890. // this.loadDataChange();
  891. // }
  892. // if (key === "3") {
  893. // this.primaryOrder(this.state.primaryOrderNo);
  894. // this.xiangmu(this.state.primaryOrderNo);
  895. // this.jiedian(this.state.primaryOrderNo);
  896. // this.jiedianNew(this.state.primaryOrderNo);
  897. // }
  898. if (key === "c") {
  899. this.additionalOrder(this.state.additionalOrder);
  900. this.xiangmu(this.state.additionalOrder);
  901. this.jiedian(this.state.additionalOrder);
  902. this.jiedianNew(this.state.additionalOrder);
  903. this.setState({
  904. buttonStatusA: false
  905. });
  906. } else {
  907. this.setState({
  908. buttonStatusA: true
  909. });
  910. }
  911. },
  912. closeDesc(e, s) {
  913. this.state.activeKey = "a";
  914. this.state.userDetaile = false;
  915. this.state.signBillVisible = false;
  916. this.state.visible = e;
  917. if (s) {
  918. this.loadData(this.state.pageNo);
  919. }
  920. },
  921. // 获取原订单编号
  922. getPrimaryOrder(value) {
  923. this.setState({
  924. primaryOrder: value
  925. });
  926. },
  927. getAdditionalOrder(value) {
  928. this.setState({
  929. additionalOrder: value
  930. });
  931. },
  932. getUrl(url) {
  933. let theorgCodeUrl = [];
  934. if (url.length) {
  935. let picArr = [];
  936. url.map(function (item) {
  937. if (
  938. item.response &&
  939. item.response.data &&
  940. item.response.data.length
  941. ) {
  942. picArr.push(item.response.data);
  943. }
  944. });
  945. theorgCodeUrl = picArr.join(",");
  946. }
  947. return theorgCodeUrl;
  948. },
  949. sureOut() {
  950. if (!this.state.companyName) {
  951. message.warning("公司名称不能为空");
  952. return;
  953. }
  954. if (!this.state.unitPrice) {
  955. message.warning("单价不能为空");
  956. return;
  957. }
  958. if (!this.state.unitNumber) {
  959. message.warning("数量不能为空");
  960. return;
  961. }
  962. if (!this.state.amount) {
  963. message.warning("总金额不能为空");
  964. return;
  965. }
  966. if (!this.state.outsourceRemarks) {
  967. message.warning("备注不能为空");
  968. return;
  969. }
  970. if (this.state.pictureUrl.length === 0) {
  971. message.warning("合同扫描件不能为空");
  972. return;
  973. }
  974. $.ajax({
  975. method: "POST",
  976. dataType: "json",
  977. crossDomain: false,
  978. url: globalConfig.context + "/api/admin/outsourceOrg/auditOutsource",
  979. data: {
  980. id: this.state.id,
  981. orderNo: this.state.orderNo,
  982. companyName: this.state.companyName,
  983. amount: this.state.amount,
  984. outsourceRemarks: this.state.outsourceRemarks,
  985. unitNumber: this.state.unitNumber,
  986. unitPrice: this.state.unitPrice,
  987. attachmentUrl: this.getUrl(this.state.attachmentUrl).length
  988. ? this.getUrl(this.state.attachmentUrl)
  989. : "",
  990. orderStatus: 2,
  991. pictureUrl: this.getUrl(this.state.pictureUrl).length
  992. ? this.getUrl(this.state.pictureUrl)
  993. : ""
  994. }
  995. }).done(
  996. function (data) {
  997. this.setState({
  998. loading: false
  999. });
  1000. if (!data.error.length) {
  1001. message.success("发起成功!");
  1002. this.outReset();
  1003. this.visitCancel();
  1004. } else {
  1005. message.warning(data.error[0].message);
  1006. }
  1007. }.bind(this)
  1008. );
  1009. },
  1010. //关闭输入理由框
  1011. noCancel() {
  1012. this.setState({
  1013. noVisible: false,
  1014. aloading: false,
  1015. reason: ""
  1016. });
  1017. },
  1018. //重置
  1019. reset() {
  1020. this.setState({
  1021. signBillVisible: false
  1022. });
  1023. this.state.orderNo = "";
  1024. this.state.customerName = "";
  1025. this.state.releaseDate[0] = undefined;
  1026. this.state.releaseDate[1] = undefined;
  1027. this.state.approval = undefined;
  1028. this.loadData(1);
  1029. // window.location.reload();
  1030. },
  1031. outReset() {
  1032. this.setState({
  1033. companyName: "",
  1034. amount: "",
  1035. unitPrice: "",
  1036. unitNumber: "",
  1037. outsourceRemarks: "",
  1038. attachmentUrl: [],
  1039. pictureUrl: []
  1040. });
  1041. },
  1042. getOrgCodeUrl(e) {
  1043. this.setState({ pictureUrl: e });
  1044. },
  1045. //关闭详情
  1046. visitCancel() {
  1047. this.setState(
  1048. {
  1049. activeKey: "a"
  1050. },
  1051. () => {
  1052. this.setState({
  1053. visible: false
  1054. });
  1055. }
  1056. );
  1057. this.loadData(this.state.pageNo);
  1058. },
  1059. visitOk() {
  1060. this.setState({
  1061. visible: false
  1062. });
  1063. },
  1064. changeList(arr) {
  1065. const newArr = [];
  1066. this.state.columns.forEach(item => {
  1067. arr.forEach(val => {
  1068. if (val === item.title) {
  1069. newArr.push(item);
  1070. }
  1071. });
  1072. });
  1073. this.setState({
  1074. changeList: newArr
  1075. });
  1076. },
  1077. createTabs() {
  1078. $.ajax({
  1079. url: globalConfig.context + "/api/admin/orderChange/getOrderChange",
  1080. method: "get",
  1081. data: {
  1082. orderNo: this.state.orderNo
  1083. },
  1084. success: data => {
  1085. if (data.error && data.error.length) {
  1086. message.warning(data.error[0].message);
  1087. } else {
  1088. this.setState({
  1089. tabList: data.data
  1090. });
  1091. }
  1092. }
  1093. });
  1094. },
  1095. render() {
  1096. const tabList = this.state.tabList || [];
  1097. const formItemLayout = {
  1098. labelCol: { span: 8 },
  1099. wrapperCol: { span: 14 }
  1100. };
  1101. const FormItem = Form.Item;
  1102. const { TabPane } = Tabs;
  1103. return (
  1104. <div className="user-content">
  1105. <ShowModalDiv ShowModal={this.state.showModal} />
  1106. <div className="content-title">
  1107. <span>合同变更审核订单</span>
  1108. </div>
  1109. <div className="user-search">
  1110. <Tabs
  1111. defaultActiveKey="1"
  1112. onChange={this.callback}
  1113. className="test">
  1114. <TabPane tab="搜索" key="1">
  1115. <div style={{ marginLeft: 10 }}>
  1116. <SearchInput search={this.search} />
  1117. </div>
  1118. </TabPane>
  1119. <TabPane tab="更改表格数据" key="2">
  1120. <div style={{ marginTop: 10, marginLeft: 10 }}>
  1121. <ChooseList
  1122. columns={this.state.columns}
  1123. changeFn={this.changeList}
  1124. changeList={this.state.changeList}
  1125. top={65}
  1126. />
  1127. </div>
  1128. </TabPane>
  1129. </Tabs>
  1130. <div className="patent-table">
  1131. <Spin spinning={this.state.loading}>
  1132. <Table
  1133. size="small"
  1134. bordered
  1135. columns={
  1136. this.state.changeList == undefined
  1137. ? this.state.columns
  1138. : this.state.changeList
  1139. }
  1140. dataSource={this.state.dataSource}
  1141. pagination={this.state.pagination}
  1142. onRowClick={this.tableRowClick}
  1143. />
  1144. </Spin>
  1145. </div>
  1146. <Modal
  1147. className="customeDetails"
  1148. footer=""
  1149. maskClosable={false}
  1150. width="900px"
  1151. visible={this.state.visible}
  1152. onOk={this.visitOk}
  1153. onCancel={this.visitCancel}
  1154. >
  1155. <Tabs
  1156. activeKey={this.state.activeKey}
  1157. onChange={this.callback}
  1158. type="card"
  1159. >
  1160. <TabPane tab="订单详情" key="a">
  1161. <Form
  1162. layout="horizontal"
  1163. onSubmit={this.handleSubmit}
  1164. id="demand-form"
  1165. style={{ paddingBottom: "40px" }}
  1166. >
  1167. <Spin spinning={this.state.loading}>
  1168. <OrderDetail
  1169. orderData={this.state.orderData}
  1170. getOrderLog={this.getOrderLog}
  1171. dataSourceX={this.state.dataSourceX}
  1172. contactList={this.state.contactList}
  1173. orderNo={this.state.orderNo}
  1174. totalCui={this.state.totalCui}
  1175. contactListNew={this.state.contactListNew}
  1176. // isCaiWu={true}
  1177. />
  1178. </Spin>
  1179. </Form>
  1180. </TabPane>
  1181. {/* <TabPane tab="合同变更记录" key="2">
  1182. <ChangeDetail
  1183. data={this.state.contractData}
  1184. txt={this.state.processStateText}
  1185. pictureUrl={this.state.voucherUrl}
  1186. processState={this.props.processState}
  1187. loadData={this.callback}
  1188. reset={this.state.visible}
  1189. dataSource={this.state.dataProps}
  1190. proceedsData={this.state.proceedsData}
  1191. proceedsTotal={this.state.proTotal}
  1192. invoiceTotal={this.state.invTotal}
  1193. contactList={this.state.refundInvoice}
  1194. onCancel={this.visitCancel}
  1195. />
  1196. </TabPane> */}
  1197. {tabList.map((item, index, arr) => {
  1198. return (
  1199. <TabPane tab={"合同变更记录" + (index + 1)} key={item.id}>
  1200. <ChangeDetail
  1201. id={item.id}
  1202. money={
  1203. index == arr.length - 1
  1204. ? this.state.orderData.totalAmount + ""
  1205. : undefined
  1206. }
  1207. data={this.state.contractData}
  1208. orderData={this.state.orderData}
  1209. txt={this.state.processStateText}
  1210. pictureUrl={this.state.voucherUrl}
  1211. processState={this.props.processState}
  1212. loadData={this.callback}
  1213. reset={this.state.visible}
  1214. dataSource={this.state.dataProps}
  1215. proceedsData={this.state.proceedsData}
  1216. proceedsTotal={this.state.proTotal}
  1217. invoiceTotal={this.state.invTotal}
  1218. contactList={this.state.refundInvoice}
  1219. onCancel={this.visitCancel}
  1220. />
  1221. </TabPane>
  1222. );
  1223. })}
  1224. {/* {this.state.status === 4 ? (
  1225. <TabPane tab="原订单" key="3">
  1226. <Form
  1227. layout="horizontal"
  1228. onSubmit={this.handleSubmit}
  1229. id="demand-form"
  1230. style={{ paddingBottom: "40px" }}
  1231. >
  1232. <Spin spinning={this.state.loading}>
  1233. <OrderDetail
  1234. orderData={this.state.primaryOrderData}
  1235. getOrderLog={this.getOrderLog}
  1236. dataSourceX={this.state.dataSourceX}
  1237. contactList={this.state.contactList}
  1238. orderNo={this.state.primaryOrderNo}
  1239. isCaiWu={true}
  1240. totalCui={this.state.totalCui}
  1241. contactListNew={this.state.contactListNew}
  1242. />
  1243. </Spin>
  1244. </Form>
  1245. </TabPane>
  1246. ) : (
  1247. ""
  1248. )} */}
  1249. {tabList.map((item, index) => {
  1250. if (item.usedOrder) {
  1251. return (
  1252. <TabPane
  1253. tab={"原订单" + (index + 1)}
  1254. key={item.usedOrder}
  1255. >
  1256. <Form
  1257. layout="horizontal"
  1258. onSubmit={this.handleSubmit}
  1259. id="demand-form"
  1260. style={{ paddingBottom: "40px" }}
  1261. >
  1262. <Spin spinning={this.state.loading}>
  1263. <OrderDetail
  1264. orderData={this.state.primaryOrderData}
  1265. getOrderLog={this.getOrderLog}
  1266. dataSourceX={this.state.dataSourceX}
  1267. contactList={this.state.contactList}
  1268. orderNo={this.state.primaryOrderNo}
  1269. isCaiWu={true}
  1270. totalCui={this.state.totalCui}
  1271. contactListNew={this.state.contactListNew}
  1272. />
  1273. </Spin>
  1274. </Form>
  1275. </TabPane>
  1276. );
  1277. } else {
  1278. return "";
  1279. }
  1280. })}
  1281. {this.state.status === 4 && this.state.isAddition ? (
  1282. this.state.type === 4 || this.state.type === 5 ? (
  1283. <TabPane tab="附加订单" key="c">
  1284. <OrderDetail
  1285. orderData={this.state.additionalOrderData}
  1286. getOrderLog={this.getOrderLog}
  1287. dataSourceX={this.state.dataSourceX}
  1288. contactList={this.state.contactList}
  1289. orderNo={this.state.additionalOrder}
  1290. isCaiWu={true}
  1291. totalCui={this.state.totalCui}
  1292. contactListNew={this.state.contactListNew}
  1293. />
  1294. </TabPane>
  1295. ) : (
  1296. ""
  1297. )
  1298. ) : (
  1299. ""
  1300. )}
  1301. </Tabs>
  1302. </Modal>
  1303. <Modal
  1304. maskClosable={false}
  1305. visible={this.state.addnextVisible}
  1306. onOk={this.nextCancel}
  1307. onCancel={this.nextCancel}
  1308. confirmLoading={this.state.confirmLoading}
  1309. width="800px"
  1310. title={"项目任务详情"}
  1311. footer=""
  1312. className="admin-desc-content"
  1313. >
  1314. <Form layout="horizontal" id="demand-form">
  1315. <Spin spinning={this.state.loading}>
  1316. <div className="clearfix">
  1317. <FormItem
  1318. className="half-item"
  1319. {...formItemLayout}
  1320. label="项目名称"
  1321. >
  1322. <span>{this.state.commodityName}</span>
  1323. </FormItem>
  1324. <FormItem
  1325. className="half-item"
  1326. {...formItemLayout}
  1327. label="项目数量"
  1328. >
  1329. <span>{this.state.commodityQuantity}</span>
  1330. </FormItem>
  1331. <FormItem
  1332. className="half-item"
  1333. {...formItemLayout}
  1334. label="金额(万元)"
  1335. >
  1336. <span>{this.state.commodityPrice}</span>
  1337. </FormItem>
  1338. <FormItem
  1339. className="half-item"
  1340. {...formItemLayout}
  1341. label="主要项目"
  1342. >
  1343. <span>{getboutique(this.state.main)}</span>
  1344. </FormItem>
  1345. <div className="clearfix">
  1346. <FormItem
  1347. labelCol={{ span: 4 }}
  1348. wrapperCol={{ span: 16 }}
  1349. label="服务说明"
  1350. >
  1351. <span>{this.state.taskComment}</span>
  1352. </FormItem>
  1353. </div>
  1354. </div>
  1355. </Spin>
  1356. </Form>
  1357. </Modal>
  1358. <Modal
  1359. maskClosable={false}
  1360. visible={this.state.noVisible}
  1361. onOk={this.handleOk}
  1362. onCancel={this.noCancel}
  1363. width="400px"
  1364. title={"拒绝理由"}
  1365. footer=""
  1366. className="admin-desc-content"
  1367. confirmLoading={this.state.confirmLoading}
  1368. >
  1369. <Form layout="horizontal" id="demand-form">
  1370. <Spin spinning={this.state.loading}>
  1371. <div className="clearfix">
  1372. <FormItem
  1373. labelCol={{ span: 4 }}
  1374. wrapperCol={{ span: 16 }}
  1375. label="拒绝理由"
  1376. >
  1377. <Input
  1378. type="textarea"
  1379. placeholder="请输入拒绝理由"
  1380. rows={4}
  1381. value={this.state.reason}
  1382. onChange={e => {
  1383. this.setState({ reason: e.target.value });
  1384. }}
  1385. />
  1386. </FormItem>
  1387. </div>
  1388. <div className="clearfix">
  1389. <Button
  1390. className="cancel"
  1391. type="primary"
  1392. onClick={this.examOks}
  1393. style={{ marginLeft: "50px" }}
  1394. htmlType="submit"
  1395. loading={this.state.aloading}
  1396. >
  1397. 确定
  1398. </Button>
  1399. <Button
  1400. className="cancel"
  1401. type="ghost"
  1402. onClick={this.noCancel}
  1403. style={{ marginLeft: "50px" }}
  1404. >
  1405. 取消
  1406. </Button>
  1407. </div>
  1408. </Spin>
  1409. </Form>
  1410. </Modal>
  1411. {/* <Modal
  1412. visible={this.state.rizhivisible}
  1413. className="admin-desc-content"
  1414. width="800px"
  1415. maskClosable={false}
  1416. title="订单日志"
  1417. footer={null}
  1418. onCancel={this.closeOrderLog}
  1419. >
  1420. <div className="patent-table">
  1421. <Spin spinning={this.state.loading}>
  1422. <Table
  1423. bordered
  1424. columns={this.state.columnsrizhi}
  1425. dataSource={this.state.dataSourcerizhi}
  1426. pagination={false}
  1427. />
  1428. </Spin>
  1429. </div>
  1430. </Modal> */}
  1431. <OrderRiZi
  1432. dataSourcerizhi={this.state.dataSourcerizhi}
  1433. closeOrderLog={this.closeOrderLog}
  1434. visible={this.state.rizhivisible}
  1435. loading={this.state.loading}
  1436. />
  1437. </div>
  1438. </div>
  1439. );
  1440. }
  1441. })
  1442. );
  1443. export default contractChange;