想实现的 在选中情况下 如果 兑换个数下的input里面的数字更改的话 需要消耗的积分 实现同步更新
求实现方法
data () {
return {
form: {
mobile: "",
cardNo: ""
},
userInfo:'',
isUserInfo: false,
rules: {},
count:0,
multipleSelection:[],
exchange:true,
noExchange:false
};
},
handleSelectionChange (val) {
console.log(val);
this.multipleSelection = val.map((item) =>{
return item.costPointsNum * item.exchangeNum;
});
let len = this.multipleSelection.length;
console.log(len);
if (len === 0) {
this.count = 0;
this.noExchange = false;
this.exchange = true;
} else {
this.count = 0;
this.multipleSelection.map(item => {
this.count += item;
});
let len = 0;
}
let leftPoints = this.userInfo.leftPoints;
console.log(leftPoints);
if (this.count < leftPoints){
console.log("可以兑换");
} else {
this.exchange = false;
this.noExchange = true;
console.log('积分余额不足');
}
return this.count;
// console.log(this.multipleSelection);
},
疑惑点:输入框里面的值不知道该怎么获取