contractJsjl.js 39 KB

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