Commit c4f8720e by 吕明尚

更改优惠卷显示

parent fc95c407
......@@ -268,12 +268,17 @@
</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="minDuration"/>
<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="weeks" width="250px">
<template slot-scope="scope">
<dict-tag :options="dict.type.sunday_type" :value="scope.row.weeks"/>
</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>
......@@ -327,7 +332,7 @@ import moment from "moment";
export default {
name: "Consumer",
dicts: ['sys_user_sex', 'wechat_role_type', 'store_coupon_type', 'store_platform_type', 'store_platform_type'],
dicts: ['sys_user_sex', 'wechat_role_type', 'store_coupon_type', 'store_platform_type', 'store_platform_type', 'sunday_type'],
data() {
return {
// 遮罩层
......@@ -406,7 +411,12 @@ export default {
getCouponList() {
this.couponQueryParams.endDate = moment().format('YYYY-MM-DD')
listDuration(this.couponQueryParams).then(response => {
this.couponList = response.rows;
this.couponList = response.rows.map(item => {
return {
...item,
weeks: item.weeks ? item.weeks.split(",") : []
}
});
this.couponTotal = response.total;
});
},
......
......@@ -205,9 +205,9 @@
</div>
</template>
</el-table-column>
<el-table-column label="适用星期" align="center" prop="sundays" width="250px">
<el-table-column label="适用星期" align="center" prop="weeks" width="250px">
<template slot-scope="scope">
<dict-tag :options="dict.type.sunday_type" :value="scope.row.sundays"/>
<dict-tag :options="dict.type.sunday_type" :value="scope.row.weeks"/>
</template>
</el-table-column>
<el-table-column label="有效开始时段" align="center" prop="couponTimeStart"/>
......@@ -465,7 +465,7 @@ export default {
this.consumerCouponList = response.rows.map(item => {
return {
...item,
sundays: item.sundays ? item.sundays.split(",") : []
weeks: item.weeks ? item.weeks.split(",") : []
}
});
this.total = response.total
......
......@@ -128,9 +128,9 @@
<dict-tag :options="dict.type.store_order_type" :value="scope.row.orderType"/>
</template>
</el-table-column>
<el-table-column label="适用星期" align="center" prop="sundays" width="250px">
<el-table-column label="适用星期" align="center" prop="weeks" width="250px">
<template slot-scope="scope">
<dict-tag :options="dict.type.sunday_type" :value="scope.row.sundays"/>
<dict-tag :options="dict.type.sunday_type" :value="scope.row.weeks"/>
</template>
</el-table-column>
<el-table-column label="套餐" align="center" prop="packageId">
......@@ -229,9 +229,9 @@
/>
</el-select>
</el-form-item>
<el-form-item label="适用星期" prop="sundays">
<el-form-item label="适用星期" prop="weeks">
<div style="display: flex;flex-direction: row;align-items: center;width: 100%;">
<el-select style="width: 100%;" v-model="sundays" multiple placeholder="选择星期" @change="onChangeSundays">
<el-select style="width: 100%;" v-model="weeks" multiple placeholder="选择星期" @change="onChangeweeks">
<el-option
v-for="dict in dict.type.sunday_type"
:key="dict.value"
......@@ -310,7 +310,7 @@ export default {
// 优惠券表格数据
couponList: [],
packList: [],
sundays: [],
weeks: [],
// 弹出层标题
title: "",
// 是否显示弹出层
......@@ -367,19 +367,20 @@ export default {
console.log(e)
this.form.roomType = e.join()
},
onChangeSundays(e) {
onChangeweeks(e) {
console.log(e)
this.form.sundays = e.join()
this.form.weeks = e.join()
},
/** 查询优惠券列表 */
getList() {
this.loading = true;
this.weeks = [];
listDuration(this.queryParams).then(response => {
this.couponList = response.rows.map(item => {
return {
...item,
sundays: item.sundays ? item.sundays.split(",") : []
weeks: item.weeks ? item.weeks.split(",") : []
}
});
this.total = response.total;
......@@ -412,6 +413,7 @@ export default {
},
// 表单重置
reset() {
this.weeks = []
this.form = {
id: null,
name: null,
......@@ -473,8 +475,8 @@ export default {
if (this.form.roomType) {
this.roomType = this.form.roomType.split(",")
}
if (this.form.sundays) {
this.sundays = this.form.sundays.split(",")
if (this.form.weeks) {
this.weeks = this.form.weeks.split(",")
}
this.open = true;
this.title = "修改优惠券";
......@@ -484,8 +486,8 @@ export default {
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.sundays.length) {
this.form.sundays = this.sundays.join();
if (this.weeks.length) {
this.form.weeks = this.weeks.join();
}
if (this.form.id != null) {
updateCoupon(this.form).then(response => {
......
......@@ -134,9 +134,9 @@
</div>
</template>
</el-table-column>
<el-table-column label="适用星期" align="center" prop="sundays" width="250px">
<el-table-column label="适用星期" align="center" prop="weeks" width="250px">
<template slot-scope="scope">
<dict-tag :options="dict.type.sunday_type" :value="scope.row.sundays"/>
<dict-tag :options="dict.type.sunday_type" :value="scope.row.weeks"/>
</template>
</el-table-column>
<el-table-column label="适用门店" align="center" prop="storeIds" width="350">
......@@ -238,9 +238,9 @@
/>
</el-select>
</el-form-item>
<el-form-item label="适用星期" prop="sundays">
<el-form-item label="适用星期" prop="weeks">
<div style="display: flex;flex-direction: row;align-items: center;width: 100%;">
<el-select style="width: 100%;" v-model="sundays" multiple placeholder="选择星期" @change="onChangeSundays">
<el-select style="width: 100%;" v-model="weeks" multiple placeholder="选择星期" @change="onChangeweeks">
<el-option
v-for="dict in dict.type.sunday_type"
:key="dict.value"
......@@ -346,7 +346,7 @@ export default {
couponList: [],
packList: [],
storeList: [],
sundays: [],
weeks: [],
storeIds: [],
// 弹出层标题
title: "",
......@@ -402,9 +402,9 @@ export default {
console.log(e)
this.form.roomType = e.join()
},
onChangeSundays(e) {
onChangeweeks(e) {
console.log(e)
this.form.sundays = e.join()
this.form.weeks = e.join()
},
/** 查询优惠券列表 */
......@@ -415,7 +415,7 @@ export default {
return {
...item,
storeIds: item.storeIds && item.storeIds.length ? item.storeIds.split(",") : [],
sundays: item.sundays ? item.sundays.split(",") : []
weeks: item.weeks ? item.weeks.split(",") : []
}
});
this.total = response.total;
......@@ -466,6 +466,7 @@ export default {
},
// 表单重置
reset() {
this.weeks = []
this.form = {
id: null,
name: null,
......@@ -534,8 +535,8 @@ export default {
if (this.form.storeIds) {
this.form.storeIds = this.form.storeIds.split(",")
}
if (this.form.sundays) {
this.sundays = this.form.sundays.split(",")
if (this.form.weeks) {
this.weeks = this.form.weeks.split(",")
}
this.open = true;
......@@ -546,8 +547,8 @@ export default {
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.sundays.length) {
this.form.sundays = this.sundays.join();
if (this.weeks.length) {
this.form.weeks = this.weeks.join();
}
this.form.storeIds = this.form.storeIds && this.form.storeIds.length ? this.form.storeIds.join() : ''
if (this.form.id != null) {
......
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