contractYxy.js 46 KB

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