feat(settlement): redesign factory/partner/store statement bills
CI / verify (pull_request) Has been cancelled

Add WineryBill/StoreBill tables, partner review-send-confirm flow, daily/monthly cron, and admin multi-select confirm with status filters.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-22 17:25:49 +08:00
parent b534a569f8
commit b392c28787
22 changed files with 1549 additions and 543 deletions
+58 -2
View File
@@ -1,3 +1,5 @@
export type FinancePayStatus = 'UNPAID' | 'PAID';
export interface StorePayoutDto {
id: string;
redeemAmount: number;
@@ -5,9 +7,28 @@ export interface StorePayoutDto {
status: 'PENDING' | 'PAID';
expectedPayAt: string;
paidAt?: string | null;
storeBillId?: string | null;
}
export type PartnerBillStatus = 'DRAFT' | 'CONFIRMED' | 'PAID' | 'REJECTED';
export type PartnerBillStatus =
| 'PENDING_REVIEW'
| 'AWAITING_CONFIRM'
| 'UNPAID'
| 'PAID'
| 'REJECTED';
export const PARTNER_BILL_STATUS_LABELS: Record<PartnerBillStatus, string> = {
PENDING_REVIEW: '待审核',
AWAITING_CONFIRM: '待合伙人确认',
UNPAID: '未打款',
PAID: '已打款',
REJECTED: '已驳回',
};
export const FINANCE_PAY_STATUS_LABELS: Record<FinancePayStatus, string> = {
UNPAID: '未打款',
PAID: '已打款',
};
export interface PartnerBillDto {
id: string;
@@ -19,6 +40,7 @@ export interface PartnerBillDto {
periodStart: string;
periodEnd: string;
confirmedAt?: string | null;
sentAt?: string | null;
paidAt?: string | null;
rejectReason?: string | null;
}
@@ -27,6 +49,41 @@ export interface PartnerBillDetailDto extends PartnerBillDto {
partnerId: string;
}
export interface StoreBillDto {
id: string;
billNo: string;
storeId: string;
billDate: string;
redeemCount: number;
redeemAmount: number;
settlementRate: number;
payoutAmount: number;
status: FinancePayStatus;
paidAt?: string | null;
}
export interface WineryBillDto {
id: string;
billNo: string;
billDate: string;
orderCount: number;
orderAmount: number;
wineryRate: number;
wineryAmount: number;
status: FinancePayStatus;
paidAt?: string | null;
}
export interface WineryBillItemDto {
id: string;
orderId: string;
orderNo: string;
deliveryType: string;
payAmount: number;
wineryAmount: number;
paidAt: string;
}
/** 门店结算默认比例(核销金额 × 比例) */
export const STORE_SETTLEMENT_DEFAULT_RATE = 0.6;
@@ -69,4 +126,3 @@ export type WineryOrderBillRow = {
paidAt: string;
receiverCity?: string;
};