From 67caca312c68c3331ccd4bda824a3b73ba8ad58e Mon Sep 17 00:00:00 2001 From: liudan <18634735655@163.com> Date: Thu, 20 Jun 2024 02:06:38 +0800 Subject: [PATCH] 1 --- pages/order_addcart/order_addcart.vue | 62 ++++++++++++++++++++++++--- 1 file changed, 55 insertions(+), 7 deletions(-) diff --git a/pages/order_addcart/order_addcart.vue b/pages/order_addcart/order_addcart.vue index 1c842e4..8dccc95 100644 --- a/pages/order_addcart/order_addcart.vue +++ b/pages/order_addcart/order_addcart.vue @@ -253,10 +253,53 @@ computed: configMap({hide_mer_status: 1,recommend_switch:0,navigation: {}}, mapGetters(['isLogin','viewColor'])), onReady(){}, mounted: function() {}, - onLoad: function(options) { + // onLoad: function(options) { + + // }, + onShow() { + console.log(this.cartList.valid) + let resArr=[] + this.cartList.valid.forEach(item=>{ + item.list.forEach(i=>{ + if(i.check){ + resArr.push(i.product_id) + } + }) + }) + console.log(resArr) + if (this.isLogin == true) { + // this.getCartList(); + 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(); + }else{ + setTimeout(() =>{ + this.isAuto = true; + this.isShowAuth = true + }, 300); + } }, - onShow: function() { + onLoad: function() { + console.log("999") let that = this let routes = getCurrentPages(); let curRoute = routes[routes.length - 1].route @@ -658,7 +701,8 @@ let that = this; getCartList().then(res => { res.data.list.forEach((item, index) => { - item.allCheck = true + // item.allCheck = true + this.$set(item,'allCheck',true) item.list.forEach((goods, j) => { goods.check = true if (goods.cart_num == 1) { @@ -746,16 +790,19 @@ return goods.check == true }) if (el.list.length == tempArr.length) { - el.allCheck = true + this.$set(el,'allCheck',true) + // el.allCheck = true allArr.push(el) } else { - el.allCheck = false + this.$set(el,'allCheck',false) + // el.allCheck = false } } else { el.list.forEach((goods) => { goods.check = this.isAllSelect }) - el.allCheck = this.isAllSelect + this.$set(el,'allCheck',this.isAllSelect) + // el.allCheck = this.isAllSelect if (el.allCheck) allArr.push(el) } // 总金额 //总数 @@ -952,7 +999,8 @@ } .shoppingCart .list .item { background-color: #fff; - margin-bottom: 15rpx; + padding-bottom: 150rpx; + // margin-bottom: 15rpx; .store-title { display: flex; align-items: center;