contractCwzj.js 39 KB

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