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