物流对账单

This commit is contained in:
2026-07-26 09:51:33 +08:00
parent 2b7ef65cce
commit 19cb312465
21 changed files with 1909 additions and 27 deletions
+11
View File
@@ -179,6 +179,17 @@ export enum FulfillmentProviderStatus {
DISABLED = 'DISABLED',
}
/** 物流承运商结算方式:前期充值,后期挂账月结 */
export enum LogisticsSettlementMethod {
PREPAID = 'PREPAID',
MONTHLY_CREDIT = 'MONTHLY_CREDIT',
}
export const LOGISTICS_SETTLEMENT_METHOD_LABELS: Record<LogisticsSettlementMethod, string> = {
[LogisticsSettlementMethod.PREPAID]: '充值扣款',
[LogisticsSettlementMethod.MONTHLY_CREDIT]: '挂账月结',
};
export enum WarehouseFulfillmentMode {
API_AUTO = 'API_AUTO',
MANUAL = 'MANUAL',
@@ -1,5 +1,11 @@
import type { FulfillmentProviderStatus, FulfillmentProviderType } from './enums';
import type {
FulfillmentProviderStatus,
FulfillmentProviderType,
LogisticsSettlementMethod,
} from './enums';
import type { WarehouseFulfillmentMode } from './enums';
import type { LogisticsPricingRuleDto } from './settlement';
import { DEFAULT_XFX_LOGISTICS_PRICING } from './settlement';
/** 小飞侠仓配凭证(存 FulfillmentProvider.configJson */
export interface XiaofeixiaProviderConfig {
@@ -19,6 +25,13 @@ export interface XiaofeixiaProviderConfigPublic {
hasApiKey: boolean;
}
export interface FulfillmentProviderBankDto {
bankAccountName?: string | null;
bankName?: string | null;
bankBranch?: string | null;
bankAccountNo?: string | null;
}
export interface FulfillmentProviderDto {
id: string;
code: string;
@@ -34,6 +47,14 @@ export interface FulfillmentProviderDto {
hasConfig: boolean;
/** 小飞侠等承运商结构化配置(脱敏) */
xiaofeixiaConfig?: XiaofeixiaProviderConfigPublic | null;
/** 结算银行账户 */
bankAccountName?: string | null;
bankName?: string | null;
bankBranch?: string | null;
bankAccountNo?: string | null;
settlementMethod: LogisticsSettlementMethod;
pricingRules?: LogisticsPricingRuleDto | null;
prepaidBalance: number;
createdAt: string;
updatedAt: string;
}
@@ -47,6 +68,12 @@ export interface CreateFulfillmentProviderInput {
capabilitiesJson?: string;
/** 结构化小飞侠配置;有则覆盖写入 configJson */
xiaofeixiaConfig?: Partial<XiaofeixiaProviderConfig>;
bankAccountName?: string | null;
bankName?: string | null;
bankBranch?: string | null;
bankAccountNo?: string | null;
settlementMethod?: LogisticsSettlementMethod;
pricingRules?: LogisticsPricingRuleDto | null;
}
export interface UpdateFulfillmentProviderInput {
@@ -56,8 +83,16 @@ export interface UpdateFulfillmentProviderInput {
configJson?: string;
capabilitiesJson?: string;
xiaofeixiaConfig?: Partial<XiaofeixiaProviderConfig>;
bankAccountName?: string | null;
bankName?: string | null;
bankBranch?: string | null;
bankAccountNo?: string | null;
settlementMethod?: LogisticsSettlementMethod;
pricingRules?: LogisticsPricingRuleDto | null;
}
export { DEFAULT_XFX_LOGISTICS_PRICING };
export interface ManualShipOrderInput {
logisticsCompany: string;
trackingNo: string;
+49
View File
@@ -90,6 +90,53 @@ export const STORE_SETTLEMENT_DEFAULT_RATE = 0.6;
/** 酒厂账单结算比例(酒单实付 × 比例),暂定 30% */
export const WINERY_SETTLEMENT_RATE = 0.3;
export type { LogisticsSettlementMethod } from './enums';
export { LOGISTICS_SETTLEMENT_METHOD_LABELS } from './enums';
import type { LogisticsSettlementMethod } from './enums';
/** 小飞侠默认计价:2瓶6元,加一瓶+2元,6瓶一箱14元 */
export const DEFAULT_XFX_LOGISTICS_PRICING = {
baseBottles: 2,
baseFee: 6,
extraBottleFee: 2,
boxBottles: 6,
boxFee: 14,
} as const;
export type LogisticsPricingRuleDto = {
baseBottles: number;
baseFee: number;
extraBottleFee: number;
boxBottles?: number;
boxFee?: number;
};
export interface LogisticsBillDto {
id: string;
billNo: string;
fulfillmentProviderId: string;
providerCode?: string;
providerName?: string;
periodStart: string;
periodEnd: string;
orderCount: number;
bottleCount: number;
logisticsAmount: number;
settlementMethod: LogisticsSettlementMethod;
status: FinancePayStatus;
paidAt?: string | null;
pricingSnapshot?: LogisticsPricingRuleDto | null;
}
export interface LogisticsBillItemDto {
id: string;
orderId: string;
orderNo: string;
quantity: number;
logisticsAmount: number;
shippedAt: string;
}
export type FinanceBillSummary = {
count: number;
redeemAmount?: number;
@@ -98,6 +145,8 @@ export type FinanceBillSummary = {
orderCommission?: number;
redeemCommission?: number;
wineryAmount?: number;
logisticsAmount?: number;
bottleCount?: number;
totalAmount: number;
};