contractJsjl.js 43 KB

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