|
|
@@ -0,0 +1,148 @@
|
|
|
+<template>
|
|
|
+ <div class="coupon-statistics">
|
|
|
+ <el-card shadow="never">
|
|
|
+ <el-form :model="searchForm" inline size="small" label-width="100px">
|
|
|
+ <el-form-item label="客户名称">
|
|
|
+ <el-input v-model="searchForm.storeName" placeholder="请输入客户名称" clearable />
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="领取日期">
|
|
|
+ <el-date-picker
|
|
|
+ v-model="searchForm.dateRange"
|
|
|
+ type="daterange"
|
|
|
+ range-separator="to"
|
|
|
+ start-placeholder="请选择起始领取日期"
|
|
|
+ end-placeholder="请选择结束领取日期"
|
|
|
+ value-format="yyyy-MM-dd"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" icon="el-icon-search" @click="handleSearch">查询</el-button>
|
|
|
+ <el-button icon="el-icon-refresh" @click="handleReset">重置</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+
|
|
|
+ <!-- Data Table -->
|
|
|
+ <el-table
|
|
|
+ :data="tableData"
|
|
|
+ border
|
|
|
+ style="width: 100%; margin-top: 16px;"
|
|
|
+ v-loading="loading"
|
|
|
+ element-loading-text="Loading..."
|
|
|
+ >
|
|
|
+ <el-table-column prop="storeName" label="客户名称" min-width="180" />
|
|
|
+ <el-table-column prop="claimDate" label="领取日期" width="150" align="center" />
|
|
|
+ <el-table-column prop="amount" label="金额 (¥)" width="120" align="center">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.amount | currency }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="claimedCount" label="已领取优惠券" width="130" align="center" />
|
|
|
+ <el-table-column prop="usedCount" label="已使用优惠券" width="120" align="center" />
|
|
|
+ <el-table-column prop="returnedCouponCount" label="已退货优惠券" width="120" align="center" />
|
|
|
+ </el-table>
|
|
|
+
|
|
|
+ <!-- Pagination -->
|
|
|
+ <div class="pagination-wrapper" style="margin-top: 16px; text-align: right;">
|
|
|
+ <el-pagination
|
|
|
+ @size-change="handleSizeChange"
|
|
|
+ @current-change="handleCurrentChange"
|
|
|
+ :current-page.sync="pagination.current"
|
|
|
+ :page-sizes="[10, 20, 50, 100]"
|
|
|
+ :page-size="pagination.size"
|
|
|
+ layout="total, sizes, prev, pager, next, jumper"
|
|
|
+ :total="pagination.total"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </el-card>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { getCouponReportList } from "@/api/redPacket/index";
|
|
|
+export default {
|
|
|
+ name: 'CouponStatistics',
|
|
|
+ filters: {
|
|
|
+ currency(val) {
|
|
|
+ if (val == null) return '0.00';
|
|
|
+ return parseFloat(val).toFixed(2);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ loading: false,
|
|
|
+ searchForm: {
|
|
|
+ storeName: '',
|
|
|
+ dateRange: []
|
|
|
+ },
|
|
|
+ tableData: [],
|
|
|
+ pagination: {
|
|
|
+ current: 1,
|
|
|
+ size: 20,
|
|
|
+ total: 0
|
|
|
+ }
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.fetchData();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ async fetchData() {
|
|
|
+ this.loading = true;
|
|
|
+ try {
|
|
|
+ const params = {
|
|
|
+ current: this.pagination.current,
|
|
|
+ size: this.pagination.size,
|
|
|
+ storeName: this.searchForm.storeName || undefined,
|
|
|
+ startDate: this.searchForm.dateRange ? this.searchForm.dateRange[0] : null,
|
|
|
+ endDate: this.searchForm.dateRange ? this.searchForm.dateRange[1] : null
|
|
|
+ };
|
|
|
+
|
|
|
+ const res = await getCouponReportList(params)
|
|
|
+ console.info('res----', res);
|
|
|
+ this.tableData = res.data.data.records || [];
|
|
|
+ this.pagination.total = res.data.data.total || 0;
|
|
|
+ } catch (error) {
|
|
|
+ this.$message.error('Failed to load data');
|
|
|
+ console.error(error);
|
|
|
+ } finally {
|
|
|
+ this.loading = false;
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ handleSearch() {
|
|
|
+ this.pagination.current = 1;
|
|
|
+ this.fetchData();
|
|
|
+ },
|
|
|
+
|
|
|
+ handleReset() {
|
|
|
+ this.searchForm = {
|
|
|
+ storeName: '',
|
|
|
+ dateRange: []
|
|
|
+ };
|
|
|
+ this.pagination.current = 1;
|
|
|
+ this.fetchData();
|
|
|
+ },
|
|
|
+
|
|
|
+ handleSizeChange(val) {
|
|
|
+ this.pagination.size = val;
|
|
|
+ this.fetchData();
|
|
|
+ },
|
|
|
+
|
|
|
+ handleCurrentChange(val) {
|
|
|
+ this.pagination.current = val;
|
|
|
+ this.fetchData();
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+.coupon-statistics {
|
|
|
+ padding: 20px;
|
|
|
+}
|
|
|
+.pagination-wrapper {
|
|
|
+ margin-top: 16px;
|
|
|
+}
|
|
|
+</style>
|