contractJszj.js 45 KB

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