contractCwzj.js 44 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. ShowModal,
  13. getType
  14. } from "@/tools.js";
  15. import "./customer.less";
  16. import { ChangeDetail } from "./changeComponent/changeDetailCwzj.js";
  17. import { SearchInput } from "./changeComponent/searchInput.js";
  18. import OrderDetail from "./changeComponent/orderDetail";
  19. import { ChooseList } from "./chooseList.jsx";
  20. import ShowModalDiv from "@/showModal.jsx";
  21. import OrderRiZi from "@/orderRiZi.jsx";
  22. import {getProjectName} from "../../../tools";
  23. const contractChange = Form.create()(
  24. React.createClass({
  25. loadData(pageNo) {
  26. this.setState({
  27. loading: true
  28. });
  29. $.ajax({
  30. method: "get",
  31. dataType: "json",
  32. crossDomain: false,
  33. url: globalConfig.context + "/api/admin/orderChange/orderChangeList",
  34. data: {
  35. pageNo: pageNo || 1,
  36. pageSize: this.state.pagination.pageSize,
  37. userName: this.state.searchData.userNameSearch,
  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. orderNo: this.state.searchData.orderNoSearch,
  44. contractNo: this.state.searchData.contractNoSearch,
  45. complete: this.state.searchData.completeSearch || 1,
  46. depId: this.state.searchData.depIdSearch,
  47. type: this.state.searchData.changeSearch
  48. },
  49. success: function (data) {
  50. ShowModal(this);
  51. let theArr = [];
  52. if (data.error.length || data.data.list == "") {
  53. if (data.error && data.error.length) {
  54. message.warning(data.error[0].message);
  55. }
  56. } else {
  57. for (let i = 0; i < data.data.list.length; i++) {
  58. let thisdata = data.data.list[i];
  59. theArr.push({
  60. key: i,
  61. orderNo: thisdata.orderNo,
  62. createTimes: thisdata.createTimes,
  63. nickname: thisdata.nickname,
  64. orderType: thisdata.orderType,
  65. establishTimes: thisdata.establishTimes,
  66. orderStatus: thisdata.orderStatus,
  67. totalAmount: thisdata.totalAmount,
  68. settlementAmount: thisdata.settlementAmount,
  69. arrears: thisdata.arrears,
  70. salesmanName: thisdata.salesmanName,
  71. depName: thisdata.depName,
  72. processState: thisdata.processState,
  73. type: thisdata.type,
  74. status: thisdata.status,
  75. id: thisdata.id,
  76. contractNo: thisdata.contractNo,
  77. processStateText: getProcessStatusNew(
  78. thisdata.processState,
  79. thisdata.status
  80. )
  81. });
  82. }
  83. this.state.pagination.total = data.data.totalCount;
  84. this.state.pagination.current = data.data.pageNo;
  85. }
  86. if (data.data && data.data.list && !data.data.list.length) {
  87. this.state.pagination.total = 0;
  88. }
  89. this.setState({
  90. dataSource: theArr,
  91. pageNo: pageNo,
  92. pagination: this.state.pagination
  93. });
  94. }.bind(this)
  95. }).always(
  96. function () {
  97. this.setState({
  98. loading: false
  99. });
  100. }.bind(this)
  101. );
  102. },
  103. getInitialState() {
  104. return {
  105. page: 1,
  106. searchData: {
  107. releaseDate: []
  108. },
  109. primaryOrderData: {}, //原订单数据
  110. orderData: {}, //现订单数据
  111. pictureUrl: [],
  112. voucherUrl: [],
  113. attachmentUrl: [],
  114. //收款数据
  115. proceedsData: {},
  116. proTotal: 0,
  117. invTotal: 0,
  118. contractData: {},
  119. // 回收退票数据
  120. refundInvoice: [],
  121. RefundInvoice: [],
  122. additionalOrderData: {},
  123. paginations: false,
  124. activeKey: "a",
  125. confirmLoading: false,
  126. aloading: false,
  127. pagination: {
  128. defaultCurrent: 1,
  129. defaultPageSize: 10,
  130. showQuickJumper: true,
  131. pageSize: 10,
  132. onChange: function (page) {
  133. this.loadData(page);
  134. }.bind(this),
  135. showTotal: function (total) {
  136. return "共" + total + "条数据";
  137. }
  138. },
  139. columns: [
  140. {
  141. title: "合同编号",
  142. dataIndex: "contractNo",
  143. key: "contractNo"
  144. },
  145. {
  146. title: "订单编号",
  147. dataIndex: "orderNo",
  148. key: "orderNo"
  149. },
  150. {
  151. title: "客户名称",
  152. dataIndex: "nickname",
  153. key: "nickname"
  154. },
  155. {
  156. title: "订单部门",
  157. dataIndex: "depName",
  158. key: "depName"
  159. },
  160. {
  161. title: "订单类型",
  162. dataIndex: "orderType",
  163. key: "orderType",
  164. render: text => {
  165. return text ? "科技项目" : "认证项目";
  166. }
  167. },
  168. {
  169. title: "下单时间",
  170. dataIndex: "establishTimes",
  171. key: "establishTimes"
  172. },
  173. {
  174. title: "订单状态",
  175. dataIndex: "orderStatus",
  176. key: "orderStatus",
  177. render: text => {
  178. return getNewOrderStatus(text);
  179. }
  180. },
  181. {
  182. title: "合同额(万元)",
  183. dataIndex: "totalAmount",
  184. key: "totalAmount"
  185. },
  186. {
  187. title: "已付额(万元)",
  188. dataIndex: "settlementAmount",
  189. key: "settlementAmount"
  190. },
  191. {
  192. title: "欠款(万元)",
  193. dataIndex: "arrears",
  194. key: "arrears"
  195. },
  196. {
  197. title: "订单负责人",
  198. dataIndex: "salesmanName",
  199. key: "salesmanName"
  200. },
  201. {
  202. title: "变更类型",
  203. dataIndex: "type",
  204. key: "type",
  205. render: text => {
  206. return getType(text);
  207. }
  208. },
  209. {
  210. title: "审核状态",
  211. dataIndex: "processStateText",
  212. key: "processStateText"
  213. },
  214. {
  215. title: "提交时间",
  216. dataIndex: "createTimes",
  217. key: "createTimes"
  218. }
  219. ],
  220. dataSource: [],
  221. // 传递给子组件的
  222. dataProps: [],
  223. columnsX: [
  224. {
  225. title: "业务项目名称",
  226. dataIndex: "commodityName",
  227. key: "commodityName"
  228. },
  229. {
  230. title: "项目类别",
  231. dataIndex: "cname",
  232. key: "cname"
  233. },
  234. {
  235. title: "项目数量",
  236. dataIndex: "commodityQuantity",
  237. key: "commodityQuantity"
  238. },
  239. {
  240. title: "金额(万元)",
  241. dataIndex: "commodityPrice",
  242. key: "commodityPrice"
  243. },
  244. {
  245. title: "负责人",
  246. dataIndex: "contacts",
  247. key: "contacts"
  248. },
  249. {
  250. title: "负责人电话",
  251. dataIndex: "contactsMobile",
  252. key: "contactsMobile"
  253. },
  254. {
  255. title: "项目状态",
  256. dataIndex: "projectStatus",
  257. key: "projectStatus",
  258. render: text => {
  259. return getProjectName(text);
  260. }
  261. },
  262. {
  263. title: "主要项目",
  264. dataIndex: "main",
  265. key: "main",
  266. render: text => {
  267. return text ? "是" : "否";
  268. }
  269. },
  270. {
  271. title: "项目说明",
  272. dataIndex: "taskComment",
  273. key: "taskComment",
  274. render: text => {
  275. return text && text.length > 8 ? text.substr(0, 8) + "…" : text;
  276. }
  277. }
  278. ],
  279. // 子组件改变的表格title数组
  280. changeList: undefined,
  281. columnsrizhi: [
  282. {
  283. title: "流程",
  284. dataIndex: "processName",
  285. key: "processName"
  286. },
  287. {
  288. title: "操作人",
  289. dataIndex: "adminName",
  290. key: "adminName"
  291. },
  292. {
  293. title: "时间",
  294. dataIndex: "createDate",
  295. key: "createDate"
  296. }
  297. ],
  298. dataSourceX: [],
  299. ContactsLists: [
  300. {
  301. title: "催款科目",
  302. dataIndex: "dunSubject",
  303. key: "dunSubject",
  304. render: text => {
  305. return getjiedian(text);
  306. }
  307. },
  308. {
  309. title: "金额(万元)",
  310. dataIndex: "money",
  311. key: "money"
  312. },
  313. {
  314. title: "催款状态",
  315. dataIndex: "dunStatus",
  316. key: "dunStatus",
  317. render: text => {
  318. return getCuikuan(text);
  319. }
  320. }
  321. ]
  322. };
  323. },
  324. //页面加载函数
  325. componentWillMount() {
  326. this.loadData();
  327. },
  328. //整行点击
  329. tableRowClick(record) {
  330. this.setState(
  331. {
  332. visible: true,
  333. type: record.type,
  334. status: record.status,
  335. buttonStatus: true,
  336. orderStatus: record.orderStatus,
  337. processStateText: record.processStateText,
  338. id: record.id,
  339. orderNo: record.orderNo
  340. },
  341. () => {
  342. this.xiangqing(record.orderNo);
  343. this.xiangmu(record.orderNo);
  344. this.jiedian(record.orderNo);
  345. this.jiedianNew(record.orderNo);
  346. this.createTabs();
  347. }
  348. );
  349. },
  350. //点击打卡项目详情
  351. tableRowClickX(record) {
  352. this.setState({
  353. jid: record.id, //项目ID
  354. kid: record.commodityId, //商品ID
  355. commodityName: record.commodityName, //金额
  356. commodityPrice: record.commodityPrice, //金额
  357. commodityQuantity: record.commodityQuantity, //数量
  358. taskComment: record.taskComment, //备注
  359. main: record.main.toString(), //是否为主要
  360. addnextVisible: true,
  361. addState: 0
  362. });
  363. },
  364. //项目详情关闭
  365. nextCancel() {
  366. this.setState({
  367. addnextVisible: false
  368. });
  369. },
  370. // 合同变更详情
  371. ChangeDetail(id) {
  372. let url = window.location.href.substring(7);
  373. $.ajax({
  374. method: "get",
  375. dataType: "json",
  376. crossDomain: false,
  377. url:
  378. globalConfig.context +
  379. "/api/admin/orderChange/orderChangeDetailsById",
  380. data: {
  381. id: id
  382. },
  383. success: function (data) {
  384. if (data.data) {
  385. let thisdata = data.data;
  386. Object.assign(thisdata, {
  387. processStateText: this.state.processStateText,
  388. userName: this.state.userName,
  389. contractNo: this.state.contractNo
  390. });
  391. this.setState({
  392. contractData: thisdata,
  393. voucherUrl: thisdata.voucherUrl
  394. ? splitUrl(
  395. thisdata.voucherUrl,
  396. ",",
  397. globalConfig.avatarHost + "/upload",
  398. url
  399. )
  400. : []
  401. });
  402. }
  403. }.bind(this)
  404. });
  405. $.ajax({
  406. method: "get",
  407. dataType: "json",
  408. crossDomain: false,
  409. url:
  410. globalConfig.context +
  411. "/api/admin/orderChange/listOrderInvoiceAndBill",
  412. data: {
  413. orderNo: this.state.orderNo
  414. },
  415. success: function (data) {
  416. if (!data.data) return;
  417. let proTotal = 0;
  418. let invTotal = 0;
  419. data.data.bill.forEach(item => {
  420. proTotal += item.transactionAmount;
  421. });
  422. data.data.invoice.forEach(item => {
  423. invTotal += item.amount;
  424. });
  425. this.setState({
  426. proceedsData: data.data,
  427. proTotal: (Math.round(proTotal * 1000000) / 1000000).toFixed(6),
  428. invTotal: (Math.round(invTotal * 1000000) / 1000000).toFixed(6),
  429. });
  430. }.bind(this)
  431. });
  432. $.ajax({
  433. method: "get",
  434. dataType: "json",
  435. crossDomain: false,
  436. url:
  437. globalConfig.context +
  438. "/api/admin/orderChange/listOrderRefundInvoice",
  439. data: {
  440. orderNo: this.state.orderNo
  441. },
  442. success: data => {
  443. if (!data) return;
  444. data.data.forEach(item => {
  445. item.load = true;
  446. });
  447. this.setState({
  448. refundInvoice: data.data
  449. });
  450. }
  451. });
  452. },
  453. //订单详情
  454. xiangqing(orderNos) {
  455. this.setState({
  456. orderData: {}
  457. },()=>{
  458. $.ajax({
  459. method: "get",
  460. dataType: "json",
  461. crossDomain: false,
  462. url: globalConfig.context + "/api/admin/newOrder/getOrderNewDetail",
  463. data: {
  464. orderNo: orderNos
  465. },
  466. success: function (data) {
  467. if (data.error.length || data.data.list == "") {
  468. if (data.error && data.error.length) {
  469. message.warning(data.error[0].message);
  470. }
  471. } else {
  472. let thisdata = data.data;
  473. this.setState({
  474. userName: thisdata.userName,
  475. primaryOrderNo: thisdata.primaryOrder,
  476. additionalOrder: thisdata.additionalOrder,
  477. contractNo: thisdata.contractNo,
  478. // arrears: thisdata.arrears,
  479. orderData: thisdata,
  480. isAddition: thisdata.additionalOrder ? true : false
  481. });
  482. }
  483. }.bind(this)
  484. });
  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. splitStatus: thisdata.splitStatus
  570. });
  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. // window.location.reload()
  830. }
  831. }.bind(this)
  832. }).always(
  833. function () {
  834. this.setState({
  835. loading: false
  836. });
  837. }.bind(this)
  838. );
  839. },
  840. //点击拒绝
  841. examNo() {
  842. this.setState({
  843. noVisible: true
  844. });
  845. },
  846. loadDataChange(key) {
  847. $.ajax({
  848. method: "get",
  849. dataType: "json",
  850. async: false,
  851. crossDomain: false,
  852. url: globalConfig.context + "/api/admin/orderChange/orderChangeLogList",
  853. data: {
  854. changeId: key
  855. },
  856. success: function (data) {
  857. if (data.error.length || data.data.list == "") {
  858. if (data.error && data.error.length) {
  859. message.warning(data.error[0].message);
  860. }
  861. } else {
  862. // console.log("拿到历史", data.data);
  863. this.setState({
  864. dataProps: data.data
  865. });
  866. }
  867. }.bind(this)
  868. });
  869. },
  870. callback(key) {
  871. this.setState(
  872. {
  873. activeKey: key
  874. },
  875. () => {
  876. if (key != "a" && key != "c" && key.length < 10) {
  877. this.ChangeDetail(key);
  878. this.loadDataChange(key);
  879. } else if (key != "a" && key != "c" && key.length > 10) {
  880. this.primaryOrder(key);
  881. this.xiangmu(key);
  882. this.jiedian(key);
  883. this.jiedianNew(key);
  884. this.loadDataChange(key);
  885. }
  886. }
  887. );
  888. if (key === "a") {
  889. this.xiangmu(this.state.orderNo);
  890. this.jiedian(this.state.orderNo);
  891. this.jiedianNew(this.state.orderNo);
  892. }
  893. // if (key === "2") {
  894. // this.ChangeDetail(this.state.id);
  895. // this.loadDataChange();
  896. // }
  897. // if (key === "3") {
  898. // this.primaryOrder(this.state.primaryOrderNo);
  899. // this.xiangmu(this.state.primaryOrderNo);
  900. // this.jiedian(this.state.primaryOrderNo);
  901. // this.jiedianNew(this.state.primaryOrderNo);
  902. // }
  903. if (key === "c") {
  904. this.additionalOrder(this.state.additionalOrder);
  905. this.xiangmu(this.state.additionalOrder);
  906. this.jiedian(this.state.additionalOrder);
  907. this.jiedianNew(this.state.additionalOrder);
  908. this.setState({
  909. buttonStatusA: false
  910. });
  911. } else {
  912. this.setState({
  913. buttonStatusA: true
  914. });
  915. }
  916. },
  917. closeDesc(e, s) {
  918. this.state.activeKey = "a";
  919. this.state.userDetaile = false;
  920. this.state.signBillVisible = false;
  921. this.state.visible = e;
  922. if (s) {
  923. this.loadData(this.state.pageNo);
  924. }
  925. },
  926. // 获取原订单编号
  927. getPrimaryOrder(value) {
  928. this.setState({
  929. primaryOrder: value
  930. });
  931. },
  932. getAdditionalOrder(value) {
  933. this.setState({
  934. additionalOrder: value
  935. });
  936. },
  937. getUrl(url) {
  938. let theorgCodeUrl = [];
  939. if (url.length) {
  940. let picArr = [];
  941. url.map(function (item) {
  942. if (
  943. item.response &&
  944. item.response.data &&
  945. item.response.data.length
  946. ) {
  947. picArr.push(item.response.data);
  948. }
  949. });
  950. theorgCodeUrl = picArr.join(",");
  951. }
  952. return theorgCodeUrl;
  953. },
  954. sureOut() {
  955. if (!this.state.companyName) {
  956. message.warning("公司名称不能为空");
  957. return;
  958. }
  959. if (!this.state.unitPrice) {
  960. message.warning("单价不能为空");
  961. return;
  962. }
  963. if (!this.state.unitNumber) {
  964. message.warning("数量不能为空");
  965. return;
  966. }
  967. if (!this.state.amount) {
  968. message.warning("总金额不能为空");
  969. return;
  970. }
  971. if (!this.state.outsourceRemarks) {
  972. message.warning("备注不能为空");
  973. return;
  974. }
  975. if (this.state.pictureUrl.length === 0) {
  976. message.warning("合同扫描件不能为空");
  977. return;
  978. }
  979. $.ajax({
  980. method: "POST",
  981. dataType: "json",
  982. crossDomain: false,
  983. url: globalConfig.context + "/api/admin/outsourceOrg/auditOutsource",
  984. data: {
  985. id: this.state.id,
  986. orderNo: this.state.orderNo,
  987. companyName: this.state.companyName,
  988. amount: this.state.amount,
  989. outsourceRemarks: this.state.outsourceRemarks,
  990. unitNumber: this.state.unitNumber,
  991. unitPrice: this.state.unitPrice,
  992. attachmentUrl: this.getUrl(this.state.attachmentUrl).length
  993. ? this.getUrl(this.state.attachmentUrl)
  994. : "",
  995. orderStatus: 2,
  996. pictureUrl: this.getUrl(this.state.pictureUrl).length
  997. ? this.getUrl(this.state.pictureUrl)
  998. : ""
  999. }
  1000. }).done(
  1001. function (data) {
  1002. this.setState({
  1003. loading: false
  1004. });
  1005. if (!data.error.length) {
  1006. message.success("发起成功!");
  1007. this.outReset();
  1008. this.visitCancel();
  1009. } else {
  1010. message.warning(data.error[0].message);
  1011. }
  1012. }.bind(this)
  1013. );
  1014. },
  1015. //关闭输入理由框
  1016. noCancel() {
  1017. this.setState({
  1018. noVisible: false,
  1019. aloading: false,
  1020. reason: ""
  1021. });
  1022. },
  1023. //重置
  1024. reset() {
  1025. this.setState({
  1026. signBillVisible: false
  1027. });
  1028. this.state.orderNo = "";
  1029. this.state.customerName = "";
  1030. this.state.releaseDate[0] = undefined;
  1031. this.state.releaseDate[1] = undefined;
  1032. this.state.approval = undefined;
  1033. this.loadData(1);
  1034. // window.location.reload();
  1035. },
  1036. outReset() {
  1037. this.setState({
  1038. companyName: "",
  1039. amount: "",
  1040. unitPrice: "",
  1041. unitNumber: "",
  1042. outsourceRemarks: "",
  1043. attachmentUrl: [],
  1044. pictureUrl: []
  1045. });
  1046. },
  1047. getOrgCodeUrl(e) {
  1048. this.setState({ pictureUrl: e });
  1049. },
  1050. //关闭详情
  1051. visitCancel() {
  1052. this.setState(
  1053. {
  1054. activeKey: "a",
  1055. visible: false
  1056. });
  1057. this.loadData(this.state.pageNo);
  1058. },
  1059. visitOk() {
  1060. this.setState({
  1061. visible: false
  1062. });
  1063. },
  1064. changeList(arr) {
  1065. const newArr = [];
  1066. this.state.columns.forEach(item => {
  1067. arr.forEach(val => {
  1068. if (val === item.title) {
  1069. newArr.push(item);
  1070. }
  1071. });
  1072. });
  1073. this.setState({
  1074. changeList: newArr
  1075. });
  1076. },
  1077. createTabs() {
  1078. $.ajax({
  1079. url: globalConfig.context + "/api/admin/orderChange/getOrderChange",
  1080. method: "get",
  1081. data: {
  1082. orderNo: this.state.orderNo
  1083. },
  1084. success: data => {
  1085. if (data.error && data.error.length) {
  1086. message.warning(data.error[0].message);
  1087. } else {
  1088. this.setState({
  1089. tabList: data.data
  1090. });
  1091. }
  1092. }
  1093. });
  1094. },
  1095. render() {
  1096. const tabList = this.state.tabList || [];
  1097. const formItemLayout = {
  1098. labelCol: { span: 8 },
  1099. wrapperCol: { span: 14 }
  1100. };
  1101. const FormItem = Form.Item;
  1102. const { TabPane } = Tabs;
  1103. return (
  1104. <div className="user-content">
  1105. <ShowModalDiv ShowModal={this.state.showModal} />
  1106. <div className="content-title">
  1107. <span>合同变更审核订单</span>
  1108. </div>
  1109. <div className="user-search">
  1110. <Tabs
  1111. defaultActiveKey="1"
  1112. onChange={this.callback}
  1113. className="test">
  1114. <TabPane tab="搜索" key="1">
  1115. <div style={{ marginLeft: 10 }}>
  1116. <SearchInput search={this.search} />
  1117. </div>
  1118. </TabPane>
  1119. <TabPane tab="更改表格数据" key="2">
  1120. <div style={{ marginTop: 10, marginLeft: 10 }}>
  1121. <ChooseList
  1122. columns={this.state.columns}
  1123. changeFn={this.changeList}
  1124. changeList={this.state.changeList}
  1125. top={65}
  1126. />
  1127. </div>
  1128. </TabPane>
  1129. </Tabs>
  1130. <div className="patent-table">
  1131. <Spin spinning={this.state.loading}>
  1132. <Table
  1133. size="small"
  1134. bordered
  1135. columns={
  1136. this.state.changeList == undefined
  1137. ? this.state.columns
  1138. : this.state.changeList
  1139. }
  1140. dataSource={this.state.dataSource}
  1141. pagination={this.state.pagination}
  1142. onRowClick={this.tableRowClick}
  1143. />
  1144. </Spin>
  1145. </div>
  1146. <Modal
  1147. className="customeDetails"
  1148. footer=""
  1149. maskClosable={false}
  1150. width="900px"
  1151. visible={this.state.visible}
  1152. onOk={this.visitOk}
  1153. onCancel={this.visitCancel}
  1154. >
  1155. {this.state.visible ? <Tabs
  1156. activeKey={this.state.activeKey}
  1157. onChange={this.callback}
  1158. type="card"
  1159. >
  1160. <TabPane tab="订单详情" key="a">
  1161. <div style={{ paddingBottom: "40px" }}>
  1162. <Spin spinning={this.state.loading}>
  1163. {this.state.activeKey === 'a' && this.state.visible? <OrderDetail
  1164. orderData={this.state.orderData}
  1165. getOrderLog={this.getOrderLog}
  1166. dataSourceX={this.state.dataSourceX}
  1167. contactList={this.state.contactList}
  1168. orderNo={this.state.orderNo}
  1169. totalCui={this.state.totalCui}
  1170. contactListNew={this.state.contactListNew}
  1171. // isCaiWu={true}
  1172. />: <div/>}
  1173. </Spin>
  1174. </div>
  1175. </TabPane>
  1176. {/* <TabPane tab="合同变更记录" key="2">
  1177. <ChangeDetail
  1178. data={this.state.contractData}
  1179. txt={this.state.processStateText}
  1180. pictureUrl={this.state.voucherUrl}
  1181. processState={this.props.processState}
  1182. loadData={this.callback}
  1183. reset={this.state.visible}
  1184. dataSource={this.state.dataProps}
  1185. proceedsData={this.state.proceedsData}
  1186. proceedsTotal={this.state.proTotal}
  1187. invoiceTotal={this.state.invTotal}
  1188. contactList={this.state.refundInvoice}
  1189. onCancel={this.visitCancel}
  1190. />
  1191. </TabPane> */}
  1192. {tabList.map((item, index, arr) => {
  1193. return (
  1194. <TabPane tab={"合同变更记录" + (index + 1)} key={item.id}>
  1195. {this.state.activeKey === String(item.id) ? <ChangeDetail
  1196. id={item.id}
  1197. money={
  1198. index == arr.length - 1
  1199. ? this.state.orderData.totalAmount + ""
  1200. : undefined
  1201. }
  1202. data={this.state.contractData}
  1203. orderData={this.state.orderData}
  1204. txt={this.state.processStateText}
  1205. pictureUrl={this.state.voucherUrl}
  1206. processState={this.props.processState}
  1207. loadData={this.callback}
  1208. reset={this.state.visible}
  1209. dataSource={this.state.dataProps}
  1210. proceedsData={this.state.proceedsData}
  1211. proceedsTotal={this.state.proTotal}
  1212. invoiceTotal={this.state.invTotal}
  1213. contactList={this.state.refundInvoice}
  1214. onCancel={this.visitCancel}
  1215. /> : <div/>}
  1216. </TabPane>
  1217. );
  1218. })}
  1219. {/* {this.state.status === 4 ? (
  1220. <TabPane tab="原订单" key="3">
  1221. <Form
  1222. layout="horizontal"
  1223. onSubmit={this.handleSubmit}
  1224. id="demand-form"
  1225. style={{ paddingBottom: "40px" }}
  1226. >
  1227. <Spin spinning={this.state.loading}>
  1228. <OrderDetail
  1229. orderData={this.state.primaryOrderData}
  1230. getOrderLog={this.getOrderLog}
  1231. dataSourceX={this.state.dataSourceX}
  1232. contactList={this.state.contactList}
  1233. orderNo={this.state.primaryOrderNo}
  1234. isCaiWu={true}
  1235. totalCui={this.state.totalCui}
  1236. contactListNew={this.state.contactListNew}
  1237. />
  1238. </Spin>
  1239. </Form>
  1240. </TabPane>
  1241. ) : (
  1242. ""
  1243. )} */}
  1244. {tabList.map((item, index) => {
  1245. if (item.usedOrder) {
  1246. return (
  1247. <TabPane
  1248. tab={"原订单" + (index + 1)}
  1249. key={item.usedOrder}
  1250. >
  1251. {this.state.activeKey === String(item.usedOrder)? <Form
  1252. layout="horizontal"
  1253. onSubmit={this.handleSubmit}
  1254. id="demand-form"
  1255. style={{ paddingBottom: "40px" }}
  1256. >
  1257. <Spin spinning={this.state.loading}>
  1258. {this.state.visible ? <OrderDetail
  1259. orderData={this.state.primaryOrderData}
  1260. getOrderLog={this.getOrderLog}
  1261. dataSourceX={this.state.dataSourceX}
  1262. contactList={this.state.contactList}
  1263. orderNo={this.state.primaryOrderNo}
  1264. isCaiWu={true}
  1265. totalCui={this.state.totalCui}
  1266. contactListNew={this.state.contactListNew}
  1267. /> : <div/>}
  1268. </Spin>
  1269. </Form> : <div/>}
  1270. </TabPane>
  1271. );
  1272. } else {
  1273. return "";
  1274. }
  1275. })}
  1276. {this.state.status === 4 && this.state.isAddition ? (
  1277. this.state.type === 4 || this.state.type === 5 ? (
  1278. <TabPane tab="附加订单" key="c">
  1279. {this.state.activeKey === "c" && this.state.visible ? <OrderDetail
  1280. orderData={this.state.additionalOrderData}
  1281. getOrderLog={this.getOrderLog}
  1282. dataSourceX={this.state.dataSourceX}
  1283. contactList={this.state.contactList}
  1284. orderNo={this.state.additionalOrder}
  1285. isCaiWu={true}
  1286. totalCui={this.state.totalCui}
  1287. contactListNew={this.state.contactListNew}
  1288. /> : <div/>}
  1289. </TabPane>
  1290. ) : (
  1291. ""
  1292. )
  1293. ) : (
  1294. ""
  1295. )}
  1296. </Tabs> : <div/>}
  1297. </Modal>
  1298. <Modal
  1299. maskClosable={false}
  1300. visible={this.state.addnextVisible}
  1301. onOk={this.nextCancel}
  1302. onCancel={this.nextCancel}
  1303. confirmLoading={this.state.confirmLoading}
  1304. width="800px"
  1305. title={"项目任务详情"}
  1306. footer=""
  1307. className="admin-desc-content"
  1308. >
  1309. <Form layout="horizontal" id="demand-form">
  1310. <Spin spinning={this.state.loading}>
  1311. <div className="clearfix">
  1312. <FormItem
  1313. className="half-item"
  1314. {...formItemLayout}
  1315. label="项目名称"
  1316. >
  1317. <span>{this.state.commodityName}</span>
  1318. </FormItem>
  1319. <FormItem
  1320. className="half-item"
  1321. {...formItemLayout}
  1322. label="项目数量"
  1323. >
  1324. <span>{this.state.commodityQuantity}</span>
  1325. </FormItem>
  1326. <FormItem
  1327. className="half-item"
  1328. {...formItemLayout}
  1329. label="金额(万元)"
  1330. >
  1331. <span>{this.state.commodityPrice}</span>
  1332. </FormItem>
  1333. <FormItem
  1334. className="half-item"
  1335. {...formItemLayout}
  1336. label="主要项目"
  1337. >
  1338. <span>{getboutique(this.state.main)}</span>
  1339. </FormItem>
  1340. <div className="clearfix">
  1341. <FormItem
  1342. labelCol={{ span: 4 }}
  1343. wrapperCol={{ span: 16 }}
  1344. label="服务说明"
  1345. >
  1346. <span>{this.state.taskComment}</span>
  1347. </FormItem>
  1348. </div>
  1349. </div>
  1350. </Spin>
  1351. </Form>
  1352. </Modal>
  1353. <Modal
  1354. maskClosable={false}
  1355. visible={this.state.noVisible}
  1356. onOk={this.handleOk}
  1357. onCancel={this.noCancel}
  1358. width="400px"
  1359. title={"拒绝理由"}
  1360. footer=""
  1361. className="admin-desc-content"
  1362. confirmLoading={this.state.confirmLoading}
  1363. >
  1364. <Form layout="horizontal" id="demand-form">
  1365. <Spin spinning={this.state.loading}>
  1366. <div className="clearfix">
  1367. <FormItem
  1368. labelCol={{ span: 4 }}
  1369. wrapperCol={{ span: 16 }}
  1370. label="拒绝理由"
  1371. >
  1372. <Input
  1373. type="textarea"
  1374. placeholder="请输入拒绝理由"
  1375. rows={4}
  1376. value={this.state.reason}
  1377. onChange={e => {
  1378. this.setState({ reason: e.target.value });
  1379. }}
  1380. />
  1381. </FormItem>
  1382. </div>
  1383. <div className="clearfix">
  1384. <Button
  1385. className="cancel"
  1386. type="primary"
  1387. onClick={this.examOks}
  1388. style={{ marginLeft: "50px" }}
  1389. htmlType="submit"
  1390. loading={this.state.aloading}
  1391. >
  1392. 确定
  1393. </Button>
  1394. <Button
  1395. className="cancel"
  1396. type="ghost"
  1397. onClick={this.noCancel}
  1398. style={{ marginLeft: "50px" }}
  1399. >
  1400. 取消
  1401. </Button>
  1402. </div>
  1403. </Spin>
  1404. </Form>
  1405. </Modal>
  1406. {/* <Modal
  1407. visible={this.state.rizhivisible}
  1408. className="admin-desc-content"
  1409. width="800px"
  1410. maskClosable={false}
  1411. title="订单日志"
  1412. footer={null}
  1413. onCancel={this.closeOrderLog}
  1414. >
  1415. <div className="patent-table">
  1416. <Spin spinning={this.state.loading}>
  1417. <Table
  1418. bordered
  1419. columns={this.state.columnsrizhi}
  1420. dataSource={this.state.dataSourcerizhi}
  1421. pagination={false}
  1422. />
  1423. </Spin>
  1424. </div>
  1425. </Modal> */}
  1426. <OrderRiZi
  1427. dataSourcerizhi={this.state.dataSourcerizhi}
  1428. closeOrderLog={this.closeOrderLog}
  1429. visible={this.state.rizhivisible}
  1430. loading={this.state.loading}
  1431. />
  1432. </div>
  1433. </div>
  1434. );
  1435. }
  1436. })
  1437. );
  1438. export default contractChange;