contractCwzj.js 37 KB

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