Commit cb885303 authored by leiqingsong's avatar leiqingsong

优惠券发送数量限制

parent b6352574
......@@ -385,7 +385,7 @@ export default {
let offset = 0;
switch (len) {
case 2:
offset = 0.5;
offset = 0;
break;
case 4:
offset = 0.75;
......
......@@ -124,7 +124,7 @@
title="选择优惠券"
:value="checked_coupon.name"
is-link
@click="showCoupon = true"
@click="handleChoseCoupon"
center
/>
</van-cell-group>
......@@ -194,6 +194,10 @@ export default {
},
created() {},
methods: {
handleChoseCoupon() {
this.showCoupon = true;
this.getCoupons();
},
openStartTime() {
this.startShow = true;
this.minStartDate = new Date();
......@@ -270,7 +274,8 @@ export default {
let temp = [];
res.data.forEach(i => {
let item = i;
item.name = i.name + " ID:" + i.id;
// item.label = i.name + " ID:" + i.id;
item.name = i.name + " ID:" + i.id + ' 剩余:' + i.validNumber + '张';
temp.push(item);
});
this.coupons = temp;
......@@ -322,6 +327,10 @@ export default {
this.$toast("活动开始时间应小于活动开始时间");
return false;
}
if (Number(this.totalLimit) > this.checked_coupon.validNumber) {
this.$toast(`优惠券总发放数量不可大于当前优惠券剩余数量${this.checked_coupon.validNumber}`);
return false;
}
if (Number(this.maxNumber) > Number(this.totalLimit)) {
this.$toast("单日最大发放数量应不大于总发放数量");
return false;
......@@ -346,7 +355,6 @@ export default {
image: JSON.stringify(this.fileList)
}
};
console.log("params", params);
if (--this.create_times < 0) {
this.$toast("已经过提交申请了,请等待处理!");
return false;
......@@ -417,7 +425,6 @@ export default {
this.create_times = 1;
console.log("create_times", this.create_times);
if (this.$route.query.activityId) {
console.log("有模板数据");
let template_id = this.$route.query.templateId;
this.getTemplateDate(template_id);
}
......
......@@ -523,6 +523,7 @@ export default {
handleCheckCoupon(index) {
this.show = true;
this.current_index = index;
this.getCoupons();
},
// 选择优惠券
onSelect(val) {
......@@ -541,7 +542,7 @@ export default {
let temp = [];
res.data.forEach(i => {
let item = i;
item.name = i.name + " ID:" + i.id;
item.name = i.name + " ID:" + i.id + " 剩余:" + i.validNumber + '张';
temp.push(item);
});
this.coupons = temp;
......@@ -654,9 +655,12 @@ export default {
Number(this.prizeList[i].total_limit) <
Number(this.prizeList[i].preLimit)
) {
console.log(this.prizeList[i].total_limit);
console.log(this.prizeList[i].preLimit);
this.$toast(`奖项${i + 1},总发放数量应大于等于每日发放数量`);
this.$toast(`奖项${Number(i) + 1},总发放数量应大于等于每日发放数量`);
validate = false;
break;
}
if (Number(this.prizeList[i].total_limit) > this.prizeList[i].checked_coupon.validNumber) {
this.$toast(`奖项${Number(i) + 1},优惠券总发放数量不可大于当前优惠券剩余数量${this.prizeList[i].checked_coupon.validNumber}`);
validate = false;
break;
}
......
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