采购单优化
This commit is contained in:
@@ -1,36 +1,29 @@
|
||||
/** 采购分摊记录 */
|
||||
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 IPurchaseStoreCell {
|
||||
order_item_id: number;
|
||||
store_id: number;
|
||||
quantity: number;
|
||||
weight: number;
|
||||
/** 金额 = 称重>0 ? 称重×单价 : 数量×单价(单价 = 成本/包规) */
|
||||
amount: number;
|
||||
}
|
||||
|
||||
/** 采购明细 */
|
||||
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 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<number, number>;
|
||||
}
|
||||
|
||||
/** 采购单 */
|
||||
@@ -38,7 +31,7 @@ export default interface IPurchaseOrder {
|
||||
id?: number;
|
||||
purchase_no?: string;
|
||||
purchase_date?: string;
|
||||
/** 0待发送 1部分发送 2全部发送 3已完成 */
|
||||
/** 0进行中 3已完成 */
|
||||
status?: number;
|
||||
total_quantity?: string;
|
||||
total_weight?: string;
|
||||
@@ -47,34 +40,20 @@ export default interface IPurchaseOrder {
|
||||
operator_id?: number;
|
||||
operator?: { id: number; nickname: string };
|
||||
remark?: string;
|
||||
items?: IPurchaseOrderItem[];
|
||||
created_at?: string;
|
||||
}
|
||||
|
||||
/** 采购单详情(矩阵数据) */
|
||||
export interface IPurchaseDetail {
|
||||
purchase: IPurchaseOrder;
|
||||
stores: { id: number; name: string }[];
|
||||
items: IPurchaseDetailRow[];
|
||||
}
|
||||
|
||||
export const PURCHASE_STATUS_MAP: Record<number, { text: string; color: string }> = {
|
||||
0: { text: '待发送', color: 'default' },
|
||||
1: { text: '部分发送', color: 'processing' },
|
||||
2: { text: '全部发送', color: 'cyan' },
|
||||
0: { text: '进行中', color: 'processing' },
|
||||
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';
|
||||
|
||||
Reference in New Issue
Block a user