contractYxgly.js 46 KB

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