contractYxy.js 45 KB

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