contractJszj.js 42 KB

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