contractCwzj.js 46 KB

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