contractCwzj.js 43 KB

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