Commit 062283b4 by 吕明尚

增加团购优惠卷管理页面

parent bba5187a
......@@ -9,6 +9,22 @@ export function listCoupon(query) {
})
}
export function listDuration(query) {
return request({
url: '/system/coupon/list/duration',
method: 'get',
params: query
})
}
export function listGroup(query) {
return request({
url: '/system/coupon/list/group',
method: 'get',
params: query
})
}
// 查询优惠券详细
export function getCoupon(id) {
return request({
......
......@@ -268,6 +268,7 @@
</template>
</el-table-column>
<el-table-column label="时长" align="center" prop="duration"/>
<el-table-column label="优惠金额" align="center" prop="subPrice"/>
<el-table-column label="平台类型" align="center" prop="platformType">
<template slot-scope="scope">
<dict-tag :options="dict.type.store_platform_type" :value="scope.row.platformType"/>
......@@ -304,6 +305,13 @@
</template>
</el-table-column>
</el-table>
<pagination
v-show="couponTotal>0"
:total="couponTotal"
:page.sync="couponQueryParams.pageNum"
:limit.sync="couponQueryParams.pageSize"
@pagination="getCouponList"
/>
<div slot="footer" class="dialog-footer">
<el-button @click="couponCancel"> </el-button>
</div>
......@@ -334,6 +342,7 @@ export default {
showSearch: true,
// 总条数
total: 0,
couponTotal: 0,
// 会员用户表格数据
consumerList: [],
couponList: [],
......@@ -358,6 +367,10 @@ export default {
totalTimes: null,
duration: null
},
couponQueryParams: {
pageNum: 1,
pageSize: 10
},
// 表单参数
form: {},
couponForm: {},
......@@ -388,6 +401,12 @@ export default {
this.loading = false;
});
},
getCouponList() {
listCoupon(this.couponQueryParams).then(response => {
this.couponList = response.rows;
this.couponTotal = response.total;
});
},
// 取消按钮
cancel() {
this.open = false;
......@@ -481,9 +500,7 @@ export default {
give(row) {
this.consumerId = row.id;
this.couponLoading = true;
listCoupon().then(response => {
this.couponList = response.rows;
});
this.getCouponList();
this.couponLoading = false;
this.couponOpen = true;
this.couponTitle = "优惠卷列表";
......
......@@ -190,32 +190,15 @@
<el-table-column type="selection" width="55" align="center"/>
<el-table-column label="ID" align="center" prop="id"/>
<el-table-column label="用户ID" align="center" prop="consumerId"/>
<!-- <el-table-column label="优惠券ID" align="center" prop="couponId"/>-->
<el-table-column label="优惠券编码" align="center" prop="couponCode"/>
<el-table-column label="优惠券名称" align="center" prop="name" width="240px"/>
<!-- <el-table-column label="优惠房型" align="center" prop="roomType" />-->
<!-- <el-table-column label="优惠房型" align="center" prop="roomType" width="240px">-->
<!-- <template slot-scope="scope">-->
<!-- <div v-if="scope.row.roomType.length" style="display: flex;flex-wrap: wrap;width: 100%;">-->
<!-- <dict-tag style="margin: 0 3px;" v-for="(item ,k) in scope.row.roomType" :key="k"-->
<!-- :options="dict.type.store_room_type" :value="item"-->
<!-- />-->
<!-- </div>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column label="优惠开始" align="center" prop="couponTimeStart"/>-->
<!-- <el-table-column label="优惠结束" align="center" prop="couponTimeEnd"/>-->
<!-- <el-table-column label="优惠券类型" align="center" prop="couponType" />-->
<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="maxDuration"/>-->
<!-- <el-table-column label="时长" align="center" prop="duration"/>-->
<!-- <el-table-column label="门槛金额" align="center" prop="minPrice"/>-->
<el-table-column label="时长" align="center" prop="duration"/>
<el-table-column label="优惠金额" align="center" prop="subPrice"/>
<!-- <el-table-column label="优惠券来源" align="center" prop="sourceType" />-->
<el-table-column label="优惠券来源" align="center" prop="sourceType">
<template slot-scope="scope">
<dict-tag :options="dict.type.consumer_coupon_source_type" :value="scope.row.sourceType"/>
......
......@@ -116,12 +116,25 @@
<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="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="orderType">
<template slot-scope="scope">
<dict-tag :options="dict.type.store_order_type" :value="scope.row.orderType"/>
</template>
</el-table-column>
<el-table-column label="套餐" align="center" prop="packageId">
<template slot-scope="scope">
<div v-if="scope.row.packageId" style="display: flex;flex-wrap: wrap;width: 100%;">
<dict-tag :options="packList" :value="scope.row.packageId"/>
</div>
</template>
</el-table-column>
<el-table-column label="优惠金额" align="center" prop="subPrice"/>
<el-table-column label="有效期开始" align="center" prop="startDate" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.startDate, '{y}-{m}-{d}') }}</span>
......@@ -172,16 +185,16 @@
<el-form-item label="优惠券类型" prop="couponType">
<el-select v-model="form.couponType" placeholder="请选择优惠券类型">
<el-option
v-for="dict in dict.type.coupon_type"
v-for="dict in dict.type.cash_coupon_type"
:key="dict.value"
:label="dict.label"
:value="parseInt(dict.value)"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="时长" prop="duration">
<el-input-number v-model="form.duration" :min="0" :max="24" placeholder="请输入时长"/>
</el-form-item>
<!-- <el-form-item label="时长" prop="duration">-->
<!-- <el-input-number v-model="form.duration" :min="0" :max="24" placeholder="请输入时长"/>-->
<!-- </el-form-item>-->
<el-form-item label="平台类型" prop="platformType">
<el-select v-model="form.platformType" placeholder="请选择第三方平台类型">
<el-option
......@@ -192,6 +205,29 @@
></el-option>
</el-select>
</el-form-item>
<el-form-item label="订单类型" prop="orderType">
<el-select v-model="form.orderType" placeholder="请选择订单类型">
<el-option
v-for="dict in dict.type.store_order_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="套餐" prop="packageId">
<el-select v-model="form.packageId" placeholder="请选择套餐">
<el-option
v-for="dict in packList"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="优惠金额" prop="subPrice">
<el-input-number v-model="form.subPrice" :min="0" :max="9999" label="请输入优惠金额"/>
</el-form-item>
<el-form-item label="有效期开始" prop="startDate">
<el-date-picker clearable
v-model="form.startDate"
......@@ -226,11 +262,12 @@
</template>
<script>
import { listCoupon, getCoupon, delCoupon, addCoupon, updateCoupon } from "@/api/system/coupon";
import {listGroup, getCoupon, delCoupon, addCoupon, updateCoupon} from "@/api/system/coupon";
import {query} from '@/api/system/pack'
export default {
name: "Coupon",
dicts: ['store_coupon_type', 'store_type', 'store_room_type', 'store_platform_type', 'coupon_type'],
dicts: ['store_coupon_type', 'store_type', 'store_room_type', 'store_platform_type', 'cash_coupon_type', 'store_order_type'],
data() {
return {
// 遮罩层
......@@ -249,6 +286,7 @@ export default {
roomType: [],
// 优惠券表格数据
couponList: [],
packList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
......@@ -271,6 +309,10 @@ export default {
form: {},
// 表单校验
rules: {
subPrice: [
//只保留2位小数
{pattern: /^(([1-9]{1}\d*)|(0{1}))(\.\d{0,2})?$/, message: "请输入正确的优惠金额", trigger: "blur"}
],
name: [
{ required: true, message: "优惠券名称不能为空", trigger: "blur" }
],
......@@ -285,6 +327,7 @@ export default {
},
created() {
this.getList();
this.onPackList();
},
methods: {
onChangeStoreType(e){
......@@ -299,12 +342,31 @@ export default {
/** 查询优惠券列表 */
getList() {
this.loading = true;
listCoupon(this.queryParams).then(response => {
listGroup(this.queryParams).then(response => {
this.couponList = response.rows;
this.total = response.total;
this.loading = false;
});
},
onPackList() {
query().then(res => {
this.packList = res.data.map(obj => {
return {
...obj,
raw: {
dictSort: 1,
dictValue: "1",
listClass: "primary",
cssClass: ''
},
value: obj.id.toString(),
label: obj.name,
}
})
this.$forceUpdate();
this.getList();
})
},
// 取消按钮
cancel() {
this.open = false;
......@@ -359,6 +421,8 @@ export default {
const id = row.id || this.ids
getCoupon(id).then(response => {
this.form = response.data;
this.form.orderType = response.data.orderType.toString();
this.form.packageId = response.data.packageId.toString();
if(this.form.storeType){
this.storeType = this.form.storeType.split(",")
}
......
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