contractJsy.js 37 KB

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