From fcbaa970d0f79ca44f0c7ed2dd79165dcc52e72b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=BF=A0=E6=9E=97?= <170083662@qq.com> Date: Wed, 4 Feb 2026 15:40:27 +0800 Subject: [PATCH] =?UTF-8?q?feat(home):=20=E6=B7=BB=E5=8A=A0=E5=95=86?= =?UTF-8?q?=E5=93=81=E4=B8=8A=E4=B8=8B=E6=9E=B6=E7=8A=B6=E6=80=81=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在商品模型中新增status字段用于标识商品上下架状态 - 首页请求商品列表时默认传入status为0参数 - 商品列表数据过滤仅显示上架状态的商品 - 添加商品状态注释说明0为上架1为下架 --- src/api/shop/shopGoods/model/index.ts | 2 ++ src/pages/index/index.tsx | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/api/shop/shopGoods/model/index.ts b/src/api/shop/shopGoods/model/index.ts index 39e372e..977d90f 100644 --- a/src/api/shop/shopGoods/model/index.ts +++ b/src/api/shop/shopGoods/model/index.ts @@ -147,4 +147,6 @@ export interface ShopGoodsParam extends PageParam { stock?: number; keywords?: string; recommend?: number; + // 0上架 1下架(以实际后端约定为准) + status?: number; } diff --git a/src/pages/index/index.tsx b/src/pages/index/index.tsx index 917221b..61d23bb 100644 --- a/src/pages/index/index.tsx +++ b/src/pages/index/index.tsx @@ -166,8 +166,8 @@ function Home() { const tab = tabs.find((t) => t.key === activeTabKey) || tabs[0] if (!tab) return - pageShopGoods({ ...tab.params }) - .then((res) => setGoodsList(res?.list || [])) + pageShopGoods({ ...tab.params, status: 0 }) + .then((res) => setGoodsList((res?.list || []).filter((g) => g?.status === 0))) .catch((err) => { console.error('首页商品列表加载失败:', err) setGoodsList([])