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