contractYxy.js 45 KB

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