feat(public): 商品详情页展示厂商建议零售价(MSRP) #34
Reference in New Issue
Block a user
Delete Branch "devin/1782348138-public-msrp"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
背景
零售价(MSRP)数据后端已具备:DB 表
product_msrp、采集导入(import_bypos.go)已写入sell_price、后台可管理。但公开前台商品详情页一直没有展示零售价——/api/v1/products/{id}详情接口里也不含价格(价格仅在单独的/products/{id}/msrp接口)。本 PR 按「方案B」把零售价内嵌进商品详情接口并在公开前台展示,并隐藏 0 元的无效价格。
改动
后端 (api)
store.Product新增msrp字段;ProductByID/ProductByGTIN现在内嵌 MSRP 列表(复用ListMSRP,已随产品缓存)。ListMSRP增加AND amount > 0过滤,按effective_date倒序(最新在前)。这样详情接口和/products/{id}/msrp都不再返回 0 元噪声数据。openapi.json的Productschema,补充msrp数组。前端 (public-frontend)
Product类型新增msrp?: Msrp[]。ProductView)新增「建议零售价」一行,显示最新一条(CNY 显示为¥xx.xx,并标注「厂商建议,仅供参考」);无有效价格时不显示。说明
sell_price)。amount=0.00的记录(源数据 sell_price 为 0),现已在查询层过滤,不会展示。验证
gofmt -l无输出、go vet ./...、go build ./...、go test ./...全部通过。npm run build(tsc + vite) 通过。