Overview_AccountingReport.vue 19 KB

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