}
this.getTotalMoney();
},
//单选框设置
checkBox:function (item){
var _this=this;
var num=0;
if (typeof item.check == “undefined”) {
this.$set(item,“check”,true);
}else{
item.check = !item.check;
}
this.productList.forEach(function (item,value) {
if (item.check) {
num++;
}
})
if (num==_this.productList.length) {
this.checkAllFlag=true;
}else{
this.checkAllFlag=false;
}
this.getTotalMoney();
},
//全选按钮设置
checkAll:function (){
var _this=this;
this.checkAllFlag = !this.checkAllFlag;
this.productList.forEach(function(item,index){
if (typeof item.check == “undefined”) {
_this.$set(item,“check”,_this.checkAllFlag);
}else{
item.check = _this.checkAllFlag;
}
})
this.getTotalMoney();
},
//总金额设置
getTotalMoney:function () {
var _this=this;
this.totalMoney = 0;
this.productList.forEach(function (item,index) {
if (item.check) {
_this.totalMoney += item.productQuentity*item.productPrice;
}
})
},
//删除商品
del: function (item) {
var index=this.productList.indexOf(item);
this.productList.splice(index,1);
this.getTotalMoney();
}
}
};