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