916bdd9c7c
- 新增 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>
92 lines
2.1 KiB
TypeScript
92 lines
2.1 KiB
TypeScript
export interface ProductSummary {
|
|
id: string;
|
|
gtin: string | null;
|
|
name: string;
|
|
brand: string | null;
|
|
category_path: string | null;
|
|
country_of_origin?: string | null;
|
|
quality_score?: number;
|
|
score?: number | null;
|
|
}
|
|
|
|
export interface Barcode {
|
|
gtin: string;
|
|
gtin_type: string;
|
|
pack_level: string;
|
|
region: string | null;
|
|
is_primary: boolean;
|
|
}
|
|
|
|
export interface ProductSpec {
|
|
key: string;
|
|
label: string;
|
|
value: string;
|
|
unit?: string;
|
|
}
|
|
|
|
export interface Product {
|
|
id: string;
|
|
gtin: string | null;
|
|
barcodes?: Barcode[] | null;
|
|
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;
|
|
quality_score: number;
|
|
nutriments?: Record<string, unknown> | null;
|
|
nutrition_basis?: string | null;
|
|
nutri_score?: string | null;
|
|
ingredients_text?: string | null;
|
|
allergens?: string[] | null;
|
|
additives?: string[] | null;
|
|
}
|
|
|
|
export interface Category {
|
|
id: string;
|
|
name_zh: string;
|
|
name_en: string | null;
|
|
path: string;
|
|
level: number;
|
|
}
|
|
|
|
export interface SubmissionImage {
|
|
url: string;
|
|
kind: string;
|
|
}
|
|
|
|
export interface SubmissionInput {
|
|
gtin?: string | null;
|
|
name: string;
|
|
brand_name?: string | null;
|
|
category_id?: string | null;
|
|
net_content_value?: number | null;
|
|
net_content_unit?: string | null;
|
|
country_of_origin?: string | null;
|
|
ingredients_text?: string | null;
|
|
nutriments?: Record<string, number> | null;
|
|
nutrition_basis?: string | null;
|
|
serving_size?: string | null;
|
|
nutri_score?: string | null;
|
|
images?: SubmissionImage[];
|
|
submitter_name?: string | null;
|
|
submitter_contact?: string | null;
|
|
note?: string | null;
|
|
}
|
|
|
|
export const NUTRIMENT_LABELS: Record<string, string> = {
|
|
energy_kcal: "能量 (kcal)",
|
|
energy_kj: "能量 (kJ)",
|
|
fat: "脂肪 (g)",
|
|
saturated_fat: "饱和脂肪 (g)",
|
|
carbohydrates: "碳水 (g)",
|
|
sugars: "糖 (g)",
|
|
proteins: "蛋白质 (g)",
|
|
salt: "盐 (g)",
|
|
sodium: "钠 (g)",
|
|
fiber: "膳食纤维 (g)",
|
|
};
|