contractYxy.js 38 KB

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