contractJszj.js 39 KB

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