contractYxy.js 40 KB

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