first version

This commit is contained in:
liu
2026-07-23 20:41:25 +08:00
parent 00a0938a1b
commit 10cff754a4
211 changed files with 11577 additions and 842 deletions
+16
View File
@@ -0,0 +1,16 @@
/** 客户等级 */
export default interface ICustomerLevel {
id?: number;
/** 等级名称 */
name?: string;
sort?: number;
status?: number;
remark?: string;
created_at?: string;
updated_at?: string;
}
export const CUSTOMER_LEVEL_STATUS_MAP: Record<number, { text: string; color: string }> = {
0: { text: '停用', color: 'error' },
1: { text: '正常', color: 'success' },
};
+30
View File
@@ -0,0 +1,30 @@
import type IStore from '@/domain/iStore.ts';
import type ISupplier from '@/domain/iSupplier.ts';
/** 小程序用户 */
export default interface IMiniUser {
id?: number;
nickname?: string;
phone?: string;
avatar?: string;
/** 0待绑定 1门店 2供应商 */
type?: number;
store_id?: number;
supplier_id?: number;
store?: IStore;
supplier?: ISupplier;
status?: number;
last_login_at?: string;
created_at?: string;
}
export const MINI_USER_TYPE_MAP: Record<number, { text: string; color: string }> = {
0: { text: '待绑定', color: 'default' },
1: { text: '门店', color: 'blue' },
2: { text: '供应商', color: 'purple' },
};
export const MINI_USER_STATUS_MAP: Record<number, { text: string; color: string }> = {
0: { text: '停用', color: 'error' },
1: { text: '正常', color: 'success' },
};
+24
View File
@@ -0,0 +1,24 @@
/** 通知(user_id=0 为全员广播) */
export default interface INotice {
id?: number;
user_id?: number;
/** order订单 price价格 system系统 */
type?: string;
title?: string;
content?: string;
data?: Record<string, unknown>;
is_read?: number;
read_at?: string;
created_at?: string;
}
export const NOTICE_TYPE_MAP: Record<string, { text: string; color: string }> = {
order: { text: '订单', color: 'blue' },
price: { text: '价格', color: 'gold' },
system: { text: '系统', color: 'default' },
};
export const NOTICE_READ_MAP: Record<number, { text: string; color: string }> = {
0: { text: '未读', color: 'warning' },
1: { text: '已读', color: 'default' },
};
+58
View File
@@ -0,0 +1,58 @@
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;
}
+15
View File
@@ -0,0 +1,15 @@
/** 商品分类(多级,children 由后端组装) */
export default interface IProductCategory {
id?: number;
parent_id?: number;
name?: string;
sort?: number;
status?: number;
children?: IProductCategory[];
created_at?: string;
}
export const CATEGORY_STATUS_MAP: Record<number, { text: string; color: string }> = {
0: { text: '停用', color: 'error' },
1: { text: '正常', color: 'success' },
};
+80
View File
@@ -0,0 +1,80 @@
/** 采购分摊记录 */
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';
+71
View File
@@ -0,0 +1,71 @@
/** 对账明细 */
export interface IReconciliationItem {
id?: number;
recon_id?: number;
store_id?: number;
purchase_item_id?: number;
order_item_id?: number;
product_id?: number;
product_name?: string;
quantity?: string;
weight?: string;
/** 公布金额(订货金额) */
publish_amount?: string;
/** 实际金额(分摊金额) */
actual_amount?: string;
/** 差额 = publish actual */
diff_amount?: string;
is_reconciled?: number;
store_remark?: string;
sort?: number;
store?: { id: number; name: string };
}
/** 对账单 */
export default interface IReconciliation {
id?: number;
recon_no?: string;
title?: string;
period_start?: string;
period_end?: string;
category_id?: number;
supplier_id?: number;
publish_amount?: string;
actual_amount?: string;
diff_amount?: string;
/** 0草稿 1对账中 2已结算 */
status?: number;
operator_id?: number;
operator?: { id: number; nickname: string };
remark?: string;
items?: IReconciliationItem[];
created_at?: string;
}
export const RECON_STATUS_MAP: Record<number, { text: string; color: string }> = {
0: { text: '草稿', color: 'default' },
1: { text: '对账中', color: 'processing' },
2: { text: '已结算', color: 'success' },
};
export const RECONCILED_MAP: Record<number, { text: string; color: string }> = {
0: { text: '未对账', color: 'warning' },
1: { text: '已对账', color: 'success' },
};
/** D5 差额对比视图 */
export interface IReconDiffRow {
store_id?: number;
store_name?: string;
product_id?: number;
product_name?: string;
publish: number;
actual: number;
diff: number;
}
export interface IReconDiff {
by_store: IReconDiffRow[];
by_product: IReconDiffRow[];
total: { publish: number; actual: number; diff: number };
}
+27
View File
@@ -0,0 +1,27 @@
/** 结算表 */
export default interface ISettlement {
id?: number;
settlement_no?: string;
recon_id?: number;
store_id?: number;
store?: { id: number; name: string };
recon?: { id: number; recon_no: string; title: string };
period_start?: string;
period_end?: string;
total_amount?: string;
actual_amount?: string;
diff_amount?: string;
/** 0待结算 1已结算 */
status?: number;
file_path?: string;
operator_id?: number;
operator?: { id: number; nickname: string };
settled_at?: string;
remark?: string;
created_at?: string;
}
export const SETTLEMENT_STATUS_MAP: Record<number, { text: string; color: string }> = {
0: { text: '待结算', color: 'default' },
1: { text: '已结算', color: 'success' },
};
+43
View File
@@ -0,0 +1,43 @@
/** 门店对账单明细 */
export interface IStatementItem {
id?: number;
statement_id?: number;
order_id?: number;
order_item_id?: number;
product_id?: number;
product_name?: string;
price?: string;
quantity?: string;
weight?: string;
amount?: string;
is_reconciled?: number;
store_remark?: string;
}
/** 门店对账单 */
export default interface IStatement {
id?: number;
statement_no?: string;
store_id?: number;
store?: { id: number; name: string };
period_start?: string;
period_end?: string;
total_amount?: string;
/** 回款周期快照(天) */
payment_cycle_days?: number;
/** 应结算日期 = period_end + 回款周期 */
settlement_date?: string;
/** 0待对账 1已对账 2已结算 */
status?: number;
reconciled_at?: string;
settled_at?: string;
remark?: string;
items?: IStatementItem[];
created_at?: string;
}
export const STATEMENT_STATUS_MAP: Record<number, { text: string; color: string }> = {
0: { text: '待对账', color: 'default' },
1: { text: '已对账', color: 'processing' },
2: { text: '已结算', color: 'success' },
};
+26
View File
@@ -0,0 +1,26 @@
import type ICustomerLevel from '@/domain/iCustomerLevel.ts';
/** 门店 */
export default interface IStore {
id?: number;
name?: string;
/** 门店编码 */
code?: string;
/** 客户等级ID(决定商品价格) */
level_id?: number;
level?: ICustomerLevel;
contact?: string;
phone?: string;
address?: string;
/** 回款周期(天) */
payment_cycle_days?: number;
status?: number;
remark?: string;
created_at?: string;
updated_at?: string;
}
export const STORE_STATUS_MAP: Record<number, { text: string; color: string }> = {
0: { text: '停用', color: 'error' },
1: { text: '正常', color: 'success' },
};
+49
View File
@@ -0,0 +1,49 @@
/** 门店订单明细(商品快照) */
export interface IStoreOrderItem {
id?: number;
order_id?: number;
store_id?: number;
product_id?: number;
product_name?: string;
product_spec?: string;
price?: string;
quantity?: string;
weight?: string;
amount?: string;
remark?: string;
}
/** 门店订单 */
export default interface IStoreOrder {
id?: number;
order_no?: string;
store_id?: number;
store?: { id: number; name: string };
order_date?: string;
total_quantity?: string;
total_weight?: string;
total_amount?: string;
/** 0待汇总 1已汇总 2配送中 3已完成 9已取消 */
status?: number;
remark?: string;
items?: IStoreOrderItem[];
created_at?: string;
}
export const STORE_ORDER_STATUS_MAP: Record<number, { text: string; color: string }> = {
0: { text: '待汇总', color: 'default' },
1: { text: '已汇总', color: 'processing' },
2: { text: '配送中', color: 'warning' },
3: { text: '已完成', color: 'success' },
9: { text: '已取消', color: 'error' },
};
/** 待汇总预览行 */
export interface IOrderSummaryRow {
product_id: number;
product_name: string;
product_spec: string;
unit: string;
total_quantity: string;
store_count: number;
}
+19
View File
@@ -0,0 +1,19 @@
/** 供应商 */
export default interface ISupplier {
id?: number;
name?: string;
contact?: string;
phone?: string;
address?: string;
/** 主营品类 */
main_products?: string;
status?: number;
remark?: string;
created_at?: string;
updated_at?: string;
}
export const SUPPLIER_STATUS_MAP: Record<number, { text: string; color: string }> = {
0: { text: '停用', color: 'error' },
1: { text: '正常', color: 'success' },
};