contractJsjl.js 43 KB

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