Commit cb885303 authored by leiqingsong's avatar leiqingsong

优惠券发送数量限制

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