contractCwzj.js 36 KB

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