contractJsjl.js 41 KB

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