多商家购物车
问题1: 单选全选中没有 对全选按钮没有监听 问题2:这个单商家的额 如何使多商家的购物车 这个也不是很适用
问题1: 单选全选中没有 对全选按钮没有监听 问题2:这个单商家的额 如何使多商家的购物车 这个也不是很适用
2018-03-29
问题1:
selectedProduct: function(item) {
//判断对象中的变量是否存在
if(typeof item.checked == 'undefined') {
// Vue.set(item, "checked", true);
this.$set(item, "checked", true);
} else {
item.checked = !item.checked;//当前值取反!!!!!
}
this.calcTotalPrice();//计算总金额
//判断是否全部选中
var checkedFlag=true;
this.productList.forEach(function(everyitem, index) {
if(typeof everyitem.checked == 'undefined') {
checkedFlag=false;
} else {
if(!item.checked){//未选中
checkedFlag=false;
}
}
});
this.checkAllFlag = checkedFlag;
},问题2:多家购物车可以通过添加一个商家字段productVenderId用于区分不同商家:
{
"productId":"600100002120",
"productName":"加多宝",
"productPrice":8,
"productVenderId":1,
"productQuantity":5,
"productImage":"static/img/goods-2.jpg",
"parts":[
{
"partsId":"20001",
"partsName":"吸管",
"imgSrc":"static/img/part-2.jpg"
}
]
}举报