contractJsy.js 41 KB

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