Files
xin-procurement/web/domain/iProduct.ts
T
2026-07-23 20:41:25 +08:00

59 lines
1.3 KiB
TypeScript

import type IProductCategory from '@/domain/iProductCategory.ts';
import type ISupplier from '@/domain/iSupplier.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?: number;
category_id?: number;
supplier_id?: number;
name?: string;
/** 规格/包规 */
spec?: string;
/** 商品等级 */
grade?: string;
/** 计价单位 */
unit?: string;
image?: string;
sort?: number;
status?: number;
remark?: string;
category?: IProductCategory;
supplier?: ISupplier;
/** 多等级价格 */
prices?: IProductPrice[];
created_at?: string;
}
export const PRODUCT_STATUS_MAP: Record<number, { text: string; color: string }> = {
0: { text: '下架', color: 'default' },
1: { text: '上架', color: 'success' },
};
/** 价格矩阵行(price_{level_id} 动态列) */
export type IPriceMatrixRow = {
id: number;
name: string;
spec?: string;
unit?: string;
} & Record<string, string | number | null | undefined>;
export interface IPriceMatrix {
levels: { id: number; name: string }[];
rows: IPriceMatrixRow[];
}
export interface IBatchPriceUpdate {
product_id: number;
level_id: number;
price: number | string;
}