feat: 可扩展档案模式框架 + 内置 3C(电子) 模式
- 新增 category.archive_kind 与 kind_field 字段模板表(迁移 0010) - 种子 electronics 字段模板 + 3C 品类树(手机/笔记本/平板等) - 后端按档案模式动态计算完整度/合格:食品沿用 food_detail, 其它模式走 product.attributes + kind_field - 新增 GET /api/kind-fields?kind= 接口 - 后台编辑页按品类模式动态渲染规格参数表单 - 公开详情页/接口输出带标签的规格表 Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
@@ -106,6 +106,23 @@ export default function ProductView({ id, onBack }: { id: string; onBack: () =>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{p.specs && p.specs.length > 0 && (
|
||||
<div className="bg-white border rounded-lg p-5 mt-4">
|
||||
<h2 className="font-medium text-gray-700 mb-2">规格参数</h2>
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 gap-2 text-sm">
|
||||
{p.specs.map((s) => (
|
||||
<div key={s.key} className="bg-gray-50 rounded px-3 py-2">
|
||||
<div className="text-gray-400 text-xs">{s.label}</div>
|
||||
<div className="text-gray-800">
|
||||
{s.value}
|
||||
{s.unit ? ` ${s.unit}` : ""}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{nutriEntries.length > 0 && (
|
||||
<div className="bg-white border rounded-lg p-5 mt-4">
|
||||
<h2 className="font-medium text-gray-700 mb-2">
|
||||
|
||||
@@ -17,6 +17,13 @@ export interface Barcode {
|
||||
is_primary: boolean;
|
||||
}
|
||||
|
||||
export interface ProductSpec {
|
||||
key: string;
|
||||
label: string;
|
||||
value: string;
|
||||
unit?: string;
|
||||
}
|
||||
|
||||
export interface Product {
|
||||
id: string;
|
||||
gtin: string | null;
|
||||
@@ -24,6 +31,8 @@ export interface Product {
|
||||
name: string;
|
||||
brand: string | null;
|
||||
category_path: string | null;
|
||||
archive_kind?: string;
|
||||
specs?: ProductSpec[] | null;
|
||||
net_content_value: number | null;
|
||||
net_content_unit: string | null;
|
||||
country_of_origin: string | null;
|
||||
|
||||
Reference in New Issue
Block a user