From 6955399f408332149aa7d4078cb24e01d34263df Mon Sep 17 00:00:00 2001 From: yiming <m13691596795@163.com> Date: 星期二, 26 三月 2024 15:13:08 +0800 Subject: [PATCH] 书展列表bug --- pages/cart/index.js | 32 ++++++++++++++++++++++++++++---- 1 files changed, 28 insertions(+), 4 deletions(-) diff --git a/pages/cart/index.js b/pages/cart/index.js index 7d37d43..95c0fe5 100644 --- a/pages/cart/index.js +++ b/pages/cart/index.js @@ -5,6 +5,7 @@ Page({ data: { + onDisabled: false, imgUrl: [], shoppingCartData: [], checkAll: false, @@ -23,10 +24,18 @@ title: '璐墿杞�' }); this.shoppingCartGet(); + console.log(this.data.shoppingCartData.length, 'this.data.shoppingCartData.length'); + }, onShow() { + if (typeof this.getTabBar === 'function' && this.getTabBar()) { + this.getTabBar().setData({ + active: 3 + }) + } this.shoppingCartGet(); this.setData({ totalPrice: 0.00, selectedCount: 0, checkAll: false, }) + }, onDelete(e) { @@ -35,7 +44,7 @@ ids: [item.id] }).then(res => { this.shoppingCartGet(); - wx.showToast({ title: '浣犵偣鍑讳簡鍒犻櫎', icon: 'none' }); + wx.showToast({ title: '鍒犻櫎鍥句功鎴愬姛', icon: 'none' }); }); }, @@ -53,7 +62,7 @@ }) res.datas.forEach(item => { - console.log(item, 'item456'); + // console.log(item, 'item456'); item.imgUrl = getPublicImage(item.productMonWithLinkDto.product.icon, '', '160'); this.setData({ @@ -65,8 +74,22 @@ this.setData({ shoppingCartData: res.datas }); + + + if (this.data.shoppingCartData.length === 0) { + console.log(11111); + this.setData({ + onDisabled: true + }) + } else { + console.log(2222); + this.setData({ + onDisabled: false + }) + } }); wx.stopPullDownRefresh() + }, bottomChange(e) { @@ -126,7 +149,7 @@ linkIds: selectedIds } app.MG.store.shoppingCartCreateOrder(data).then(res => { - console.log(res, 456); + // console.log(res, 456); const url = '/pages/cart/paymentPage/index?orderNumber=' + res.orderNumber @@ -165,7 +188,8 @@ this.setData({ isMore: false }) - }, 100) + console.log('300'); + }, 300) } }, -- Gitblit v1.9.1