From 3349745145f6bd3228472a8a313fcbbbe5309dff Mon Sep 17 00:00:00 2001 From: weiwei Date: Mon, 9 Jun 2025 20:42:43 +0800 Subject: [PATCH] --- src/pages/shop/detail.vue | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/src/pages/shop/detail.vue b/src/pages/shop/detail.vue index c2e677b..eaae7fb 100644 --- a/src/pages/shop/detail.vue +++ b/src/pages/shop/detail.vue @@ -108,7 +108,7 @@ @@ -208,17 +208,22 @@ const getClassify = async () => { const getPorductList = async () => { const target = state.classifyList[state.currentClassifyIndex] if (isEmpty(target)) return - const { code, data }: any = await shopApi.getSupermarketSpuList({ - merchantId: state.merchantId, - categoryId: target.id, - current: 1, - size: 99999, - }) - if (code == 0) { - state.goodsList = data.records - return + try { + uni.showLoading({ title: "加载中...", mask: true }) + const { code, data }: any = await shopApi.getSupermarketSpuList({ + merchantId: state.merchantId, + categoryId: target.id, + current: 1, + size: 99999, + }) + if (code == 0) { + state.goodsList = data.records + return + } + state.goodsList = [] + } finally { + uni.hideLoading() } - state.goodsList = [] } const doClassify = async (i: any) => { @@ -262,7 +267,7 @@ const chentProductCount = async (item: any, type?: "add" | "remove") => { state.cartList.push(item) } - nextTick(async () => await updateShopCar()) // 保存购物车数据 + nextTick(async () => await updateShopCart()) // 保存购物车数据 } catch (e) { console.error(e) } finally { @@ -271,7 +276,7 @@ const chentProductCount = async (item: any, type?: "add" | "remove") => { } // 保存购物车数据 -const updateShopCar = async () => { +const updateShopCart = async () => { if (isEmpty(state.cartList)) return const list = state.cartList .filter((v) => v.productCount && v.productCount > 0)