contractCwzy.js 37 KB

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