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

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