contractYxgly.js 43 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423
  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. 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. });
  696. }
  697. if (!totalCui) {
  698. totalCui = 0;
  699. }
  700. totalCui = (Math.round(totalCui * 10000) / 10000).toFixed(4);
  701. this.setState({
  702. contactListNew: theArr,
  703. totalCui
  704. });
  705. }
  706. }.bind(this)
  707. }).always(
  708. function () {
  709. this.setState({
  710. loading: false
  711. });
  712. }.bind(this)
  713. );
  714. },
  715. //审核通过
  716. examOk() {
  717. $.ajax({
  718. method: "post",
  719. dataType: "json",
  720. crossDomain: false,
  721. url: globalConfig.context + "/api/admin/newOrder/auditOrderNew",
  722. data: {
  723. orderNo: this.state.orderNo,
  724. orderStatus: 2
  725. },
  726. success: function (data) {
  727. if (data.error.length || data.data.list == "") {
  728. if (data.error && data.error.length) {
  729. message.warning(data.error[0].message);
  730. }
  731. } else {
  732. message.success("该订单已通过审核~");
  733. this.setState({
  734. visible: false
  735. });
  736. this.reset();
  737. }
  738. }.bind(this)
  739. }).always(
  740. function () {
  741. this.setState({
  742. loading: false
  743. });
  744. }.bind(this)
  745. );
  746. },
  747. //通过发给外包
  748. outsourcing() {
  749. $.ajax({
  750. method: "post",
  751. dataType: "json",
  752. crossDomain: false,
  753. url: globalConfig.context + "/api/admin/newOrder/auditOrderNew",
  754. data: {
  755. orderNo: this.state.orderNo,
  756. orderStatus: 2,
  757. outsource: 1
  758. },
  759. success: function (data) {
  760. if (data.error.length || data.data.list == "") {
  761. if (data.error && data.error.length) {
  762. message.warning(data.error[0].message);
  763. }
  764. } else {
  765. message.success("该订单已通过审核~");
  766. this.setState({
  767. visible: false
  768. });
  769. this.reset();
  770. }
  771. }.bind(this)
  772. }).always(
  773. function () {
  774. this.setState({
  775. loading: false
  776. });
  777. }.bind(this)
  778. );
  779. },
  780. //审核不通过
  781. examOks() {
  782. this.setState({
  783. aloading: true
  784. });
  785. $.ajax({
  786. method: "post",
  787. dataType: "json",
  788. crossDomain: false,
  789. url: globalConfig.context + "/api/admin/newOrder/auditOrderNew",
  790. data: {
  791. orderNo: this.state.orderNo,
  792. orderStatus: 3,
  793. reason: this.state.reason
  794. },
  795. success: function (data) {
  796. if (data.error.length || data.data.list == "") {
  797. if (data.error && data.error.length) {
  798. message.warning(data.error[0].message);
  799. this.setState({
  800. aloading: true
  801. });
  802. }
  803. } else {
  804. message.success("该订单已被拒绝~");
  805. this.setState({
  806. visible: false,
  807. aloading: false,
  808. noVisible: false,
  809. reason: ""
  810. });
  811. this.reset();
  812. }
  813. }.bind(this)
  814. }).always(
  815. function () {
  816. this.setState({
  817. loading: false
  818. });
  819. }.bind(this)
  820. );
  821. },
  822. //点击拒绝
  823. examNo() {
  824. this.setState({
  825. noVisible: true
  826. });
  827. },
  828. // componentDidMount(){
  829. // window.setTimeout(() => {
  830. // console.log(this.state.dataProps);
  831. // },100)
  832. // },
  833. loadDataChange(key) {
  834. $.ajax({
  835. method: "get",
  836. dataType: "json",
  837. async: false,
  838. crossDomain: false,
  839. url: globalConfig.context + "/api/admin/orderChange/orderChangeLogList",
  840. data: {
  841. changeId: key
  842. },
  843. success: function (data) {
  844. if (data.error.length || data.data.list == "") {
  845. if (data.error && data.error.length) {
  846. message.warning(data.error[0].message);
  847. }
  848. } else {
  849. // console.log("拿到历史", data.data);
  850. this.setState({
  851. dataProps: data.data
  852. });
  853. }
  854. }.bind(this)
  855. });
  856. },
  857. callback(key) {
  858. this.setState(
  859. {
  860. activeKey: key
  861. },
  862. () => {
  863. if (key != "a" && key != "c" && key.length < 10) {
  864. this.ChangeDetail(key);
  865. this.loadDataChange(key);
  866. } else if (key != "a" && key != "c" && key.length > 10) {
  867. this.primaryOrder(key);
  868. this.xiangmu(key);
  869. this.jiedian(key);
  870. this.jiedianNew(key);
  871. this.loadDataChange(key);
  872. }
  873. }
  874. );
  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.orderNo);
  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.state.searchData.completeSearch = 0;
  1021. this.state.searchData = {
  1022. completeSearch: 0
  1023. };
  1024. this.loadData(1);
  1025. },
  1026. outReset() {
  1027. this.setState({
  1028. companyName: "",
  1029. amount: "",
  1030. unitPrice: "",
  1031. unitNumber: "",
  1032. outsourceRemarks: "",
  1033. attachmentUrl: [],
  1034. pictureUrl: []
  1035. });
  1036. },
  1037. getOrgCodeUrl(e) {
  1038. this.setState({ pictureUrl: e });
  1039. },
  1040. //关闭详情
  1041. visitCancel() {
  1042. this.setState(
  1043. {
  1044. visible: false,
  1045. activeKey: "a"
  1046. },
  1047. () => {
  1048. this.setState({
  1049. activeKey: "a"
  1050. });
  1051. }
  1052. );
  1053. this.loadData(this.state.page);
  1054. },
  1055. visitOk() {
  1056. this.setState({
  1057. visible: false
  1058. });
  1059. },
  1060. createTabs() {
  1061. $.ajax({
  1062. url: globalConfig.context + "/api/admin/orderChange/getOrderChange",
  1063. method: "get",
  1064. data: {
  1065. orderNo: this.state.orderNo
  1066. },
  1067. success: data => {
  1068. if (data.error && data.error.length) {
  1069. message.warning(data.error[0].message);
  1070. } else {
  1071. this.setState({
  1072. tabList: data.data
  1073. });
  1074. }
  1075. }
  1076. });
  1077. },
  1078. render() {
  1079. const tabList = this.state.tabList || [];
  1080. const formItemLayout = {
  1081. labelCol: { span: 8 },
  1082. wrapperCol: { span: 14 }
  1083. };
  1084. const FormItem = Form.Item;
  1085. const { TabPane } = Tabs;
  1086. return (
  1087. <div className="user-content">
  1088. <ShowModalDiv ShowModal={this.state.showModal} />
  1089. <div className="content-title">
  1090. <span>合同变更审核订单</span>
  1091. </div>
  1092. <div className="user-search">
  1093. <Tabs
  1094. defaultActiveKey="1"
  1095. onChange={this.callback}
  1096. className="test">
  1097. <TabPane tab="搜索" key="1">
  1098. <div style={{ marginLeft: 10 }}>
  1099. <SearchInput search={this.search} />
  1100. </div>
  1101. </TabPane>
  1102. </Tabs>
  1103. <div className="patent-table">
  1104. <Spin spinning={this.state.loading}>
  1105. <Table
  1106. size="small"
  1107. bordered
  1108. columns={this.state.columns}
  1109. dataSource={this.state.dataSource}
  1110. pagination={this.state.pagination}
  1111. onRowClick={this.tableRowClick}
  1112. />
  1113. </Spin>
  1114. </div>
  1115. <Modal
  1116. className="customeDetails"
  1117. footer=""
  1118. maskClosable={false}
  1119. width="900px"
  1120. visible={this.state.visible}
  1121. onOk={this.visitOk}
  1122. onCancel={this.visitCancel}
  1123. >
  1124. <Tabs
  1125. activeKey={this.state.activeKey}
  1126. onChange={this.callback}
  1127. type="card"
  1128. >
  1129. <TabPane tab="订单详情" key="a">
  1130. <Form
  1131. layout="horizontal"
  1132. onSubmit={this.handleSubmit}
  1133. id="demand-form"
  1134. style={{ paddingBottom: "40px" }}
  1135. >
  1136. <Spin spinning={this.state.loading}>
  1137. <OrderDetail
  1138. orderData={this.state.orderData}
  1139. getOrderLog={this.getOrderLog}
  1140. totalCui={this.state.totalCui}
  1141. dataSourceX={this.state.dataSourceX}
  1142. contactList={this.state.contactList}
  1143. contactListNew={this.state.contactListNew}
  1144. orderNo={this.state.orderNo}
  1145. />
  1146. </Spin>
  1147. </Form>
  1148. </TabPane>
  1149. {/* <TabPane tab="合同变更记录" key="2">
  1150. <ChangeDetail
  1151. data={this.state.contractData}
  1152. pictureUrl={this.state.voucherUrl}
  1153. processState={this.props.processState}
  1154. dataSource={this.state.dataProps}
  1155. proceedsData={this.state.proceedsData}
  1156. proceedsTotal={this.state.proTotal}
  1157. invoiceTotal={this.state.invTotal}
  1158. contactList={this.state.refundInvoice}
  1159. onCancel={this.visitCancel}
  1160. />
  1161. </TabPane> */}
  1162. {tabList.map((item, index, arr) => {
  1163. return (
  1164. <TabPane tab={"合同变更记录" + (index + 1)} key={item.id}>
  1165. <ChangeDetail
  1166. id={item.id}
  1167. money={index == arr.length - 1 ? this.state.orderData.totalAmount + "" : undefined}
  1168. data={this.state.contractData}
  1169. pictureUrl={this.state.voucherUrl}
  1170. processState={this.props.processState}
  1171. dataSource={this.state.dataProps}
  1172. proceedsData={this.state.proceedsData}
  1173. proceedsTotal={this.state.proTotal}
  1174. invoiceTotal={this.state.invTotal}
  1175. contactList={this.state.refundInvoice}
  1176. onCancel={this.visitCancel}
  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. totalCui={this.state.totalCui}
  1196. contactListNew={this.state.contactListNew}
  1197. orderNo={this.state.primaryOrderNo}
  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. totalCui={this.state.totalCui}
  1244. contactListNew={this.state.contactListNew}
  1245. contactList={this.state.contactList}
  1246. orderNo={this.state.additionalOrder}
  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;