contractYxgly.js 42 KB

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