contractJszj.js 38 KB

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