contractCwzj.js 46 KB

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