contractJsjl.js 39 KB

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