81 lines
2.0 KiB
TypeScript
81 lines
2.0 KiB
TypeScript
/** 采购分摊记录 */
|
|
export interface IPurchaseAllocation {
|
|
id?: number;
|
|
purchase_item_id?: number;
|
|
order_item_id?: number;
|
|
store_id?: number;
|
|
product_id?: number;
|
|
quantity?: string;
|
|
weight?: string;
|
|
amount?: string;
|
|
store?: { id: number; name: string };
|
|
product?: { id: number; name: string; unit: string };
|
|
}
|
|
|
|
/** 采购明细 */
|
|
export interface IPurchaseOrderItem {
|
|
id?: number;
|
|
purchase_id?: number;
|
|
product_id?: number;
|
|
supplier_id?: number;
|
|
product_name?: string;
|
|
product_spec?: string;
|
|
price?: string;
|
|
quantity?: string;
|
|
weight?: string;
|
|
amount?: string;
|
|
sort?: number;
|
|
is_sent?: number;
|
|
sent_at?: string;
|
|
supplier_confirmed_at?: string;
|
|
remark?: string;
|
|
supplier?: { id: number; name: string };
|
|
allocations?: IPurchaseAllocation[];
|
|
}
|
|
|
|
/** 采购单 */
|
|
export default interface IPurchaseOrder {
|
|
id?: number;
|
|
purchase_no?: string;
|
|
purchase_date?: string;
|
|
/** 0待发送 1部分发送 2全部发送 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;
|
|
items?: IPurchaseOrderItem[];
|
|
created_at?: string;
|
|
}
|
|
|
|
export const PURCHASE_STATUS_MAP: Record<number, { text: string; color: string }> = {
|
|
0: { text: '待发送', color: 'default' },
|
|
1: { text: '部分发送', color: 'processing' },
|
|
2: { text: '全部发送', color: 'cyan' },
|
|
3: { text: '已完成', color: 'success' },
|
|
};
|
|
|
|
/** 分摊结果聚合行 */
|
|
export interface IAllocationAggRow {
|
|
store_id?: number;
|
|
store_name?: string;
|
|
product_id?: number;
|
|
product_name?: string;
|
|
unit?: string;
|
|
quantity: number;
|
|
weight: number;
|
|
amount: number;
|
|
}
|
|
|
|
export interface IAllocationResult {
|
|
by_store: IAllocationAggRow[];
|
|
by_product: IAllocationAggRow[];
|
|
total_amount: number;
|
|
}
|
|
|
|
export type PurchaseExportType = 'all' | 'category';
|
|
export type ExportFormat = 'xlsx' | 'pdf';
|