contractYxgly.js 43 KB

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