contractYxgly.js 43 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426
  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: (Math.round(proTotal * 10000) / 10000).toFixed(4),
  418. invTotal: (Math.round(invTotal * 10000) / 10000).toFixed(4),
  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. splitStatus: thisdata.splitStatus
  556. });
  557. }
  558. }
  559. this.setState({
  560. dataSourceX: theArr
  561. });
  562. }.bind(this)
  563. });
  564. },
  565. search(obj) {
  566. this.setState(
  567. {
  568. searchData: obj
  569. },
  570. () => {
  571. this.loadData(1);
  572. }
  573. );
  574. },
  575. rizhi(orderNo) {
  576. $.ajax({
  577. method: "get",
  578. dataType: "json",
  579. crossDomain: false,
  580. url: "/api/admin/newOrder/selectOrderLog",
  581. data: {
  582. orderNo: orderNo
  583. },
  584. success: function (data) {
  585. let theArr = [];
  586. let thisData = data.data;
  587. if (!thisData.length) {
  588. if (data.error && data.error.length) {
  589. message.warning(data.error[0].message);
  590. }
  591. thisData = {};
  592. } else {
  593. for (let i = 0; i < data.data.length; i++) {
  594. let thisdata = data.data[i];
  595. theArr.push({
  596. processName: thisdata.processName,
  597. adminName: thisdata.adminName,
  598. createDate: thisdata.createDate,
  599. remarks: thisdata.remarks
  600. });
  601. }
  602. }
  603. this.setState({
  604. dataSourcerizhi: theArr
  605. });
  606. }.bind(this)
  607. });
  608. },
  609. getOrderLog(orderNo) {
  610. this.setState({
  611. rizhivisible: true
  612. });
  613. this.rizhi(orderNo);
  614. },
  615. closeOrderLog() {
  616. this.setState({
  617. rizhivisible: false
  618. });
  619. },
  620. //节点列表
  621. jiedian(orderNos) {
  622. $.ajax({
  623. method: "get",
  624. dataType: "json",
  625. crossDomain: false,
  626. url: globalConfig.context + "/api/admin/newOrder/selectOrderDun",
  627. data: {
  628. orderNo: orderNos
  629. },
  630. success: function (data) {
  631. let theArr = [];
  632. let thisData = [];
  633. if (data.error.length || data.data.list == "") {
  634. if (data.error && data.error.length) {
  635. message.warning(data.error[0].message);
  636. }
  637. } else {
  638. for (let i = 0; i < data.data.length; i++) {
  639. thisData = data.data[i];
  640. theArr.push({
  641. key: i,
  642. dunSubject: thisData.dunSubject
  643. ? thisData.dunSubject.toString()
  644. : "", //催款科目
  645. id: thisData.id, //节点Id
  646. money: thisData.money, //催款金额
  647. dunStatus: thisData.dunStatus //催款状态
  648. });
  649. }
  650. this.setState({
  651. contactList: theArr
  652. });
  653. }
  654. }.bind(this)
  655. });
  656. },
  657. jiedianNew(orderNos) {
  658. $.ajax({
  659. method: "get",
  660. dataType: "json",
  661. crossDomain: false,
  662. url:
  663. globalConfig.context + "/api/admin/newOrderDun/selectListNewOrderDun",
  664. data: {
  665. orderNo: orderNos
  666. },
  667. success: function (data) {
  668. if (data.error && data.error.length) {
  669. message.warning(data.error[0].message);
  670. } else {
  671. let theArr = [];
  672. let thisData = [];
  673. let arr = data.data || [];
  674. let totalCui = 0;
  675. for (let i = 0; i < arr.length; i++) {
  676. thisData = arr[i];
  677. totalCui += +thisData.money;
  678. theArr.push({
  679. key: i,
  680. dunSubject: thisData.dunSubject
  681. ? thisData.dunSubject.toString()
  682. : "", //催款科目
  683. id: thisData.id, //节点Id
  684. money: thisData.money, //催款金额
  685. // orderNo: record ? record.orderNo : this.props.datauser.orderNo,
  686. commodityName: thisData.commodityName,
  687. projectType: thisData.projectType,
  688. dunTypeName: thisData.dunTypeName,
  689. status: thisData.status,
  690. waitDay: thisData.waitDay,
  691. effectiveCount: thisData.effectiveCount,
  692. startDate: thisData.startDate,
  693. dunType: thisData.dunType,
  694. appropriationRatio: thisData.appropriationRatio,
  695. customizeName: thisData.customizeName,
  696. customizeTimes: thisData.customizeTimes,
  697. tid: thisData.tid,
  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. // componentDidMount(){
  832. // window.setTimeout(() => {
  833. // console.log(this.state.dataProps);
  834. // },100)
  835. // },
  836. loadDataChange(key) {
  837. $.ajax({
  838. method: "get",
  839. dataType: "json",
  840. async: false,
  841. crossDomain: false,
  842. url: globalConfig.context + "/api/admin/orderChange/orderChangeLogList",
  843. data: {
  844. changeId: key
  845. },
  846. success: function (data) {
  847. if (data.error.length || data.data.list == "") {
  848. if (data.error && data.error.length) {
  849. message.warning(data.error[0].message);
  850. }
  851. } else {
  852. // console.log("拿到历史", data.data);
  853. this.setState({
  854. dataProps: data.data
  855. });
  856. }
  857. }.bind(this)
  858. });
  859. },
  860. callback(key) {
  861. this.setState(
  862. {
  863. activeKey: key
  864. },
  865. () => {
  866. if (key != "a" && key != "c" && key.length < 10) {
  867. this.ChangeDetail(key);
  868. this.loadDataChange(key);
  869. } else if (key != "a" && key != "c" && key.length > 10) {
  870. this.primaryOrder(key);
  871. this.xiangmu(key);
  872. this.jiedian(key);
  873. this.jiedianNew(key);
  874. this.loadDataChange(key);
  875. }
  876. }
  877. );
  878. if (key === "a") {
  879. this.xiangmu(this.state.orderNo);
  880. this.jiedian(this.state.orderNo);
  881. this.jiedianNew(this.state.orderNo);
  882. }
  883. // if (key === "2") {
  884. // this.ChangeDetail(this.state.orderNo);
  885. // this.loadDataChange();
  886. // }
  887. // if (key === "3") {
  888. // this.primaryOrder(this.state.primaryOrderNo);
  889. // this.xiangmu(this.state.primaryOrderNo);
  890. // this.jiedian(this.state.primaryOrderNo);
  891. // this.jiedianNew(this.state.primaryOrderNo);
  892. // }
  893. if (key === "c") {
  894. this.additionalOrder(this.state.additionalOrder);
  895. this.xiangmu(this.state.additionalOrder);
  896. this.jiedian(this.state.additionalOrder);
  897. this.jiedianNew(this.state.additionalOrder);
  898. this.setState({
  899. buttonStatusA: false
  900. });
  901. } else {
  902. this.setState({
  903. buttonStatusA: true
  904. });
  905. }
  906. },
  907. closeDesc(e, s) {
  908. this.state.activeKey = "a";
  909. this.state.userDetaile = false;
  910. this.state.signBillVisible = false;
  911. this.state.visible = e;
  912. if (s) {
  913. this.loadData(this.state.pageNo);
  914. }
  915. },
  916. // 获取原订单编号
  917. getPrimaryOrder(value) {
  918. this.setState({
  919. primaryOrder: value
  920. });
  921. },
  922. getAdditionalOrder(value) {
  923. this.setState({
  924. additionalOrder: value
  925. });
  926. },
  927. getUrl(url) {
  928. let theorgCodeUrl = [];
  929. if (url.length) {
  930. let picArr = [];
  931. url.map(function (item) {
  932. if (
  933. item.response &&
  934. item.response.data &&
  935. item.response.data.length
  936. ) {
  937. picArr.push(item.response.data);
  938. }
  939. });
  940. theorgCodeUrl = picArr.join(",");
  941. }
  942. return theorgCodeUrl;
  943. },
  944. sureOut() {
  945. if (!this.state.companyName) {
  946. message.warning("公司名称不能为空");
  947. return;
  948. }
  949. if (!this.state.unitPrice) {
  950. message.warning("单价不能为空");
  951. return;
  952. }
  953. if (!this.state.unitNumber) {
  954. message.warning("数量不能为空");
  955. return;
  956. }
  957. if (!this.state.amount) {
  958. message.warning("总金额不能为空");
  959. return;
  960. }
  961. if (!this.state.outsourceRemarks) {
  962. message.warning("备注不能为空");
  963. return;
  964. }
  965. if (this.state.pictureUrl.length === 0) {
  966. message.warning("合同扫描件不能为空");
  967. return;
  968. }
  969. $.ajax({
  970. method: "POST",
  971. dataType: "json",
  972. crossDomain: false,
  973. url: globalConfig.context + "/api/admin/outsourceOrg/auditOutsource",
  974. data: {
  975. id: this.state.id,
  976. orderNo: this.state.orderNo,
  977. companyName: this.state.companyName,
  978. amount: this.state.amount,
  979. outsourceRemarks: this.state.outsourceRemarks,
  980. unitNumber: this.state.unitNumber,
  981. unitPrice: this.state.unitPrice,
  982. attachmentUrl: this.getUrl(this.state.attachmentUrl).length
  983. ? this.getUrl(this.state.attachmentUrl)
  984. : "",
  985. orderStatus: 2,
  986. pictureUrl: this.getUrl(this.state.pictureUrl).length
  987. ? this.getUrl(this.state.pictureUrl)
  988. : ""
  989. }
  990. }).done(
  991. function (data) {
  992. this.setState({
  993. loading: false
  994. });
  995. if (!data.error.length) {
  996. message.success("发起成功!");
  997. this.outReset();
  998. this.visitCancel();
  999. } else {
  1000. message.warning(data.error[0].message);
  1001. }
  1002. }.bind(this)
  1003. );
  1004. },
  1005. //关闭输入理由框
  1006. noCancel() {
  1007. this.setState({
  1008. noVisible: false,
  1009. aloading: false,
  1010. reason: ""
  1011. });
  1012. },
  1013. //重置
  1014. reset() {
  1015. this.setState({
  1016. signBillVisible: false
  1017. });
  1018. this.state.orderNo = "";
  1019. this.state.customerName = "";
  1020. this.state.releaseDate[0] = undefined;
  1021. this.state.releaseDate[1] = undefined;
  1022. this.state.approval = undefined;
  1023. // this.state.searchData.completeSearch = 0;
  1024. this.state.searchData = {
  1025. completeSearch: 0
  1026. };
  1027. this.loadData(1);
  1028. },
  1029. outReset() {
  1030. this.setState({
  1031. companyName: "",
  1032. amount: "",
  1033. unitPrice: "",
  1034. unitNumber: "",
  1035. outsourceRemarks: "",
  1036. attachmentUrl: [],
  1037. pictureUrl: []
  1038. });
  1039. },
  1040. getOrgCodeUrl(e) {
  1041. this.setState({ pictureUrl: e });
  1042. },
  1043. //关闭详情
  1044. visitCancel() {
  1045. this.setState(
  1046. {
  1047. visible: false,
  1048. activeKey: "a"
  1049. },
  1050. () => {
  1051. this.setState({
  1052. activeKey: "a"
  1053. });
  1054. }
  1055. );
  1056. this.loadData(this.state.page);
  1057. },
  1058. visitOk() {
  1059. this.setState({
  1060. visible: false
  1061. });
  1062. },
  1063. createTabs() {
  1064. $.ajax({
  1065. url: globalConfig.context + "/api/admin/orderChange/getOrderChange",
  1066. method: "get",
  1067. data: {
  1068. orderNo: this.state.orderNo
  1069. },
  1070. success: data => {
  1071. if (data.error && data.error.length) {
  1072. message.warning(data.error[0].message);
  1073. } else {
  1074. this.setState({
  1075. tabList: data.data
  1076. });
  1077. }
  1078. }
  1079. });
  1080. },
  1081. render() {
  1082. const tabList = this.state.tabList || [];
  1083. const formItemLayout = {
  1084. labelCol: { span: 8 },
  1085. wrapperCol: { span: 14 }
  1086. };
  1087. const FormItem = Form.Item;
  1088. const { TabPane } = Tabs;
  1089. return (
  1090. <div className="user-content">
  1091. <ShowModalDiv ShowModal={this.state.showModal} />
  1092. <div className="content-title">
  1093. <span>合同变更审核订单</span>
  1094. </div>
  1095. <div className="user-search">
  1096. <Tabs
  1097. defaultActiveKey="1"
  1098. onChange={this.callback}
  1099. className="test">
  1100. <TabPane tab="搜索" key="1">
  1101. <div style={{ marginLeft: 10 }}>
  1102. <SearchInput search={this.search} />
  1103. </div>
  1104. </TabPane>
  1105. </Tabs>
  1106. <div className="patent-table">
  1107. <Spin spinning={this.state.loading}>
  1108. <Table
  1109. size="small"
  1110. bordered
  1111. columns={this.state.columns}
  1112. dataSource={this.state.dataSource}
  1113. pagination={this.state.pagination}
  1114. onRowClick={this.tableRowClick}
  1115. />
  1116. </Spin>
  1117. </div>
  1118. <Modal
  1119. className="customeDetails"
  1120. footer=""
  1121. maskClosable={false}
  1122. width="900px"
  1123. visible={this.state.visible}
  1124. onOk={this.visitOk}
  1125. onCancel={this.visitCancel}
  1126. >
  1127. <Tabs
  1128. activeKey={this.state.activeKey}
  1129. onChange={this.callback}
  1130. type="card"
  1131. >
  1132. <TabPane tab="订单详情" key="a">
  1133. <Form
  1134. layout="horizontal"
  1135. onSubmit={this.handleSubmit}
  1136. id="demand-form"
  1137. style={{ paddingBottom: "40px" }}
  1138. >
  1139. <Spin spinning={this.state.loading}>
  1140. <OrderDetail
  1141. orderData={this.state.orderData}
  1142. getOrderLog={this.getOrderLog}
  1143. totalCui={this.state.totalCui}
  1144. dataSourceX={this.state.dataSourceX}
  1145. contactList={this.state.contactList}
  1146. contactListNew={this.state.contactListNew}
  1147. orderNo={this.state.orderNo}
  1148. />
  1149. </Spin>
  1150. </Form>
  1151. </TabPane>
  1152. {/* <TabPane tab="合同变更记录" key="2">
  1153. <ChangeDetail
  1154. data={this.state.contractData}
  1155. pictureUrl={this.state.voucherUrl}
  1156. processState={this.props.processState}
  1157. dataSource={this.state.dataProps}
  1158. proceedsData={this.state.proceedsData}
  1159. proceedsTotal={this.state.proTotal}
  1160. invoiceTotal={this.state.invTotal}
  1161. contactList={this.state.refundInvoice}
  1162. onCancel={this.visitCancel}
  1163. />
  1164. </TabPane> */}
  1165. {tabList.map((item, index, arr) => {
  1166. return (
  1167. <TabPane tab={"合同变更记录" + (index + 1)} key={item.id}>
  1168. <ChangeDetail
  1169. id={item.id}
  1170. money={index == arr.length - 1 ? this.state.orderData.totalAmount + "" : undefined}
  1171. data={this.state.contractData}
  1172. pictureUrl={this.state.voucherUrl}
  1173. processState={this.props.processState}
  1174. dataSource={this.state.dataProps}
  1175. proceedsData={this.state.proceedsData}
  1176. proceedsTotal={this.state.proTotal}
  1177. invoiceTotal={this.state.invTotal}
  1178. contactList={this.state.refundInvoice}
  1179. onCancel={this.visitCancel}
  1180. />
  1181. </TabPane>
  1182. );
  1183. })}
  1184. {/* {this.state.status === 4 ? (
  1185. <TabPane tab="原订单" key="3">
  1186. <Form
  1187. layout="horizontal"
  1188. onSubmit={this.handleSubmit}
  1189. id="demand-form"
  1190. style={{ paddingBottom: "40px" }}
  1191. >
  1192. <Spin spinning={this.state.loading}>
  1193. <OrderDetail
  1194. orderData={this.state.primaryOrderData}
  1195. getOrderLog={this.getOrderLog}
  1196. dataSourceX={this.state.dataSourceX}
  1197. contactList={this.state.contactList}
  1198. totalCui={this.state.totalCui}
  1199. contactListNew={this.state.contactListNew}
  1200. orderNo={this.state.primaryOrderNo}
  1201. />
  1202. </Spin>
  1203. </Form>
  1204. </TabPane>
  1205. ) : (
  1206. ""
  1207. )} */}
  1208. {tabList.map((item, index) => {
  1209. if (item.usedOrder) {
  1210. return (
  1211. <TabPane
  1212. tab={"原订单" + (index + 1)}
  1213. key={item.usedOrder}
  1214. >
  1215. <Form
  1216. layout="horizontal"
  1217. onSubmit={this.handleSubmit}
  1218. id="demand-form"
  1219. style={{ paddingBottom: "40px" }}
  1220. >
  1221. <Spin spinning={this.state.loading}>
  1222. <OrderDetail
  1223. orderData={this.state.primaryOrderData}
  1224. getOrderLog={this.getOrderLog}
  1225. dataSourceX={this.state.dataSourceX}
  1226. contactList={this.state.contactList}
  1227. orderNo={this.state.primaryOrderNo}
  1228. totalCui={this.state.totalCui}
  1229. contactListNew={this.state.contactListNew}
  1230. />
  1231. </Spin>
  1232. </Form>
  1233. </TabPane>
  1234. );
  1235. } else {
  1236. return "";
  1237. }
  1238. })}
  1239. {this.state.status === 4 && this.state.isAddition ? (
  1240. this.state.type === 4 || this.state.type === 5 ? (
  1241. <TabPane tab="附加订单" key="c">
  1242. <OrderDetail
  1243. orderData={this.state.additionalOrderData}
  1244. getOrderLog={this.getOrderLog}
  1245. dataSourceX={this.state.dataSourceX}
  1246. totalCui={this.state.totalCui}
  1247. contactListNew={this.state.contactListNew}
  1248. contactList={this.state.contactList}
  1249. orderNo={this.state.additionalOrder}
  1250. />
  1251. </TabPane>
  1252. ) : (
  1253. ""
  1254. )
  1255. ) : (
  1256. ""
  1257. )}
  1258. </Tabs>
  1259. </Modal>
  1260. <Modal
  1261. maskClosable={false}
  1262. visible={this.state.addnextVisible}
  1263. onOk={this.nextCancel}
  1264. onCancel={this.nextCancel}
  1265. confirmLoading={this.state.confirmLoading}
  1266. width="800px"
  1267. title={"项目任务详情"}
  1268. footer=""
  1269. className="admin-desc-content"
  1270. >
  1271. <Form layout="horizontal" id="demand-form">
  1272. <Spin spinning={this.state.loading}>
  1273. <div className="clearfix">
  1274. <FormItem
  1275. className="half-item"
  1276. {...formItemLayout}
  1277. label="项目名称"
  1278. >
  1279. <span>{this.state.commodityName}</span>
  1280. </FormItem>
  1281. <FormItem
  1282. className="half-item"
  1283. {...formItemLayout}
  1284. label="项目数量"
  1285. >
  1286. <span>{this.state.commodityQuantity}</span>
  1287. </FormItem>
  1288. <FormItem
  1289. className="half-item"
  1290. {...formItemLayout}
  1291. label="金额(万元)"
  1292. >
  1293. <span>{this.state.commodityPrice}</span>
  1294. </FormItem>
  1295. <FormItem
  1296. className="half-item"
  1297. {...formItemLayout}
  1298. label="主要项目"
  1299. >
  1300. <span>{getboutique(this.state.main)}</span>
  1301. </FormItem>
  1302. <div className="clearfix">
  1303. <FormItem
  1304. labelCol={{ span: 4 }}
  1305. wrapperCol={{ span: 16 }}
  1306. label="服务说明"
  1307. >
  1308. <span>{this.state.taskComment}</span>
  1309. </FormItem>
  1310. </div>
  1311. </div>
  1312. </Spin>
  1313. </Form>
  1314. </Modal>
  1315. <Modal
  1316. maskClosable={false}
  1317. visible={this.state.noVisible}
  1318. onOk={this.handleOk}
  1319. onCancel={this.noCancel}
  1320. width="400px"
  1321. title={"拒绝理由"}
  1322. footer=""
  1323. className="admin-desc-content"
  1324. confirmLoading={this.state.confirmLoading}
  1325. >
  1326. <Form layout="horizontal" id="demand-form">
  1327. <Spin spinning={this.state.loading}>
  1328. <div className="clearfix">
  1329. <FormItem
  1330. labelCol={{ span: 4 }}
  1331. wrapperCol={{ span: 16 }}
  1332. label="拒绝理由"
  1333. >
  1334. <Input
  1335. type="textarea"
  1336. placeholder="请输入拒绝理由"
  1337. rows={4}
  1338. value={this.state.reason}
  1339. onChange={e => {
  1340. this.setState({ reason: e.target.value });
  1341. }}
  1342. />
  1343. </FormItem>
  1344. </div>
  1345. <div className="clearfix">
  1346. <Button
  1347. className="cancel"
  1348. type="primary"
  1349. onClick={this.examOks}
  1350. style={{ marginLeft: "50px" }}
  1351. htmlType="submit"
  1352. loading={this.state.aloading}
  1353. >
  1354. 确定
  1355. </Button>
  1356. <Button
  1357. className="cancel"
  1358. type="ghost"
  1359. onClick={this.noCancel}
  1360. style={{ marginLeft: "50px" }}
  1361. >
  1362. 取消
  1363. </Button>
  1364. </div>
  1365. </Spin>
  1366. </Form>
  1367. </Modal>
  1368. {/* <Modal
  1369. visible={this.state.rizhivisible}
  1370. className="admin-desc-content"
  1371. width="800px"
  1372. maskClosable={false}
  1373. title="订单日志"
  1374. footer={null}
  1375. onCancel={this.closeOrderLog}
  1376. >
  1377. <div className="patent-table">
  1378. <Spin spinning={this.state.loading}>
  1379. <Table
  1380. bordered
  1381. columns={this.state.columnsrizhi}
  1382. dataSource={this.state.dataSourcerizhi}
  1383. pagination={false}
  1384. />
  1385. </Spin>
  1386. </div>
  1387. </Modal> */}
  1388. <OrderRiZi
  1389. dataSourcerizhi={this.state.dataSourcerizhi}
  1390. closeOrderLog={this.closeOrderLog}
  1391. visible={this.state.rizhivisible}
  1392. loading={this.state.loading}
  1393. />
  1394. </div>
  1395. </div>
  1396. );
  1397. }
  1398. })
  1399. );
  1400. export default contractChange;