contractCwzj.js 40 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351
  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/changeDetailCwzj.js";
  17. import { SearchInput } from "./changeComponent/searchInput.js";
  18. import OrderDetail from "./changeComponent/orderDetail";
  19. import { ChooseList } from "./chooseList.jsx";
  20. import ShowModalDiv from "@/showModal.jsx";
  21. import OrderRiZi from "@/orderRiZi.jsx";
  22. const contractChange = Form.create()(
  23. React.createClass({
  24. loadData(pageNo) {
  25. this.setState({
  26. loading: true
  27. });
  28. $.ajax({
  29. method: "get",
  30. dataType: "json",
  31. crossDomain: false,
  32. url: globalConfig.context + "/api/admin/orderChange/orderChangeList",
  33. data: {
  34. pageNo: pageNo || 1,
  35. pageSize: this.state.pagination.pageSize,
  36. userName: this.state.searchData.userNameSearch,
  37. processState: this.props.processState,
  38. timeType: this.state.searchData.timeTypeSearch,
  39. startTime: this.state.searchData.releaseDate[0],
  40. endTime: this.state.searchData.releaseDate[1],
  41. salesmanName: this.state.searchData.salesmanNameSearch,
  42. orderNo: this.state.searchData.orderNoSearch,
  43. contractNo: this.state.searchData.contractNoSearch,
  44. complete: this.state.searchData.completeSearch || 1,
  45. depId: this.state.searchData.depIdSearch
  46. },
  47. success: function(data) {
  48. ShowModal(this);
  49. let theArr = [];
  50. if (data.error.length || data.data.list == "") {
  51. if (data.error && data.error.length) {
  52. message.warning(data.error[0].message);
  53. }
  54. } else {
  55. for (let i = 0; i < data.data.list.length; i++) {
  56. let thisdata = data.data.list[i];
  57. theArr.push({
  58. key: i,
  59. orderNo: thisdata.orderNo,
  60. createTimes: thisdata.createTimes,
  61. nickname: thisdata.nickname,
  62. orderType: thisdata.orderType,
  63. establishTimes: thisdata.establishTimes,
  64. orderStatus: thisdata.orderStatus,
  65. totalAmount: thisdata.totalAmount,
  66. settlementAmount: thisdata.settlementAmount,
  67. arrears: thisdata.arrears,
  68. salesmanName: thisdata.salesmanName,
  69. depName: thisdata.depName,
  70. processState: thisdata.processState,
  71. type: thisdata.type,
  72. status: thisdata.status,
  73. id: thisdata.id,
  74. contractNo: thisdata.contractNo,
  75. processStateText: getProcessStatusNew(
  76. thisdata.processState,
  77. thisdata.status
  78. )
  79. });
  80. }
  81. this.state.pagination.total = data.data.totalCount;
  82. this.state.pagination.current = data.data.pageNo;
  83. }
  84. if (data.data && data.data.list && !data.data.list.length) {
  85. this.state.pagination.total = 0;
  86. }
  87. this.setState({
  88. dataSource: theArr,
  89. pageNo: pageNo,
  90. pagination: this.state.pagination
  91. });
  92. }.bind(this)
  93. }).always(
  94. function() {
  95. this.setState({
  96. loading: false
  97. });
  98. }.bind(this)
  99. );
  100. },
  101. getInitialState() {
  102. return {
  103. page: 1,
  104. searchData: {
  105. releaseDate: []
  106. },
  107. primaryOrderData: {}, //原订单数据
  108. orderData: {}, //现订单数据
  109. pictureUrl: [],
  110. voucherUrl: [],
  111. attachmentUrl: [],
  112. //收款数据
  113. proceedsData: {},
  114. proTotal: 0,
  115. invTotal: 0,
  116. contractData: {},
  117. // 回收退票数据
  118. refundInvoice: [],
  119. RefundInvoice: [],
  120. additionalOrderData: {},
  121. paginations: false,
  122. activeKey: "1",
  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 getProjectStatus(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. // 子组件改变的表格title数组
  278. changeList: undefined,
  279. columnsrizhi: [
  280. {
  281. title: "流程",
  282. dataIndex: "processName",
  283. key: "processName"
  284. },
  285. {
  286. title: "操作人",
  287. dataIndex: "adminName",
  288. key: "adminName"
  289. },
  290. {
  291. title: "时间",
  292. dataIndex: "createDate",
  293. key: "createDate"
  294. }
  295. ],
  296. dataSourceX: [],
  297. ContactsLists: [
  298. {
  299. title: "催款科目",
  300. dataIndex: "dunSubject",
  301. key: "dunSubject",
  302. render: text => {
  303. return getjiedian(text);
  304. }
  305. },
  306. {
  307. title: "金额(万元)",
  308. dataIndex: "money",
  309. key: "money"
  310. },
  311. {
  312. title: "催款状态",
  313. dataIndex: "dunStatus",
  314. key: "dunStatus",
  315. render: text => {
  316. return getCuikuan(text);
  317. }
  318. }
  319. ]
  320. };
  321. },
  322. //页面加载函数
  323. componentWillMount() {
  324. this.loadData();
  325. },
  326. //整行点击
  327. tableRowClick(record) {
  328. this.setState(
  329. {
  330. visible: true,
  331. type: record.type,
  332. status: record.status,
  333. buttonStatus: true,
  334. orderStatus: record.orderStatus,
  335. processStateText: record.processStateText,
  336. id: record.id,
  337. orderNo: record.orderNo
  338. },
  339. () => {
  340. this.xiangqing(record.orderNo);
  341. this.xiangmu(record.orderNo);
  342. this.jiedian(record.orderNo);
  343. this.jiedianNew(record.orderNo);
  344. }
  345. );
  346. },
  347. //点击打卡项目详情
  348. tableRowClickX(record) {
  349. this.setState({
  350. jid: record.id, //项目ID
  351. kid: record.commodityId, //商品ID
  352. commodityName: record.commodityName, //金额
  353. commodityPrice: record.commodityPrice, //金额
  354. commodityQuantity: record.commodityQuantity, //数量
  355. taskComment: record.taskComment, //备注
  356. main: record.main.toString(), //是否为主要
  357. addnextVisible: true,
  358. addState: 0
  359. });
  360. },
  361. //项目详情关闭
  362. nextCancel() {
  363. this.setState({
  364. addnextVisible: false
  365. });
  366. },
  367. // 合同变更详情
  368. ChangeDetail(id) {
  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: id
  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,
  425. invTotal
  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. });
  475. }
  476. }.bind(this)
  477. });
  478. },
  479. // 原订单数据
  480. primaryOrder(primaryOrder) {
  481. $.ajax({
  482. method: "get",
  483. dataType: "json",
  484. crossDomain: false,
  485. url: globalConfig.context + "/api/admin/newOrder/getOrderNewDetail",
  486. data: {
  487. orderNo: primaryOrder
  488. },
  489. success: function(data) {
  490. if (data.error.length || data.data.list == "") {
  491. if (data.error && data.error.length) {
  492. message.warning(data.error[0].message);
  493. }
  494. } else {
  495. let thisdata = data.data;
  496. this.setState({
  497. primaryOrderData: thisdata
  498. });
  499. }
  500. }.bind(this)
  501. });
  502. },
  503. // 附加订单数据
  504. additionalOrder(additionalOrder) {
  505. $.ajax({
  506. method: "get",
  507. dataType: "json",
  508. crossDomain: false,
  509. url: globalConfig.context + "/api/admin/newOrder/getOrderNewDetail",
  510. data: {
  511. orderNo: additionalOrder
  512. },
  513. success: function(data) {
  514. if (data.error.length || data.data.list == "") {
  515. if (data.error && data.error.length) {
  516. message.warning(data.error[0].message);
  517. }
  518. } else {
  519. let thisdata = data.data;
  520. this.setState({
  521. additionalOrderData: thisdata
  522. });
  523. }
  524. }.bind(this)
  525. });
  526. },
  527. //项目列表
  528. xiangmu(orderNos) {
  529. $.ajax({
  530. method: "get",
  531. dataType: "json",
  532. crossDomain: false,
  533. url: globalConfig.context + "/api/admin/newOrder/getOrderTask",
  534. data: {
  535. orderNo: orderNos
  536. },
  537. success: function(data) {
  538. let theArr = [];
  539. if (data.error.length || data.data.list == "") {
  540. if (data.error && data.error.length) {
  541. message.warning(data.error[0].message);
  542. }
  543. } else {
  544. for (let i = 0; i < data.data.length; i++) {
  545. let thisdata = data.data[i];
  546. theArr.push({
  547. key: i,
  548. id: thisdata.id,
  549. orderNo: thisdata.orderNo, //订单编号
  550. commodityId: thisdata.commodityId, //项目ID
  551. commodityName: thisdata.commodityName, //项目名称
  552. cname: thisdata.cname, //项目类别
  553. commodityPrice: thisdata.commodityPrice, //项目价格
  554. commodityQuantity: thisdata.commodityQuantity, //项目数量
  555. main: thisdata.main, //是否为主要任务
  556. taskComment: thisdata.taskComment, //任务说明
  557. contacts: thisdata.contacts, //联系人
  558. contactsMobile: thisdata.contactsMobile, //联系人电话
  559. projectStatus: thisdata.projectStatus, //项目状态
  560. sort: thisdata.cSort
  561. });
  562. }
  563. }
  564. this.setState({
  565. dataSourceX: theArr
  566. });
  567. }.bind(this)
  568. });
  569. },
  570. search(obj) {
  571. this.setState(
  572. {
  573. searchData: obj
  574. },
  575. () => {
  576. this.loadData(1);
  577. }
  578. );
  579. },
  580. rizhi(orderNo) {
  581. $.ajax({
  582. method: "get",
  583. dataType: "json",
  584. crossDomain: false,
  585. url: "/api/admin/newOrder/selectOrderLog",
  586. data: {
  587. orderNo: orderNo
  588. },
  589. success: function(data) {
  590. let theArr = [];
  591. let thisData = data.data;
  592. if (!thisData.length) {
  593. if (data.error && data.error.length) {
  594. message.warning(data.error[0].message);
  595. }
  596. thisData = {};
  597. } else {
  598. for (let i = 0; i < data.data.length; i++) {
  599. let thisdata = data.data[i];
  600. theArr.push({
  601. processName: thisdata.processName,
  602. adminName: thisdata.adminName,
  603. createDate: thisdata.createDate,
  604. remarks: thisdata.remarks
  605. });
  606. }
  607. }
  608. this.setState({
  609. dataSourcerizhi: theArr
  610. });
  611. }.bind(this)
  612. });
  613. },
  614. getOrderLog(orderNo) {
  615. this.setState({
  616. rizhivisible: true
  617. });
  618. this.rizhi(orderNo);
  619. },
  620. closeOrderLog() {
  621. this.setState({
  622. rizhivisible: false
  623. });
  624. },
  625. //节点列表
  626. jiedian(orderNos) {
  627. $.ajax({
  628. method: "get",
  629. dataType: "json",
  630. crossDomain: false,
  631. url: globalConfig.context + "/api/admin/newOrder/selectOrderDun",
  632. data: {
  633. orderNo: orderNos
  634. },
  635. success: function(data) {
  636. let theArr = [];
  637. let thisData = [];
  638. if (data.error.length || data.data.list == "") {
  639. if (data.error && data.error.length) {
  640. message.warning(data.error[0].message);
  641. }
  642. } else {
  643. for (let i = 0; i < data.data.length; i++) {
  644. thisData = data.data[i];
  645. theArr.push({
  646. key: i,
  647. dunSubject: thisData.dunSubject
  648. ? thisData.dunSubject.toString()
  649. : "", //催款科目
  650. id: thisData.id, //节点Id
  651. money: thisData.money, //催款金额
  652. dunStatus: thisData.dunStatus //催款状态
  653. });
  654. }
  655. this.setState({
  656. contactList: theArr
  657. });
  658. }
  659. }.bind(this)
  660. });
  661. },
  662. jiedianNew(orderNos) {
  663. $.ajax({
  664. method: "get",
  665. dataType: "json",
  666. crossDomain: false,
  667. url:
  668. globalConfig.context + "/api/admin/newOrderDun/selectListNewOrderDun",
  669. data: {
  670. orderNo: orderNos
  671. },
  672. success: function(data) {
  673. if (data.error && data.error.length) {
  674. message.warning(data.error[0].message);
  675. } else {
  676. let theArr = [];
  677. let thisData = [];
  678. let arr = data.data || [];
  679. let totalCui = 0;
  680. for (let i = 0; i < arr.length; i++) {
  681. thisData = arr[i];
  682. totalCui += +thisData.money;
  683. theArr.push({
  684. key: i,
  685. dunSubject: thisData.dunSubject
  686. ? thisData.dunSubject.toString()
  687. : "", //催款科目
  688. id: thisData.id, //节点Id
  689. money: thisData.money, //催款金额
  690. // orderNo: record ? record.orderNo : this.props.datauser.orderNo,
  691. commodityName: thisData.commodityName,
  692. projectType: thisData.projectType,
  693. dunTypeName: thisData.dunTypeName,
  694. status: thisData.status,
  695. waitDay: thisData.waitDay,
  696. effectiveCount: thisData.effectiveCount,
  697. startDate: thisData.startDate,
  698. dunType: thisData.dunType,
  699. appropriationRatio: thisData.appropriationRatio
  700. });
  701. }
  702. if (!totalCui) {
  703. totalCui = 0;
  704. }
  705. totalCui = (Math.round(totalCui * 10000) / 10000).toFixed(4);
  706. this.setState({
  707. contactListNew: theArr,
  708. totalCui
  709. });
  710. }
  711. }.bind(this)
  712. }).always(
  713. function() {
  714. this.setState({
  715. loading: false
  716. });
  717. }.bind(this)
  718. );
  719. },
  720. //审核通过
  721. examOk() {
  722. $.ajax({
  723. method: "post",
  724. dataType: "json",
  725. crossDomain: false,
  726. url: globalConfig.context + "/api/admin/newOrder/auditOrderNew",
  727. data: {
  728. orderNo: this.state.orderNo,
  729. orderStatus: 2
  730. },
  731. success: function(data) {
  732. if (data.error.length || data.data.list == "") {
  733. if (data.error && data.error.length) {
  734. message.warning(data.error[0].message);
  735. }
  736. } else {
  737. message.success("该订单已通过审核~");
  738. this.setState({
  739. visible: false
  740. });
  741. this.reset();
  742. }
  743. }.bind(this)
  744. }).always(
  745. function() {
  746. this.setState({
  747. loading: false
  748. });
  749. }.bind(this)
  750. );
  751. },
  752. //通过发给外包
  753. outsourcing() {
  754. $.ajax({
  755. method: "post",
  756. dataType: "json",
  757. crossDomain: false,
  758. url: globalConfig.context + "/api/admin/newOrder/auditOrderNew",
  759. data: {
  760. orderNo: this.state.orderNo,
  761. orderStatus: 2,
  762. outsource: 1
  763. },
  764. success: function(data) {
  765. if (data.error.length || data.data.list == "") {
  766. if (data.error && data.error.length) {
  767. message.warning(data.error[0].message);
  768. }
  769. } else {
  770. message.success("该订单已通过审核~");
  771. this.setState({
  772. visible: false
  773. });
  774. this.reset();
  775. }
  776. }.bind(this)
  777. }).always(
  778. function() {
  779. this.setState({
  780. loading: false
  781. });
  782. }.bind(this)
  783. );
  784. },
  785. //审核不通过
  786. examOks() {
  787. this.setState({
  788. aloading: true
  789. });
  790. $.ajax({
  791. method: "post",
  792. dataType: "json",
  793. crossDomain: false,
  794. url: globalConfig.context + "/api/admin/newOrder/auditOrderNew",
  795. data: {
  796. orderNo: this.state.orderNo,
  797. orderStatus: 3,
  798. reason: this.state.reason
  799. },
  800. success: function(data) {
  801. if (data.error.length || data.data.list == "") {
  802. if (data.error && data.error.length) {
  803. message.warning(data.error[0].message);
  804. this.setState({
  805. aloading: true
  806. });
  807. }
  808. } else {
  809. message.success("该订单已被拒绝~");
  810. this.setState({
  811. visible: false,
  812. aloading: false,
  813. noVisible: false,
  814. reason: ""
  815. });
  816. this.reset();
  817. // window.location.reload()
  818. }
  819. }.bind(this)
  820. }).always(
  821. function() {
  822. this.setState({
  823. loading: false
  824. });
  825. }.bind(this)
  826. );
  827. },
  828. //点击拒绝
  829. examNo() {
  830. this.setState({
  831. noVisible: true
  832. });
  833. },
  834. loadDataChange() {
  835. $.ajax({
  836. method: "get",
  837. dataType: "json",
  838. async: false,
  839. crossDomain: false,
  840. url: globalConfig.context + "/api/admin/orderChange/orderChangeLogList",
  841. data: {
  842. changeId: this.state.id
  843. },
  844. success: function(data) {
  845. if (data.error.length || data.data.list == "") {
  846. if (data.error && data.error.length) {
  847. message.warning(data.error[0].message);
  848. }
  849. } else {
  850. // console.log("拿到历史", data.data);
  851. this.setState({
  852. dataProps: data.data
  853. });
  854. }
  855. }.bind(this)
  856. });
  857. },
  858. callback(key) {
  859. this.setState({
  860. activeKey: key
  861. });
  862. if (key === "1") {
  863. this.xiangmu(this.state.orderNo);
  864. this.jiedian(this.state.orderNo);
  865. this.jiedianNew(this.state.orderNo);
  866. }
  867. if (key === "2") {
  868. this.ChangeDetail(this.state.id);
  869. this.loadDataChange();
  870. }
  871. if (key === "3") {
  872. this.primaryOrder(this.state.primaryOrderNo);
  873. this.xiangmu(this.state.primaryOrderNo);
  874. this.jiedian(this.state.primaryOrderNo);
  875. this.jiedianNew(this.state.primaryOrderNo);
  876. }
  877. if (key === "4") {
  878. this.additionalOrder(this.state.additionalOrder);
  879. this.xiangmu(this.state.additionalOrder);
  880. this.jiedian(this.state.additionalOrder);
  881. this.jiedianNew(this.state.additionalOrder);
  882. this.setState({
  883. buttonStatusA: false
  884. });
  885. } else {
  886. this.setState({
  887. buttonStatusA: true
  888. });
  889. }
  890. },
  891. closeDesc(e, s) {
  892. this.state.activeKey = "1";
  893. this.state.userDetaile = false;
  894. this.state.signBillVisible = false;
  895. this.state.visible = e;
  896. if (s) {
  897. this.loadData(this.state.pageNo);
  898. }
  899. },
  900. // 获取原订单编号
  901. getPrimaryOrder(value) {
  902. this.setState({
  903. primaryOrder: value
  904. });
  905. },
  906. getAdditionalOrder(value) {
  907. this.setState({
  908. additionalOrder: value
  909. });
  910. },
  911. getUrl(url) {
  912. let theorgCodeUrl = [];
  913. if (url.length) {
  914. let picArr = [];
  915. url.map(function(item) {
  916. if (
  917. item.response &&
  918. item.response.data &&
  919. item.response.data.length
  920. ) {
  921. picArr.push(item.response.data);
  922. }
  923. });
  924. theorgCodeUrl = picArr.join(",");
  925. }
  926. return theorgCodeUrl;
  927. },
  928. sureOut() {
  929. if (!this.state.companyName) {
  930. message.warning("公司名称不能为空");
  931. return;
  932. }
  933. if (!this.state.unitPrice) {
  934. message.warning("单价不能为空");
  935. return;
  936. }
  937. if (!this.state.unitNumber) {
  938. message.warning("数量不能为空");
  939. return;
  940. }
  941. if (!this.state.amount) {
  942. message.warning("总金额不能为空");
  943. return;
  944. }
  945. if (!this.state.outsourceRemarks) {
  946. message.warning("备注不能为空");
  947. return;
  948. }
  949. if (this.state.pictureUrl.length === 0) {
  950. message.warning("合同扫描件不能为空");
  951. return;
  952. }
  953. $.ajax({
  954. method: "POST",
  955. dataType: "json",
  956. crossDomain: false,
  957. url: globalConfig.context + "/api/admin/outsourceOrg/auditOutsource",
  958. data: {
  959. id: this.state.id,
  960. orderNo: this.state.orderNo,
  961. companyName: this.state.companyName,
  962. amount: this.state.amount,
  963. outsourceRemarks: this.state.outsourceRemarks,
  964. unitNumber: this.state.unitNumber,
  965. unitPrice: this.state.unitPrice,
  966. attachmentUrl: this.getUrl(this.state.attachmentUrl).length
  967. ? this.getUrl(this.state.attachmentUrl)
  968. : "",
  969. orderStatus: 2,
  970. pictureUrl: this.getUrl(this.state.pictureUrl).length
  971. ? this.getUrl(this.state.pictureUrl)
  972. : ""
  973. }
  974. }).done(
  975. function(data) {
  976. this.setState({
  977. loading: false
  978. });
  979. if (!data.error.length) {
  980. message.success("发起成功!");
  981. this.outReset();
  982. this.visitCancel();
  983. } else {
  984. message.warning(data.error[0].message);
  985. }
  986. }.bind(this)
  987. );
  988. },
  989. //关闭输入理由框
  990. noCancel() {
  991. this.setState({
  992. noVisible: false,
  993. aloading: false,
  994. reason: ""
  995. });
  996. },
  997. //重置
  998. reset() {
  999. this.setState({
  1000. signBillVisible: false
  1001. });
  1002. this.state.orderNo = "";
  1003. this.state.customerName = "";
  1004. this.state.releaseDate[0] = undefined;
  1005. this.state.releaseDate[1] = undefined;
  1006. this.state.approval = undefined;
  1007. this.loadData(1);
  1008. // window.location.reload();
  1009. },
  1010. outReset() {
  1011. this.setState({
  1012. companyName: "",
  1013. amount: "",
  1014. unitPrice: "",
  1015. unitNumber: "",
  1016. outsourceRemarks: "",
  1017. attachmentUrl: [],
  1018. pictureUrl: []
  1019. });
  1020. },
  1021. getOrgCodeUrl(e) {
  1022. this.setState({ pictureUrl: e });
  1023. },
  1024. //关闭详情
  1025. visitCancel() {
  1026. this.setState(
  1027. {
  1028. activeKey: "1"
  1029. },
  1030. () => {
  1031. this.setState({
  1032. visible: false
  1033. });
  1034. }
  1035. );
  1036. this.loadData(this.state.pageNo);
  1037. },
  1038. visitOk() {
  1039. this.setState({
  1040. visible: false
  1041. });
  1042. },
  1043. changeList(arr) {
  1044. const newArr = [];
  1045. this.state.columns.forEach(item => {
  1046. arr.forEach(val => {
  1047. if (val === item.title) {
  1048. newArr.push(item);
  1049. }
  1050. });
  1051. });
  1052. this.setState({
  1053. changeList: newArr
  1054. });
  1055. },
  1056. render() {
  1057. const formItemLayout = {
  1058. labelCol: { span: 8 },
  1059. wrapperCol: { span: 14 }
  1060. };
  1061. const FormItem = Form.Item;
  1062. const { TabPane } = Tabs;
  1063. return (
  1064. <div className="user-content">
  1065. <ShowModalDiv ShowModal={this.state.showModal} />
  1066. <div className="content-title">
  1067. <span>合同变更审核订单</span>
  1068. </div>
  1069. <div className="user-search">
  1070. <SearchInput search={this.search} />
  1071. <ChooseList
  1072. columns={this.state.columns}
  1073. changeFn={this.changeList}
  1074. changeList={this.state.changeList}
  1075. top={65}
  1076. />
  1077. <div className="patent-table">
  1078. <Spin spinning={this.state.loading}>
  1079. <Table
  1080. size="small"
  1081. bordered
  1082. columns={
  1083. this.state.changeList == undefined
  1084. ? this.state.columns
  1085. : this.state.changeList
  1086. }
  1087. dataSource={this.state.dataSource}
  1088. pagination={this.state.pagination}
  1089. onRowClick={this.tableRowClick}
  1090. />
  1091. </Spin>
  1092. </div>
  1093. <Modal
  1094. className="customeDetails"
  1095. footer=""
  1096. maskClosable={false}
  1097. width="900px"
  1098. visible={this.state.visible}
  1099. onOk={this.visitOk}
  1100. onCancel={this.visitCancel}
  1101. >
  1102. <Tabs activeKey={this.state.activeKey} onChange={this.callback}>
  1103. <TabPane tab="订单详情" key="1">
  1104. <Form
  1105. layout="horizontal"
  1106. onSubmit={this.handleSubmit}
  1107. id="demand-form"
  1108. style={{ paddingBottom: "40px" }}
  1109. >
  1110. <Spin spinning={this.state.loading}>
  1111. <OrderDetail
  1112. orderData={this.state.orderData}
  1113. getOrderLog={this.getOrderLog}
  1114. dataSourceX={this.state.dataSourceX}
  1115. contactList={this.state.contactList}
  1116. orderNo={this.state.orderNo}
  1117. totalCui={this.state.totalCui}
  1118. contactListNew={this.state.contactListNew}
  1119. isCaiWu={true}
  1120. />
  1121. </Spin>
  1122. </Form>
  1123. </TabPane>
  1124. <TabPane tab="合同变更记录" key="2">
  1125. <ChangeDetail
  1126. data={this.state.contractData}
  1127. txt={this.state.processStateText}
  1128. pictureUrl={this.state.voucherUrl}
  1129. processState={this.props.processState}
  1130. loadData={this.callback}
  1131. reset={this.state.visible}
  1132. dataSource={this.state.dataProps}
  1133. proceedsData={this.state.proceedsData}
  1134. proceedsTotal={this.state.proTotal}
  1135. invoiceTotal={this.state.invTotal}
  1136. contactList={this.state.refundInvoice}
  1137. onCancel={this.visitCancel}
  1138. />
  1139. </TabPane>
  1140. {this.state.status === 4 ? (
  1141. <TabPane tab="原订单" key="3">
  1142. <Form
  1143. layout="horizontal"
  1144. onSubmit={this.handleSubmit}
  1145. id="demand-form"
  1146. style={{ paddingBottom: "40px" }}
  1147. >
  1148. <Spin spinning={this.state.loading}>
  1149. <OrderDetail
  1150. orderData={this.state.primaryOrderData}
  1151. getOrderLog={this.getOrderLog}
  1152. dataSourceX={this.state.dataSourceX}
  1153. contactList={this.state.contactList}
  1154. orderNo={this.state.primaryOrderNo}
  1155. isCaiWu={true}
  1156. totalCui={this.state.totalCui}
  1157. contactListNew={this.state.contactListNew}
  1158. />
  1159. </Spin>
  1160. </Form>
  1161. </TabPane>
  1162. ) : (
  1163. ""
  1164. )}
  1165. {this.state.status === 4 ? (
  1166. this.state.type === 4 || this.state.type === 5 ? (
  1167. <TabPane tab="附加订单" key="4">
  1168. <OrderDetail
  1169. orderData={this.state.additionalOrderData}
  1170. getOrderLog={this.getOrderLog}
  1171. dataSourceX={this.state.dataSourceX}
  1172. contactList={this.state.contactList}
  1173. orderNo={this.state.additionalOrder}
  1174. isCaiWu={true}
  1175. totalCui={this.state.totalCui}
  1176. contactListNew={this.state.contactListNew}
  1177. />
  1178. </TabPane>
  1179. ) : (
  1180. ""
  1181. )
  1182. ) : (
  1183. ""
  1184. )}
  1185. </Tabs>
  1186. </Modal>
  1187. <Modal
  1188. maskClosable={false}
  1189. visible={this.state.addnextVisible}
  1190. onOk={this.nextCancel}
  1191. onCancel={this.nextCancel}
  1192. confirmLoading={this.state.confirmLoading}
  1193. width="800px"
  1194. title={"项目任务详情"}
  1195. footer=""
  1196. className="admin-desc-content"
  1197. >
  1198. <Form layout="horizontal" id="demand-form">
  1199. <Spin spinning={this.state.loading}>
  1200. <div className="clearfix">
  1201. <FormItem
  1202. className="half-item"
  1203. {...formItemLayout}
  1204. label="项目名称"
  1205. >
  1206. <span>{this.state.commodityName}</span>
  1207. </FormItem>
  1208. <FormItem
  1209. className="half-item"
  1210. {...formItemLayout}
  1211. label="项目数量"
  1212. >
  1213. <span>{this.state.commodityQuantity}</span>
  1214. </FormItem>
  1215. <FormItem
  1216. className="half-item"
  1217. {...formItemLayout}
  1218. label="金额(万元)"
  1219. >
  1220. <span>{this.state.commodityPrice}</span>
  1221. </FormItem>
  1222. <FormItem
  1223. className="half-item"
  1224. {...formItemLayout}
  1225. label="主要项目"
  1226. >
  1227. <span>{getboutique(this.state.main)}</span>
  1228. </FormItem>
  1229. <div className="clearfix">
  1230. <FormItem
  1231. labelCol={{ span: 4 }}
  1232. wrapperCol={{ span: 16 }}
  1233. label="服务说明"
  1234. >
  1235. <span>{this.state.taskComment}</span>
  1236. </FormItem>
  1237. </div>
  1238. </div>
  1239. </Spin>
  1240. </Form>
  1241. </Modal>
  1242. <Modal
  1243. maskClosable={false}
  1244. visible={this.state.noVisible}
  1245. onOk={this.handleOk}
  1246. onCancel={this.noCancel}
  1247. width="400px"
  1248. title={"拒绝理由"}
  1249. footer=""
  1250. className="admin-desc-content"
  1251. confirmLoading={this.state.confirmLoading}
  1252. >
  1253. <Form layout="horizontal" id="demand-form">
  1254. <Spin spinning={this.state.loading}>
  1255. <div className="clearfix">
  1256. <FormItem
  1257. labelCol={{ span: 4 }}
  1258. wrapperCol={{ span: 16 }}
  1259. label="拒绝理由"
  1260. >
  1261. <Input
  1262. type="textarea"
  1263. placeholder="请输入拒绝理由"
  1264. rows={4}
  1265. value={this.state.reason}
  1266. onChange={e => {
  1267. this.setState({ reason: e.target.value });
  1268. }}
  1269. />
  1270. </FormItem>
  1271. </div>
  1272. <div className="clearfix">
  1273. <Button
  1274. className="cancel"
  1275. type="primary"
  1276. onClick={this.examOks}
  1277. style={{ marginLeft: "50px" }}
  1278. htmlType="submit"
  1279. loading={this.state.aloading}
  1280. >
  1281. 确定
  1282. </Button>
  1283. <Button
  1284. className="cancel"
  1285. type="ghost"
  1286. onClick={this.noCancel}
  1287. style={{ marginLeft: "50px" }}
  1288. >
  1289. 取消
  1290. </Button>
  1291. </div>
  1292. </Spin>
  1293. </Form>
  1294. </Modal>
  1295. {/* <Modal
  1296. visible={this.state.rizhivisible}
  1297. className="admin-desc-content"
  1298. width="800px"
  1299. maskClosable={false}
  1300. title="订单日志"
  1301. footer={null}
  1302. onCancel={this.closeOrderLog}
  1303. >
  1304. <div className="patent-table">
  1305. <Spin spinning={this.state.loading}>
  1306. <Table
  1307. bordered
  1308. columns={this.state.columnsrizhi}
  1309. dataSource={this.state.dataSourcerizhi}
  1310. pagination={false}
  1311. />
  1312. </Spin>
  1313. </div>
  1314. </Modal> */}
  1315. <OrderRiZi
  1316. dataSourcerizhi={this.state.dataSourcerizhi}
  1317. closeOrderLog={this.closeOrderLog}
  1318. visible={this.state.rizhivisible}
  1319. loading={this.state.loading}
  1320. />
  1321. </div>
  1322. </div>
  1323. );
  1324. }
  1325. })
  1326. );
  1327. export default contractChange;