contractJszj.js 43 KB

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