contractJszj.js 43 KB

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