contractYxgly.js 43 KB

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