liudan 5 months ago
parent 8ed1eb9515
commit 9b5db39b6c
  1. 40
      pages/order_addcart/order_addcart.vue

@ -257,7 +257,6 @@
// },
onShow() {
console.log(this.cartList.valid)
let resArr=[]
this.cartList.valid.forEach(item=>{
@ -268,6 +267,9 @@
})
})
console.log(resArr)
let finishArr = [];
let totalMoney = 0
this.selectCountPrice = 0.00
if (this.isLogin == true) {
// this.getCartList();
getCartList().then(res => {
@ -281,14 +283,27 @@
}
})
let selectedArr = i.list.filter(y=>{return y.check})
console.log(selectedArr)
if(selectedArr.length==i.list.length){
this.$set(i,'allCheck',true)
}
if(selectedArr.length>0){
finishArr.push(...selectedArr)
hasSelected = true;
}
})
finishArr.forEach(e => {
if (e.check) {
totalMoney = this.$util.$h.Add(totalMoney, this.$util.$h.Mul(e.productAttr.price, e.cart_num))
}
})
this.selectCountPrice = totalMoney
if(!hasSelected){
this.selectCountPrice = 0.00
this.cartCount = 0
@ -480,14 +495,16 @@
});
}
},
onMyEvent: function() {
onMyEvent() {
this.$set(this.attr, 'cartAttr', false);
this.$set(this, 'isOpen', false);
},
/*
* 更改商品属性
*/
changeCart: function(goods, id) {
changeCart(goods, id) {
let that = this;
if(that.goods == goods){
that.isOpen = that.attr.cartAttr = true;
@ -819,7 +836,22 @@
}
const sku = {}
// this.checkboxAllChange(true)
//
if(isChange){
let totalMoney = 0;
console.log(this.cartList.valid,"liudan")
this.cartList.valid.forEach(el=>{
el.list.forEach(e => {
if (e.check) {
totalMoney = this.$util.$h.Add(totalMoney, this.$util.$h.Mul(e.productAttr.price, e.cart_num))
}
})
})
this.selectCountPrice = totalMoney
}
});
},
//

Loading…
Cancel
Save