diff --git a/pages/goods-detail/goods-detail.js b/pages/goods-detail/goods-detail.js index 51ad520..cc2bd16 100644 --- a/pages/goods-detail/goods-detail.js +++ b/pages/goods-detail/goods-detail.js @@ -507,16 +507,27 @@ Page({ const item = e.currentTarget.dataset.item; if (!item) { console.error('点击的商品项数据不存在'); + wx.showToast({ + title: '商品信息有误', + icon: 'none' + }); return; } // 获取商品ID const productId = item.id || item.productId; if (!productId) { - console.error('商品ID不存在'); + console.error('商品ID不存在:', item); + wx.showToast({ + title: '商品ID不存在', + icon: 'none' + }); return; } + console.log('点击商品项信息:', item); + console.log('获取到的商品ID:', productId, '类型:', typeof productId); + // 跳转到商品详情页 wx.navigateTo({ url: `/pages/goods-detail/goods-detail?productId=${productId}`,