回筐、账单完成

This commit is contained in:
liu
2026-08-14 01:19:47 +08:00
parent e35c951a59
commit bf8ac68391
39 changed files with 1392 additions and 963 deletions
+41
View File
@@ -0,0 +1,41 @@
import type { IBill } from '@/domain/iPurchaseOrder.ts';
/** 门店账单(采购单完成后按门店生成),类型定义在 iPurchaseOrder.ts */
export type { IBill };
export { BILL_STATUS_MAP } from '@/domain/iPurchaseOrder.ts';
/** 账单合并商品明细行(按商品聚合账单关联的全部订单明细) */
export interface IBillGoodsItem {
product_id: number;
product_name: string;
/** 规格/包规 */
product_spec: string;
unit: string;
/** 单价(加权平均:Σ金额÷Σ数量) */
price: string;
/** 数量合计 */
quantity: number;
/** 重量合计 */
weight: string;
/** 金额合计 = Σ 明细金额 */
amount: string;
}
/** 账单关联的门店订单 */
export interface IBillOrder {
id: number;
order_no: string;
order_date: string;
total_quantity: number;
total_weight: string;
total_amount: string;
/** 0待接单 1已接单 2采购中 3配送中 4已完成 9已取消 */
status: number;
}
/** 账单详情(账单 + 合并商品明细 + 关联订单) */
export interface IBillDetail {
bill: IBill;
items: IBillGoodsItem[];
orders: IBillOrder[];
}
+26
View File
@@ -0,0 +1,26 @@
/** 门店回筐记录(压筐=生成账单自动写入只读;回筐=门店退回手动登记) */
export default interface IContainerReturn {
id?: number;
store_id?: number;
/** 关联账单ID(0=手动回筐登记) */
bill_id?: number;
/** 类型:1压筐 2回筐 */
type?: number;
box_num?: number;
tray_num?: number;
/** 记录日期(压筐=账单日期,回筐=退回日期) */
return_date?: string;
operator_id?: number;
remark?: string;
created_at?: string;
/** 列表接口附带 */
store?: { id: number; name: string; pending_box_num?: number; pending_tray_num?: number } | null;
bill?: { id: number; bill_no: string } | null;
operator?: { id: number; nickname: string } | null;
}
/** 回筐记录类型映射 */
export const CONTAINER_TYPE_MAP: Record<number, { text: string; color: string }> = {
1: { text: '压筐', color: 'processing' },
2: { text: '回筐', color: 'success' },
};
+19
View File
@@ -74,11 +74,30 @@ export interface IBill {
added_amount: string;
/** 账单总金额 = 商品金额 + 配送费 + 附加金额 */
total_amount: string;
/** 支付状态:0未支付 1已支付 */
status?: number;
/** 付款时间(线下收款手动登记) */
paid_at?: string | null;
/** 付款备注(线下收款信息) */
pay_remark?: string;
paid_operator_id?: number;
order_count?: number;
remark?: string;
created_at?: string;
/** 门店账单列表/详情接口附带 */
store?: { id: number; name: string; address?: string; contact?: string; phone?: string } | null;
purchase?: { id: number; purchase_no: string; purchase_date: string; status?: number } | null;
operator?: { id: number; nickname: string } | null;
paid_operator?: { id: number; nickname: string } | null;
orders_count?: number;
}
/** 账单支付状态映射 */
export const BILL_STATUS_MAP: Record<number, { text: string; color: string }> = {
0: { text: '未支付', color: 'warning' },
1: { text: '已支付', color: 'success' },
};
/** 账单生成预览行(按门店汇总,金额只读) */
export interface IBillPrepareStore {
store_id: number;
-43
View File
@@ -1,43 +0,0 @@
/** 门店对账单明细 */
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' },
};
+4
View File
@@ -14,6 +14,10 @@ export default interface IStore {
address?: string;
/** 回款周期(天) */
payment_cycle_days?: number;
/** 待回筐数量(生成账单压筐累加,回筐登记扣减) */
pending_box_num?: number;
/** 待回托盘数量 */
pending_tray_num?: number;
status?: number;
remark?: string;
created_at?: string;
-1
View File
@@ -44,7 +44,6 @@ export default interface IStoreOrder {
order_no?: string;
store_id?: number;
purchase_id?: number;
statement_id?: number;
/** 关联账单ID(采购单完成后按门店生成账单时回写) */
bill_id?: number;
store?: {