shouKuang.jsx 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347
  1. import React from "react";
  2. import $ from "jquery/src/ajax";
  3. import moment from "moment";
  4. import "./public.less";
  5. import {
  6. Button,
  7. Form,
  8. Input,
  9. Spin,
  10. Table,
  11. Select,
  12. message,
  13. DatePicker,
  14. Modal,
  15. Tabs
  16. } from "antd";
  17. import OrderDesc from "../orderDetail/orderDesc";
  18. import Receivable from "./receivable";
  19. import Assign from "@/manageCenter/publicComponent/assign";
  20. import ReactToPrint from "react-to-print";
  21. import {
  22. getLiquidationStatus,
  23. getProcessStatus,
  24. getApproval,
  25. getInvoiceStatus,
  26. getTransactionProject,
  27. } from "@/tools";
  28. import { ChooseList } from "../../order/orderNew/chooseList"
  29. const FormItem = Form.Item;
  30. const { TabPane } = Tabs;
  31. const ShouKuang = React.createClass({
  32. departmentList() {
  33. this.setState({
  34. loading: true
  35. });
  36. $.ajax({
  37. method: "get",
  38. dataType: "json",
  39. crossDomain: false,
  40. url: globalConfig.context + "/api/admin/organization/selectSuperId",
  41. data: {},
  42. success: function(data) {
  43. let thedata = data.data;
  44. let theArr = [];
  45. if (!thedata) {
  46. if (data.error && data.error.length) {
  47. message.warning(data.error[0].message);
  48. }
  49. } else {
  50. thedata.map(function(item, index) {
  51. theArr.push({
  52. key: index,
  53. name: item.name,
  54. id: item.id
  55. });
  56. });
  57. }
  58. this.setState({
  59. departmentArr: theArr
  60. });
  61. }.bind(this)
  62. }).always(
  63. function() {
  64. this.setState({
  65. loading: false
  66. });
  67. }.bind(this)
  68. );
  69. },
  70. loadData(pageNo,pageSize) {
  71. this.state.data = [];
  72. this.state.pagination.pageSize = 10
  73. this.setState({
  74. selectedRowKeys: [],
  75. selectedRowKey: [],
  76. page: pageNo,
  77. loading: true,
  78. pagination: this.state.pagination
  79. });
  80. $.ajax({
  81. method: "get",
  82. dataType: "json",
  83. crossDomain: false,
  84. url: globalConfig.context + "/api/admin/financial/financeList",
  85. data: {
  86. pageNo: pageNo || 1,
  87. pageSize: pageSize || this.state.pagination.pageSize,
  88. buyerName: this.state.nameSearch, //客户名称
  89. orderNo: this.state.orderNoSearch,
  90. startTime: this.state.releaseDate[0],
  91. endTime: this.state.releaseDate[1],
  92. departmentId: this.state.departmenttList,
  93. processStatus: this.state.processStatusSearch,
  94. contractNo: this.state.contractNoSearch
  95. },
  96. success: function(data) {
  97. let theArr = [];
  98. if (!data.data || !data.data.pagination.list) {
  99. if (data.error && data.error.length) {
  100. message.warning(data.error[0].message);
  101. }
  102. } else {
  103. for (let i = 0; i < data.data.pagination.list.length; i++) {
  104. let thisdata = data.data.pagination.list[i];
  105. theArr.push({
  106. key: thisdata.orderNo,
  107. orderNo: thisdata.orderNo,
  108. orderType: thisdata.orderType,
  109. orderStatus: thisdata.orderStatus,
  110. sellerName: thisdata.sellerName,
  111. processStatus: thisdata.processStatus,
  112. liquidationStatus: thisdata.liquidationStatus,
  113. approval: thisdata.approval,
  114. buyerName: thisdata.buyerName,
  115. actuallyTotalAmount: thisdata.actuallyTotalAmount,
  116. signTime: thisdata.signTime,
  117. companyId: thisdata.companyId,
  118. companyName: thisdata.companyName,
  119. buyerId: thisdata.buyerId,
  120. buyerName: thisdata.buyerName,
  121. contractNo: thisdata.contractNo,
  122. createTime: thisdata.createTime,
  123. departmentName: thisdata.departmentName,
  124. invoiceAmount: thisdata.invoiceAmount,
  125. finalReceivables: thisdata.finalReceivables,
  126. finalReceivablesTime: thisdata.finalReceivablesTime,
  127. signTotalAmount: thisdata.signTotalAmount
  128. });
  129. }
  130. }
  131. this.state.pagination.current = data.data.pagination.pageNo;
  132. this.state.pagination.total = data.data.pagination.totalCount;
  133. if (
  134. data.data &&
  135. data.data.pagination.list &&
  136. !data.data.pagination.list.length
  137. ) {
  138. this.state.pagination.current = 0;
  139. this.state.pagination.total = 0;
  140. }
  141. this.setState({
  142. totalPage: data.data.pagination.totalPage,
  143. dataSource: theArr,
  144. pagination: this.state.pagination,
  145. totalHui: data.data.count ? data.data.count.signTotalAmount : 0 ,
  146. hui: data.data.count ? data.data.count.actuallyTotalAmount : 0,
  147. });
  148. }.bind(this)
  149. }).always(
  150. function() {
  151. this.setState({
  152. loading: false
  153. });
  154. }.bind(this)
  155. );
  156. },
  157. getInitialState() {
  158. return {
  159. searchMore: true,
  160. dvisible: false,
  161. assignVisibleX: false,
  162. assignVisibleY: false,
  163. releaseDate: [],
  164. assignDataX: [],
  165. assignDataY: [],
  166. totalPage: 0,
  167. processStatusSearch: "3",
  168. boHuivisible: false,
  169. selectedRowKeys: [],
  170. selectedRows: [],
  171. loading: false,
  172. pagination: {
  173. defaultCurrent: 1,
  174. defaultPageSize: 10,
  175. showQuickJumper: true,
  176. pageSize: 10,
  177. onChange: function(page) {
  178. this.loadData(page);
  179. }.bind(this),
  180. showTotal: function(total) {
  181. return "共" + total + "条数据";
  182. }
  183. },
  184. // 子组件改变的表格title数组
  185. changeList: undefined,
  186. printColumns: [
  187. {
  188. title: "合同编号",
  189. dataIndex: "contractNo",
  190. key: "contractNo"
  191. },
  192. {
  193. title: "订单编号",
  194. dataIndex: "orderNo",
  195. key: "orderNo"
  196. // fixed: "left"
  197. },
  198. {
  199. title: "客户名称",
  200. dataIndex: "buyerName",
  201. key: "buyerName"
  202. },
  203. {
  204. title: "订单部门",
  205. dataIndex: "departmentName",
  206. key: "departmentName"
  207. },
  208. {
  209. title: "订单负责人",
  210. dataIndex: "sellerName",
  211. key: "sellerName"
  212. },
  213. {
  214. title: "签单日期",
  215. dataIndex: "signTime",
  216. key: "signTime"
  217. },
  218. {
  219. title: "下单日期",
  220. dataIndex: "createTime",
  221. key: "createTime"
  222. },
  223. {
  224. title: "签单金额(万元)",
  225. dataIndex: "signTotalAmount",
  226. key: "signTotalAmount"
  227. },
  228. {
  229. title: "开票金额(万元)",
  230. dataIndex: "invoiceAmount",
  231. key: "invoiceAmount"
  232. },
  233. {
  234. title: "已收款(万元)",
  235. dataIndex: "actuallyTotalAmount",
  236. key: "actuallyTotalAmount"
  237. },
  238. {
  239. title: "最近收款(万元)",
  240. dataIndex: "finalReceivables",
  241. key: "finalReceivables"
  242. },
  243. {
  244. title: "最近收款时间",
  245. dataIndex: "finalReceivablesTime",
  246. key: "finalReceivablesTime"
  247. },
  248. {
  249. title: "结算状态",
  250. dataIndex: "liquidationStatus",
  251. key: "liquidationStatus",
  252. render: text => {
  253. return getLiquidationStatus(text);
  254. }
  255. },
  256. {
  257. title: "流程状态",
  258. dataIndex: "processStatus",
  259. key: "processStatus",
  260. render: text => {
  261. return getProcessStatus(text);
  262. }
  263. },
  264. {
  265. title: "特批状态",
  266. dataIndex: "approval",
  267. key: "approval",
  268. render: text => {
  269. return getApproval(text);
  270. }
  271. }
  272. ],
  273. columns: [
  274. {
  275. title: "合同编号",
  276. dataIndex: "contractNo",
  277. key: "contractNo",
  278. className: "title-table"
  279. },
  280. {
  281. title: "订单编号",
  282. dataIndex: "orderNo",
  283. key: "orderNo",
  284. className: "title-table"
  285. // fixed: "left"
  286. },
  287. {
  288. title: "客户名称",
  289. dataIndex: "buyerName",
  290. key: "buyerName",
  291. className: "title-table"
  292. },
  293. {
  294. title: "订单部门",
  295. dataIndex: "departmentName",
  296. key: "departmentName",
  297. className: "title-table"
  298. },
  299. {
  300. title: "订单负责人",
  301. dataIndex: "sellerName",
  302. key: "sellerName",
  303. className: "title-table"
  304. },
  305. {
  306. title: "签单日期",
  307. dataIndex: "signTime",
  308. key: "signTime",
  309. className: "title-table"
  310. },
  311. {
  312. title: "下单日期",
  313. dataIndex: "createTime",
  314. key: "createTime",
  315. className: "title-table"
  316. },
  317. {
  318. title: "签单金额(万元)",
  319. dataIndex: "signTotalAmount",
  320. key: "signTotalAmount",
  321. className: "title-table"
  322. },
  323. {
  324. title: "开票金额(万元)",
  325. dataIndex: "invoiceAmount",
  326. key: "invoiceAmount",
  327. className: "title-table"
  328. },
  329. {
  330. title: "已收款(万元)",
  331. dataIndex: "actuallyTotalAmount",
  332. key: "actuallyTotalAmount",
  333. className: "title-table"
  334. },
  335. {
  336. title: "最近收款(万元)",
  337. dataIndex: "finalReceivables",
  338. key: "finalReceivables",
  339. className: "title-table"
  340. },
  341. {
  342. title: "最近收款时间",
  343. dataIndex: "finalReceivablesTime",
  344. key: "finalReceivablesTime",
  345. className: "title-table"
  346. },
  347. {
  348. title: "结算状态",
  349. dataIndex: "liquidationStatus",
  350. key: "liquidationStatus",
  351. className: "title-table",
  352. render: text => {
  353. return getLiquidationStatus(text);
  354. }
  355. },
  356. {
  357. title: "流程状态",
  358. dataIndex: "processStatus",
  359. key: "processStatus",
  360. className: "title-table",
  361. render: text => {
  362. return getProcessStatus(text);
  363. }
  364. },
  365. {
  366. title: "特批状态",
  367. dataIndex: "approval",
  368. key: "approval",
  369. className: "title-table",
  370. render: text => {
  371. return getApproval(text);
  372. }
  373. },
  374. // {
  375. // title: '订单状态',
  376. // dataIndex: 'orderStatus',
  377. // key: 'orderStatus',
  378. // render: text => { return getNewOrderStatus(text)}
  379. // },
  380. {
  381. title: "操作",
  382. dataIndex: "caozuo",
  383. key: "caouzo",
  384. className: "title-table",
  385. render: (text, recard) => {
  386. return (
  387. <div>
  388. {recard.liquidationStatus < 2 &&
  389. (recard.approval === 1 || recard.approval === 2) ? (
  390. <Button
  391. style={{ background: "rgb(192,192,192)" }}
  392. onClick={e => {
  393. e.stopPropagation(), this.evaluateX(recard);
  394. }}
  395. >
  396. 收款
  397. </Button>
  398. ) : (
  399. <Button
  400. type="primary"
  401. onClick={e => {
  402. e.stopPropagation(), this.evaluateX(recard);
  403. }}
  404. >
  405. 收款
  406. </Button>
  407. )}
  408. {recard.approval === 2 && recard.processStatus < 4 ? (
  409. <Button
  410. type="primary"
  411. onClick={e => {
  412. e.stopPropagation(), this.evaluateZ(recard);
  413. }}
  414. style={{ marginLeft: "5px" }}
  415. >
  416. 通过
  417. </Button>
  418. ) : (
  419. ""
  420. )}
  421. {!(
  422. recard.actuallyTotalAmount &&
  423. Number(recard.actuallyTotalAmount) > 0
  424. ) && (
  425. <Button
  426. type="danger"
  427. style={{ marginLeft: "5px" }}
  428. onClick={e => {
  429. e.stopPropagation(), this.reject(recard);
  430. }}
  431. >
  432. 驳回
  433. </Button>
  434. )}
  435. {
  436. <Button
  437. type="primary"
  438. style={{ marginLeft: "5px" }}
  439. onClick={e => {
  440. e.stopPropagation(), this.evaluateY(recard, "财务专员");
  441. }}
  442. >
  443. 转交
  444. </Button>
  445. }
  446. </div>
  447. );
  448. }
  449. }
  450. ],
  451. dataSource: [],
  452. searchTime: [],
  453. columnsDate: [
  454. {
  455. title: "编号",
  456. dataIndex: "id",
  457. key: "id"
  458. },
  459. {
  460. title: "订单编号",
  461. dataIndex: "orderno",
  462. key: "orderno"
  463. },
  464. {
  465. title: "开票金额(万元)",
  466. dataIndex: "amount",
  467. key: "amount"
  468. },
  469. {
  470. title: "申请时间",
  471. dataIndex: "createTime",
  472. key: "createTime"
  473. },
  474. {
  475. title: "开票状态",
  476. dataIndex: "status",
  477. key: "status",
  478. render: text => {
  479. return getInvoiceStatus(text);
  480. }
  481. }
  482. ],
  483. waterlistDate: [
  484. {
  485. title: "订单编号",
  486. dataIndex: "orderNo",
  487. key: "orderNo"
  488. },
  489. {
  490. title: "平台流水号",
  491. dataIndex: "billNo",
  492. key: "billNo"
  493. // fixed: "left"
  494. },
  495. {
  496. title: "收款金额(万元)",
  497. dataIndex: "transactionAmount",
  498. key: "transactionAmount"
  499. },
  500. {
  501. title: "收款方",
  502. dataIndex: "payeeName",
  503. key: "payeeName"
  504. },
  505. {
  506. title: "付款方",
  507. dataIndex: "payerName",
  508. key: "payerName"
  509. },
  510. {
  511. title: "流水科目",
  512. dataIndex: "transactionSubject",
  513. key: "transactionSubject",
  514. render: text => {
  515. return getTransactionProject(text);
  516. }
  517. },
  518. {
  519. title: "收款类型",
  520. dataIndex: "type",
  521. key: "type"
  522. },
  523. {
  524. title: "财务流水时间",
  525. dataIndex: "financialPayTimes",
  526. key: "financialPayTimes"
  527. },
  528. {
  529. title: "财务流水号",
  530. dataIndex: "financialPayNo",
  531. key: "financialPayNo"
  532. },
  533. {
  534. title: "订单负责人",
  535. dataIndex: "saleName",
  536. key: "saleName"
  537. },
  538. {
  539. title: "创建时间",
  540. dataIndex: "createTimes",
  541. key: "createTimes"
  542. }
  543. ],
  544. waterData: []
  545. };
  546. },
  547. // 特批通过
  548. evaluateZ(record) {
  549. $.ajax({
  550. method: "POST",
  551. dataType: "json",
  552. crossDomain: false,
  553. url: globalConfig.context + "/api/admin/financial/financeApproval",
  554. data: {
  555. orderNo: record.orderNo
  556. }
  557. }).done(
  558. function(data) {
  559. if (!data.error.length) {
  560. message.success("通过成功!");
  561. this.setState({
  562. loading: false
  563. });
  564. this.loadData();
  565. } else {
  566. message.warning(data.error[0].message);
  567. }
  568. }.bind(this)
  569. );
  570. },
  571. /* 收款 */
  572. evaluateX(recard) {
  573. this.state.assignDataX = recard;
  574. this.setState({
  575. assignVisibleX: true
  576. });
  577. },
  578. /* 转交 */
  579. evaluateY(recard, nub) {
  580. this.state.assignDataY = recard;
  581. this.setState({
  582. nub,
  583. assignVisibleY: true
  584. });
  585. },
  586. /* 驳回 */
  587. reject(recard) {
  588. this.setState({
  589. bohuiData: recard,
  590. boHuiVisible: true,
  591. content: ""
  592. });
  593. },
  594. boHuiOk() {
  595. this.setState({
  596. boHuiVisible: false
  597. });
  598. if (
  599. this.state.pagination.current == this.state.totalPage &&
  600. this.state.pagination.total % 10 == 1
  601. ) {
  602. this.loadData(this.state.page - 1);
  603. } else {
  604. this.loadData(this.state.page);
  605. }
  606. },
  607. boHuiCancel() {
  608. this.setState({
  609. boHuiVisible: false
  610. });
  611. },
  612. componentWillMount() {
  613. this.loadData();
  614. this.departmentList();
  615. },
  616. tableRowClick(record) {
  617. this.state.RowData = record;
  618. this.setState({
  619. showDesc: true
  620. });
  621. },
  622. closeDesc(e, s) {
  623. this.state.showDesc = e;
  624. if (s) {
  625. this.loadData(this.state.page);
  626. }
  627. },
  628. closeAssignX(e, s) {
  629. this.state.assignDataX = {};
  630. this.state.assignVisibleX = e;
  631. if (s) {
  632. this.loadData(this.state.page);
  633. }
  634. },
  635. closeAssignY(e, s) {
  636. this.state.assignDataY = {};
  637. this.state.assignVisibleY = e;
  638. if (s) {
  639. this.loadData(this.state.page);
  640. }
  641. },
  642. search() {
  643. this.loadData();
  644. },
  645. reset() {
  646. this.state.nameSearch = "";
  647. this.state.releaseDate = [];
  648. this.state.orderNoSearch = "";
  649. this.state.departmenttList = undefined;
  650. this.state.processStatus = [];
  651. this.state.contractNoSearch = "";
  652. this.loadData();
  653. },
  654. //驳回
  655. boHuiSubmit(e) {
  656. e.preventDefault();
  657. if (!this.state.content) {
  658. message.warning("请填写驳回原因");
  659. return false;
  660. }
  661. this.setState({
  662. loading: true
  663. });
  664. $.ajax({
  665. method: "POST",
  666. dataType: "json",
  667. crossDomain: false,
  668. url: globalConfig.context + "/api/admin/financial/reject",
  669. data: {
  670. orderNo: this.state.bohuiData.orderNo,
  671. reason: this.state.content
  672. }
  673. }).done(
  674. function(data) {
  675. if (!data.error.length) {
  676. message.success("驳回成功!");
  677. this.setState({
  678. loading: false
  679. });
  680. this.boHuiOk();
  681. } else {
  682. message.warning(data.error[0].message);
  683. }
  684. }.bind(this)
  685. );
  686. },
  687. searchSwitch() {
  688. this.setState({
  689. searchMore: !this.state.searchMore
  690. });
  691. },
  692. changeList(arr) {
  693. const newArr = [];
  694. this.state.columns.forEach(item => {
  695. arr.forEach(val => {
  696. if (val === item.title) {
  697. newArr.push(item);
  698. }
  699. });
  700. });
  701. this.setState({
  702. changeList: newArr
  703. });
  704. },
  705. callback(key) {
  706. console.log(key);
  707. },
  708. onSelectChange(selectedRowKeys) {
  709. // for(var i=0; i<selectedRowKeys.length; i++){
  710. // for(var j=i+1; j<selectedRowKeys.length; j++){
  711. // if(selectedRowKeys[i]==selectedRowKeys[j]){
  712. // selectedRowKeys.splice(j,1);
  713. // j--;
  714. // }
  715. // }
  716. // }
  717. this.setState({ selectedRowKeys });
  718. },
  719. inRecordCanl() {
  720. this.setState({
  721. bvisible: false
  722. });
  723. },
  724. inRecordData() {
  725. this.setState({
  726. loading: true
  727. });
  728. $.ajax({
  729. method: "get",
  730. dataType: "json",
  731. crossDomain: false,
  732. url:
  733. globalConfig.context +
  734. "/api/admin/orderInvoice/salesmanOrderInvoiceList",
  735. data: {
  736. orderNo: this.state.selectedRowKeys[0]
  737. },
  738. success: function(data) {
  739. let theArr = [];
  740. let sum = 0;
  741. if (!data.data) {
  742. if (data.error && data.error.length) {
  743. message.warning(data.error[0].message);
  744. }
  745. } else {
  746. for (let i = 0; i < data.data.list.length; i++) {
  747. let thisdata = data.data.list[i];
  748. sum += parseFloat(thisdata.amount);
  749. theArr.push({
  750. id: thisdata.id,
  751. orderno: thisdata.orderno, //订单编号
  752. amount: thisdata.amount, //签单金额
  753. createTime: thisdata.createTime, //流程状态
  754. status: thisdata.status, //结算状态
  755. rejectReason: thisdata.rejectReason
  756. });
  757. }
  758. }
  759. this.setState({
  760. recordData: theArr,
  761. sum: sum.toFixed(4)
  762. });
  763. }.bind(this)
  764. }).done(
  765. function() {
  766. this.setState({
  767. loading: false
  768. });
  769. }.bind(this)
  770. );
  771. },
  772. waterData() {
  773. this.state.data = [];
  774. this.setState({
  775. loading: true
  776. });
  777. $.ajax({
  778. method: "get",
  779. dataType: "json",
  780. crossDomain: false,
  781. url: globalConfig.context + "/api/admin/financial/myBillList",
  782. data: {
  783. orderNo: this.state.selectedRowKeys[0]
  784. },
  785. success: function(data) {
  786. let theArr = [];
  787. let waterSum = 0;
  788. if (!data.data || !data.data.list) {
  789. if (data.error && data.error.length) {
  790. message.warning(data.error[0].message);
  791. }
  792. } else {
  793. for (let i = 0; i < data.data.list.length; i++) {
  794. let thisdata = data.data.list[i];
  795. waterSum += parseFloat(thisdata.transactionAmount);
  796. theArr.push({
  797. key: i,
  798. orderNo: thisdata.orderNo,
  799. billNo: thisdata.billNo,
  800. transactionAmount: thisdata.transactionAmount,
  801. payeeName: thisdata.payeeName,
  802. payerName: thisdata.payerName,
  803. transactionSubject: thisdata.transactionSubject,
  804. transactionChannel: thisdata.transactionChannel,
  805. financialPayTimes: thisdata.financialPayTimes,
  806. financialPayNo: thisdata.financialPayNo,
  807. createrName: thisdata.createrName,
  808. saleName: thisdata.saleName,
  809. createTimes: thisdata.createTimes,
  810. type: thisdata.type == 0 ? "手工" : "批量"
  811. });
  812. }
  813. }
  814. this.setState({
  815. waterData: theArr,
  816. waterSum: waterSum.toFixed(4)
  817. });
  818. }.bind(this)
  819. }).always(
  820. function() {
  821. this.setState({
  822. loading: false
  823. });
  824. }.bind(this)
  825. );
  826. },
  827. waterCanl() {
  828. this.setState({
  829. cvisible: false
  830. });
  831. },
  832. exportKaip() {
  833. window.location.href =
  834. globalConfig.context +
  835. "/api/admin/receivables/exportInvoice?" +
  836. `orderNo=${this.state.selectedRowKeys}`;
  837. },
  838. exportAll() {
  839. window.location.href =
  840. globalConfig.context +
  841. "/api/admin/receivables/exportReceivables?" +
  842. `orderNo=${this.state.orderNoSearch ? this.state.orderNoSearch : ""}&buyerName=${this.state.nameSearch ? this.state.nameSearch : ""}&departmentId=${this.state.departmenttList ? this.state.departmenttList : ""}&contractNo=${this.state.contractNoSearch ? this.state.contractNoSearch : ""}&processStatus=${this.state.processStatusSearch}`;
  843. },
  844. exportWater() {
  845. window.location.href =
  846. globalConfig.context +
  847. "/api/admin/receivables/exportMyBill?" +
  848. `orderNo=${this.state.selectedRowKeys}`;
  849. },
  850. printAll() {
  851. this.setState({
  852. dvisible: true,
  853. // loading: true
  854. });
  855. this.loadData(1,9999)
  856. this.state.pagination.pageSize = 9999
  857. this.setState({
  858. pagination: this.state.pagination
  859. });
  860. window.setTimeout(()=> {
  861. document.querySelectorAll(".ant-pagination.ant-table-pagination.mini")[0].style.display="none"
  862. // let tr = document.querySelectorAll(".patent-table tr");
  863. // for(let i = 0; i < tr.length; i++) {
  864. // tr[i].style.fontSize = "6px"
  865. // }
  866. // let td = document.querySelectorAll(".patent-table tr td");
  867. // for (let i = 0; i < td.length; i++) {
  868. // td[i].style.padding = "0 0 0 0";
  869. // }
  870. },100)
  871. },
  872. render() {
  873. const formItemLayout = {
  874. labelCol: { span: 8 },
  875. wrapperCol: { span: 14 }
  876. };
  877. const { RangePicker } = DatePicker;
  878. var departmentArr = this.state.departmentArr || [];
  879. const { loading, selectedRowKeys, visible } = this.state;
  880. const rowSelection = {
  881. selectedRowKeys,
  882. onChange: this.onSelectChange,
  883. hideDefaultSelections: true,
  884. type: "radio"
  885. };
  886. return (
  887. <div className="user-content">
  888. <div className="content-title" style={{ marginBottom: 10 }}>
  889. <span style={{ fontWeight: 900, fontSize: 16 }}>收款结算</span>
  890. </div>
  891. <Tabs defaultActiveKey="2" onChange={this.callback}>
  892. <TabPane tab="更改表格显示数据" key="1">
  893. <div style={{ marginLeft: 10 }}>
  894. <ChooseList
  895. columns={this.state.columns}
  896. changeFn={this.changeList}
  897. changeList={this.state.changeList}
  898. top={55}
  899. />
  900. </div>
  901. </TabPane>
  902. <TabPane tab="搜索" key="2">
  903. <div className="user-search" style={{ marginLeft: 10 }}>
  904. <Input
  905. placeholder="订单编号"
  906. value={this.state.orderNoSearch}
  907. onChange={e => {
  908. this.setState({ orderNoSearch: e.target.value });
  909. }}
  910. />
  911. <Input
  912. placeholder="客户名称"
  913. value={this.state.nameSearch}
  914. onChange={e => {
  915. this.setState({ nameSearch: e.target.value });
  916. }}
  917. />
  918. <Select
  919. placeholder="订单部门"
  920. style={{ width: 150, marginRight: 10 }}
  921. value={this.state.departmenttList}
  922. onChange={e => {
  923. this.setState({ departmenttList: e });
  924. }}
  925. >
  926. {departmentArr.map(function(item) {
  927. return (
  928. <Select.Option key={item.id}>{item.name}</Select.Option>
  929. );
  930. })}
  931. </Select>
  932. <Input
  933. placeholder="合同编号"
  934. value={this.state.contractNoSearch}
  935. onChange={e => {
  936. this.setState({
  937. contractNoSearch: e.target.value
  938. });
  939. }}
  940. />
  941. <Select
  942. placeholder="流程状态"
  943. onChange={e => {
  944. this.setState({ processStatusSearch: e });
  945. }}
  946. style={{ width: 160, marginRight: 5 }}
  947. value={this.state.processStatusSearch}
  948. >
  949. <Option value="3">未分配</Option>
  950. <Option value="4">已分配</Option>
  951. </Select>
  952. <span style={{ marginRight: 10 }}>下单日期:</span>
  953. <RangePicker
  954. value={[
  955. this.state.releaseDate[0]
  956. ? moment(this.state.releaseDate[0])
  957. : null,
  958. this.state.releaseDate[1]
  959. ? moment(this.state.releaseDate[1])
  960. : null
  961. ]}
  962. onChange={(data, dataString) => {
  963. this.setState({ releaseDate: dataString });
  964. }}
  965. />
  966. <Button
  967. type="primary"
  968. onClick={this.search}
  969. style={{ marginLeft: 10 }}
  970. >
  971. 搜索
  972. </Button>
  973. <Button onClick={this.reset}>重置</Button>
  974. </div>
  975. </TabPane>
  976. <TabPane tab="打印" key="3">
  977. <Button
  978. type="primary"
  979. style={{ margin: "0px 0px 10px 10px" }}
  980. onClick={this.printAll}
  981. disabled={!this.state.dataSource.length}
  982. >
  983. 打印所有列表信息
  984. </Button>
  985. <Button
  986. type="primary"
  987. disabled={this.state.selectedRowKeys.length != 1}
  988. style={{ margin: "0px 0px 10px 10px" }}
  989. onClick={() => {
  990. this.inRecordData();
  991. this.setState({
  992. bvisible: true
  993. });
  994. }}
  995. >
  996. 打印开票详情
  997. </Button>
  998. <Button
  999. type="primary"
  1000. disabled={this.state.selectedRowKeys.length != 1}
  1001. style={{ margin: "0px 0px 10px 10px" }}
  1002. onClick={() => {
  1003. this.waterData();
  1004. this.setState({
  1005. cvisible: true
  1006. });
  1007. }}
  1008. >
  1009. 打印收款流水
  1010. </Button>
  1011. </TabPane>
  1012. <TabPane tab="导出Excel" key="4">
  1013. <Button
  1014. type="primary"
  1015. style={{ margin: "0px 0px 10px 10px" }}
  1016. onClick={this.exportAll}
  1017. >
  1018. 导出当前列表
  1019. </Button>
  1020. <Button
  1021. type="primary"
  1022. disabled={!this.state.selectedRowKeys.length}
  1023. style={{ margin: "0px 0px 10px 10px" }}
  1024. onClick={this.exportKaip}
  1025. >
  1026. 导出所选开票详情
  1027. </Button>
  1028. <Button
  1029. type="primary"
  1030. disabled={!this.state.selectedRowKeys.length}
  1031. style={{ margin: "0px 0px 10px 10px" }}
  1032. onClick={this.exportWater}
  1033. >
  1034. 导出所选收款详情流水
  1035. </Button>
  1036. </TabPane>
  1037. <TabPane tab="查看" key="5">
  1038. <Button
  1039. type="primary"
  1040. disabled={this.state.selectedRowKeys.length != 1}
  1041. style={{ margin: "0px 0px 10px 10px" }}
  1042. onClick={() => {
  1043. this.inRecordData();
  1044. this.setState({
  1045. bvisible: true
  1046. });
  1047. }}
  1048. >
  1049. 查看开票详情
  1050. </Button>
  1051. <Button
  1052. type="primary"
  1053. disabled={this.state.selectedRowKeys.length != 1}
  1054. style={{ margin: "0px 0px 10px 10px" }}
  1055. onClick={() => {
  1056. this.waterData();
  1057. this.setState({
  1058. cvisible: true
  1059. });
  1060. }}
  1061. >
  1062. 详情收款流水
  1063. </Button>
  1064. </TabPane>
  1065. </Tabs>
  1066. <div className="patent-table">
  1067. <Spin spinning={this.state.loading}>
  1068. <Table
  1069. bordered
  1070. columns={
  1071. this.state.changeList == undefined
  1072. ? this.state.columns
  1073. : this.state.changeList
  1074. }
  1075. dataSource={this.state.dataSource}
  1076. rowSelection={rowSelection}
  1077. scroll={{ x: "max-content", y: 0 }}
  1078. pagination={this.state.pagination}
  1079. onRowDoubleClick={this.tableRowClick.bind(this)}
  1080. size="small"
  1081. />
  1082. </Spin>
  1083. <p
  1084. style={{ display: "inline-block", fontSize: "14px", color: "red" }}
  1085. >
  1086. {
  1087. <span style={{ marginRight: 10 }}>
  1088. {`收款金额总计(万元):${
  1089. this.state.hui ? this.state.hui : "0"
  1090. }`}
  1091. </span>
  1092. }
  1093. {
  1094. <span>
  1095. {`合同额总计(万元):${
  1096. this.state.totalHui ? this.state.totalHui : "0"
  1097. }`}
  1098. </span>
  1099. }
  1100. </p>
  1101. </div>
  1102. <Assign
  1103. title="任务"
  1104. selApi={"/api/admin/newOrder/updateFinance"}
  1105. data={this.state.assignDataY}
  1106. showDesc={this.state.assignVisibleY}
  1107. closeDesc={this.closeAssignY.bind(this)}
  1108. // fenpaiData={8}
  1109. specially={0}
  1110. roleName={this.state.nub}
  1111. requestMethod={"get"}
  1112. />
  1113. <OrderDesc
  1114. data={this.state.RowData}
  1115. showDesc={this.state.showDesc}
  1116. closeDesc={this.closeDesc.bind(this)}
  1117. />
  1118. <Receivable
  1119. title="收款记录"
  1120. api="/api/admin/financial/addReceiptsFlow"
  1121. data={this.state.assignDataX}
  1122. showDesc={this.state.assignVisibleX}
  1123. closeDesc={this.closeAssignX.bind(this)}
  1124. />
  1125. <Modal
  1126. visible={this.state.boHuiVisible}
  1127. width="400px"
  1128. title="驳回备注"
  1129. footer=""
  1130. onOk={this.boHuiOk}
  1131. onCancel={this.boHuiCancel}
  1132. >
  1133. <Form layout="horizontal" onSubmit={this.boHuiSubmit}>
  1134. <Spin spinning={this.state.loading}>
  1135. <FormItem
  1136. labelCol={{ span: 5 }}
  1137. wrapperCol={{ span: 16 }}
  1138. label={
  1139. <span>
  1140. <strong style={{ color: "#f00" }}>*</strong>驳回原因
  1141. </span>
  1142. }
  1143. >
  1144. <Input
  1145. type="textarea"
  1146. rows={4}
  1147. placeholder="请输入驳回原因"
  1148. value={this.state.content}
  1149. onChange={e => {
  1150. this.setState({ content: e.target.value });
  1151. }}
  1152. />
  1153. </FormItem>
  1154. <FormItem wrapperCol={{ span: 12, offset: 5 }}>
  1155. <Button
  1156. type="primary"
  1157. htmlType="submit"
  1158. style={{ marginRight: 20 }}
  1159. >
  1160. 驳回
  1161. </Button>
  1162. <Button
  1163. type="default"
  1164. onClick={() => {
  1165. this.boHuiCancel();
  1166. }}
  1167. >
  1168. 取消
  1169. </Button>
  1170. </FormItem>
  1171. </Spin>
  1172. </Form>
  1173. </Modal>
  1174. <Modal
  1175. visible={this.state.bvisible}
  1176. footer=""
  1177. title="开票历史记录"
  1178. className="admin-desc-content"
  1179. width="900px"
  1180. onCancel={this.inRecordCanl}
  1181. >
  1182. <Spin spinning={this.state.loading}>
  1183. <div
  1184. className="patent-table"
  1185. ref={e => {
  1186. this.refs.kaiPiao = e;
  1187. }}
  1188. >
  1189. <Table
  1190. columns={this.state.columnsDate}
  1191. dataSource={this.state.recordData}
  1192. pagination={false}
  1193. bordered
  1194. />
  1195. <div className="clearfix" style={{ marginTop: "20px" }}>
  1196. <FormItem
  1197. className="half-item"
  1198. {...formItemLayout}
  1199. label={<span style={{ fontSize: "14px" }}>开票总计</span>}
  1200. >
  1201. <span>{this.state.sum + "(万元)"}</span>
  1202. </FormItem>
  1203. </div>
  1204. <ReactToPrint
  1205. trigger={() => (
  1206. <Button
  1207. type="primary"
  1208. style={{
  1209. float: "right",
  1210. // marginTop: 10,
  1211. position: "absolute",
  1212. top: -54,
  1213. right: 30
  1214. }}
  1215. >
  1216. 打印
  1217. </Button>
  1218. )}
  1219. content={() => this.refs.kaiPiao}
  1220. />
  1221. </div>
  1222. </Spin>
  1223. </Modal>
  1224. <Modal
  1225. visible={this.state.cvisible}
  1226. footer=""
  1227. title="详细收款流水"
  1228. className="admin-desc-content"
  1229. width="1300px"
  1230. onCancel={this.waterCanl}
  1231. >
  1232. <Spin spinning={this.state.loading}>
  1233. <div
  1234. className="patent-table"
  1235. ref={e => {
  1236. this.refs.shouKuan = e;
  1237. }}
  1238. >
  1239. <Table
  1240. columns={this.state.waterlistDate}
  1241. dataSource={this.state.waterData}
  1242. pagination={false}
  1243. bordered
  1244. />
  1245. <div className="clearfix" style={{ marginTop: "20px" }}>
  1246. <FormItem
  1247. className="half-item"
  1248. {...formItemLayout}
  1249. label={<span style={{ fontSize: "14px" }}>总计金额</span>}
  1250. >
  1251. <span>{this.state.waterSum + "(万元)"}</span>
  1252. </FormItem>
  1253. </div>
  1254. <ReactToPrint
  1255. trigger={() => (
  1256. <Button
  1257. type="primary"
  1258. style={{
  1259. float: "right",
  1260. position: "absolute",
  1261. top: -54,
  1262. right: 30
  1263. }}
  1264. >
  1265. 打印
  1266. </Button>
  1267. )}
  1268. content={() => this.refs.shouKuan}
  1269. />
  1270. </div>
  1271. </Spin>
  1272. </Modal>
  1273. <Modal
  1274. visible={this.state.dvisible}
  1275. footer=""
  1276. title="所有列表信息"
  1277. className="admin-desc-content"
  1278. width="1300px"
  1279. onCancel={() => {
  1280. this.loadData();
  1281. this.setState({
  1282. dvisible: false
  1283. });
  1284. }}
  1285. >
  1286. <Spin spinning={this.state.loading}>
  1287. <div
  1288. className="patent-table"
  1289. style={{
  1290. // width: 900,
  1291. // position: "relative",
  1292. // left: "50%",
  1293. // transform: "translate(-50%)",
  1294. padding: "25px 0 30px 30px"
  1295. }}
  1296. ref={e => {
  1297. this.refs.all = e;
  1298. }}
  1299. >
  1300. <Table
  1301. columns={this.state.printColumns}
  1302. dataSource={this.state.dataSource}
  1303. pagination={this.state.pagination}
  1304. bordered
  1305. size="small"
  1306. />
  1307. </div>
  1308. </Spin>
  1309. <ReactToPrint
  1310. trigger={() => (
  1311. <Button
  1312. type="primary"
  1313. style={{
  1314. float: "right",
  1315. marginTop: 10,
  1316. position: "absolute",
  1317. top: 0,
  1318. right: 30
  1319. }}
  1320. >
  1321. 打印
  1322. </Button>
  1323. )}
  1324. content={() => this.refs.all}
  1325. />
  1326. </Modal>
  1327. </div>
  1328. );
  1329. }
  1330. });
  1331. export default ShouKuang;