contractYxgly.js 36 KB

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