contractCwzj.js 44 KB

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