Commit bba5187a by 吕明尚

优惠卷赠送功能

parent d13e7620
...@@ -63,3 +63,11 @@ export function queryCouponList() { ...@@ -63,3 +63,11 @@ export function queryCouponList() {
method: 'get' method: 'get'
}) })
} }
export function give(data) {
return request({
url: '/system/consumerCoupon/give',
method: 'post',
data: data
})
}
...@@ -190,6 +190,13 @@ ...@@ -190,6 +190,13 @@
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPermi="['system:consumer:remove']" v-hasPermi="['system:consumer:remove']"
>删除</el-button> >删除</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="give(scope.row)"
>赠送优惠卷
</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -251,19 +258,72 @@ ...@@ -251,19 +258,72 @@
<el-button @click="cancel"> </el-button> <el-button @click="cancel"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
<el-dialog :title="couponTitle" :visible.sync="couponOpen" width="80%" append-to-bod>
<el-table v-loading="couponLoading" :data="couponList">
<el-table-column label="优惠券名称" align="center" prop="name"/>
<el-table-column label="优惠券类型" align="center" prop="couponType">
<template slot-scope="scope">
<dict-tag :options="dict.type.store_coupon_type" :value="scope.row.couponType"/>
</template>
</el-table-column>
<el-table-column label="时长" align="center" prop="duration"/>
<el-table-column label="平台类型" align="center" prop="platformType">
<template slot-scope="scope">
<dict-tag :options="dict.type.store_platform_type" :value="scope.row.platformType"/>
</template>
</el-table-column>
<el-table-column label="有效期开始" align="center" prop="startDate" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.startDate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="有效期结束" align="center" prop="endDate" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.endDate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="数量" align="center" prop="number"/>
<el-table-column label="备注" align="center" prop="remark"/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-edit"-->
<!-- @click="handleUpdate(scope.row)"-->
<!-- v-hasPermi="['system:consumer:edit']"-->
<!-- >修改</el-button>-->
<el-button
size="mini"
type="text"
icon="el-icon-circle-plus"
@click="submitcouponGive(scope.row)"
>选择
</el-button>
</template>
</el-table-column>
</el-table>
<div slot="footer" class="dialog-footer">
<el-button @click="couponCancel"> </el-button>
</div>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { listConsumer, getConsumer, delConsumer, addConsumer, updateConsumer } from "@/api/system/consumer"; import { listConsumer, getConsumer, delConsumer, addConsumer, updateConsumer } from "@/api/system/consumer";
import {listCoupon} from "../../../api/system/coupon";
import {give} from "../../../api/system/consumerCoupon";
export default { export default {
name: "Consumer", name: "Consumer",
dicts: ['sys_user_sex','wechat_role_type'], dicts: ['sys_user_sex', 'wechat_role_type', 'store_coupon_type', 'store_platform_type', 'store_platform_type'],
data() { data() {
return { return {
// 遮罩层 // 遮罩层
loading: true, loading: true,
couponLoading: true,
// 选中数组 // 选中数组
ids: [], ids: [],
// 非单个禁用 // 非单个禁用
...@@ -276,10 +336,14 @@ export default { ...@@ -276,10 +336,14 @@ export default {
total: 0, total: 0,
// 会员用户表格数据 // 会员用户表格数据
consumerList: [], consumerList: [],
couponList: [],
// 弹出层标题 // 弹出层标题
title: "", title: "",
couponTitle: "",
// 是否显示弹出层 // 是否显示弹出层
couponOpen: false,
open: false, open: false,
consumerId: null,
// 查询参数 // 查询参数
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
...@@ -296,6 +360,7 @@ export default { ...@@ -296,6 +360,7 @@ export default {
}, },
// 表单参数 // 表单参数
form: {}, form: {},
couponForm: {},
// 表单校验 // 表单校验
rules: { rules: {
openId: [ openId: [
...@@ -318,7 +383,6 @@ export default { ...@@ -318,7 +383,6 @@ export default {
getList() { getList() {
this.loading = true; this.loading = true;
listConsumer(this.queryParams).then(response => { listConsumer(this.queryParams).then(response => {
console.log(response,909090)
this.consumerList = response.rows; this.consumerList = response.rows;
this.total = response.total; this.total = response.total;
this.loading = false; this.loading = false;
...@@ -413,7 +477,29 @@ export default { ...@@ -413,7 +477,29 @@ export default {
this.download('system/consumer/export', { this.download('system/consumer/export', {
...this.queryParams ...this.queryParams
}, `consumer_${new Date().getTime()}.xlsx`) }, `consumer_${new Date().getTime()}.xlsx`)
},
give(row) {
this.consumerId = row.id;
this.couponLoading = true;
listCoupon().then(response => {
this.couponList = response.rows;
});
this.couponLoading = false;
this.couponOpen = true;
this.couponTitle = "优惠卷列表";
},
submitcouponGive(row) {
give({consumerId: this.consumerId, couponId: row.id}).then(response => {
this.$modal.msgSuccess("赠送成功");
this.couponOpen = false;
});
this.consumerId = null;
this.couponOpen = false;
},
couponCancel() {
this.couponOpen = false;
} }
} }
}; };
</script> </script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment