contractJszj.js 43 KB

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