feat(public): 商品详情页展示厂商建议零售价(MSRP)
后端 ProductByID/ProductByGTIN 在商品详情 JSON 中内嵌 msrp 字段(按 effective_date 倒序,过滤 amount=0 的无效快照);公开前台详情页新增「建议零售价」展示。 Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
@@ -42,6 +42,12 @@ export default function ProductView({ id, onBack }: { id: string; onBack: () =>
|
||||
const nutriEntries = Object.entries(p.nutriments || {}).filter(
|
||||
([, v]) => v !== null && v !== undefined,
|
||||
);
|
||||
const latestMsrp = (p.msrp || [])[0];
|
||||
const msrpText = latestMsrp
|
||||
? latestMsrp.currency === "CNY"
|
||||
? `¥${latestMsrp.amount.toFixed(2)}`
|
||||
: `${latestMsrp.amount.toFixed(2)} ${latestMsrp.currency}`
|
||||
: null;
|
||||
|
||||
return (
|
||||
<div>
|
||||
@@ -93,6 +99,17 @@ export default function ProductView({ id, onBack }: { id: string; onBack: () =>
|
||||
}
|
||||
/>
|
||||
<Row label="产地" value={p.country_of_origin} />
|
||||
<Row
|
||||
label="建议零售价"
|
||||
value={
|
||||
msrpText ? (
|
||||
<span className="inline-flex items-baseline gap-2">
|
||||
<span className="font-medium text-gray-900">{msrpText}</span>
|
||||
<span className="text-xs text-gray-400">厂商建议,仅供参考</span>
|
||||
</span>
|
||||
) : null
|
||||
}
|
||||
/>
|
||||
<Row label="Nutri-Score" value={p.nutri_score} />
|
||||
<Row label="配料" value={p.ingredients_text} />
|
||||
<Row
|
||||
|
||||
Reference in New Issue
Block a user