contractYxgly.js 43 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429
  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/changeDetailYxgly.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. type: this.state.searchData.changeSearch
  46. },
  47. success: function (data) {
  48. ShowModal(this);
  49. let theArr = [];
  50. if (data.error.length || data.data.list == "") {
  51. if (data.error && data.error.length) {
  52. message.warning(data.error[0].message);
  53. }
  54. } else {
  55. for (let i = 0; i < data.data.list.length; i++) {
  56. let thisdata = data.data.list[i];
  57. theArr.push({
  58. key: i,
  59. orderNo: thisdata.orderNo,
  60. createTimes: thisdata.createTimes,
  61. nickname: thisdata.nickname,
  62. orderType: thisdata.orderType,
  63. establishTimes: thisdata.establishTimes,
  64. orderStatus: thisdata.orderStatus,
  65. totalAmount: thisdata.totalAmount,
  66. settlementAmount: thisdata.settlementAmount,
  67. arrears: thisdata.arrears,
  68. salesmanName: thisdata.salesmanName,
  69. depName: thisdata.depName,
  70. processState: thisdata.processState,
  71. type: thisdata.type,
  72. status: thisdata.status,
  73. id: thisdata.id,
  74. contractNo: thisdata.contractNo,
  75. processStateText: getProcessStatusNew(
  76. thisdata.processState,
  77. thisdata.status
  78. )
  79. });
  80. }
  81. this.state.pagination.total = data.data.totalCount;
  82. this.state.pagination.current = data.data.pageNo;
  83. }
  84. if (data.data && data.data.list && !data.data.list.length) {
  85. this.state.pagination.total = 0;
  86. }
  87. this.setState({
  88. dataSource: theArr,
  89. pageNo: pageNo,
  90. pagination: this.state.pagination
  91. });
  92. }.bind(this)
  93. }).always(
  94. function () {
  95. this.setState({
  96. loading: false
  97. });
  98. }.bind(this)
  99. );
  100. },
  101. getInitialState() {
  102. return {
  103. page: 1,
  104. searchData: {
  105. releaseDate: []
  106. },
  107. primaryOrderData: {}, //原订单数据
  108. orderData: {}, //现订单数据
  109. pictureUrl: [],
  110. voucherUrl: [],
  111. attachmentUrl: [],
  112. contractData: {},
  113. additionalOrderData: {},
  114. proceedsData: [],
  115. paginations: false,
  116. activeKey: "a",
  117. confirmLoading: false,
  118. aloading: false,
  119. pagination: {
  120. defaultCurrent: 1,
  121. defaultPageSize: 10,
  122. showQuickJumper: true,
  123. pageSize: 10,
  124. onChange: function (page) {
  125. this.loadData(page);
  126. }.bind(this),
  127. showTotal: function (total) {
  128. return "共" + total + "条数据";
  129. }
  130. },
  131. columns: [
  132. {
  133. title: "合同编号",
  134. dataIndex: "contractNo",
  135. key: "contractNo"
  136. },
  137. {
  138. title: "订单编号",
  139. dataIndex: "orderNo",
  140. key: "orderNo"
  141. },
  142. {
  143. title: "客户名称",
  144. dataIndex: "nickname",
  145. key: "nickname"
  146. },
  147. {
  148. title: "订单部门",
  149. dataIndex: "depName",
  150. key: "depName"
  151. },
  152. {
  153. title: "订单类型",
  154. dataIndex: "orderType",
  155. key: "orderType",
  156. render: text => {
  157. return text ? "科技项目" : "认证项目";
  158. }
  159. },
  160. {
  161. title: "下单时间",
  162. dataIndex: "establishTimes",
  163. key: "establishTimes"
  164. },
  165. {
  166. title: "订单状态",
  167. dataIndex: "orderStatus",
  168. key: "orderStatus",
  169. render: text => {
  170. return getNewOrderStatus(text);
  171. }
  172. },
  173. {
  174. title: "合同额(万元)",
  175. dataIndex: "totalAmount",
  176. key: "totalAmount"
  177. },
  178. {
  179. title: "已付额(万元)",
  180. dataIndex: "settlementAmount",
  181. key: "settlementAmount"
  182. },
  183. {
  184. title: "欠款(万元)",
  185. dataIndex: "arrears",
  186. key: "arrears"
  187. },
  188. {
  189. title: "订单负责人",
  190. dataIndex: "salesmanName",
  191. key: "salesmanName"
  192. },
  193. {
  194. title: "变更类型",
  195. dataIndex: "type",
  196. key: "type",
  197. render: text => {
  198. return getType(text);
  199. }
  200. },
  201. {
  202. title: "审核状态",
  203. dataIndex: "processStateText",
  204. key: "processStateText"
  205. },
  206. {
  207. title: "提交时间",
  208. dataIndex: "createTimes",
  209. key: "createTimes"
  210. }
  211. ],
  212. dataSource: [],
  213. // 传递给子组件的
  214. dataProps: [],
  215. columnsX: [
  216. {
  217. title: "业务项目名称",
  218. dataIndex: "commodityName",
  219. key: "commodityName"
  220. },
  221. {
  222. title: "项目类别",
  223. dataIndex: "cname",
  224. key: "cname"
  225. },
  226. {
  227. title: "项目数量",
  228. dataIndex: "commodityQuantity",
  229. key: "commodityQuantity"
  230. },
  231. {
  232. title: "金额(万元)",
  233. dataIndex: "commodityPrice",
  234. key: "commodityPrice"
  235. },
  236. {
  237. title: "负责人",
  238. dataIndex: "contacts",
  239. key: "contacts"
  240. },
  241. {
  242. title: "负责人电话",
  243. dataIndex: "contactsMobile",
  244. key: "contactsMobile"
  245. },
  246. {
  247. title: "项目状态",
  248. dataIndex: "projectStatus",
  249. key: "projectStatus",
  250. render: text => {
  251. return getProjectStatus(text);
  252. }
  253. },
  254. {
  255. title: "主要项目",
  256. dataIndex: "main",
  257. key: "main",
  258. render: text => {
  259. return text ? "是" : "否";
  260. }
  261. },
  262. {
  263. title: "项目说明",
  264. dataIndex: "taskComment",
  265. key: "taskComment",
  266. render: text => {
  267. return text && text.length > 8 ? text.substr(0, 8) + "…" : text;
  268. }
  269. }
  270. ],
  271. columnsrizhi: [
  272. {
  273. title: "流程",
  274. dataIndex: "processName",
  275. key: "processName"
  276. },
  277. {
  278. title: "操作人",
  279. dataIndex: "adminName",
  280. key: "adminName"
  281. },
  282. {
  283. title: "时间",
  284. dataIndex: "createDate",
  285. key: "createDate"
  286. }
  287. ],
  288. dataSourceX: [],
  289. ContactsLists: [
  290. {
  291. title: "催款科目",
  292. dataIndex: "dunSubject",
  293. key: "dunSubject",
  294. render: text => {
  295. return getjiedian(text);
  296. }
  297. },
  298. {
  299. title: "金额(万元)",
  300. dataIndex: "money",
  301. key: "money"
  302. },
  303. {
  304. title: "催款状态",
  305. dataIndex: "dunStatus",
  306. key: "dunStatus",
  307. render: text => {
  308. return getCuikuan(text);
  309. }
  310. }
  311. ]
  312. };
  313. },
  314. //页面加载函数
  315. componentWillMount() {
  316. this.loadData();
  317. },
  318. //整行点击
  319. tableRowClick(record) {
  320. this.setState(
  321. {
  322. visible: true,
  323. type: record.type,
  324. status: record.status,
  325. buttonStatus: true,
  326. orderStatus: record.orderStatus,
  327. processStateText: record.processStateText,
  328. id: record.id,
  329. orderNo: record.orderNo
  330. },
  331. () => {
  332. this.xiangqing(record.orderNo);
  333. this.xiangmu(record.orderNo);
  334. this.jiedian(record.orderNo);
  335. this.jiedianNew(record.orderNo);
  336. this.createTabs();
  337. }
  338. );
  339. },
  340. //点击打卡项目详情
  341. tableRowClickX(record) {
  342. this.setState({
  343. jid: record.id, //项目ID
  344. kid: record.commodityId, //商品ID
  345. commodityName: record.commodityName, //金额
  346. commodityPrice: record.commodityPrice, //金额
  347. commodityQuantity: record.commodityQuantity, //数量
  348. taskComment: record.taskComment, //备注
  349. main: record.main.toString(), //是否为主要
  350. addnextVisible: true,
  351. addState: 0
  352. });
  353. },
  354. //项目详情关闭
  355. nextCancel() {
  356. this.setState({
  357. addnextVisible: false
  358. });
  359. },
  360. // 合同变更详情
  361. ChangeDetail(key) {
  362. let url = window.location.href.substring(7);
  363. $.ajax({
  364. method: "get",
  365. dataType: "json",
  366. crossDomain: false,
  367. url:
  368. globalConfig.context +
  369. "/api/admin/orderChange/orderChangeDetailsById",
  370. data: {
  371. id: key
  372. },
  373. success: function (data) {
  374. if (data.data) {
  375. let thisdata = data.data;
  376. Object.assign(thisdata, {
  377. processStateText: this.state.processStateText,
  378. userName: this.state.userName,
  379. contractNo: this.state.contractNo
  380. });
  381. this.setState({
  382. contractData: thisdata,
  383. voucherUrl: thisdata.voucherUrl
  384. ? splitUrl(
  385. thisdata.voucherUrl,
  386. ",",
  387. globalConfig.avatarHost + "/upload",
  388. url
  389. )
  390. : []
  391. });
  392. }
  393. }.bind(this)
  394. });
  395. $.ajax({
  396. method: "get",
  397. dataType: "json",
  398. crossDomain: false,
  399. url:
  400. globalConfig.context +
  401. "/api/admin/orderChange/listOrderInvoiceAndBill",
  402. data: {
  403. orderNo: this.state.orderNo
  404. },
  405. success: function (data) {
  406. if (!data.data) return;
  407. let proTotal = 0;
  408. let invTotal = 0;
  409. data.data.bill.forEach(item => {
  410. proTotal += item.transactionAmount;
  411. });
  412. data.data.invoice.forEach(item => {
  413. invTotal += item.amount;
  414. });
  415. this.setState({
  416. proceedsData: data.data,
  417. proTotal,
  418. invTotal
  419. });
  420. }.bind(this)
  421. });
  422. $.ajax({
  423. method: "get",
  424. dataType: "json",
  425. crossDomain: false,
  426. url:
  427. globalConfig.context +
  428. "/api/admin/orderChange/listOrderRefundInvoice",
  429. data: {
  430. orderNo: this.state.orderNo
  431. },
  432. success: data => {
  433. if (!data) return;
  434. data.data.forEach(item => {
  435. item.load = true;
  436. });
  437. this.setState({
  438. refundInvoice: data.data
  439. });
  440. }
  441. });
  442. },
  443. //订单详情
  444. xiangqing(orderNos) {
  445. $.ajax({
  446. method: "get",
  447. dataType: "json",
  448. crossDomain: false,
  449. url: globalConfig.context + "/api/admin/newOrder/getOrderNewDetail",
  450. data: {
  451. orderNo: orderNos
  452. },
  453. success: function (data) {
  454. if (data.error.length || data.data.list == "") {
  455. if (data.error && data.error.length) {
  456. message.warning(data.error[0].message);
  457. }
  458. } else {
  459. let thisdata = data.data;
  460. this.setState({
  461. userName: thisdata.userName,
  462. primaryOrderNo: thisdata.primaryOrder,
  463. additionalOrder: thisdata.additionalOrder,
  464. contractNo: thisdata.contractNo,
  465. // arrears: thisdata.arrears,
  466. orderData: thisdata,
  467. isAddition: thisdata.additionalOrder ? true : false
  468. });
  469. }
  470. }.bind(this)
  471. });
  472. },
  473. // 原订单数据
  474. primaryOrder(primaryOrder) {
  475. $.ajax({
  476. method: "get",
  477. dataType: "json",
  478. crossDomain: false,
  479. url: globalConfig.context + "/api/admin/newOrder/getOrderNewDetail",
  480. data: {
  481. orderNo: primaryOrder
  482. },
  483. success: function (data) {
  484. if (data.error.length || data.data.list == "") {
  485. if (data.error && data.error.length) {
  486. message.warning(data.error[0].message);
  487. }
  488. } else {
  489. let thisdata = data.data;
  490. this.setState({
  491. primaryOrderData: thisdata
  492. });
  493. }
  494. }.bind(this)
  495. });
  496. },
  497. // 附加订单数据
  498. additionalOrder(additionalOrder) {
  499. $.ajax({
  500. method: "get",
  501. dataType: "json",
  502. crossDomain: false,
  503. url: globalConfig.context + "/api/admin/newOrder/getOrderNewDetail",
  504. data: {
  505. orderNo: additionalOrder
  506. },
  507. success: function (data) {
  508. if (data.error.length || data.data.list == "") {
  509. if (data.error && data.error.length) {
  510. message.warning(data.error[0].message);
  511. }
  512. } else {
  513. let thisdata = data.data;
  514. this.setState({
  515. additionalOrderData: thisdata
  516. });
  517. }
  518. }.bind(this)
  519. });
  520. },
  521. //项目列表
  522. xiangmu(orderNos) {
  523. $.ajax({
  524. method: "get",
  525. dataType: "json",
  526. crossDomain: false,
  527. url: globalConfig.context + "/api/admin/newOrder/getOrderTask",
  528. data: {
  529. orderNo: orderNos
  530. },
  531. success: function (data) {
  532. let theArr = [];
  533. if (data.error.length || data.data.list == "") {
  534. if (data.error && data.error.length) {
  535. message.warning(data.error[0].message);
  536. }
  537. } else {
  538. for (let i = 0; i < data.data.length; i++) {
  539. let thisdata = data.data[i];
  540. theArr.push({
  541. key: i,
  542. id: thisdata.id,
  543. orderNo: thisdata.orderNo, //订单编号
  544. commodityId: thisdata.commodityId, //项目ID
  545. commodityName: thisdata.commodityName, //项目名称
  546. cname: thisdata.cname, //项目类别
  547. commodityPrice: thisdata.commodityPrice, //项目价格
  548. commodityQuantity: thisdata.commodityQuantity, //项目数量
  549. main: thisdata.main, //是否为主要任务
  550. taskComment: thisdata.taskComment, //任务说明
  551. contacts: thisdata.contacts, //联系人
  552. contactsMobile: thisdata.contactsMobile, //联系人电话
  553. projectStatus: thisdata.projectStatus, //项目状态
  554. sort: thisdata.cSort
  555. });
  556. }
  557. }
  558. this.setState({
  559. dataSourceX: theArr
  560. });
  561. }.bind(this)
  562. });
  563. },
  564. search(obj) {
  565. this.setState(
  566. {
  567. searchData: obj
  568. },
  569. () => {
  570. this.loadData(1);
  571. }
  572. );
  573. },
  574. rizhi(orderNo) {
  575. $.ajax({
  576. method: "get",
  577. dataType: "json",
  578. crossDomain: false,
  579. url: "/api/admin/newOrder/selectOrderLog",
  580. data: {
  581. orderNo: orderNo
  582. },
  583. success: function (data) {
  584. let theArr = [];
  585. let thisData = data.data;
  586. if (!thisData.length) {
  587. if (data.error && data.error.length) {
  588. message.warning(data.error[0].message);
  589. }
  590. thisData = {};
  591. } else {
  592. for (let i = 0; i < data.data.length; i++) {
  593. let thisdata = data.data[i];
  594. theArr.push({
  595. processName: thisdata.processName,
  596. adminName: thisdata.adminName,
  597. createDate: thisdata.createDate,
  598. remarks: thisdata.remarks
  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. // componentDidMount(){
  828. // window.setTimeout(() => {
  829. // console.log(this.state.dataProps);
  830. // },100)
  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. if (key === "a") {
  875. this.xiangmu(this.state.orderNo);
  876. this.jiedian(this.state.orderNo);
  877. this.jiedianNew(this.state.orderNo);
  878. }
  879. // if (key === "2") {
  880. // this.ChangeDetail(this.state.orderNo);
  881. // this.loadDataChange();
  882. // }
  883. // if (key === "3") {
  884. // this.primaryOrder(this.state.primaryOrderNo);
  885. // this.xiangmu(this.state.primaryOrderNo);
  886. // this.jiedian(this.state.primaryOrderNo);
  887. // this.jiedianNew(this.state.primaryOrderNo);
  888. // }
  889. if (key === "c") {
  890. this.additionalOrder(this.state.additionalOrder);
  891. this.xiangmu(this.state.additionalOrder);
  892. this.jiedian(this.state.additionalOrder);
  893. this.jiedianNew(this.state.additionalOrder);
  894. this.setState({
  895. buttonStatusA: false
  896. });
  897. } else {
  898. this.setState({
  899. buttonStatusA: true
  900. });
  901. }
  902. },
  903. closeDesc(e, s) {
  904. this.state.activeKey = "a";
  905. this.state.userDetaile = false;
  906. this.state.signBillVisible = false;
  907. this.state.visible = e;
  908. if (s) {
  909. this.loadData(this.state.pageNo);
  910. }
  911. },
  912. // 获取原订单编号
  913. getPrimaryOrder(value) {
  914. this.setState({
  915. primaryOrder: value
  916. });
  917. },
  918. getAdditionalOrder(value) {
  919. this.setState({
  920. additionalOrder: value
  921. });
  922. },
  923. getUrl(url) {
  924. let theorgCodeUrl = [];
  925. if (url.length) {
  926. let picArr = [];
  927. url.map(function (item) {
  928. if (
  929. item.response &&
  930. item.response.data &&
  931. item.response.data.length
  932. ) {
  933. picArr.push(item.response.data);
  934. }
  935. });
  936. theorgCodeUrl = picArr.join(",");
  937. }
  938. return theorgCodeUrl;
  939. },
  940. sureOut() {
  941. if (!this.state.companyName) {
  942. message.warning("公司名称不能为空");
  943. return;
  944. }
  945. if (!this.state.unitPrice) {
  946. message.warning("单价不能为空");
  947. return;
  948. }
  949. if (!this.state.unitNumber) {
  950. message.warning("数量不能为空");
  951. return;
  952. }
  953. if (!this.state.amount) {
  954. message.warning("总金额不能为空");
  955. return;
  956. }
  957. if (!this.state.outsourceRemarks) {
  958. message.warning("备注不能为空");
  959. return;
  960. }
  961. if (this.state.pictureUrl.length === 0) {
  962. message.warning("合同扫描件不能为空");
  963. return;
  964. }
  965. $.ajax({
  966. method: "POST",
  967. dataType: "json",
  968. crossDomain: false,
  969. url: globalConfig.context + "/api/admin/outsourceOrg/auditOutsource",
  970. data: {
  971. id: this.state.id,
  972. orderNo: this.state.orderNo,
  973. companyName: this.state.companyName,
  974. amount: this.state.amount,
  975. outsourceRemarks: this.state.outsourceRemarks,
  976. unitNumber: this.state.unitNumber,
  977. unitPrice: this.state.unitPrice,
  978. attachmentUrl: this.getUrl(this.state.attachmentUrl).length
  979. ? this.getUrl(this.state.attachmentUrl)
  980. : "",
  981. orderStatus: 2,
  982. pictureUrl: this.getUrl(this.state.pictureUrl).length
  983. ? this.getUrl(this.state.pictureUrl)
  984. : ""
  985. }
  986. }).done(
  987. function (data) {
  988. this.setState({
  989. loading: false
  990. });
  991. if (!data.error.length) {
  992. message.success("发起成功!");
  993. this.outReset();
  994. this.visitCancel();
  995. } else {
  996. message.warning(data.error[0].message);
  997. }
  998. }.bind(this)
  999. );
  1000. },
  1001. //关闭输入理由框
  1002. noCancel() {
  1003. this.setState({
  1004. noVisible: false,
  1005. aloading: false,
  1006. reason: ""
  1007. });
  1008. },
  1009. //重置
  1010. reset() {
  1011. this.setState({
  1012. signBillVisible: false
  1013. });
  1014. this.state.orderNo = "";
  1015. this.state.customerName = "";
  1016. this.state.releaseDate[0] = undefined;
  1017. this.state.releaseDate[1] = undefined;
  1018. this.state.approval = undefined;
  1019. // this.state.searchData.completeSearch = 0;
  1020. this.state.searchData = {
  1021. completeSearch: 0
  1022. };
  1023. this.loadData(1);
  1024. },
  1025. outReset() {
  1026. this.setState({
  1027. companyName: "",
  1028. amount: "",
  1029. unitPrice: "",
  1030. unitNumber: "",
  1031. outsourceRemarks: "",
  1032. attachmentUrl: [],
  1033. pictureUrl: []
  1034. });
  1035. },
  1036. getOrgCodeUrl(e) {
  1037. this.setState({ pictureUrl: e });
  1038. },
  1039. //关闭详情
  1040. visitCancel() {
  1041. this.setState(
  1042. {
  1043. visible: false,
  1044. activeKey: "a"
  1045. },
  1046. () => {
  1047. this.setState({
  1048. activeKey: "a"
  1049. });
  1050. }
  1051. );
  1052. this.loadData(this.state.page);
  1053. },
  1054. visitOk() {
  1055. this.setState({
  1056. visible: false
  1057. });
  1058. },
  1059. createTabs() {
  1060. $.ajax({
  1061. url: globalConfig.context + "/api/admin/orderChange/getOrderChange",
  1062. method: "get",
  1063. data: {
  1064. orderNo: this.state.orderNo
  1065. },
  1066. success: data => {
  1067. if (data.error && data.error.length) {
  1068. message.warning(data.error[0].message);
  1069. } else {
  1070. this.setState({
  1071. tabList: data.data
  1072. });
  1073. }
  1074. }
  1075. });
  1076. },
  1077. render() {
  1078. const tabList = this.state.tabList || [];
  1079. const formItemLayout = {
  1080. labelCol: { span: 8 },
  1081. wrapperCol: { span: 14 }
  1082. };
  1083. const FormItem = Form.Item;
  1084. const { TabPane } = Tabs;
  1085. return (
  1086. <div className="user-content">
  1087. <ShowModalDiv ShowModal={this.state.showModal} />
  1088. <div className="content-title">
  1089. <span>合同变更审核订单</span>
  1090. </div>
  1091. <div className="user-search">
  1092. <Tabs
  1093. defaultActiveKey="1"
  1094. onChange={this.callback}
  1095. className="test">
  1096. <TabPane tab="搜索" key="1">
  1097. <div style={{ marginLeft: 10 }}>
  1098. <SearchInput search={this.search} />
  1099. </div>
  1100. </TabPane>
  1101. </Tabs>
  1102. <div className="patent-table">
  1103. <Spin spinning={this.state.loading}>
  1104. <Table
  1105. size="small"
  1106. bordered
  1107. columns={this.state.columns}
  1108. dataSource={this.state.dataSource}
  1109. pagination={this.state.pagination}
  1110. onRowClick={this.tableRowClick}
  1111. />
  1112. </Spin>
  1113. </div>
  1114. <Modal
  1115. className="customeDetails"
  1116. footer=""
  1117. maskClosable={false}
  1118. width="900px"
  1119. visible={this.state.visible}
  1120. onOk={this.visitOk}
  1121. onCancel={this.visitCancel}
  1122. >
  1123. <Tabs
  1124. activeKey={this.state.activeKey}
  1125. onChange={this.callback}
  1126. type="card"
  1127. >
  1128. <TabPane tab="订单详情" key="a">
  1129. <Form
  1130. layout="horizontal"
  1131. onSubmit={this.handleSubmit}
  1132. id="demand-form"
  1133. style={{ paddingBottom: "40px" }}
  1134. >
  1135. <Spin spinning={this.state.loading}>
  1136. <OrderDetail
  1137. orderData={this.state.orderData}
  1138. getOrderLog={this.getOrderLog}
  1139. totalCui={this.state.totalCui}
  1140. dataSourceX={this.state.dataSourceX}
  1141. contactList={this.state.contactList}
  1142. contactListNew={this.state.contactListNew}
  1143. orderNo={this.state.orderNo}
  1144. />
  1145. </Spin>
  1146. </Form>
  1147. </TabPane>
  1148. {/* <TabPane tab="合同变更记录" key="2">
  1149. <ChangeDetail
  1150. data={this.state.contractData}
  1151. pictureUrl={this.state.voucherUrl}
  1152. processState={this.props.processState}
  1153. dataSource={this.state.dataProps}
  1154. proceedsData={this.state.proceedsData}
  1155. proceedsTotal={this.state.proTotal}
  1156. invoiceTotal={this.state.invTotal}
  1157. contactList={this.state.refundInvoice}
  1158. onCancel={this.visitCancel}
  1159. />
  1160. </TabPane> */}
  1161. {tabList.map((item, index, arr) => {
  1162. return (
  1163. <TabPane tab={"合同变更记录" + (index + 1)} key={item.id}>
  1164. {this.state.contractData.processState === 0 ? (
  1165. <ChangeApply
  1166. orderData={this.state.contractData}
  1167. voucherUrl={this.state.voucherUrl}
  1168. onCancel={this.visitCancel}
  1169. />
  1170. ) : (
  1171. <ChangeDetail
  1172. id={item.id}
  1173. money={index == arr.length - 1 ? this.state.orderData.totalAmount + "" : undefined}
  1174. data={this.state.contractData}
  1175. pictureUrl={this.state.voucherUrl}
  1176. processState={this.props.processState}
  1177. dataSource={this.state.dataProps}
  1178. proceedsData={this.state.proceedsData}
  1179. proceedsTotal={this.state.proTotal}
  1180. invoiceTotal={this.state.invTotal}
  1181. contactList={this.state.refundInvoice}
  1182. onCancel={this.visitCancel}
  1183. />
  1184. )}
  1185. </TabPane>
  1186. );
  1187. })}
  1188. {/* {this.state.status === 4 ? (
  1189. <TabPane tab="原订单" key="3">
  1190. <Form
  1191. layout="horizontal"
  1192. onSubmit={this.handleSubmit}
  1193. id="demand-form"
  1194. style={{ paddingBottom: "40px" }}
  1195. >
  1196. <Spin spinning={this.state.loading}>
  1197. <OrderDetail
  1198. orderData={this.state.primaryOrderData}
  1199. getOrderLog={this.getOrderLog}
  1200. dataSourceX={this.state.dataSourceX}
  1201. contactList={this.state.contactList}
  1202. totalCui={this.state.totalCui}
  1203. contactListNew={this.state.contactListNew}
  1204. orderNo={this.state.primaryOrderNo}
  1205. />
  1206. </Spin>
  1207. </Form>
  1208. </TabPane>
  1209. ) : (
  1210. ""
  1211. )} */}
  1212. {tabList.map((item, index) => {
  1213. if (item.usedOrder) {
  1214. return (
  1215. <TabPane
  1216. tab={"原订单" + (index + 1)}
  1217. key={item.usedOrder}
  1218. >
  1219. <Form
  1220. layout="horizontal"
  1221. onSubmit={this.handleSubmit}
  1222. id="demand-form"
  1223. style={{ paddingBottom: "40px" }}
  1224. >
  1225. <Spin spinning={this.state.loading}>
  1226. <OrderDetail
  1227. orderData={this.state.primaryOrderData}
  1228. getOrderLog={this.getOrderLog}
  1229. dataSourceX={this.state.dataSourceX}
  1230. contactList={this.state.contactList}
  1231. orderNo={this.state.primaryOrderNo}
  1232. totalCui={this.state.totalCui}
  1233. contactListNew={this.state.contactListNew}
  1234. />
  1235. </Spin>
  1236. </Form>
  1237. </TabPane>
  1238. );
  1239. } else {
  1240. return "";
  1241. }
  1242. })}
  1243. {this.state.status === 4 && this.state.isAddition ? (
  1244. this.state.type === 4 || this.state.type === 5 ? (
  1245. <TabPane tab="附加订单" key="c">
  1246. <OrderDetail
  1247. orderData={this.state.additionalOrderData}
  1248. getOrderLog={this.getOrderLog}
  1249. dataSourceX={this.state.dataSourceX}
  1250. totalCui={this.state.totalCui}
  1251. contactListNew={this.state.contactListNew}
  1252. contactList={this.state.contactList}
  1253. orderNo={this.state.additionalOrder}
  1254. />
  1255. </TabPane>
  1256. ) : (
  1257. ""
  1258. )
  1259. ) : (
  1260. ""
  1261. )}
  1262. </Tabs>
  1263. </Modal>
  1264. <Modal
  1265. maskClosable={false}
  1266. visible={this.state.addnextVisible}
  1267. onOk={this.nextCancel}
  1268. onCancel={this.nextCancel}
  1269. confirmLoading={this.state.confirmLoading}
  1270. width="800px"
  1271. title={"项目任务详情"}
  1272. footer=""
  1273. className="admin-desc-content"
  1274. >
  1275. <Form layout="horizontal" id="demand-form">
  1276. <Spin spinning={this.state.loading}>
  1277. <div className="clearfix">
  1278. <FormItem
  1279. className="half-item"
  1280. {...formItemLayout}
  1281. label="项目名称"
  1282. >
  1283. <span>{this.state.commodityName}</span>
  1284. </FormItem>
  1285. <FormItem
  1286. className="half-item"
  1287. {...formItemLayout}
  1288. label="项目数量"
  1289. >
  1290. <span>{this.state.commodityQuantity}</span>
  1291. </FormItem>
  1292. <FormItem
  1293. className="half-item"
  1294. {...formItemLayout}
  1295. label="金额(万元)"
  1296. >
  1297. <span>{this.state.commodityPrice}</span>
  1298. </FormItem>
  1299. <FormItem
  1300. className="half-item"
  1301. {...formItemLayout}
  1302. label="主要项目"
  1303. >
  1304. <span>{getboutique(this.state.main)}</span>
  1305. </FormItem>
  1306. <div className="clearfix">
  1307. <FormItem
  1308. labelCol={{ span: 4 }}
  1309. wrapperCol={{ span: 16 }}
  1310. label="服务说明"
  1311. >
  1312. <span>{this.state.taskComment}</span>
  1313. </FormItem>
  1314. </div>
  1315. </div>
  1316. </Spin>
  1317. </Form>
  1318. </Modal>
  1319. <Modal
  1320. maskClosable={false}
  1321. visible={this.state.noVisible}
  1322. onOk={this.handleOk}
  1323. onCancel={this.noCancel}
  1324. width="400px"
  1325. title={"拒绝理由"}
  1326. footer=""
  1327. className="admin-desc-content"
  1328. confirmLoading={this.state.confirmLoading}
  1329. >
  1330. <Form layout="horizontal" id="demand-form">
  1331. <Spin spinning={this.state.loading}>
  1332. <div className="clearfix">
  1333. <FormItem
  1334. labelCol={{ span: 4 }}
  1335. wrapperCol={{ span: 16 }}
  1336. label="拒绝理由"
  1337. >
  1338. <Input
  1339. type="textarea"
  1340. placeholder="请输入拒绝理由"
  1341. rows={4}
  1342. value={this.state.reason}
  1343. onChange={e => {
  1344. this.setState({ reason: e.target.value });
  1345. }}
  1346. />
  1347. </FormItem>
  1348. </div>
  1349. <div className="clearfix">
  1350. <Button
  1351. className="cancel"
  1352. type="primary"
  1353. onClick={this.examOks}
  1354. style={{ marginLeft: "50px" }}
  1355. htmlType="submit"
  1356. loading={this.state.aloading}
  1357. >
  1358. 确定
  1359. </Button>
  1360. <Button
  1361. className="cancel"
  1362. type="ghost"
  1363. onClick={this.noCancel}
  1364. style={{ marginLeft: "50px" }}
  1365. >
  1366. 取消
  1367. </Button>
  1368. </div>
  1369. </Spin>
  1370. </Form>
  1371. </Modal>
  1372. {/* <Modal
  1373. visible={this.state.rizhivisible}
  1374. className="admin-desc-content"
  1375. width="800px"
  1376. maskClosable={false}
  1377. title="订单日志"
  1378. footer={null}
  1379. onCancel={this.closeOrderLog}
  1380. >
  1381. <div className="patent-table">
  1382. <Spin spinning={this.state.loading}>
  1383. <Table
  1384. bordered
  1385. columns={this.state.columnsrizhi}
  1386. dataSource={this.state.dataSourcerizhi}
  1387. pagination={false}
  1388. />
  1389. </Spin>
  1390. </div>
  1391. </Modal> */}
  1392. <OrderRiZi
  1393. dataSourcerizhi={this.state.dataSourcerizhi}
  1394. closeOrderLog={this.closeOrderLog}
  1395. visible={this.state.rizhivisible}
  1396. loading={this.state.loading}
  1397. />
  1398. </div>
  1399. </div>
  1400. );
  1401. }
  1402. })
  1403. );
  1404. export default contractChange;