Commit fc538223 authored by leiqingsong's avatar leiqingsong

修改轮盘&修改送券活动领取&优惠券创建bug

parent 69a1d0ce
...@@ -615,10 +615,20 @@ export default { ...@@ -615,10 +615,20 @@ export default {
this.$toast("请完整填写表单!"); this.$toast("请完整填写表单!");
return false; return false;
} }
if (Number(this.basicInfo.jointimes) > Number(this.basicInfo.total_join)) { if (
Number(this.basicInfo.jointimes) > Number(this.basicInfo.total_join)
) {
this.$toast("会员单日参与次数应小于等于会员总参与次数"); this.$toast("会员单日参与次数应小于等于会员总参与次数");
return false; return false;
} }
if (
this.prizeList.length < 2 ||
this.prizeList.length % 2 != 0 ||
this.prizeList.length > 8
) {
this.$toast("奖项必须大于2小于8,且为偶数个!");
return false;
}
let validate = null; let validate = null;
for (let i in this.prizeList) { for (let i in this.prizeList) {
if (this.prizeList[i].type == "") { if (this.prizeList[i].type == "") {
...@@ -640,14 +650,20 @@ export default { ...@@ -640,14 +650,20 @@ export default {
break; break;
} }
if (Number(this.prizeList[i].total_limit) < Number(this.prizeList[i].preLimit)) { if (
Number(this.prizeList[i].total_limit) <
Number(this.prizeList[i].preLimit)
) {
console.log(this.prizeList[i].total_limit); console.log(this.prizeList[i].total_limit);
console.log(this.prizeList[i].preLimit); console.log(this.prizeList[i].preLimit);
this.$toast(`奖项${i + 1},总发放数量应大于等于每日发放数量`); this.$toast(`奖项${i + 1},总发放数量应大于等于每日发放数量`);
validate = false; validate = false;
break; break;
} }
if (Number(this.prizeList[i].total_limit) < Number(this.prizeList[i].limit)) { if (
Number(this.prizeList[i].total_limit) <
Number(this.prizeList[i].limit)
) {
this.$toast(`奖项${i + 1},总发放数量应大于每人限领数量`); this.$toast(`奖项${i + 1},总发放数量应大于每人限领数量`);
validate = false; validate = false;
break; break;
...@@ -716,7 +732,8 @@ export default { ...@@ -716,7 +732,8 @@ export default {
}, },
activityPrizes: params_prizeList activityPrizes: params_prizeList
}; };
API_Active.createActive(params).then(res => { API_Active.createActive(params)
.then(res => {
this.create_times = 1; this.create_times = 1;
if (res.result === "fail") { if (res.result === "fail") {
this.$toast(res.errorMsg); this.$toast(res.errorMsg);
...@@ -734,7 +751,8 @@ export default { ...@@ -734,7 +751,8 @@ export default {
} }
}); });
}, 200); }, 200);
}).catch(error=>{ })
.catch(error => {
this.create_times = 1; this.create_times = 1;
console.log(error); console.log(error);
}); });
...@@ -855,14 +873,21 @@ export default { ...@@ -855,14 +873,21 @@ export default {
return newString; return newString;
}, },
addPrice() { addPrice() {
if (this.prizeList.length > 5) { if (this.prizeList.length > 7) {
this.$toast("最多设置6个奖项"); this.$toast("最多设置8个奖项");
return; return false;
} }
// 计算剩余 概率 // 计算剩余 概率
let temp = 100; let temp = 100;
let total = 0;
this.prizeList.forEach(p => { this.prizeList.forEach(p => {
total += Number(p.probability);
if (total === 100) {
this.prizeList[0].probability -= 1;
temp = 1;
} else {
temp -= Number(p.probability); temp -= Number(p.probability);
}
}); });
// this.remain_probability -= Number(this.prizeList[this.prizeList.length-1].probability) // this.remain_probability -= Number(this.prizeList[this.prizeList.length-1].probability)
this.prizeList.push({ this.prizeList.push({
......
...@@ -138,7 +138,7 @@ ...@@ -138,7 +138,7 @@
/> />
</template> </template>
</van-cell> </van-cell>
<van-cell title="优惠券ID" style="font-size:14px;"> <!-- <van-cell title="优惠券ID" style="font-size:14px;">
<template slot="default"> <template slot="default">
<div class="npbr"> <div class="npbr">
<van-field <van-field
...@@ -156,7 +156,7 @@ ...@@ -156,7 +156,7 @@
/> />
</div> </div>
</template> </template>
</van-cell> </van-cell> -->
<van-cell title="总限制次数" style="font-size:14px;" class="js"> <van-cell title="总限制次数" style="font-size:14px;" class="js">
<van-stepper <van-stepper
v-model="addForm.limitOfUse" v-model="addForm.limitOfUse"
......
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