contractJsjl.js 46 KB

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