contractYxy.js 44 KB

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