contractJszj.js 42 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390
  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/changeDetailJszj.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. processState: this.props.processState,
  40. timeType: this.state.searchData.timeTypeSearch,
  41. startTime: this.state.searchData.releaseDate[0],
  42. endTime: this.state.searchData.releaseDate[1],
  43. salesmanName: this.state.searchData.salesmanNameSearch,
  44. complete: this.state.searchData.completeSearch || 1,
  45. depId: this.state.searchData.depIdSearch,
  46. orderNo: this.state.searchData.orderNoSearch,
  47. contractNo: this.state.searchData.contractNoSearch,
  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. },
  350. //点击打卡项目详情
  351. tableRowClickX(record) {
  352. this.setState({
  353. jid: record.id, //项目ID
  354. kid: record.commodityId, //商品ID
  355. commodityName: record.commodityName, //金额
  356. commodityPrice: record.commodityPrice, //金额
  357. commodityQuantity: record.commodityQuantity, //数量
  358. taskComment: record.taskComment, //备注
  359. main: record.main.toString(), //是否为主要
  360. addnextVisible: true,
  361. dataInfor:record,
  362. addState: 0
  363. });
  364. },
  365. //项目详情关闭
  366. nextCancel() {
  367. this.setState({
  368. addnextVisible: false
  369. });
  370. },
  371. // 合同变更详情
  372. ChangeDetail(id) {
  373. let url = window.location.href.substring(7);
  374. $.ajax({
  375. method: "get",
  376. dataType: "json",
  377. crossDomain: false,
  378. url:
  379. globalConfig.context +
  380. "/api/admin/orderChange/orderChangeDetailsById",
  381. data: {
  382. id: id
  383. },
  384. success: function (data) {
  385. if (data.data) {
  386. let thisdata = data.data;
  387. Object.assign(thisdata, {
  388. processStateText: this.state.processStateText,
  389. userName: this.state.userName,
  390. contractNo: this.state.contractNo
  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: (Math.round(proTotal * 1000000) / 1000000).toFixed(6),
  429. invTotal: (Math.round(invTotal * 1000000) / 1000000).toFixed(6),
  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. userName: thisdata.userName,
  473. primaryOrderNo: thisdata.primaryOrder,
  474. additionalOrder: thisdata.additionalOrder,
  475. contractNo: thisdata.contractNo,
  476. // arrears: thisdata.arrears,
  477. orderData: thisdata,
  478. isAddition: thisdata.additionalOrder ? true : false
  479. });
  480. }
  481. }.bind(this)
  482. });
  483. },
  484. // 原订单数据
  485. primaryOrder(primaryOrder) {
  486. $.ajax({
  487. method: "get",
  488. dataType: "json",
  489. crossDomain: false,
  490. url: globalConfig.context + "/api/admin/newOrder/getOrderNewDetail",
  491. data: {
  492. orderNo: primaryOrder
  493. },
  494. success: function (data) {
  495. if (data.error.length || data.data.list == "") {
  496. if (data.error && data.error.length) {
  497. message.warning(data.error[0].message);
  498. }
  499. } else {
  500. let thisdata = data.data;
  501. this.setState({
  502. primaryOrderData: thisdata
  503. });
  504. }
  505. }.bind(this)
  506. });
  507. },
  508. // 附加订单数据
  509. additionalOrder(additionalOrder) {
  510. $.ajax({
  511. method: "get",
  512. dataType: "json",
  513. crossDomain: false,
  514. url: globalConfig.context + "/api/admin/newOrder/getOrderNewDetail",
  515. data: {
  516. orderNo: additionalOrder
  517. },
  518. success: function (data) {
  519. if (data.error.length || data.data.list == "") {
  520. if (data.error && data.error.length) {
  521. message.warning(data.error[0].message);
  522. }
  523. } else {
  524. let thisdata = data.data;
  525. this.setState({
  526. additionalOrderData: thisdata
  527. });
  528. }
  529. }.bind(this)
  530. });
  531. },
  532. //项目列表
  533. xiangmu(orderNos) {
  534. $.ajax({
  535. method: "get",
  536. dataType: "json",
  537. crossDomain: false,
  538. url: globalConfig.context + "/api/admin/newOrder/getOrderTask",
  539. data: {
  540. orderNo: orderNos
  541. },
  542. success: function (data) {
  543. let theArr = [];
  544. if (data.error.length || data.data.list == "") {
  545. if (data.error && data.error.length) {
  546. message.warning(data.error[0].message);
  547. }
  548. } else {
  549. for (let i = 0; i < data.data.length; i++) {
  550. let thisdata = data.data[i];
  551. thisdata.key = i;
  552. thisdata.sort = thisdata.cSort;
  553. theArr.push(thisdata);
  554. }
  555. }
  556. this.setState({
  557. dataSourceX: theArr
  558. });
  559. }.bind(this)
  560. });
  561. },
  562. search(obj) {
  563. this.setState(
  564. {
  565. searchData: obj
  566. },
  567. () => {
  568. this.loadData(1);
  569. }
  570. );
  571. },
  572. rizhi(orderNo) {
  573. $.ajax({
  574. method: "get",
  575. dataType: "json",
  576. crossDomain: false,
  577. url: "/api/admin/newOrder/selectOrderLog",
  578. data: {
  579. orderNo: orderNo
  580. },
  581. success: function (data) {
  582. let theArr = [];
  583. let thisData = data.data;
  584. if (!thisData.length) {
  585. if (data.error && data.error.length) {
  586. message.warning(data.error[0].message);
  587. }
  588. thisData = {};
  589. } else {
  590. for (let i = 0; i < data.data.length; i++) {
  591. let thisdata = data.data[i];
  592. theArr.push({
  593. processName: thisdata.processName,
  594. adminName: thisdata.adminName,
  595. createDate: thisdata.createDate,
  596. remarks: thisdata.remarks
  597. });
  598. }
  599. }
  600. this.setState({
  601. dataSourcerizhi: theArr
  602. });
  603. }.bind(this)
  604. });
  605. },
  606. getOrderLog(orderNo) {
  607. this.setState({
  608. rizhivisible: true
  609. });
  610. this.rizhi(orderNo);
  611. },
  612. closeOrderLog() {
  613. this.setState({
  614. rizhivisible: false
  615. });
  616. },
  617. //节点列表
  618. jiedian(orderNos) {
  619. $.ajax({
  620. method: "get",
  621. dataType: "json",
  622. crossDomain: false,
  623. url: globalConfig.context + "/api/admin/newOrder/selectOrderDun",
  624. data: {
  625. orderNo: orderNos
  626. },
  627. success: function (data) {
  628. let theArr = [];
  629. let thisData = [];
  630. if (data.error.length || data.data.list == "") {
  631. if (data.error && data.error.length) {
  632. message.warning(data.error[0].message);
  633. }
  634. } else {
  635. for (let i = 0; i < data.data.length; i++) {
  636. thisData = data.data[i];
  637. theArr.push({
  638. key: i,
  639. dunSubject: thisData.dunSubject
  640. ? thisData.dunSubject.toString()
  641. : "", //催款科目
  642. id: thisData.id, //节点Id
  643. money: thisData.money, //催款金额
  644. dunStatus: thisData.dunStatus //催款状态
  645. });
  646. }
  647. this.setState({
  648. contactList: theArr
  649. });
  650. }
  651. }.bind(this)
  652. });
  653. },
  654. jiedianNew(orderNos) {
  655. $.ajax({
  656. method: "get",
  657. dataType: "json",
  658. crossDomain: false,
  659. url:
  660. globalConfig.context + "/api/admin/newOrderDun/selectListNewOrderDun",
  661. data: {
  662. orderNo: orderNos
  663. },
  664. success: function (data) {
  665. if (data.error && data.error.length) {
  666. message.warning(data.error[0].message);
  667. } else {
  668. let theArr = [];
  669. let thisData = [];
  670. let arr = data.data || [];
  671. let totalCui = 0;
  672. for (let i = 0; i < arr.length; i++) {
  673. thisData = arr[i];
  674. totalCui += +thisData.money;
  675. theArr.push({
  676. key: i,
  677. dunSubject: thisData.dunSubject
  678. ? thisData.dunSubject.toString()
  679. : "", //催款科目
  680. id: thisData.id, //节点Id
  681. money: thisData.money, //催款金额
  682. // orderNo: record ? record.orderNo : this.props.datauser.orderNo,
  683. commodityName: thisData.commodityName,
  684. projectType: thisData.projectType,
  685. dunTypeName: thisData.dunTypeName,
  686. status: thisData.status,
  687. waitDay: thisData.waitDay,
  688. effectiveCount: thisData.effectiveCount,
  689. startDate: thisData.startDate,
  690. dunType: thisData.dunType,
  691. appropriationRatio: thisData.appropriationRatio,
  692. customizeName: thisData.customizeName,
  693. customizeTimes: thisData.customizeTimes,
  694. tid: thisData.tid,
  695. });
  696. }
  697. if (!totalCui) {
  698. totalCui = 0;
  699. }
  700. totalCui = (Math.round(totalCui * 1000000) / 1000000).toFixed(6);
  701. this.setState({
  702. contactListNew: theArr,
  703. totalCui
  704. });
  705. }
  706. }.bind(this)
  707. }).always(
  708. function () {
  709. this.setState({
  710. loading: false
  711. });
  712. }.bind(this)
  713. );
  714. },
  715. //审核通过
  716. examOk() {
  717. $.ajax({
  718. method: "post",
  719. dataType: "json",
  720. crossDomain: false,
  721. url: globalConfig.context + "/api/admin/newOrder/auditOrderNew",
  722. data: {
  723. orderNo: this.state.orderNo,
  724. orderStatus: 2
  725. },
  726. success: function (data) {
  727. if (data.error.length || data.data.list == "") {
  728. if (data.error && data.error.length) {
  729. message.warning(data.error[0].message);
  730. }
  731. } else {
  732. message.success("该订单已通过审核~");
  733. this.setState({
  734. visible: false
  735. });
  736. this.reset();
  737. }
  738. }.bind(this)
  739. }).always(
  740. function () {
  741. this.setState({
  742. loading: false
  743. });
  744. }.bind(this)
  745. );
  746. },
  747. //通过发给外包
  748. outsourcing() {
  749. $.ajax({
  750. method: "post",
  751. dataType: "json",
  752. crossDomain: false,
  753. url: globalConfig.context + "/api/admin/newOrder/auditOrderNew",
  754. data: {
  755. orderNo: this.state.orderNo,
  756. orderStatus: 2,
  757. outsource: 1
  758. },
  759. success: function (data) {
  760. if (data.error.length || data.data.list == "") {
  761. if (data.error && data.error.length) {
  762. message.warning(data.error[0].message);
  763. }
  764. } else {
  765. message.success("该订单已通过审核~");
  766. this.setState({
  767. visible: false
  768. });
  769. this.reset();
  770. }
  771. }.bind(this)
  772. }).always(
  773. function () {
  774. this.setState({
  775. loading: false
  776. });
  777. }.bind(this)
  778. );
  779. },
  780. //审核不通过
  781. examOks() {
  782. this.setState({
  783. aloading: true
  784. });
  785. $.ajax({
  786. method: "post",
  787. dataType: "json",
  788. crossDomain: false,
  789. url: globalConfig.context + "/api/admin/newOrder/auditOrderNew",
  790. data: {
  791. orderNo: this.state.orderNo,
  792. orderStatus: 3,
  793. reason: this.state.reason
  794. },
  795. success: function (data) {
  796. if (data.error.length || data.data.list == "") {
  797. if (data.error && data.error.length) {
  798. message.warning(data.error[0].message);
  799. this.setState({
  800. aloading: true
  801. });
  802. }
  803. } else {
  804. message.success("该订单已被拒绝~");
  805. this.setState({
  806. visible: false,
  807. aloading: false,
  808. noVisible: false,
  809. reason: ""
  810. });
  811. this.reset();
  812. }
  813. }.bind(this)
  814. }).always(
  815. function () {
  816. this.setState({
  817. loading: false
  818. });
  819. }.bind(this)
  820. );
  821. },
  822. //点击拒绝
  823. examNo() {
  824. this.setState({
  825. noVisible: true
  826. });
  827. },
  828. loadDataChange(key) {
  829. $.ajax({
  830. method: "get",
  831. dataType: "json",
  832. async: false,
  833. crossDomain: false,
  834. url: globalConfig.context + "/api/admin/orderChange/orderChangeLogList",
  835. data: {
  836. changeId: key
  837. },
  838. success: function (data) {
  839. if (data.error.length || data.data.list == "") {
  840. if (data.error && data.error.length) {
  841. message.warning(data.error[0].message);
  842. }
  843. } else {
  844. // console.log("拿到历史", data.data);
  845. this.setState({
  846. dataProps: data.data
  847. });
  848. }
  849. }.bind(this)
  850. });
  851. },
  852. callback(key) {
  853. this.setState(
  854. {
  855. activeKey: key
  856. },
  857. () => {
  858. if (key != "a" && key != "c" && key.length < 10) {
  859. this.ChangeDetail(key);
  860. this.loadDataChange(key);
  861. } else if (key != "a" && key != "c" && key.length > 10) {
  862. this.primaryOrder(key);
  863. this.xiangmu(key);
  864. this.jiedian(key);
  865. this.jiedianNew(key);
  866. this.loadDataChange(key);
  867. }
  868. }
  869. );
  870. if (key === "a") {
  871. this.xiangmu(this.state.orderNo);
  872. this.jiedian(this.state.orderNo);
  873. this.jiedianNew(this.state.orderNo);
  874. }
  875. // if (key === "2") {
  876. // this.ChangeDetail(this.state.id);
  877. // this.loadDataChange();
  878. // }
  879. // if (key === "3") {
  880. // this.primaryOrder(this.state.primaryOrderNo);
  881. // this.xiangmu(this.state.primaryOrderNo);
  882. // this.jiedian(this.state.primaryOrderNo);
  883. // this.jiedianNew(this.state.primaryOrderNo);
  884. // }
  885. if (key === "c") {
  886. this.additionalOrder(this.state.additionalOrder);
  887. this.xiangmu(this.state.additionalOrder);
  888. this.jiedian(this.state.additionalOrder);
  889. this.jiedianNew(this.state.additionalOrder);
  890. this.setState({
  891. buttonStatusA: false
  892. });
  893. } else {
  894. this.setState({
  895. buttonStatusA: true
  896. });
  897. }
  898. },
  899. closeDesc(e, s) {
  900. this.state.activeKey = "a";
  901. this.state.userDetaile = false;
  902. this.state.signBillVisible = false;
  903. this.state.visible = e;
  904. if (s) {
  905. this.loadData(this.state.pageNo);
  906. }
  907. },
  908. // 获取原订单编号
  909. getPrimaryOrder(value) {
  910. this.setState({
  911. primaryOrder: value
  912. });
  913. },
  914. getAdditionalOrder(value) {
  915. this.setState({
  916. additionalOrder: value
  917. });
  918. },
  919. getUrl(url) {
  920. let theorgCodeUrl = [];
  921. if (url.length) {
  922. let picArr = [];
  923. url.map(function (item) {
  924. if (
  925. item.response &&
  926. item.response.data &&
  927. item.response.data.length
  928. ) {
  929. picArr.push(item.response.data);
  930. }
  931. });
  932. theorgCodeUrl = picArr.join(",");
  933. }
  934. return theorgCodeUrl;
  935. },
  936. sureOut() {
  937. if (!this.state.companyName) {
  938. message.warning("公司名称不能为空");
  939. return;
  940. }
  941. if (!this.state.unitPrice) {
  942. message.warning("单价不能为空");
  943. return;
  944. }
  945. if (!this.state.unitNumber) {
  946. message.warning("数量不能为空");
  947. return;
  948. }
  949. if (!this.state.amount) {
  950. message.warning("总金额不能为空");
  951. return;
  952. }
  953. if (!this.state.outsourceRemarks) {
  954. message.warning("备注不能为空");
  955. return;
  956. }
  957. if (this.state.pictureUrl.length === 0) {
  958. message.warning("合同扫描件不能为空");
  959. return;
  960. }
  961. $.ajax({
  962. method: "POST",
  963. dataType: "json",
  964. crossDomain: false,
  965. url: globalConfig.context + "/api/admin/outsourceOrg/auditOutsource",
  966. data: {
  967. id: this.state.id,
  968. orderNo: this.state.orderNo,
  969. companyName: this.state.companyName,
  970. amount: this.state.amount,
  971. outsourceRemarks: this.state.outsourceRemarks,
  972. unitNumber: this.state.unitNumber,
  973. unitPrice: this.state.unitPrice,
  974. attachmentUrl: this.getUrl(this.state.attachmentUrl).length
  975. ? this.getUrl(this.state.attachmentUrl)
  976. : "",
  977. orderStatus: 2,
  978. pictureUrl: this.getUrl(this.state.pictureUrl).length
  979. ? this.getUrl(this.state.pictureUrl)
  980. : ""
  981. }
  982. }).done(
  983. function (data) {
  984. this.setState({
  985. loading: false
  986. });
  987. if (!data.error.length) {
  988. message.success("发起成功!");
  989. this.outReset();
  990. this.visitCancel();
  991. } else {
  992. message.warning(data.error[0].message);
  993. }
  994. }.bind(this)
  995. );
  996. },
  997. //关闭输入理由框
  998. noCancel() {
  999. this.setState({
  1000. noVisible: false,
  1001. aloading: false,
  1002. reason: ""
  1003. });
  1004. },
  1005. //重置
  1006. reset() {
  1007. this.setState({
  1008. signBillVisible: false
  1009. });
  1010. this.state.orderNo = "";
  1011. this.state.customerName = "";
  1012. this.state.releaseDate[0] = undefined;
  1013. this.state.releaseDate[1] = undefined;
  1014. this.state.approval = undefined;
  1015. this.loadData(1);
  1016. },
  1017. outReset() {
  1018. this.setState({
  1019. companyName: "",
  1020. amount: "",
  1021. unitPrice: "",
  1022. unitNumber: "",
  1023. outsourceRemarks: "",
  1024. attachmentUrl: [],
  1025. pictureUrl: []
  1026. });
  1027. },
  1028. getOrgCodeUrl(e) {
  1029. this.setState({ pictureUrl: e });
  1030. },
  1031. //关闭详情
  1032. visitCancel() {
  1033. this.setState(
  1034. {
  1035. activeKey: "a"
  1036. },
  1037. () => {
  1038. this.setState({
  1039. visible: false
  1040. });
  1041. }
  1042. );
  1043. this.loadData(this.state.pageNo);
  1044. },
  1045. visitOk() {
  1046. this.setState({
  1047. visible: false
  1048. });
  1049. },
  1050. // createTabs() {
  1051. // $.ajax({
  1052. // url: globalConfig.context + "/api/admin/orderChange/getOrderChange",
  1053. // method: "get",
  1054. // data: {
  1055. // orderNo: this.state.orderNo
  1056. // },
  1057. // success: data => {
  1058. // if (data.error && data.error.length) {
  1059. // message.warning(data.error[0].message);
  1060. // } else {
  1061. // this.setState({
  1062. // tabList: data.data
  1063. // });
  1064. // }
  1065. // }
  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. render() {
  1082. const tabList = this.state.tabList || [];
  1083. const formItemLayout = {
  1084. labelCol: { span: 8 },
  1085. wrapperCol: { span: 14 }
  1086. };
  1087. const FormItem = Form.Item;
  1088. const { TabPane } = Tabs;
  1089. return (
  1090. <div className="user-content">
  1091. <ShowModalDiv ShowModal={this.state.showModal} />
  1092. <div className="content-title">
  1093. <span>合同变更审核订单</span>
  1094. </div>
  1095. <div className="user-search">
  1096. <Tabs
  1097. defaultActiveKey="1"
  1098. onChange={this.callback}
  1099. className="test">
  1100. <TabPane tab="搜索" key="1">
  1101. <div style={{ marginLeft: 10 }}>
  1102. <SearchInput search={this.search} />
  1103. </div>
  1104. </TabPane>
  1105. <TabPane tab="更改表格显示数据" key="2">
  1106. <div style={{ marginLeft: 10 }}>
  1107. <ChooseList
  1108. columns={this.state.columns}
  1109. changeFn={this.changeList}
  1110. changeList={this.state.changeList}
  1111. top={55}
  1112. margin={11}
  1113. />
  1114. </div>
  1115. </TabPane>
  1116. </Tabs>
  1117. <div className="patent-table">
  1118. <Spin spinning={this.state.loading}>
  1119. <Table
  1120. size="small"
  1121. bordered
  1122. columns={
  1123. this.state.changeList
  1124. ? this.state.changeList
  1125. : this.state.columns
  1126. }
  1127. dataSource={this.state.dataSource}
  1128. pagination={this.state.pagination}
  1129. onRowClick={this.tableRowClick}
  1130. />
  1131. </Spin>
  1132. </div>
  1133. {this.state.visible ? <Modal
  1134. className="customeDetails"
  1135. footer=""
  1136. maskClosable={false}
  1137. width="900px"
  1138. visible={this.state.visible}
  1139. onOk={this.visitOk}
  1140. onCancel={this.visitCancel}
  1141. >
  1142. <Tabs
  1143. activeKey={this.state.activeKey}
  1144. onChange={this.callback}
  1145. type="card"
  1146. >
  1147. <TabPane tab="订单详情" key="a">
  1148. {this.state.activeKey === "a" ? <Form
  1149. layout="horizontal"
  1150. onSubmit={this.handleSubmit}
  1151. id="demand-form"
  1152. style={{ paddingBottom: "40px" }}
  1153. >
  1154. <Spin spinning={this.state.loading}>
  1155. <OrderDetail
  1156. orderData={this.state.orderData}
  1157. getOrderLog={this.getOrderLog}
  1158. dataSourceX={this.state.dataSourceX}
  1159. contactList={this.state.contactList}
  1160. totalCui={this.state.totalCui}
  1161. contactListNew={this.state.contactListNew}
  1162. orderNo={this.state.orderNo}
  1163. />
  1164. </Spin>
  1165. </Form> : <div/>}
  1166. </TabPane>
  1167. {/* <TabPane tab="合同变更记录" key="2">
  1168. <ChangeDetail
  1169. data={this.state.contractData}
  1170. pictureUrl={this.state.voucherUrl}
  1171. processState={this.props.processState}
  1172. loadData={this.callback}
  1173. reset={this.state.visible}
  1174. dataSource={this.state.dataProps}
  1175. proceedsData={this.state.proceedsData}
  1176. proceedsTotal={this.state.proTotal}
  1177. invoiceTotal={this.state.invTotal}
  1178. contactList={this.state.refundInvoice}
  1179. onCancel={this.visitCancel}
  1180. />
  1181. </TabPane> */}
  1182. {/*{tabList.map((item, index, arr) => {*/}
  1183. {/* return (*/}
  1184. {/* <TabPane tab={"合同变更记录" + (index + 1)} key={item.id}>*/}
  1185. {/* {this.state.activeKey === String(item.id) ?<ChangeDetail*/}
  1186. {/* id={item.id}*/}
  1187. {/* money={index == arr.length - 1 ? this.state.orderData.totalAmount + "" : undefined}*/}
  1188. {/* data={this.state.contractData}*/}
  1189. {/* pictureUrl={this.state.voucherUrl}*/}
  1190. {/* processState={this.props.processState}*/}
  1191. {/* loadData={this.callback}*/}
  1192. {/* reset={this.state.visible}*/}
  1193. {/* dataSource={this.state.dataProps}*/}
  1194. {/* proceedsData={this.state.proceedsData}*/}
  1195. {/* proceedsTotal={this.state.proTotal}*/}
  1196. {/* invoiceTotal={this.state.invTotal}*/}
  1197. {/* contactList={this.state.refundInvoice}*/}
  1198. {/* onCancel={this.visitCancel}*/}
  1199. {/* /> : <div/>}*/}
  1200. {/* </TabPane>*/}
  1201. {/* );*/}
  1202. {/*})}*/}
  1203. {/* {this.state.status === 4 ? (
  1204. <TabPane tab="原订单" key="3">
  1205. <Form
  1206. layout="horizontal"
  1207. onSubmit={this.handleSubmit}
  1208. id="demand-form"
  1209. style={{ paddingBottom: "40px" }}
  1210. >
  1211. <Spin spinning={this.state.loading}>
  1212. <OrderDetail
  1213. orderData={this.state.primaryOrderData}
  1214. getOrderLog={this.getOrderLog}
  1215. dataSourceX={this.state.dataSourceX}
  1216. contactList={this.state.contactList}
  1217. orderNo={this.state.primaryOrderNo}
  1218. totalCui={this.state.totalCui}
  1219. contactListNew={this.state.contactListNew}
  1220. />
  1221. </Spin>
  1222. </Form>
  1223. </TabPane>
  1224. ) : (
  1225. ""
  1226. )} */}
  1227. {/*{tabList.map((item, index) => {*/}
  1228. {/* if (item.usedOrder) {*/}
  1229. {/* return (*/}
  1230. {/* <TabPane*/}
  1231. {/* tab={"原订单" + (index + 1)}*/}
  1232. {/* key={item.usedOrder}*/}
  1233. {/* >*/}
  1234. {/* {this.state.activeKey === String(item.usedOrder) ?<Form*/}
  1235. {/* layout="horizontal"*/}
  1236. {/* onSubmit={this.handleSubmit}*/}
  1237. {/* id="demand-form"*/}
  1238. {/* style={{ paddingBottom: "40px" }}*/}
  1239. {/* >*/}
  1240. {/* <Spin spinning={this.state.loading}>*/}
  1241. {/* <OrderDetail*/}
  1242. {/* orderData={this.state.primaryOrderData}*/}
  1243. {/* getOrderLog={this.getOrderLog}*/}
  1244. {/* dataSourceX={this.state.dataSourceX}*/}
  1245. {/* contactList={this.state.contactList}*/}
  1246. {/* orderNo={this.state.primaryOrderNo}*/}
  1247. {/* totalCui={this.state.totalCui}*/}
  1248. {/* contactListNew={this.state.contactListNew}*/}
  1249. {/* />*/}
  1250. {/* </Spin>*/}
  1251. {/* </Form> : <div/>}*/}
  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. {this.state.activeKey === 'c' ? <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. totalCui={this.state.totalCui}
  1268. contactListNew={this.state.contactListNew}
  1269. /> : <div/>}
  1270. </TabPane>
  1271. ) : (
  1272. ""
  1273. )
  1274. ) : (
  1275. ""
  1276. )}
  1277. </Tabs>
  1278. </Modal>:<div/>}
  1279. <Modal
  1280. maskClosable={false}
  1281. visible={this.state.noVisible}
  1282. onOk={this.handleOk}
  1283. onCancel={this.noCancel}
  1284. width="400px"
  1285. title={"拒绝理由"}
  1286. footer=""
  1287. className="admin-desc-content"
  1288. confirmLoading={this.state.confirmLoading}
  1289. >
  1290. <Form layout="horizontal" id="demand-form">
  1291. <Spin spinning={this.state.loading}>
  1292. <div className="clearfix">
  1293. <FormItem
  1294. labelCol={{ span: 4 }}
  1295. wrapperCol={{ span: 16 }}
  1296. label="拒绝理由"
  1297. >
  1298. <Input
  1299. type="textarea"
  1300. placeholder="请输入拒绝理由"
  1301. rows={4}
  1302. value={this.state.reason}
  1303. onChange={e => {
  1304. this.setState({ reason: e.target.value });
  1305. }}
  1306. />
  1307. </FormItem>
  1308. </div>
  1309. <div className="clearfix">
  1310. <Button
  1311. className="cancel"
  1312. type="primary"
  1313. onClick={this.examOks}
  1314. style={{ marginLeft: "50px" }}
  1315. htmlType="submit"
  1316. loading={this.state.aloading}
  1317. >
  1318. 确定
  1319. </Button>
  1320. <Button
  1321. className="cancel"
  1322. type="ghost"
  1323. onClick={this.noCancel}
  1324. style={{ marginLeft: "50px" }}
  1325. >
  1326. 取消
  1327. </Button>
  1328. </div>
  1329. </Spin>
  1330. </Form>
  1331. </Modal>
  1332. {/* <Modal
  1333. visible={this.state.rizhivisible}
  1334. className="admin-desc-content"
  1335. width="800px"
  1336. maskClosable={false}
  1337. title="订单日志"
  1338. footer={null}
  1339. onCancel={this.closeOrderLog}
  1340. >
  1341. <div className="patent-table">
  1342. <Spin spinning={this.state.loading}>
  1343. <Table
  1344. bordered
  1345. columns={this.state.columnsrizhi}
  1346. dataSource={this.state.dataSourcerizhi}
  1347. pagination={false}
  1348. />
  1349. </Spin>
  1350. </div>
  1351. </Modal> */}
  1352. <OrderRiZi
  1353. dataSourcerizhi={this.state.dataSourcerizhi}
  1354. closeOrderLog={this.closeOrderLog}
  1355. visible={this.state.rizhivisible}
  1356. loading={this.state.loading}
  1357. />
  1358. </div>
  1359. {this.state.addnextVisible && <ProjectDetailsReadOnly
  1360. infor={this.state.dataInfor}
  1361. visible={this.state.addnextVisible}
  1362. onCancel={this.nextCancel}
  1363. />}
  1364. </div>
  1365. );
  1366. }
  1367. })
  1368. );
  1369. export default contractChange;