liudan 7 months ago
parent 7080f785f9
commit 78e62e6c72
  1. 46
      pages/order_addcart/order_addcart.vue

@ -334,6 +334,35 @@
},
onLoadFun(){
this.isShowAuth = false;
let resArr=[]
this.cartList.valid.forEach(item=>{
item.list.forEach(i=>{
if(i.check){
resArr.push(i.product_id)
}
})
})
getCartList().then(res => {
console.log(res,"mm")
res.data.list.forEach(i=>{
i.list.forEach(u=>{
if(resArr.includes(u.product_id)){
u.check = true;
}
})
let selectedArr = i.list.filter(y=>{return y.check})
console.log(selectedArr)
if(selectedArr.length==i.list.length){
this.$set(i,'allCheck',true)
}
})
this.cartList.valid = res.data.list;
this.cartList.invalid = res.data.fail
})
this.getCartNum();
},
goRouter(item) {
var pages = getCurrentPages();
@ -740,7 +769,7 @@
this.recommend = false
}
const sku = {}
this.checkboxAllChange()
this.checkboxAllChange(true)
//
});
},
@ -780,7 +809,7 @@
this.cartAllCheck('goodsCheck')
},
//
cartAllCheck(type) {
cartAllCheck(type,isFirst) {
let allArr = [];
let totalMoney = 0
let totalNum = 0
@ -816,12 +845,19 @@
this.cartCount = totalNum
this.selectCountPrice = totalMoney
//
this.isAllSelect = allArr.length == this.cartList.valid.length ? true : false
console.log(allArr,"oooo12345",this.cartList.valid,isFirst)
if(!isFirst){
this.isAllSelect = allArr.length == this.cartList.valid.length ? true : false
}
},
//
checkboxAllChange() {
checkboxAllChange(val) {
this.isAllSelect = !this.isAllSelect
this.cartAllCheck('cartCheck')
if(val){
this.cartAllCheck('cartCheck','first')
}
},
//
getHostProduct: function() {

Loading…
Cancel
Save