contractCwzj.js 44 KB

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