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

@ -334,6 +334,35 @@
}, },
onLoadFun(){ onLoadFun(){
this.isShowAuth = false; 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) { goRouter(item) {
var pages = getCurrentPages(); var pages = getCurrentPages();
@ -740,7 +769,7 @@
this.recommend = false this.recommend = false
} }
const sku = {} const sku = {}
this.checkboxAllChange() this.checkboxAllChange(true)
// //
}); });
}, },
@ -780,7 +809,7 @@
this.cartAllCheck('goodsCheck') this.cartAllCheck('goodsCheck')
}, },
// //
cartAllCheck(type) { cartAllCheck(type,isFirst) {
let allArr = []; let allArr = [];
let totalMoney = 0 let totalMoney = 0
let totalNum = 0 let totalNum = 0
@ -816,12 +845,19 @@
this.cartCount = totalNum this.cartCount = totalNum
this.selectCountPrice = totalMoney 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.isAllSelect = !this.isAllSelect
this.cartAllCheck('cartCheck') if(val){
this.cartAllCheck('cartCheck','first')
}
}, },
// //
getHostProduct: function() { getHostProduct: function() {

Loading…
Cancel
Save