contractJszj.js 46 KB

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