contractYxgly.js 43 KB

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