contractYxy.js 45 KB

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