/** 采购明细门店单元格(溯源订货明细) */ export interface IPurchaseStoreCell { order_item_id: number; store_id: number; quantity: number; weight: number; /** 金额 = 称重>0 ? 称重×单价 : 数量×单价(单价 = 成本/包规) */ amount: number; } /** 采购明细行(商品维度聚合,行 × 门店列矩阵) */ export interface IPurchaseDetailRow { product_id: number; product_name: string; /** 规格/包规 */ product_spec: string; unit: string; supplier_id: number; supplier?: { id: number; name: string } | null; /** 成本 */ cost_price: number; /** 合计数量 */ quantity: number; /** 合计实际称重 */ weight: number; cells: Record; } /** 采购单 */ export default interface IPurchaseOrder { id?: number; purchase_no?: string; purchase_date?: string; /** 0进行中 3已完成 */ status?: number; total_quantity?: string; total_weight?: string; estimate_amount?: string; actual_amount?: string; operator_id?: number; operator?: { id: number; nickname: string }; remark?: string; created_at?: string; } /** 采购单详情(矩阵数据) */ export interface IPurchaseDetail { purchase: IPurchaseOrder; stores: { id: number; name: string }[]; items: IPurchaseDetailRow[]; } export const PURCHASE_STATUS_MAP: Record = { 0: { text: '进行中', color: 'processing' }, 3: { text: '已完成', color: 'success' }, }; export type PurchaseExportType = 'all' | 'category'; export type ExportFormat = 'xlsx' | 'pdf';