From c5864be56488bee0c767d4b1cf157db4a0ec33c3 Mon Sep 17 00:00:00 2001 From: yiming <m13691596795@163.com> Date: 星期二, 26 三月 2024 10:47:38 +0800 Subject: [PATCH] 关于我们bug --- pages/cart/index.js | 25 ++++++++++++++++++++++--- 1 files changed, 22 insertions(+), 3 deletions(-) diff --git a/pages/cart/index.js b/pages/cart/index.js index ad14b41..df1d933 100644 --- a/pages/cart/index.js +++ b/pages/cart/index.js @@ -5,6 +5,7 @@ Page({ data: { + onDisabled: false, imgUrl: [], shoppingCartData: [], checkAll: false, @@ -23,6 +24,8 @@ title: '璐墿杞�' }); this.shoppingCartGet(); + console.log(this.data.shoppingCartData.length, 'this.data.shoppingCartData.length'); + }, onShow() { if (typeof this.getTabBar === 'function' && this.getTabBar()) { @@ -32,6 +35,8 @@ } this.shoppingCartGet(); this.setData({ totalPrice: 0.00, selectedCount: 0, checkAll: false, }) + + }, onDelete(e) { const item = e.currentTarget.dataset.item; @@ -39,7 +44,7 @@ ids: [item.id] }).then(res => { this.shoppingCartGet(); - wx.showToast({ title: '浣犵偣鍑讳簡鍒犻櫎', icon: 'none' }); + wx.showToast({ title: '鍒犻櫎鍥句功鎴愬姛', icon: 'none' }); }); }, @@ -57,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({ @@ -69,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) { @@ -130,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 -- Gitblit v1.9.1