contractJsy.js 41 KB

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