|
@@ -137,15 +137,12 @@
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
|
|
- 'form.month'(val) {
|
|
|
- let freeNum = 0;
|
|
|
- if (this.monthlyRuleObj.giveFlag && Number(this.monthlyRuleObj.giveFlag) === 1) {
|
|
|
- let remainNum = Number(val) % Number(this.monthlyRuleObj.minMonth),
|
|
|
- timesNum = Number(val) / Number(this.monthlyRuleObj.minMonth);
|
|
|
- if (remainNum === 0) {
|
|
|
- this.freeMonthNum = Number(timesNum) * Number(this.monthlyRuleObj.giveMonth);
|
|
|
- }
|
|
|
- }
|
|
|
+ 'form.month':{
|
|
|
+ handler(val){
|
|
|
+ this.calcFreeMonthNum(val)
|
|
|
+ },
|
|
|
+ deep:true,
|
|
|
+ immediate:false
|
|
|
}
|
|
|
},
|
|
|
onLoad(page) {
|
|
@@ -310,9 +307,20 @@
|
|
|
}).then(res => {
|
|
|
if (res.code === 200) {
|
|
|
this.monthlyRuleObj = res?.rows[0] ?? {}
|
|
|
+ this.calcFreeMonthNum(this.form.month)
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ calcFreeMonthNum(val){
|
|
|
+ let freeNum = 0;
|
|
|
+ if (this.monthlyRuleObj.giveFlag && Number(this.monthlyRuleObj.giveFlag) === 1) {
|
|
|
+ // let remainNum = Number(val) % Number(this.monthlyRuleObj.minMonth)
|
|
|
+ let timesNum = parseInt(Number(val) / Number(this.monthlyRuleObj.minMonth));
|
|
|
+ if (timesNum > 0) {
|
|
|
+ this.freeMonthNum = Number(timesNum) * Number(this.monthlyRuleObj.giveMonth);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
/**
|
|
|
* 提交包月信息
|
|
|
* @date 2022-10-09
|