feat(home): 添加商品上下架状态管理功能

- 在商品模型中新增status字段用于标识商品上下架状态
- 首页请求商品列表时默认传入status为0参数
- 商品列表数据过滤仅显示上架状态的商品
- 添加商品状态注释说明0为上架1为下架
This commit is contained in:
2026-02-04 15:40:27 +08:00
parent 5e36f243ef
commit fcbaa970d0
2 changed files with 4 additions and 2 deletions

View File

@@ -147,4 +147,6 @@ export interface ShopGoodsParam extends PageParam {
stock?: number;
keywords?: string;
recommend?: number;
// 0上架 1下架以实际后端约定为准
status?: number;
}

View File

@@ -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([])