contractJsjl.js 43 KB

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