contractCwzj.js 36 KB

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