contractCwzy.js 45 KB

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