contractJsjl.js 43 KB

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