contractYxgly.js 43 KB

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