mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-ui.git
synced 2025-12-18 08:55:52 +08:00
自动发券模块(管理端加前端展示)
This commit is contained in:
@@ -12,11 +12,19 @@
|
||||
<span v-if="couponActivity.couponActivityType === 'REGISTERED'"
|
||||
>新人发券</span
|
||||
>
|
||||
<span v-else-if="couponActivity.couponActivityType === 'AUTO_COUPON'">自动发券</span>
|
||||
<spin v-else>精确发券</spin>
|
||||
</FormItem>
|
||||
<FormItem label="领取频率" v-if="couponActivity.couponFrequencyEnum != '' && couponActivity.couponFrequencyEnum != null && couponActivity.couponFrequencyEnum != undefined">
|
||||
<span v-if="couponActivity.couponFrequencyEnum === 'DAY'"
|
||||
>每日</span
|
||||
>
|
||||
<span v-else-if="couponActivity.couponFrequencyEnum === 'WEEK'">每周一次</span>
|
||||
<span v-else>每月一次</span>
|
||||
</FormItem>
|
||||
<FormItem
|
||||
label="活动范围"
|
||||
v-if="couponActivity.couponActivityType === 'SPECIFY'"
|
||||
v-if="couponActivity.couponActivityType === 'SPECIFY' || couponActivity.couponActivityType === 'AUTO_COUPON'"
|
||||
>
|
||||
<span v-if="couponActivity.activityScope === 'ALL'">全部会员</span>
|
||||
<spin v-else>指定会员</spin>
|
||||
|
||||
@@ -34,6 +34,22 @@
|
||||
>
|
||||
<Radio label="REGISTERED">新人发券</Radio>
|
||||
<Radio label="SPECIFY">精确发券</Radio>
|
||||
<Radio label="INVITE_NEW">邀新赠券</Radio>
|
||||
<Radio label="AUTO_COUPON">自动赠券</Radio>
|
||||
</RadioGroup>
|
||||
</FormItem>
|
||||
<FormItem
|
||||
label="领取频率"
|
||||
v-if="form.couponActivityType === 'AUTO_COUPON'"
|
||||
>
|
||||
<RadioGroup
|
||||
type="button"
|
||||
button-style="solid"
|
||||
v-model="form.couponFrequencyEnum"
|
||||
>
|
||||
<Radio label="DAY">每日一次</Radio>
|
||||
<Radio label="WEEK">每周一次</Radio>
|
||||
<Radio label="MONTH">每月一次</Radio>
|
||||
</RadioGroup>
|
||||
</FormItem>
|
||||
<FormItem
|
||||
@@ -161,6 +177,7 @@ export default {
|
||||
endTime: "", //结束时间
|
||||
memberDTOS: [], //指定会员范围
|
||||
couponActivityItems: [], //优惠券列表
|
||||
couponFrequencyEnum:"", //选择周期
|
||||
},
|
||||
submitLoading: false, // 添加或编辑提交状态
|
||||
selectCouponList: [], //选择的优惠券列表
|
||||
@@ -323,7 +340,7 @@ export default {
|
||||
// 清空原有数据
|
||||
this.form.couponActivityItems = this.selectCouponList.map((item) => {
|
||||
return {
|
||||
num: 0,
|
||||
num: 1,
|
||||
couponId: item.id,
|
||||
};
|
||||
});
|
||||
@@ -341,6 +358,33 @@ export default {
|
||||
},
|
||||
/** 保存平台优惠券 */
|
||||
handleSubmit() {
|
||||
if(this.form.couponFrequencyEnum !== ''){
|
||||
console.log(this.activityScope)
|
||||
if(this.form.activityScope == 'ALL'){
|
||||
this.form.startTime = this.$options.filters.unixToDate(this.rangeTime[0] / 1000);
|
||||
this.form.endTime = this.$options.filters.unixToDate(this.rangeTime[1] / 1000);
|
||||
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (valid) {
|
||||
const params = JSON.parse(JSON.stringify(this.form));
|
||||
this.submitLoading = true;
|
||||
// 添加 避免编辑后传入id等数据 记得删除
|
||||
delete params.id;
|
||||
saveActivityCoupon(params).then((res) => {
|
||||
this.submitLoading = false;
|
||||
if (res.success) {
|
||||
this.$Message.success("优惠券活动创建成功");
|
||||
this.closeCurrentPage();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}else {
|
||||
this.$Message.info('自动发券只能全用户发送')
|
||||
this.form.couponActivityType = 'SPECIFY'
|
||||
this.form.activityScope = 'ALL'
|
||||
}
|
||||
}else{
|
||||
this.form.startTime = this.$options.filters.unixToDate(this.rangeTime[0] / 1000);
|
||||
this.form.endTime = this.$options.filters.unixToDate(this.rangeTime[1] / 1000);
|
||||
|
||||
@@ -359,6 +403,8 @@ export default {
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
// 关闭当前页面
|
||||
closeCurrentPage() {
|
||||
|
||||
@@ -92,7 +92,9 @@ export default {
|
||||
render: (h, params) => {
|
||||
if (params.row.couponActivityType === "REGISTERED") {
|
||||
return h("div", ["注册赠券"]);
|
||||
} else {
|
||||
}else if(params.row.couponActivityType === 'AUTO_COUPON'){
|
||||
return h("div", ["自动发券"]);
|
||||
}else {
|
||||
return h("div", ["精确发券"]);
|
||||
}
|
||||
},
|
||||
@@ -111,6 +113,25 @@ export default {
|
||||
return h("div", [text]);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "领取频率",
|
||||
key: "couponFrequencyEnum",
|
||||
minWidth: 120,
|
||||
render: (h, params) => {
|
||||
console.log(params)
|
||||
let text = ''
|
||||
if (params.row.couponFrequencyEnum === "DAY") {
|
||||
text = "每日";
|
||||
} else if(params.row.couponFrequencyEnum === "WEEK") {
|
||||
text = "每周";
|
||||
} else if(params.row.couponFrequencyEnum === 'MONTH'){
|
||||
text = '每月'
|
||||
} else {
|
||||
text = '/'
|
||||
}
|
||||
return h("div", [text]);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "活动时间",
|
||||
minWidth: 150,
|
||||
@@ -121,6 +142,8 @@ export default {
|
||||
innerHTML: params.row.startTime + "<br/>" + params.row.endTime,
|
||||
},
|
||||
});
|
||||
}else{
|
||||
return h("div", '/');
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
@@ -125,7 +125,7 @@
|
||||
<FormItem label="有效期" prop="rangeTime">
|
||||
<div v-if="form.getType == 'ACTIVITY'">
|
||||
<RadioGroup v-model="rangeTimeType">
|
||||
<Radio :disabled="disabled" :label="1">起止时间</Radio>
|
||||
<Radio :disabled="disabled" :label="1" v-if="form.getType !== 'ACTIVITY'">起止时间</Radio>
|
||||
<Radio :disabled="disabled" :label="0">固定时间</Radio>
|
||||
</RadioGroup>
|
||||
</div>
|
||||
@@ -144,6 +144,7 @@
|
||||
<div class="effectiveDays" v-if="rangeTimeType == 0">
|
||||
领取当天开始
|
||||
<InputNumber
|
||||
:disabled="disabled"
|
||||
v-model="form.effectiveDays"
|
||||
:min="1"
|
||||
style="width: 100px"
|
||||
@@ -242,6 +243,11 @@ export default {
|
||||
handler(val) {
|
||||
if (val == "FREE") {
|
||||
this.rangeTimeType = 1;
|
||||
}else{
|
||||
this.rangeTimeType = 0;
|
||||
}
|
||||
if(this.rangeTimeType == 0){
|
||||
delete this.formRule.rangeTime
|
||||
}
|
||||
},
|
||||
deep: true,
|
||||
@@ -301,6 +307,7 @@ export default {
|
||||
promotionGoodsList: [],
|
||||
scopeIdGoods: [],
|
||||
rangeDayType: "",
|
||||
effectiveDays:1,
|
||||
},
|
||||
id: this.$route.query.id, // 优惠券id
|
||||
submitLoading: false, // 添加或编辑提交状态
|
||||
|
||||
Reference in New Issue
Block a user