contractCwzj.js 42 KB

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