contractJsjl.js 42 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403
  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/changeDetailJsjl.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. orderNo: this.state.searchData.orderNoSearch,
  41. contractNo: this.state.searchData.contractNoSearch,
  42. processState: this.props.processState,
  43. timeType: this.state.searchData.timeTypeSearch,
  44. startTime: this.state.searchData.releaseDate[0],
  45. endTime: this.state.searchData.releaseDate[1],
  46. salesmanName: this.state.searchData.salesmanNameSearch,
  47. complete: this.state.searchData.completeSearch || 1,
  48. depId: this.state.searchData.depIdSearch,
  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. // console.log("row",this.state.activeKey);
  351. },
  352. //点击打卡项目详情
  353. tableRowClickX(record) {
  354. this.setState({
  355. jid: record.id, //项目ID
  356. kid: record.commodityId, //商品ID
  357. commodityName: record.commodityName, //金额
  358. commodityPrice: record.commodityPrice, //金额
  359. commodityQuantity: record.commodityQuantity, //数量
  360. taskComment: record.taskComment, //备注
  361. main: record.main.toString(), //是否为主要
  362. addnextVisible: true,
  363. dataInfor:record,
  364. addState: 0
  365. });
  366. },
  367. //项目详情关闭
  368. nextCancel() {
  369. this.setState({
  370. addnextVisible: false
  371. });
  372. },
  373. // 合同变更详情
  374. ChangeDetail(id) {
  375. let url = window.location.href.substring(7);
  376. $.ajax({
  377. method: "get",
  378. dataType: "json",
  379. crossDomain: false,
  380. url:
  381. globalConfig.context +
  382. "/api/admin/orderChange/orderChangeDetailsById",
  383. data: {
  384. id: id
  385. },
  386. success: function (data) {
  387. if (data.data) {
  388. let thisdata = data.data;
  389. Object.assign(thisdata, {
  390. processStateText: this.state.processStateText,
  391. userName: this.state.userName,
  392. contractNo: this.state.contractNo
  393. });
  394. this.setState({
  395. contractData: thisdata,
  396. voucherUrl: thisdata.voucherUrl
  397. ? splitUrl(
  398. thisdata.voucherUrl,
  399. ",",
  400. globalConfig.avatarHost + "/upload",
  401. url
  402. )
  403. : []
  404. });
  405. }
  406. }.bind(this)
  407. });
  408. $.ajax({
  409. method: "get",
  410. dataType: "json",
  411. crossDomain: false,
  412. url:
  413. globalConfig.context +
  414. "/api/admin/orderChange/listOrderInvoiceAndBill",
  415. data: {
  416. orderNo: this.state.orderNo
  417. },
  418. success: function (data) {
  419. if (!data.data) return;
  420. let proTotal = 0;
  421. let invTotal = 0;
  422. data.data.bill.forEach(item => {
  423. proTotal += item.transactionAmount;
  424. });
  425. data.data.invoice.forEach(item => {
  426. invTotal += item.amount;
  427. });
  428. this.setState({
  429. proceedsData: data.data,
  430. proTotal: (Math.round(proTotal * 1000000) / 1000000).toFixed(6),
  431. invTotal: (Math.round(invTotal * 1000000) / 1000000).toFixed(6),
  432. });
  433. }.bind(this)
  434. });
  435. $.ajax({
  436. method: "get",
  437. dataType: "json",
  438. crossDomain: false,
  439. url:
  440. globalConfig.context +
  441. "/api/admin/orderChange/listOrderRefundInvoice",
  442. data: {
  443. orderNo: this.state.orderNo
  444. },
  445. success: data => {
  446. if (!data) return;
  447. data.data.forEach(item => {
  448. item.load = true;
  449. });
  450. this.setState({
  451. refundInvoice: data.data
  452. });
  453. }
  454. });
  455. },
  456. //订单详情
  457. xiangqing(orderNos) {
  458. $.ajax({
  459. method: "get",
  460. dataType: "json",
  461. crossDomain: false,
  462. url: globalConfig.context + "/api/admin/newOrder/getOrderNewDetail",
  463. data: {
  464. orderNo: orderNos
  465. },
  466. success: function (data) {
  467. if (data.error.length || data.data.list == "") {
  468. if (data.error && data.error.length) {
  469. message.warning(data.error[0].message);
  470. }
  471. } else {
  472. let thisdata = data.data;
  473. this.setState({
  474. userName: thisdata.userName,
  475. primaryOrderNo: thisdata.primaryOrder,
  476. additionalOrder: thisdata.additionalOrder,
  477. contractNo: thisdata.contractNo,
  478. // arrears: thisdata.arrears,
  479. orderData: thisdata,
  480. isAddition: thisdata.additionalOrder ? true : false,
  481. deleteSign:thisdata.deleteSign,
  482. });
  483. }
  484. }.bind(this)
  485. });
  486. },
  487. // 原订单数据
  488. primaryOrder(primaryOrder) {
  489. $.ajax({
  490. method: "get",
  491. dataType: "json",
  492. crossDomain: false,
  493. url: globalConfig.context + "/api/admin/newOrder/getOrderNewDetail",
  494. data: {
  495. orderNo: primaryOrder
  496. },
  497. success: function (data) {
  498. if (data.error.length || data.data.list == "") {
  499. if (data.error && data.error.length) {
  500. message.warning(data.error[0].message);
  501. }
  502. } else {
  503. let thisdata = data.data;
  504. this.setState({
  505. primaryOrderData: thisdata
  506. });
  507. }
  508. }.bind(this)
  509. });
  510. },
  511. // 附加订单数据
  512. additionalOrder(additionalOrder) {
  513. $.ajax({
  514. method: "get",
  515. dataType: "json",
  516. crossDomain: false,
  517. url: globalConfig.context + "/api/admin/newOrder/getOrderNewDetail",
  518. data: {
  519. orderNo: additionalOrder
  520. },
  521. success: function (data) {
  522. if (data.error.length || data.data.list == "") {
  523. if (data.error && data.error.length) {
  524. message.warning(data.error[0].message);
  525. }
  526. } else {
  527. let thisdata = data.data;
  528. this.setState({
  529. additionalOrderData: thisdata
  530. });
  531. }
  532. }.bind(this)
  533. });
  534. },
  535. //项目列表
  536. xiangmu(orderNos) {
  537. $.ajax({
  538. method: "get",
  539. dataType: "json",
  540. crossDomain: false,
  541. url: globalConfig.context + "/api/admin/newOrder/getOrderTask",
  542. data: {
  543. orderNo: orderNos
  544. },
  545. success: function (data) {
  546. let theArr = [];
  547. if (data.error.length || data.data.list == "") {
  548. if (data.error && data.error.length) {
  549. message.warning(data.error[0].message);
  550. }
  551. } else {
  552. for (let i = 0; i < data.data.length; i++) {
  553. let thisdata = data.data[i];
  554. thisdata.key = i;
  555. thisdata.sort = thisdata.cSort;
  556. theArr.push(thisdata);
  557. }
  558. }
  559. this.setState({
  560. dataSourceX: theArr
  561. });
  562. }.bind(this)
  563. });
  564. },
  565. search(obj) {
  566. this.setState(
  567. {
  568. searchData: obj
  569. },
  570. () => {
  571. this.loadData(1);
  572. }
  573. );
  574. },
  575. rizhi(orderNo) {
  576. $.ajax({
  577. method: "get",
  578. dataType: "json",
  579. crossDomain: false,
  580. url: "/api/admin/newOrder/selectOrderLog",
  581. data: {
  582. orderNo: orderNo
  583. },
  584. success: function (data) {
  585. let theArr = [];
  586. let thisData = data.data;
  587. if (!thisData.length) {
  588. if (data.error && data.error.length) {
  589. message.warning(data.error[0].message);
  590. }
  591. thisData = {};
  592. } else {
  593. for (let i = 0; i < data.data.length; i++) {
  594. let thisdata = data.data[i];
  595. theArr.push({
  596. processName: thisdata.processName,
  597. adminName: thisdata.adminName,
  598. createDate: thisdata.createDate,
  599. remarks: thisdata.remarks
  600. });
  601. }
  602. }
  603. this.setState({
  604. dataSourcerizhi: theArr
  605. });
  606. }.bind(this)
  607. });
  608. },
  609. getOrderLog(orderNo) {
  610. this.setState({
  611. rizhivisible: true
  612. });
  613. this.rizhi(orderNo);
  614. },
  615. closeOrderLog() {
  616. this.setState({
  617. rizhivisible: false
  618. });
  619. },
  620. //节点列表
  621. jiedian(orderNos) {
  622. $.ajax({
  623. method: "get",
  624. dataType: "json",
  625. crossDomain: false,
  626. url: globalConfig.context + "/api/admin/newOrder/selectOrderDun",
  627. data: {
  628. orderNo: orderNos
  629. },
  630. success: function (data) {
  631. let theArr = [];
  632. let thisData = [];
  633. if (data.error.length || data.data.list == "") {
  634. if (data.error && data.error.length) {
  635. message.warning(data.error[0].message);
  636. }
  637. } else {
  638. for (let i = 0; i < data.data.length; i++) {
  639. thisData = data.data[i];
  640. theArr.push({
  641. key: i,
  642. dunSubject: thisData.dunSubject
  643. ? thisData.dunSubject.toString()
  644. : "", //催款科目
  645. id: thisData.id, //节点Id
  646. money: thisData.money, //催款金额
  647. dunStatus: thisData.dunStatus //催款状态
  648. });
  649. }
  650. this.setState({
  651. contactList: theArr
  652. });
  653. }
  654. }.bind(this)
  655. });
  656. },
  657. jiedianNew(orderNos) {
  658. $.ajax({
  659. method: "get",
  660. dataType: "json",
  661. crossDomain: false,
  662. url:
  663. globalConfig.context + "/api/admin/newOrderDun/selectListNewOrderDun",
  664. data: {
  665. orderNo: orderNos
  666. },
  667. success: function (data) {
  668. if (data.error && data.error.length) {
  669. message.warning(data.error[0].message);
  670. } else {
  671. let theArr = [];
  672. let thisData = [];
  673. let arr = data.data || [];
  674. let totalCui = 0;
  675. for (let i = 0; i < arr.length; i++) {
  676. thisData = arr[i];
  677. totalCui += +thisData.money;
  678. theArr.push({
  679. key: i,
  680. dunSubject: thisData.dunSubject
  681. ? thisData.dunSubject.toString()
  682. : "", //催款科目
  683. id: thisData.id, //节点Id
  684. money: thisData.money, //催款金额
  685. // orderNo: record ? record.orderNo : this.props.datauser.orderNo,
  686. commodityName: thisData.commodityName,
  687. projectType: thisData.projectType,
  688. dunTypeName: thisData.dunTypeName,
  689. status: thisData.status,
  690. waitDay: thisData.waitDay,
  691. effectiveCount: thisData.effectiveCount,
  692. startDate: thisData.startDate,
  693. dunType: thisData.dunType,
  694. appropriationRatio: thisData.appropriationRatio,
  695. customizeName: thisData.customizeName,
  696. customizeTimes: thisData.customizeTimes,
  697. tid: thisData.tid,
  698. });
  699. }
  700. if (!totalCui) {
  701. totalCui = 0;
  702. }
  703. totalCui = (Math.round(totalCui * 1000000) / 1000000).toFixed(6);
  704. this.setState({
  705. contactListNew: theArr,
  706. totalCui
  707. });
  708. }
  709. }.bind(this)
  710. }).always(
  711. function () {
  712. this.setState({
  713. loading: false
  714. });
  715. }.bind(this)
  716. );
  717. },
  718. //审核通过
  719. examOk() {
  720. $.ajax({
  721. method: "post",
  722. dataType: "json",
  723. crossDomain: false,
  724. url: globalConfig.context + "/api/admin/newOrder/auditOrderNew",
  725. data: {
  726. orderNo: this.state.orderNo,
  727. orderStatus: 2
  728. },
  729. success: function (data) {
  730. if (data.error.length || data.data.list == "") {
  731. if (data.error && data.error.length) {
  732. message.warning(data.error[0].message);
  733. }
  734. } else {
  735. message.success("该订单已通过审核~");
  736. this.setState({
  737. visible: false
  738. });
  739. this.reset();
  740. }
  741. }.bind(this)
  742. }).always(
  743. function () {
  744. this.setState({
  745. loading: false
  746. });
  747. }.bind(this)
  748. );
  749. },
  750. //通过发给外包
  751. outsourcing() {
  752. $.ajax({
  753. method: "post",
  754. dataType: "json",
  755. crossDomain: false,
  756. url: globalConfig.context + "/api/admin/newOrder/auditOrderNew",
  757. data: {
  758. orderNo: this.state.orderNo,
  759. orderStatus: 2,
  760. outsource: 1
  761. },
  762. success: function (data) {
  763. if (data.error.length || data.data.list == "") {
  764. if (data.error && data.error.length) {
  765. message.warning(data.error[0].message);
  766. }
  767. } else {
  768. message.success("该订单已通过审核~");
  769. this.setState({
  770. visible: false
  771. });
  772. this.reset();
  773. }
  774. }.bind(this)
  775. }).always(
  776. function () {
  777. this.setState({
  778. loading: false
  779. });
  780. }.bind(this)
  781. );
  782. },
  783. //审核不通过
  784. examOks() {
  785. this.setState({
  786. aloading: true
  787. });
  788. $.ajax({
  789. method: "post",
  790. dataType: "json",
  791. crossDomain: false,
  792. url: globalConfig.context + "/api/admin/newOrder/auditOrderNew",
  793. data: {
  794. orderNo: this.state.orderNo,
  795. orderStatus: 3,
  796. reason: this.state.reason
  797. },
  798. success: function (data) {
  799. if (data.error.length || data.data.list == "") {
  800. if (data.error && data.error.length) {
  801. message.warning(data.error[0].message);
  802. this.setState({
  803. aloading: true
  804. });
  805. }
  806. } else {
  807. message.success("该订单已被拒绝~");
  808. this.setState({
  809. visible: false,
  810. aloading: false,
  811. noVisible: false,
  812. reason: ""
  813. });
  814. this.reset();
  815. }
  816. }.bind(this)
  817. }).always(
  818. function () {
  819. this.setState({
  820. loading: false
  821. });
  822. }.bind(this)
  823. );
  824. },
  825. //点击拒绝
  826. examNo() {
  827. this.setState({
  828. noVisible: true
  829. });
  830. },
  831. loadDataChange(key) {
  832. $.ajax({
  833. method: "get",
  834. dataType: "json",
  835. async: false,
  836. crossDomain: false,
  837. url: globalConfig.context + "/api/admin/orderChange/orderChangeLogList",
  838. data: {
  839. changeId: key
  840. },
  841. success: function (data) {
  842. if (data.error.length || data.data.list == "") {
  843. if (data.error && data.error.length) {
  844. message.warning(data.error[0].message);
  845. }
  846. } else {
  847. // console.log("拿到历史", data.data);
  848. this.setState({
  849. dataProps: data.data
  850. });
  851. }
  852. }.bind(this)
  853. });
  854. },
  855. callback(key) {
  856. this.setState(
  857. {
  858. activeKey: key
  859. },
  860. () => {
  861. if (key != "a" && key != "c" && key.length < 10) {
  862. this.ChangeDetail(key);
  863. this.loadDataChange(key);
  864. } else if (key != "a" && key != "c" && key.length > 10) {
  865. this.primaryOrder(key);
  866. this.xiangmu(key);
  867. this.jiedian(key);
  868. this.jiedianNew(key);
  869. this.loadDataChange(key);
  870. }
  871. }
  872. );
  873. // console.log("change",this.state.activeKey);
  874. if (key === "a") {
  875. this.xiangmu(this.state.orderNo);
  876. this.jiedian(this.state.orderNo);
  877. this.jiedianNew(this.state.orderNo);
  878. }
  879. // if (key === "2") {
  880. // this.ChangeDetail(this.state.id);
  881. // this.loadDataChange();
  882. // }
  883. // if (key === "3") {
  884. // this.primaryOrder(this.state.primaryOrderNo);
  885. // this.xiangmu(this.state.primaryOrderNo);
  886. // this.jiedian(this.state.primaryOrderNo);
  887. // this.jiedianNew(this.state.primaryOrderNo);
  888. // }
  889. if (key === "c") {
  890. this.additionalOrder(this.state.additionalOrder);
  891. this.xiangmu(this.state.additionalOrder);
  892. this.jiedian(this.state.additionalOrder);
  893. this.jiedianNew(this.state.additionalOrder);
  894. this.setState({
  895. buttonStatusA: false
  896. });
  897. } else {
  898. this.setState({
  899. buttonStatusA: true
  900. });
  901. }
  902. },
  903. closeDesc(e, s) {
  904. this.state.activeKey = "a";
  905. this.state.userDetaile = false;
  906. this.state.signBillVisible = false;
  907. this.state.visible = e;
  908. if (s) {
  909. this.loadData(this.state.pageNo);
  910. }
  911. },
  912. // 获取原订单编号
  913. getPrimaryOrder(value) {
  914. this.setState({
  915. primaryOrder: value
  916. });
  917. },
  918. getAdditionalOrder(value) {
  919. this.setState({
  920. additionalOrder: value
  921. });
  922. },
  923. getUrl(url) {
  924. let theorgCodeUrl = [];
  925. if (url.length) {
  926. let picArr = [];
  927. url.map(function (item) {
  928. if (
  929. item.response &&
  930. item.response.data &&
  931. item.response.data.length
  932. ) {
  933. picArr.push(item.response.data);
  934. }
  935. });
  936. theorgCodeUrl = picArr.join(",");
  937. }
  938. return theorgCodeUrl;
  939. },
  940. sureOut() {
  941. if (!this.state.companyName) {
  942. message.warning("公司名称不能为空");
  943. return;
  944. }
  945. if (!this.state.unitPrice) {
  946. message.warning("单价不能为空");
  947. return;
  948. }
  949. if (!this.state.unitNumber) {
  950. message.warning("数量不能为空");
  951. return;
  952. }
  953. if (!this.state.amount) {
  954. message.warning("总金额不能为空");
  955. return;
  956. }
  957. if (!this.state.outsourceRemarks) {
  958. message.warning("备注不能为空");
  959. return;
  960. }
  961. if (this.state.pictureUrl.length === 0) {
  962. message.warning("合同扫描件不能为空");
  963. return;
  964. }
  965. $.ajax({
  966. method: "POST",
  967. dataType: "json",
  968. crossDomain: false,
  969. url: globalConfig.context + "/api/admin/outsourceOrg/auditOutsource",
  970. data: {
  971. id: this.state.id,
  972. orderNo: this.state.orderNo,
  973. companyName: this.state.companyName,
  974. amount: this.state.amount,
  975. outsourceRemarks: this.state.outsourceRemarks,
  976. unitNumber: this.state.unitNumber,
  977. unitPrice: this.state.unitPrice,
  978. attachmentUrl: this.getUrl(this.state.attachmentUrl).length
  979. ? this.getUrl(this.state.attachmentUrl)
  980. : "",
  981. orderStatus: 2,
  982. pictureUrl: this.getUrl(this.state.pictureUrl).length
  983. ? this.getUrl(this.state.pictureUrl)
  984. : ""
  985. }
  986. }).done(
  987. function (data) {
  988. this.setState({
  989. loading: false
  990. });
  991. if (!data.error.length) {
  992. message.success("发起成功!");
  993. this.outReset();
  994. this.visitCancel();
  995. } else {
  996. message.warning(data.error[0].message);
  997. }
  998. }.bind(this)
  999. );
  1000. },
  1001. //关闭输入理由框
  1002. noCancel() {
  1003. this.setState({
  1004. noVisible: false,
  1005. aloading: false,
  1006. reason: ""
  1007. });
  1008. },
  1009. //重置
  1010. reset() {
  1011. this.setState({
  1012. signBillVisible: false
  1013. });
  1014. this.state.orderNo = "";
  1015. this.state.customerName = "";
  1016. this.state.releaseDate[0] = undefined;
  1017. this.state.releaseDate[1] = undefined;
  1018. this.state.approval = undefined;
  1019. this.loadData(1);
  1020. },
  1021. outReset() {
  1022. this.setState({
  1023. companyName: "",
  1024. amount: "",
  1025. unitPrice: "",
  1026. unitNumber: "",
  1027. outsourceRemarks: "",
  1028. attachmentUrl: [],
  1029. pictureUrl: []
  1030. });
  1031. },
  1032. getOrgCodeUrl(e) {
  1033. this.setState({ pictureUrl: e });
  1034. },
  1035. //关闭详情
  1036. visitCancel() {
  1037. this.setState(
  1038. {
  1039. visible: false,
  1040. activeKey: "a"
  1041. },
  1042. () => {
  1043. this.setState({
  1044. activeKey: "a"
  1045. });
  1046. }
  1047. );
  1048. this.loadData(this.state.page);
  1049. // console.log("table",this.state.activeKey);
  1050. },
  1051. visitOk() {
  1052. this.setState({
  1053. visible: false
  1054. });
  1055. },
  1056. createTabs() {
  1057. $.ajax({
  1058. url: globalConfig.context + "/api/admin/orderChange/getOrderChange",
  1059. method: "get",
  1060. data: {
  1061. orderNo: this.state.orderNo
  1062. },
  1063. success: data => {
  1064. if (data.error && data.error.length) {
  1065. message.warning(data.error[0].message);
  1066. } else {
  1067. this.setState({
  1068. tabList: data.data
  1069. });
  1070. }
  1071. }
  1072. });
  1073. },
  1074. changeList(arr) {
  1075. const newArr = [];
  1076. this.state.columns.forEach(item => {
  1077. arr.forEach(val => {
  1078. if (val === item.title) {
  1079. newArr.push(item);
  1080. }
  1081. });
  1082. });
  1083. this.setState({
  1084. changeList: newArr
  1085. });
  1086. },
  1087. render() {
  1088. const tabList = this.state.tabList || [];
  1089. const formItemLayout = {
  1090. labelCol: { span: 8 },
  1091. wrapperCol: { span: 14 }
  1092. };
  1093. const FormItem = Form.Item;
  1094. const { TabPane } = Tabs;
  1095. return (
  1096. <div className="user-content">
  1097. <ShowModalDiv ShowModal={this.state.showModal} />
  1098. <div className="content-title">
  1099. <span>合同变更审核订单</span>
  1100. </div>
  1101. <div className="user-search">
  1102. <Tabs
  1103. defaultActiveKey="1"
  1104. onChange={this.callback}
  1105. className="test">
  1106. <TabPane tab="搜索" key="1">
  1107. <div style={{ marginLeft: 10 }}>
  1108. <SearchInput search={this.search} />
  1109. </div>
  1110. </TabPane>
  1111. <TabPane tab="更改表格显示数据" key="2">
  1112. <div style={{ marginLeft: 10 }}>
  1113. <ChooseList
  1114. columns={this.state.columns}
  1115. changeFn={this.changeList}
  1116. changeList={this.state.changeList}
  1117. top={55}
  1118. margin={11}
  1119. />
  1120. </div>
  1121. </TabPane>
  1122. </Tabs>
  1123. <div className="patent-table">
  1124. <Spin spinning={this.state.loading}>
  1125. <Table
  1126. size="small"
  1127. bordered
  1128. columns={
  1129. this.state.changeList
  1130. ? this.state.changeList
  1131. : this.state.columns
  1132. }
  1133. dataSource={this.state.dataSource}
  1134. pagination={this.state.pagination}
  1135. onRowClick={this.tableRowClick}
  1136. />
  1137. </Spin>
  1138. </div>
  1139. <Modal
  1140. className="customeDetails"
  1141. footer=""
  1142. maskClosable={false}
  1143. width="900px"
  1144. visible={this.state.visible}
  1145. onOk={this.visitOk}
  1146. onCancel={this.visitCancel}
  1147. >
  1148. <Tabs
  1149. activeKey={this.state.activeKey}
  1150. onChange={this.callback}
  1151. type="card"
  1152. tabBarExtraContent={
  1153. <div style={{fontWeight:'bold',paddingRight:'15px'}}>
  1154. <OrderItemStatus deleteSign={this.state.deleteSign}/>
  1155. </div>
  1156. }
  1157. >
  1158. <TabPane tab="订单详情" key="a">
  1159. <Form
  1160. layout="horizontal"
  1161. onSubmit={this.handleSubmit}
  1162. id="demand-form"
  1163. style={{ paddingBottom: "40px" }}
  1164. >
  1165. <Spin spinning={this.state.loading}>
  1166. <OrderDetail
  1167. orderData={this.state.orderData}
  1168. getOrderLog={this.getOrderLog}
  1169. dataSourceX={this.state.dataSourceX}
  1170. contactList={this.state.contactList}
  1171. orderNo={this.state.orderNo}
  1172. totalCui={this.state.totalCui}
  1173. contactListNew={this.state.contactListNew}
  1174. />
  1175. </Spin>
  1176. </Form>
  1177. </TabPane>
  1178. {/* <TabPane tab="合同变更记录" key="2">
  1179. <ChangeDetail
  1180. data={this.state.contractData}
  1181. pictureUrl={this.state.voucherUrl}
  1182. processState={this.props.processState}
  1183. // loadData={this.callback}
  1184. reset={this.state.visible}
  1185. dataSource={this.state.dataProps}
  1186. proceedsData={this.state.proceedsData}
  1187. proceedsTotal={this.state.proTotal}
  1188. invoiceTotal={this.state.invTotal}
  1189. contactList={this.state.refundInvoice}
  1190. onCancel={this.visitCancel}
  1191. />
  1192. </TabPane> */}
  1193. {tabList.map((item, index, arr) => {
  1194. return (
  1195. <TabPane tab={"合同变更记录" + (index + 1)} key={item.id}>
  1196. <ChangeDetail
  1197. id={item.id}
  1198. money={index == arr.length - 1 ? this.state.orderData.totalAmount + "" : undefined}
  1199. data={this.state.contractData}
  1200. pictureUrl={this.state.voucherUrl}
  1201. processState={this.props.processState}
  1202. // loadData={this.callback}
  1203. reset={this.state.visible}
  1204. dataSource={this.state.dataProps}
  1205. proceedsData={this.state.proceedsData}
  1206. proceedsTotal={this.state.proTotal}
  1207. invoiceTotal={this.state.invTotal}
  1208. contactList={this.state.refundInvoice}
  1209. onCancel={this.visitCancel}
  1210. />
  1211. </TabPane>
  1212. );
  1213. })}
  1214. {/* {this.state.status === 4 ? (
  1215. <TabPane tab="原订单" key="3">
  1216. <Form
  1217. layout="horizontal"
  1218. onSubmit={this.handleSubmit}
  1219. id="demand-form"
  1220. style={{ paddingBottom: "40px" }}
  1221. >
  1222. <Spin spinning={this.state.loading}>
  1223. <OrderDetail
  1224. orderData={this.state.primaryOrderData}
  1225. getOrderLog={this.getOrderLog}
  1226. dataSourceX={this.state.dataSourceX}
  1227. contactList={this.state.contactList}
  1228. orderNo={this.state.primaryOrderNo}
  1229. totalCui={this.state.totalCui}
  1230. contactListNew={this.state.contactListNew}
  1231. />
  1232. </Spin>
  1233. </Form>
  1234. </TabPane>
  1235. ) : (
  1236. ""
  1237. )} */}
  1238. {tabList.map((item, index) => {
  1239. if (item.usedOrder) {
  1240. return (
  1241. <TabPane
  1242. tab={"原订单" + (index + 1)}
  1243. key={item.usedOrder}
  1244. >
  1245. <Form
  1246. layout="horizontal"
  1247. onSubmit={this.handleSubmit}
  1248. id="demand-form"
  1249. style={{ paddingBottom: "40px" }}
  1250. >
  1251. <Spin spinning={this.state.loading}>
  1252. <OrderDetail
  1253. orderData={this.state.primaryOrderData}
  1254. getOrderLog={this.getOrderLog}
  1255. dataSourceX={this.state.dataSourceX}
  1256. contactList={this.state.contactList}
  1257. orderNo={this.state.primaryOrderNo}
  1258. totalCui={this.state.totalCui}
  1259. contactListNew={this.state.contactListNew}
  1260. />
  1261. </Spin>
  1262. </Form>
  1263. </TabPane>
  1264. );
  1265. } else {
  1266. return "";
  1267. }
  1268. })}
  1269. {this.state.status === 4 && this.state.isAddition ? (
  1270. this.state.type === 4 || this.state.type === 5 ? (
  1271. <TabPane tab="附加订单" key="c">
  1272. <OrderDetail
  1273. orderData={this.state.additionalOrderData}
  1274. getOrderLog={this.getOrderLog}
  1275. dataSourceX={this.state.dataSourceX}
  1276. contactList={this.state.contactList}
  1277. orderNo={this.state.additionalOrder}
  1278. totalCui={this.state.totalCui}
  1279. contactListNew={this.state.contactListNew}
  1280. />
  1281. </TabPane>
  1282. ) : (
  1283. ""
  1284. )
  1285. ) : (
  1286. ""
  1287. )}
  1288. </Tabs>
  1289. </Modal>
  1290. <Modal
  1291. maskClosable={false}
  1292. visible={this.state.noVisible}
  1293. onOk={this.handleOk}
  1294. onCancel={this.noCancel}
  1295. width="400px"
  1296. title={"拒绝理由"}
  1297. footer=""
  1298. className="admin-desc-content"
  1299. confirmLoading={this.state.confirmLoading}
  1300. >
  1301. <Form layout="horizontal" id="demand-form">
  1302. <Spin spinning={this.state.loading}>
  1303. <div className="clearfix">
  1304. <FormItem
  1305. labelCol={{ span: 4 }}
  1306. wrapperCol={{ span: 16 }}
  1307. label="拒绝理由"
  1308. >
  1309. <Input
  1310. type="textarea"
  1311. placeholder="请输入拒绝理由"
  1312. rows={4}
  1313. value={this.state.reason}
  1314. onChange={e => {
  1315. this.setState({ reason: e.target.value });
  1316. }}
  1317. />
  1318. </FormItem>
  1319. </div>
  1320. <div className="clearfix">
  1321. <Button
  1322. className="cancel"
  1323. type="primary"
  1324. onClick={this.examOks}
  1325. style={{ marginLeft: "50px" }}
  1326. htmlType="submit"
  1327. loading={this.state.aloading}
  1328. >
  1329. 确定
  1330. </Button>
  1331. <Button
  1332. className="cancel"
  1333. type="ghost"
  1334. onClick={this.noCancel}
  1335. style={{ marginLeft: "50px" }}
  1336. >
  1337. 取消
  1338. </Button>
  1339. </div>
  1340. </Spin>
  1341. </Form>
  1342. </Modal>
  1343. {/* <Modal
  1344. visible={this.state.rizhivisible}
  1345. className="admin-desc-content"
  1346. width="800px"
  1347. maskClosable={false}
  1348. title="订单日志"
  1349. footer={null}
  1350. onCancel={this.closeOrderLog}
  1351. >
  1352. <div className="patent-table">
  1353. <Spin spinning={this.state.loading}>
  1354. <Table
  1355. bordered
  1356. columns={this.state.columnsrizhi}
  1357. dataSource={this.state.dataSourcerizhi}
  1358. pagination={false}
  1359. />
  1360. </Spin>
  1361. </div>
  1362. </Modal> */}
  1363. <OrderRiZi
  1364. dataSourcerizhi={this.state.dataSourcerizhi}
  1365. closeOrderLog={this.closeOrderLog}
  1366. visible={this.state.rizhivisible}
  1367. loading={this.state.loading}
  1368. />
  1369. </div>
  1370. {this.state.addnextVisible && <ProjectDetailsReadOnly
  1371. infor={this.state.dataInfor}
  1372. visible={this.state.addnextVisible}
  1373. onCancel={this.nextCancel}
  1374. />}
  1375. </div>
  1376. );
  1377. }
  1378. })
  1379. );
  1380. export default contractChange;