import type IProductCategory from '@/domain/iProductCategory.ts'; import type ISupplier from '@/domain/iSupplier.ts'; import type {ISysFileInfo} from "@/domain/iSysFile.ts"; /** 商品等级价格行 */ export interface IProductPrice { id?: number; product_id?: number; level_id?: number; price?: string | number; level?: { id: number; name: string }; } /** 商品档案 */ export default interface IProduct { /** 商品ID */ id?: number; /** 分类ID */ category_id?: number; /** 供应商ID */ supplier_id?: number; /** 商品名称 */ name?: string; /** 规格/包规 */ spec?: string; /** 计价单位 */ unit?: string; /** 封面 */ image_ids?: string; images_arr?: ISysFileInfo[]; /** 商品图文详情(富文本 HTML) */ content?: string; /** 排序 */ sort?: number; /** 保质期 */ shelf_life?: number; /** 库存 */ stock?: number; /** 状态 */ status?: number; /** 描述 */ remark?: string; /** 分类关联数据 */ category?: IProductCategory; /** 供应商关联数据 */ supplier?: ISupplier; /** 多等级价格 */ prices?: IProductPrice[]; /** 创建时间 */ created_at?: string; } export const PRODUCT_STATUS_MAP: Record = { 0: { text: '下架', color: 'default' }, 1: { text: '上架', color: 'success' }, }; /** 价格矩阵行(price_{level_id} 动态列) */ export type IPriceMatrixRow = { id: number; name: string; spec?: string; unit?: string; } & Record; export interface IPriceMatrix { levels: { id: number; name: string }[]; rows: IPriceMatrixRow[]; total: number; } export interface IBatchPriceUpdate { product_id: number; level_id: number; price: number | string; }