contractYxy.js 41 KB

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