From 220af7f756aa4879c0dca91289aacdae7a65f2d7 Mon Sep 17 00:00:00 2001 From: weiwei Date: Thu, 5 Jun 2025 11:36:18 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E9=99=A4=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/shop/detail.vue | 50 +++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/src/pages/shop/detail.vue b/src/pages/shop/detail.vue index f9909e4..a2fe252 100644 --- a/src/pages/shop/detail.vue +++ b/src/pages/shop/detail.vue @@ -175,8 +175,8 @@ onShow(async () => { }) try { await getDetail() - // await getShopCar() - // await getClassify() + await getShopCar() + await getClassify() } catch (error) { uni.showToast({ title: "加载失败", @@ -222,29 +222,29 @@ const getPorduct = async () => { size: 9999, }) state.goodsList = data.records - // state.goodsList.forEach((i) => { - // if (i && i.foodSPURespVOList && i.foodSPURespVOList.length) { - // i.foodSPURespVOList.forEach((j) => { - // j.productCount = 0; - // j.productId = j.id; - // }); - // } - // }); - // const goodsList = [...state.goodsList]; - // if (state.carList && state.carList.length) { - // for (const i of goodsList) { - // if (i && i.foodSPURespVOList && i.foodSPURespVOList.length) { - // for (const j of i.foodSPURespVOList) { - // for (const v of state.carList) { - // if (j.id == v.productId) { - // j.productCount = v.productCount; - // } - // } - // } - // } - // } - // } - // state.goodsList = goodsList; + state.goodsList.forEach((i) => { + if (i && i.foodSPURespVOList && i.foodSPURespVOList.length) { + i.foodSPURespVOList.forEach((j) => { + j.productCount = 0 + j.productId = j.id + }) + } + }) + const goodsList = [...state.goodsList] + if (state.carList && state.carList.length) { + for (const i of goodsList) { + if (i && i.foodSPURespVOList && i.foodSPURespVOList.length) { + for (const j of i.foodSPURespVOList) { + for (const v of state.carList) { + if (j.id == v.productId) { + j.productCount = v.productCount + } + } + } + } + } + } + state.goodsList = goodsList } const doClassify = async (i: any) => {