From 0c8505fb7d8a3ba0a3ef6dbcf5a7aa8cdb36105d Mon Sep 17 00:00:00 2001 From: litian <C21AF165> Date: 星期三, 10 四月 2024 16:39:13 +0800 Subject: [PATCH] 子商品跳转 --- pages/cart/index.js | 19 +++++++++++-------- 1 files changed, 11 insertions(+), 8 deletions(-) diff --git a/pages/cart/index.js b/pages/cart/index.js index 7e503ce..c31356e 100644 --- a/pages/cart/index.js +++ b/pages/cart/index.js @@ -86,8 +86,6 @@ totalSize: res.totalSize }) res.datas.forEach(item => { - console.log(res); - this.setData({ bookId: res.id, bookName: res.name @@ -105,13 +103,11 @@ this.setData({ shoppingCartData: res.datas }); - console.log(this.data.shoppingCartData, 'shoppingCartData'); if (this.data.shoppingCartData.length === 0) { this.setData({ onDisabled: true }) } else { - console.log(2222); this.setData({ onDisabled: false }) @@ -281,13 +277,20 @@ console.log(978); this.shoppingCartGet() }, - onBook(e) { + async onBook(e) { const item = e.currentTarget.dataset.item console.log(item); - console.log(item.productMonWithLinkDto.product.id); - console.log(item.productMonWithLinkDto.product.name); + let parentData = null; + parentData = await app.MG.store.getProductBySaleMethod({ + 'saleMethodId': item.saleMethod.id + }) + console.log(parentData) + let bookId = item.productMonWithLinkDto.product.id; + if (parentData.parentProduct.length > 0) { + bookId = parentData.parentProduct[parentData.parentProduct.length - 1].id; + } wx.navigateTo({ - url: '/packageBookService/pages/bookServices/detail/index?id=' + item.productMonWithLinkDto.product.id + '&name=' + item.productMonWithLinkDto.product.name + url: '/packageBookService/pages/bookServices/detail/index?id=' + bookId + '&name=' + item.productMonWithLinkDto.product.name }) } }); \ No newline at end of file -- Gitblit v1.9.1