contractJsjl.js 44 KB

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