contractYxgly.js 45 KB

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