contractYxgly.js 42 KB

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