contractYxgly.js 39 KB

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