|
|
@@ -65,6 +65,7 @@
|
|
|
<el-table-column label="最低消费" align="center" prop="useMinPrice" />
|
|
|
<el-table-column label="优惠券有效期限(天)" align="center" prop="couponTime" />
|
|
|
<el-table-column label="总数量" align="center" prop="totalCount" />
|
|
|
+ <el-table-column label="领取数量" align="center" prop="receiveCount" />
|
|
|
<el-table-column label="剩余领取数量" align="center" prop="remainCount" />
|
|
|
<el-table-column label="类型" align="center" prop="couponType" >
|
|
|
<template slot-scope="scope">
|
|
|
@@ -107,7 +108,28 @@
|
|
|
|
|
|
<!-- 添加或修改优惠券领取对话框 -->
|
|
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
|
|
- <el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
|
+ <el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
|
|
+ <el-form-item label="优惠券开始时间" prop="startTime">
|
|
|
+ <el-date-picker clearable size="small" style="width: 200px"
|
|
|
+ v-model="form.startTime"
|
|
|
+ type="date"
|
|
|
+ value-format="yyyy-MM-dd"
|
|
|
+ placeholder="选择开始时间" disabled >
|
|
|
+ </el-date-picker>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="优惠券结束时间" prop="limitTime">
|
|
|
+ <el-date-picker clearable size="small" style="width: 200px"
|
|
|
+ v-model="form.limitTime"
|
|
|
+ type="date"
|
|
|
+ value-format="yyyy-MM-dd"
|
|
|
+ placeholder="选择结束时间"
|
|
|
+ :picker-options="pickerOptions"
|
|
|
+ >
|
|
|
+ </el-date-picker>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="优惠券领取数量" prop="totalCount">
|
|
|
+ <el-input-number v-model="form.totalCount" :min=totalCount placeholder="请输入优惠券领取数量" />
|
|
|
+ </el-form-item>
|
|
|
<el-form-item label="状态">
|
|
|
<el-radio-group v-model="form.status">
|
|
|
<el-radio :label="item.dictValue" v-for="item in statusOptions" >{{item.dictLabel}}</el-radio>
|
|
|
@@ -129,6 +151,19 @@ export default {
|
|
|
name: "HisStoreCouponIssue",
|
|
|
data() {
|
|
|
return {
|
|
|
+ pickerOptions: {
|
|
|
+ disabledDate: (time) => {
|
|
|
+ // 如果没有选择开始时间,则不限制
|
|
|
+ if (!this.limitTime) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ // 设置可选时间为当前日期之后
|
|
|
+ const limitTime = new Date(this.limitTime);
|
|
|
+ return time.getTime() < limitTime.getTime();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ limitTime:null,
|
|
|
+ totalCount:null,
|
|
|
couponTypeOptions:[],
|
|
|
statusOptions:[],
|
|
|
dateRange:[],
|
|
|
@@ -198,9 +233,29 @@ export default {
|
|
|
getList() {
|
|
|
this.loading = true;
|
|
|
listStoreCouponIssue(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
|
|
|
- this.storeCouponIssueList = response.rows;
|
|
|
+ if (response.rows.length > 0) {
|
|
|
+ this.storeCouponIssueList = response.rows.map(item => {
|
|
|
+ // 计算领取数量
|
|
|
+ const receiveCount = item.remainCount;
|
|
|
+ // 计算剩余数量 = 总数量 - 领取数量
|
|
|
+ const remainCount = item.totalCount - receiveCount;
|
|
|
+
|
|
|
+ // 返回新的对象,包含计算后的值
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ receiveCount,
|
|
|
+ remainCount,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.storeCouponIssueList = response.rows
|
|
|
+ }
|
|
|
+
|
|
|
this.total = response.total;
|
|
|
this.loading = false;
|
|
|
+ }).catch(error => {
|
|
|
+ this.loading = false;
|
|
|
+ console.error('获取优惠券列表失败:', error);
|
|
|
});
|
|
|
},
|
|
|
// 取消按钮
|
|
|
@@ -248,6 +303,8 @@ export default {
|
|
|
handleAdd() {
|
|
|
this.reset();
|
|
|
this.open = true;
|
|
|
+ this.limitTime = null;
|
|
|
+ this.totalCount = null;
|
|
|
this.title = "添加优惠券领取";
|
|
|
},
|
|
|
/** 修改按钮操作 */
|
|
|
@@ -256,6 +313,8 @@ export default {
|
|
|
const id = row.id || this.ids
|
|
|
getStoreCouponIssue(id).then(response => {
|
|
|
this.form = response.data;
|
|
|
+ this.limitTime = response.data.limitTime;
|
|
|
+ this.totalCount = response.data.totalCount;
|
|
|
this.form.status = response.data.status.toString();
|
|
|
this.open = true;
|
|
|
this.title = "修改优惠券领取";
|