/** * 文件职责:财务中心交易流水 API 契约与请求封装。 */ import { requestClient } from '#/api/request'; /** 交易类型筛选值。 */ export type FinanceTransactionTypeFilter = | 'all' | 'income' | 'point_redeem' | 'refund' | 'stored_card_recharge'; /** 交易渠道筛选值。 */ export type FinanceTransactionChannelFilter = | 'all' | 'delivery' | 'dine_in' | 'pickup'; /** 交易支付方式筛选值。 */ export type FinanceTransactionPaymentFilter = | 'alipay' | 'all' | 'balance' | 'card' | 'cash' | 'wechat'; /** 交易流水筛选参数。 */ export interface FinanceTransactionFilterQuery { channel?: FinanceTransactionChannelFilter; endDate?: string; keyword?: string; paymentMethod?: FinanceTransactionPaymentFilter; startDate?: string; storeId: string; type?: FinanceTransactionTypeFilter; } /** 交易流水列表查询参数。 */ export interface FinanceTransactionListQuery extends FinanceTransactionFilterQuery { page: number; pageSize: number; } /** 交易流水列表行。 */ export interface FinanceTransactionListItemDto { amount: number; channel: string; isIncome: boolean; occurredAt: string; orderNo?: string; paymentMethod: string; remark: string; transactionId: string; transactionNo: string; type: string; typeText: string; } /** 交易流水列表结果。 */ export interface FinanceTransactionListResultDto { items: FinanceTransactionListItemDto[]; page: number; pageIncomeAmount: number; pageRefundAmount: number; pageSize: number; total: number; } /** 交易流水统计结果。 */ export interface FinanceTransactionStatsDto { totalCount: number; totalIncome: number; totalRefund: number; } /** 交易流水详情。 */ export interface FinanceTransactionDetailDto { amount: number; arrivedAmount?: number; channel: string; customerName: string; customerPhone: string; giftAmount?: number; memberMobileMasked?: string; memberName?: string; occurredAt: string; orderNo?: string; paymentMethod: string; pointBalanceAfterChange?: number; pointChangeAmount?: number; rechargeAmount?: number; refundNo?: string; refundReason?: string; remark: string; storeId: string; transactionId: string; transactionNo: string; type: string; typeText: string; } /** 交易流水导出结果。 */ export interface FinanceTransactionExportDto { fileContentBase64: string; fileName: string; totalCount: number; } /** 查询交易流水列表。 */ export async function getFinanceTransactionListApi( params: FinanceTransactionListQuery, ) { return requestClient.get( '/finance/transaction/list', { params, }, ); } /** 查询交易流水统计。 */ export async function getFinanceTransactionStatsApi( params: FinanceTransactionFilterQuery, ) { return requestClient.get( '/finance/transaction/stats', { params, }, ); } /** 查询交易流水详情。 */ export async function getFinanceTransactionDetailApi(params: { storeId: string; transactionId: string; }) { return requestClient.get( '/finance/transaction/detail', { params, }, ); } /** 导出交易流水 CSV。 */ export async function exportFinanceTransactionCsvApi( params: FinanceTransactionFilterQuery, ) { return requestClient.get( '/finance/transaction/export', { params, }, ); }