liudan 7 months ago
parent b7b23bafee
commit 67caca312c
  1. 62
      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;

Loading…
Cancel
Save