accountingReport.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654
  1. <template>
  2. <div class="app-container">
  3. <el-form
  4. :model="queryParams"
  5. ref="queryForm"
  6. :inline="true"
  7. label-width="98px"
  8. >
  9. <el-form-item label="班次号" prop="classesNo">
  10. <el-input
  11. v-model="queryParams.likeClassesNo"
  12. placeholder="请输入班次号"
  13. clearable
  14. size="small"
  15. @keyup.enter.native="handleQuery"
  16. />
  17. </el-form-item>
  18. <el-form-item label="班结时间" prop="endDate">
  19. <el-date-picker
  20. style="width: 350px"
  21. v-model="dateRangeCreatedDate"
  22. size="mini"
  23. value-format="yyyy-MM-dd HH:mm:ss"
  24. type="datetimerange"
  25. range-separator="至"
  26. start-placeholder="开始日期"
  27. end-placeholder="结束日期"
  28. >
  29. </el-date-picker>
  30. </el-form-item>
  31. <el-form-item label="班结人" prop="classesMan">
  32. <el-input
  33. v-model="queryParams.classesMan"
  34. placeholder="请输入班结人"
  35. clearable
  36. size="small"
  37. @keyup.enter.native="handleQuery"
  38. />
  39. </el-form-item>
  40. <el-form-item>
  41. <el-button
  42. type="cyan"
  43. icon="el-icon-search"
  44. size="mini"
  45. @click="handleQuery"
  46. >搜索</el-button
  47. >
  48. <el-button
  49. type="info"
  50. icon="el-icon-refresh"
  51. size="mini"
  52. @click="resetQuery"
  53. >重置</el-button
  54. >
  55. </el-form-item>
  56. </el-form>
  57. <el-table v-loading="loading" :data="summaryList" :fit="true">
  58. <af-table-column
  59. label="班结主键id"
  60. align="center"
  61. prop="id"
  62. v-if="false"
  63. />
  64. <af-table-column label="班次号" align="center" prop="classesNo" />
  65. <af-table-column
  66. label="班次开始时间"
  67. align="center"
  68. prop="startDate"
  69. >
  70. </af-table-column>
  71. <af-table-column
  72. label="班次结束时间"
  73. align="center"
  74. prop="endDate"
  75. >
  76. </af-table-column>
  77. <af-table-column
  78. label="油站id"
  79. align="center"
  80. prop="stationId"
  81. v-if="false"
  82. />
  83. <af-table-column label="油站名称" align="center" prop="stationName" />
  84. <af-table-column label="订单数" align="center" prop="orderNum" />
  85. <af-table-column
  86. label="小票数量"
  87. align="center"
  88. prop="printNum"
  89. />
  90. <af-table-column label="销量L" align="center" prop="saleLiters" />
  91. <af-table-column label="应收金额" align="center" prop="saleAmt" />
  92. <af-table-column label="实收金额" align="center" prop="amt" />
  93. <af-table-column label="优惠金额" align="center" prop="discountAmt" />
  94. <af-table-column label="微信支付金额" align="center" prop="wxAmt" />
  95. <af-table-column
  96. label="支付支付金额"
  97. align="center"
  98. prop="zfbAmt"
  99. v-if="false"
  100. />
  101. <af-table-column
  102. label="电子卡支付金额"
  103. align="center"
  104. prop="dzkAmt"
  105. v-if="false"
  106. />
  107. <af-table-column label="班结人" align="center" prop="classesMan" />
  108. <af-table-column
  109. label="操作"
  110. align="center"
  111. class-name="small-padding fixed-width"
  112. >
  113. <template slot-scope="scope">
  114. <el-button
  115. size="mini"
  116. type="text"
  117. icon="el-icon-plus"
  118. @click="handlelook(scope.row)"
  119. >查看</el-button
  120. >
  121. <el-button
  122. size="mini"
  123. type="text"
  124. icon="el-icon-download"
  125. @click="handleExport(scope.row)"
  126. v-hasPermi="['station:structure:export']"
  127. >下载</el-button
  128. >
  129. </template>
  130. </af-table-column>
  131. </el-table>
  132. <pagination
  133. v-show="total > 0"
  134. :total="total"
  135. :page.sync="queryParams.pageNum"
  136. :limit.sync="queryParams.pageSize"
  137. @pagination="getList"
  138. />
  139. <!-- 查看班结数据 -->
  140. <el-dialog :title="title" :visible.sync="open" append-to-body class="uncon">
  141. <el-form
  142. :model="queryParams"
  143. ref="queryForm"
  144. :inline="true"
  145. v-show="true"
  146. label-width="68px"
  147. >
  148. <el-form-item prop="carNumber">
  149. 开班时间:{{ opo.classStartDate }} 班结时间:{{
  150. opo.classStructureDate
  151. }}班结人:{{ opo.classStructureMan }}
  152. </el-form-item>
  153. </el-form>
  154. <!--按员工汇总-->
  155. <span style="color: #ff9955; font-size: 15px">|</span
  156. ><span style="font-size: 15px">按员工汇总</span>
  157. <el-table
  158. v-loading="loading"
  159. show-summary
  160. :data="structureList"
  161. :summary-method="getTotal"
  162. >
  163. <af-table-column label="员工姓名" align="center" prop="oilPersonnel" />
  164. <af-table-column label="负责枪号" align="center" prop="oilGun" />
  165. <af-table-column label="销量" align="center" prop="orderLiters" />
  166. <af-table-column label="销额" align="center" prop="amt" />
  167. <af-table-column label="销售笔数" align="center" prop="orderNo" />
  168. </el-table>
  169. <!--按油品汇总-->
  170. <span style="color: #ff9955; font-size: 15px">|</span
  171. ><span style="font-size: 15px">按油品汇总</span>
  172. <el-table
  173. v-loading="loading"
  174. :data="structureList1"
  175. show-summary
  176. :summary-method="getTotal2"
  177. >
  178. <af-table-column label="油品" align="center" prop="oilName" />
  179. <af-table-column label="负责枪号" align="center" prop="oilGun" />
  180. <af-table-column label="销量" align="center" prop="orderLiters" />
  181. <af-table-column label="销额" align="center" prop="amt" />
  182. <af-table-column label="销售笔数" align="center" prop="orderNo" />
  183. </el-table>
  184. <!--按员工/支付方式汇总: -->
  185. <span style="color: #ff9955; font-size: 15px">|</span
  186. ><span style="font-size: 15px">按员工/支付方式汇总</span>
  187. <el-table
  188. v-loading="loading"
  189. :data="structureList3"
  190. show-summary
  191. :summary-method="getTotal3"
  192. max-height="h-180"
  193. >
  194. <af-table-column label="员工姓名" align="center" prop="oilPersonnel" />
  195. <af-table-column label="负责枪号" align="center" prop="oilGun" />
  196. <af-table-column label="微信笔数" align="center" prop="wxNum" />
  197. <af-table-column label="支付宝笔数" align="center" prop="zfbNum" />
  198. <af-table-column label="现金笔数" align="center" prop="xjNum" />
  199. <af-table-column label="优惠" align="center" prop="discountAmt" />
  200. <af-table-column
  201. label="优惠劵"
  202. align="center"
  203. prop="discountCouponAmt"
  204. />
  205. <af-table-column label="微信金额" align="center" prop="wxAmt" />
  206. <af-table-column label="支付宝金额" align="center" prop="zfbAmt" />
  207. <af-table-column label="现金金额" align="center" prop="xjAmt" />
  208. <af-table-column label="会员卡支付" align="center" prop="memberAmt" />
  209. </el-table>
  210. </el-dialog>
  211. </div>
  212. </template>
  213. <script>
  214. import { listSummary } from "@/api/station/summary";
  215. import { exportStructure } from "@/api/station/structure";
  216. import {
  217. listPersonnelPayStructure,
  218. listClass,
  219. listPersonnelStructure,
  220. listOilStructure,
  221. } from "@/api/station/structure";
  222. export default {
  223. name: "accountingReport",
  224. data() {
  225. return {
  226. // 遮罩层
  227. loading: true,
  228. // 总条数
  229. total: 0,
  230. // 【请填写功能名称】表格数据
  231. summaryList: [],
  232. dateRangeCreatedDate: [],
  233. // 弹出层标题
  234. title: "",
  235. // 是否显示弹出层
  236. open: false,
  237. // 查询参数
  238. queryParams: {
  239. pageNum: 1,
  240. pageSize: 10,
  241. classesNo: null,
  242. startDate: null,
  243. endDate: null,
  244. stationId: null,
  245. stationName: null,
  246. orderNum: null,
  247. printNum: null,
  248. saleLiters: null,
  249. saleAmt: null,
  250. wxAmt: null,
  251. zfbAmt: null,
  252. dzkAmt: null,
  253. classesMan: null,
  254. likeClassesNo: null,
  255. },
  256. // 查询参数
  257. queryParam: {
  258. orderNo: null,
  259. stationId: null,
  260. stationName: null,
  261. oilGun: null,
  262. oilName: null,
  263. oilPirce: null,
  264. oilType: null,
  265. consumerId: null,
  266. consumer: null,
  267. amt: null,
  268. orderLiters: null,
  269. payType: null,
  270. payWay: null,
  271. payDate: null,
  272. oilPersonnel: null,
  273. orderType: null,
  274. printNum: null,
  275. classStructureNo: null,
  276. classStartDate: null,
  277. classStructureDate: null,
  278. classStructureMan: null,
  279. oils: null,
  280. receivableAmt: null,
  281. receivedAmt: null,
  282. discountAmt: null,
  283. discountCouponAmt: null,
  284. discountCoupon: null,
  285. wxAmt: null,
  286. zfbAmt: null,
  287. posAmt: null,
  288. xjAmt: null,
  289. didiAppAmt: null,
  290. tyAppAmt: null,
  291. otherAmt: null,
  292. dzkAmt: null,
  293. score: null,
  294. memberNo: null,
  295. memberAmt: null,
  296. carNo: null,
  297. customerPhone: null,
  298. customerGrade: null,
  299. },
  300. // 表单参数
  301. form: {},
  302. // 表单校验
  303. rules: {},
  304. structureList: [],
  305. structureList1: [],
  306. structureList3: [],
  307. opo: {
  308. classStartDate: null,
  309. classStructureMan: null,
  310. classStructureDate: null,
  311. classStructureNo: null,
  312. },
  313. };
  314. },
  315. created() {
  316. this.getList();
  317. },
  318. methods: {
  319. /** 查询【请填写功能名称】列表 */
  320. getList() {
  321. this.loading = true;
  322. this.queryParams.stationId = this.$store.selectDeptId;
  323. if (
  324. this.queryParams.stationId == null ||
  325. this.queryParams.stationId == ""
  326. ) {
  327. this.queryParams.stationId = this.$store.state.user.deptId;
  328. }
  329. console.log("这个",this.queryParams, this.dateRangeCreatedDate)
  330. listSummary(
  331. this.addDateRange(this.queryParams, this.dateRangeCreatedDate)
  332. ).then((response) => {
  333. console.log("条件",response)
  334. this.summaryList = response.rows;
  335. console.log("summaryList", this.summaryList);
  336. this.total = response.total;
  337. this.loading = false;
  338. });
  339. },
  340. // 取消按钮
  341. cancel() {
  342. this.open = false;
  343. this.reset();
  344. },
  345. // 表单重置
  346. reset() {
  347. this.form = {
  348. id: null,
  349. classesNo: null,
  350. startDate: null,
  351. endDate: null,
  352. stationId: null,
  353. stationName: null,
  354. orderNum: null,
  355. printNum: null,
  356. saleLiters: null,
  357. saleAmt: null,
  358. wxAmt: null,
  359. zfbAmt: null,
  360. dzkAmt: null,
  361. classesMan: null,
  362. };
  363. this.resetForm("form");
  364. },
  365. /** 搜索按钮操作 */
  366. handleQuery() {
  367. this.queryParams.pageNum = 1;
  368. this.getList();
  369. },
  370. /** 重置按钮操作 */
  371. resetQuery() {
  372. this.resetForm("queryForm");
  373. this.dateRangeCreatedDate = [];
  374. this.handleQuery();
  375. },
  376. handlelook(row) {
  377. //this.$router.push({path:'/station/structure',query:{classesNo:row.classesNo,stationId:row.stationId,name:row.classesMan}});
  378. this.open = true;
  379. this.title = "查看班结明细";
  380. this.queryParams.classStructureMan = row.classesMan;
  381. this.queryParams.classStructureNo = row.classesNo;
  382. this.queryParams.stationId = row.stationId;
  383. listClass(this.queryParams).then((response) => {
  384. this.opo = response.data;
  385. this.getStructureList();
  386. this.getStructureList2();
  387. this.getStructureList3();
  388. });
  389. },
  390. /** 查询班结管理列表 */
  391. getStructureList() {
  392. this.loading = true;
  393. listPersonnelStructure(this.queryParams).then((response) => {
  394. this.structureList = response.rows;
  395. this.loading = false;
  396. });
  397. },
  398. getStructureList2() {
  399. this.loading = true;
  400. listOilStructure(this.queryParams).then((response) => {
  401. this.structureList1 = response.rows;
  402. this.loading = false;
  403. });
  404. },
  405. getStructureList3() {
  406. this.loading = true;
  407. listPersonnelPayStructure(this.queryParams).then((response) => {
  408. this.structureList3 = response.rows;
  409. this.loading = false;
  410. });
  411. },
  412. getTotal(param) {
  413. const { columns, data } = param;
  414. const sums = [];
  415. columns.forEach((column, index) => {
  416. if (index === 0) {
  417. sums[index] = "合计";
  418. return;
  419. }
  420. const values = data.map((item) => Number(item[column.property]));
  421. if (column.property === "orderLiters") {
  422. sums[index] = values.reduce((prev, curr) => {
  423. const value = Number(curr);
  424. if (!isNaN(value)) {
  425. return prev + curr;
  426. } else {
  427. return prev;
  428. }
  429. }, 0);
  430. sums[index] = sums[index].toFixed(2);
  431. } else if (column.property === "amt") {
  432. sums[index] = values.reduce((prev, curr) => {
  433. const value = Number(curr);
  434. if (!isNaN(value)) {
  435. return prev + curr;
  436. } else {
  437. return prev;
  438. }
  439. }, 0);
  440. sums[index] = sums[index].toFixed(2);
  441. } else if (column.property === "orderNo") {
  442. sums[index] = values.reduce((prev, curr) => {
  443. const value = Number(curr);
  444. if (!isNaN(value)) {
  445. return prev + curr;
  446. } else {
  447. return prev;
  448. }
  449. }, 0);
  450. sums[index] = sums[index].toFixed(0);
  451. } else {
  452. sums[index] = "";
  453. }
  454. });
  455. return sums;
  456. },
  457. getTotal2(param) {
  458. const { columns, data } = param;
  459. const sums = [];
  460. columns.forEach((column, index) => {
  461. if (index === 0) {
  462. sums[index] = "合计";
  463. return;
  464. }
  465. const values = data.map((item) => Number(item[column.property]));
  466. if (column.property === "orderLiters") {
  467. sums[index] = values.reduce((prev, curr) => {
  468. const value = Number(curr);
  469. if (!isNaN(value)) {
  470. return prev + curr;
  471. } else {
  472. return prev;
  473. }
  474. }, 0);
  475. sums[index] = sums[index].toFixed(2);
  476. } else if (column.property === "amt") {
  477. sums[index] = values.reduce((prev, curr) => {
  478. const value = Number(curr);
  479. if (!isNaN(value)) {
  480. return prev + curr;
  481. } else {
  482. return prev;
  483. }
  484. }, 0);
  485. sums[index] = sums[index].toFixed(2);
  486. } else if (column.property === "orderNo") {
  487. sums[index] = values.reduce((prev, curr) => {
  488. const value = Number(curr);
  489. if (!isNaN(value)) {
  490. return prev + curr;
  491. } else {
  492. return prev;
  493. }
  494. }, 0);
  495. sums[index] = sums[index].toFixed(0);
  496. } else {
  497. sums[index] = "";
  498. }
  499. });
  500. return sums;
  501. },
  502. getTotal3(param) {
  503. const { columns, data } = param;
  504. const sums = [];
  505. columns.forEach((column, index) => {
  506. if (index === 0) {
  507. sums[index] = "合计";
  508. return;
  509. }
  510. const values = data.map((item) => Number(item[column.property]));
  511. if (column.property === "wxNum") {
  512. sums[index] = values.reduce((prev, curr) => {
  513. const value = Number(curr);
  514. if (!isNaN(value)) {
  515. return prev + curr;
  516. } else {
  517. return prev;
  518. }
  519. }, 0);
  520. sums[index] = sums[index].toFixed(0);
  521. } else if (column.property === "zfbNum") {
  522. sums[index] = values.reduce((prev, curr) => {
  523. const value = Number(curr);
  524. if (!isNaN(value)) {
  525. return prev + curr;
  526. } else {
  527. return prev;
  528. }
  529. }, 0);
  530. sums[index] = sums[index].toFixed(0);
  531. } else if (column.property === "xjNum") {
  532. sums[index] = values.reduce((prev, curr) => {
  533. const value = Number(curr);
  534. if (!isNaN(value)) {
  535. return prev + curr;
  536. } else {
  537. return prev;
  538. }
  539. }, 0);
  540. sums[index] = sums[index].toFixed(0);
  541. } else if (column.property === "discountAmt") {
  542. sums[index] = values.reduce((prev, curr) => {
  543. const value = Number(curr);
  544. if (!isNaN(value)) {
  545. return prev + curr;
  546. } else {
  547. return prev;
  548. }
  549. }, 0);
  550. sums[index] = sums[index].toFixed(2);
  551. } else if (column.property === "discountCouponAmt") {
  552. sums[index] = values.reduce((prev, curr) => {
  553. const value = Number(curr);
  554. if (!isNaN(value)) {
  555. return prev + curr;
  556. } else {
  557. return prev;
  558. }
  559. }, 0);
  560. sums[index] = sums[index].toFixed(2);
  561. } else if (column.property === "wxAmt") {
  562. sums[index] = values.reduce((prev, curr) => {
  563. const value = Number(curr);
  564. if (!isNaN(value)) {
  565. return prev + curr;
  566. } else {
  567. return prev;
  568. }
  569. }, 0);
  570. sums[index] = sums[index].toFixed(2);
  571. } else if (column.property === "zfbAmt") {
  572. sums[index] = values.reduce((prev, curr) => {
  573. const value = Number(curr);
  574. if (!isNaN(value)) {
  575. return prev + curr;
  576. } else {
  577. return prev;
  578. }
  579. }, 0);
  580. sums[index] = sums[index].toFixed(2);
  581. } else if (column.property === "xjAmt") {
  582. sums[index] = values.reduce((prev, curr) => {
  583. const value = Number(curr);
  584. if (!isNaN(value)) {
  585. return prev + curr;
  586. } else {
  587. return prev;
  588. }
  589. }, 0);
  590. sums[index] = sums[index].toFixed(2);
  591. } else if (column.property === "memberAmt") {
  592. sums[index] = values.reduce((prev, curr) => {
  593. const value = Number(curr);
  594. if (!isNaN(value)) {
  595. return prev + curr;
  596. } else {
  597. return prev;
  598. }
  599. }, 0);
  600. sums[index] = sums[index].toFixed(2);
  601. } else {
  602. sums[index] = "";
  603. }
  604. });
  605. return sums;
  606. },
  607. /** 导出按钮操作 */
  608. handleExport(row) {
  609. const classesNo = row.classesNo;
  610. this.queryParam.classStructureNo = classesNo;
  611. this.queryParam.stationId = row.stationId;
  612. const queryParams = this.queryParam;
  613. this.$confirm("是否确认导出所有班结数据项?", "警告", {
  614. confirmButtonText: "确定",
  615. cancelButtonText: "取消",
  616. type: "warning",
  617. })
  618. .then(function () {
  619. return exportStructure(queryParams);
  620. })
  621. .then((response) => {
  622. this.download(response.msg);
  623. });
  624. },
  625. },
  626. };
  627. </script>
  628. <style lang="scss">
  629. .uncon {
  630. .el-table {
  631. overflow: auto;
  632. }
  633. .el-table--scrollable-x .el-table__body-wrapper {
  634. overflow-x: visible;
  635. }
  636. .el-table__body-wrapper {
  637. overflow: visible;
  638. }
  639. .el-table__header-wrapper {
  640. overflow: visible;
  641. }
  642. .el-table__footer-wrapper {
  643. overflow: visible;
  644. }
  645. .el-table::after {
  646. position: relative !important;
  647. }
  648. }
  649. </style>