|
|
@@ -0,0 +1,218 @@
|
|
|
+<template>
|
|
|
+ <div class="app-container">
|
|
|
+ <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px">
|
|
|
+ <el-form-item label="优惠券名称" prop="couponTitle">
|
|
|
+ <el-input
|
|
|
+ v-model="queryParams.couponTitle"
|
|
|
+ placeholder="请输入优惠券名称"
|
|
|
+ clearable
|
|
|
+ size="small"
|
|
|
+ @keyup.enter.native="handleQuery"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="状态" prop="status">
|
|
|
+ <el-select v-model="queryParams.status" placeholder="请选择状态" clearable size="small">
|
|
|
+ <el-option
|
|
|
+ v-for="item in statusOptions"
|
|
|
+ :key="item.dictValue"
|
|
|
+ :label="item.dictLabel"
|
|
|
+ :value="item.dictValue"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="领取时间">
|
|
|
+ <el-date-picker
|
|
|
+ v-model="dateRange"
|
|
|
+ size="small"
|
|
|
+ style="width: 220px"
|
|
|
+ value-format="yyyy-MM-dd"
|
|
|
+ type="daterange"
|
|
|
+ range-separator="-"
|
|
|
+ start-placeholder="开始日期"
|
|
|
+ end-placeholder="结束日期"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
|
|
+ <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+
|
|
|
+ <el-row :gutter="10" class="mb8">
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button
|
|
|
+ type="warning"
|
|
|
+ icon="el-icon-download"
|
|
|
+ size="mini"
|
|
|
+ @click="handleExport"
|
|
|
+ >导出</el-button>
|
|
|
+ </el-col>
|
|
|
+ <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <el-table
|
|
|
+ height="500"
|
|
|
+ border
|
|
|
+ size="mini"
|
|
|
+ v-loading="loading"
|
|
|
+ :data="storeCouponUserList"
|
|
|
+ >
|
|
|
+ <el-table-column label="会员" min-width="120" show-overflow-tooltip>
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <div class="cell-main">{{ scope.row.nickname || '-' }}</div>
|
|
|
+ <div class="cell-sub">{{ scope.row.phone || '-' }}</div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="优惠券" min-width="140" show-overflow-tooltip>
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <div class="cell-main">{{ scope.row.couponTitle || '-' }}</div>
|
|
|
+ <div class="cell-sub">面值 {{ scope.row.couponPrice }} / 满 {{ scope.row.useMinPrice }}</div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="领取/有效期" min-width="150">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <div class="cell-sub">领:{{ formatTime(scope.row.createTime) }}</div>
|
|
|
+ <div class="cell-sub">止:{{ formatTime(scope.row.limitTime) }}</div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="核销信息" min-width="150">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <div class="cell-main">{{ scope.row.verifyUserName || '-' }}</div>
|
|
|
+ <div class="cell-sub">{{ formatTime(scope.row.verifyTime || scope.row.useTime) }}</div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="状态" width="80" align="center">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-tag size="mini" :type="statusTagType(scope.row.status)">{{ statusLabel(scope.row.status) }}</el-tag>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作" width="70" align="center">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button
|
|
|
+ v-if="String(scope.row.status) === '0'"
|
|
|
+ size="mini"
|
|
|
+ type="text"
|
|
|
+ @click="handleVerify(scope.row)"
|
|
|
+ >核销</el-button>
|
|
|
+ <span v-else class="cell-sub">-</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+
|
|
|
+ <pagination
|
|
|
+ v-show="total > 0"
|
|
|
+ :total="total"
|
|
|
+ :page.sync="queryParams.pageNum"
|
|
|
+ :limit.sync="queryParams.pageSize"
|
|
|
+ @pagination="getList"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { listStoreCouponUser, exportStoreCouponUser, verifyStoreCouponUser } from "@/api/live/liveCouponUser";
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: "LiveCouponUser",
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ statusOptions: [],
|
|
|
+ loading: true,
|
|
|
+ dateRange: [],
|
|
|
+ showSearch: true,
|
|
|
+ total: 0,
|
|
|
+ storeCouponUserList: [],
|
|
|
+ queryParams: {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ couponTitle: null,
|
|
|
+ status: null
|
|
|
+ }
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.getDicts("live_coupon_user_status").then((response) => {
|
|
|
+ this.statusOptions = response.data || [];
|
|
|
+ });
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ statusLabel(status) {
|
|
|
+ const hit = (this.statusOptions || []).find(item => String(item.dictValue) === String(status));
|
|
|
+ if (hit) {
|
|
|
+ return hit.dictLabel;
|
|
|
+ }
|
|
|
+ const fallback = { 0: "未核销", 1: "已核销", 2: "已过期" };
|
|
|
+ return fallback[status] != null ? fallback[status] : status;
|
|
|
+ },
|
|
|
+ statusTagType(status) {
|
|
|
+ const map = { 0: "info", 1: "success", 2: "danger" };
|
|
|
+ return map[status] || "info";
|
|
|
+ },
|
|
|
+ formatTime(val) {
|
|
|
+ if (!val) {
|
|
|
+ return "-";
|
|
|
+ }
|
|
|
+ const text = String(val).replace("T", " ");
|
|
|
+ return text.length >= 16 ? text.substring(0, 16) : text;
|
|
|
+ },
|
|
|
+ getList() {
|
|
|
+ this.loading = true;
|
|
|
+ listStoreCouponUser(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
|
|
|
+ this.storeCouponUserList = response.rows;
|
|
|
+ this.total = response.total;
|
|
|
+ this.loading = false;
|
|
|
+ }).catch(() => {
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ handleQuery() {
|
|
|
+ this.queryParams.pageNum = 1;
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+ resetQuery() {
|
|
|
+ this.dateRange = [];
|
|
|
+ this.resetForm("queryForm");
|
|
|
+ this.handleQuery();
|
|
|
+ },
|
|
|
+ handleVerify(row) {
|
|
|
+ this.$confirm('是否确认核销"' + row.couponTitle + '"?', "警告", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning"
|
|
|
+ }).then(() => {
|
|
|
+ return verifyStoreCouponUser({ couponUserId: row.id });
|
|
|
+ }).then(response => {
|
|
|
+ if (response.code === 200) {
|
|
|
+ this.msgSuccess(response.msg || "核销成功");
|
|
|
+ this.getList();
|
|
|
+ }
|
|
|
+ }).catch(() => {});
|
|
|
+ },
|
|
|
+ handleExport() {
|
|
|
+ const queryParams = this.addDateRange({ ...this.queryParams }, this.dateRange);
|
|
|
+ this.$confirm('是否确认导出所有优惠券发放记录数据项?', "警告", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning"
|
|
|
+ }).then(() => {
|
|
|
+ return exportStoreCouponUser(queryParams);
|
|
|
+ }).then(response => {
|
|
|
+ this.download(response.msg);
|
|
|
+ }).catch(() => {});
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+.cell-main {
|
|
|
+ line-height: 18px;
|
|
|
+ color: #303133;
|
|
|
+}
|
|
|
+.cell-sub {
|
|
|
+ line-height: 18px;
|
|
|
+ font-size: 12px;
|
|
|
+ color: #909399;
|
|
|
+}
|
|
|
+</style>
|