contractYxy.js 45 KB

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