feat(finance): 实现发票管理页面与子页面
This commit is contained in:
@@ -1,161 +1,7 @@
|
||||
/**
|
||||
* 文件职责:财务中心交易流水 API 契约与请求封装。
|
||||
* 文件职责:财务中心 API 聚合导出。
|
||||
*/
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export * from './cost';
|
||||
export * from './invoice';
|
||||
export * from './settlement';
|
||||
|
||||
/** 交易类型筛选值。 */
|
||||
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<FinanceTransactionListResultDto>(
|
||||
'/finance/transaction/list',
|
||||
{
|
||||
params,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询交易流水统计。 */
|
||||
export async function getFinanceTransactionStatsApi(
|
||||
params: FinanceTransactionFilterQuery,
|
||||
) {
|
||||
return requestClient.get<FinanceTransactionStatsDto>(
|
||||
'/finance/transaction/stats',
|
||||
{
|
||||
params,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询交易流水详情。 */
|
||||
export async function getFinanceTransactionDetailApi(params: {
|
||||
storeId: string;
|
||||
transactionId: string;
|
||||
}) {
|
||||
return requestClient.get<FinanceTransactionDetailDto>(
|
||||
'/finance/transaction/detail',
|
||||
{
|
||||
params,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/** 导出交易流水 CSV。 */
|
||||
export async function exportFinanceTransactionCsvApi(
|
||||
params: FinanceTransactionFilterQuery,
|
||||
) {
|
||||
return requestClient.get<FinanceTransactionExportDto>(
|
||||
'/finance/transaction/export',
|
||||
{
|
||||
params,
|
||||
},
|
||||
);
|
||||
}
|
||||
export * from './transaction';
|
||||
|
||||
206
apps/web-antd/src/api/finance/invoice.ts
Normal file
206
apps/web-antd/src/api/finance/invoice.ts
Normal file
@@ -0,0 +1,206 @@
|
||||
/**
|
||||
* 文件职责:财务中心发票管理 API 契约与请求封装。
|
||||
*/
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
/** 发票状态筛选值。 */
|
||||
export type FinanceInvoiceStatusFilter = 'all' | 'issued' | 'pending' | 'voided';
|
||||
|
||||
/** 发票类型筛选值。 */
|
||||
export type FinanceInvoiceTypeFilter = 'all' | 'normal' | 'special';
|
||||
|
||||
/** 发票设置详情。 */
|
||||
export interface FinanceInvoiceSettingDto {
|
||||
autoIssueMaxAmount: number;
|
||||
bankAccount?: string;
|
||||
bankName?: string;
|
||||
companyName: string;
|
||||
enableAutoIssue: boolean;
|
||||
enableElectronicNormalInvoice: boolean;
|
||||
enableElectronicSpecialInvoice: boolean;
|
||||
registeredAddress?: string;
|
||||
registeredPhone?: string;
|
||||
taxpayerNumber: string;
|
||||
}
|
||||
|
||||
/** 保存发票设置请求。 */
|
||||
export interface SaveFinanceInvoiceSettingPayload
|
||||
extends FinanceInvoiceSettingDto {}
|
||||
|
||||
/** 发票记录列表查询参数。 */
|
||||
export interface FinanceInvoiceRecordListQuery {
|
||||
endDate?: string;
|
||||
invoiceType?: Exclude<FinanceInvoiceTypeFilter, 'all'>;
|
||||
keyword?: string;
|
||||
page: number;
|
||||
pageSize: number;
|
||||
startDate?: string;
|
||||
status?: Exclude<FinanceInvoiceStatusFilter, 'all'>;
|
||||
}
|
||||
|
||||
/** 发票统计结果。 */
|
||||
export interface FinanceInvoiceStatsDto {
|
||||
currentMonthIssuedAmount: number;
|
||||
currentMonthIssuedCount: number;
|
||||
pendingCount: number;
|
||||
voidedCount: number;
|
||||
}
|
||||
|
||||
/** 发票记录列表项。 */
|
||||
export interface FinanceInvoiceRecordListItemDto {
|
||||
amount: number;
|
||||
applicantName: string;
|
||||
appliedAt: string;
|
||||
companyName: string;
|
||||
invoiceNo: string;
|
||||
invoiceType: string;
|
||||
invoiceTypeText: string;
|
||||
orderNo: string;
|
||||
recordId: string;
|
||||
status: string;
|
||||
statusText: string;
|
||||
}
|
||||
|
||||
/** 发票记录分页结果。 */
|
||||
export interface FinanceInvoiceRecordListResultDto {
|
||||
items: FinanceInvoiceRecordListItemDto[];
|
||||
page: number;
|
||||
pageSize: number;
|
||||
stats: FinanceInvoiceStatsDto;
|
||||
totalCount: number;
|
||||
}
|
||||
|
||||
/** 发票记录详情。 */
|
||||
export interface FinanceInvoiceRecordDetailDto {
|
||||
amount: number;
|
||||
applicantName: string;
|
||||
appliedAt: string;
|
||||
applyRemark?: string;
|
||||
companyName: string;
|
||||
contactEmail?: string;
|
||||
contactPhone?: string;
|
||||
invoiceNo: string;
|
||||
invoiceType: string;
|
||||
invoiceTypeText: string;
|
||||
issueRemark?: string;
|
||||
issuedAt?: string;
|
||||
issuedByUserId?: string;
|
||||
orderNo: string;
|
||||
recordId: string;
|
||||
status: string;
|
||||
statusText: string;
|
||||
taxpayerNumber?: string;
|
||||
voidReason?: string;
|
||||
voidedAt?: string;
|
||||
voidedByUserId?: string;
|
||||
}
|
||||
|
||||
/** 发票开票请求。 */
|
||||
export interface FinanceInvoiceIssuePayload {
|
||||
contactEmail?: string;
|
||||
issueRemark?: string;
|
||||
recordId: string;
|
||||
}
|
||||
|
||||
/** 发票开票结果。 */
|
||||
export interface FinanceInvoiceIssueResultDto {
|
||||
amount: number;
|
||||
companyName: string;
|
||||
contactEmail?: string;
|
||||
invoiceNo: string;
|
||||
issuedAt: string;
|
||||
recordId: string;
|
||||
status: string;
|
||||
statusText: string;
|
||||
}
|
||||
|
||||
/** 发票作废请求。 */
|
||||
export interface FinanceInvoiceVoidPayload {
|
||||
recordId: string;
|
||||
voidReason: string;
|
||||
}
|
||||
|
||||
/** 发票申请请求。 */
|
||||
export interface FinanceInvoiceApplyPayload {
|
||||
amount: number;
|
||||
applicantName: string;
|
||||
appliedAt?: string;
|
||||
applyRemark?: string;
|
||||
companyName: string;
|
||||
contactEmail?: string;
|
||||
contactPhone?: string;
|
||||
invoiceType: Exclude<FinanceInvoiceTypeFilter, 'all'>;
|
||||
orderNo: string;
|
||||
taxpayerNumber?: string;
|
||||
}
|
||||
|
||||
/** 查询发票设置。 */
|
||||
export async function getFinanceInvoiceSettingDetailApi() {
|
||||
return requestClient.get<FinanceInvoiceSettingDto>(
|
||||
'/finance/invoice/settings/detail',
|
||||
);
|
||||
}
|
||||
|
||||
/** 保存发票设置。 */
|
||||
export async function saveFinanceInvoiceSettingApi(
|
||||
payload: SaveFinanceInvoiceSettingPayload,
|
||||
) {
|
||||
return requestClient.post<FinanceInvoiceSettingDto>(
|
||||
'/finance/invoice/settings/save',
|
||||
payload,
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询发票记录列表。 */
|
||||
export async function getFinanceInvoiceRecordListApi(
|
||||
params: FinanceInvoiceRecordListQuery,
|
||||
) {
|
||||
return requestClient.get<FinanceInvoiceRecordListResultDto>(
|
||||
'/finance/invoice/record/list',
|
||||
{
|
||||
params,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询发票记录详情。 */
|
||||
export async function getFinanceInvoiceRecordDetailApi(params: {
|
||||
recordId: string;
|
||||
}) {
|
||||
return requestClient.get<FinanceInvoiceRecordDetailDto>(
|
||||
'/finance/invoice/record/detail',
|
||||
{
|
||||
params,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/** 执行发票开票。 */
|
||||
export async function issueFinanceInvoiceRecordApi(
|
||||
payload: FinanceInvoiceIssuePayload,
|
||||
) {
|
||||
return requestClient.post<FinanceInvoiceIssueResultDto>(
|
||||
'/finance/invoice/record/issue',
|
||||
payload,
|
||||
);
|
||||
}
|
||||
|
||||
/** 执行发票作废。 */
|
||||
export async function voidFinanceInvoiceRecordApi(
|
||||
payload: FinanceInvoiceVoidPayload,
|
||||
) {
|
||||
return requestClient.post<FinanceInvoiceRecordDetailDto>(
|
||||
'/finance/invoice/record/void',
|
||||
payload,
|
||||
);
|
||||
}
|
||||
|
||||
/** 发起发票申请。 */
|
||||
export async function applyFinanceInvoiceRecordApi(
|
||||
payload: FinanceInvoiceApplyPayload,
|
||||
) {
|
||||
return requestClient.post<FinanceInvoiceRecordDetailDto>(
|
||||
'/finance/invoice/record/apply',
|
||||
payload,
|
||||
);
|
||||
}
|
||||
159
apps/web-antd/src/api/finance/transaction.ts
Normal file
159
apps/web-antd/src/api/finance/transaction.ts
Normal file
@@ -0,0 +1,159 @@
|
||||
/**
|
||||
* 文件职责:财务中心交易流水 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<FinanceTransactionListResultDto>(
|
||||
'/finance/transaction/list',
|
||||
{
|
||||
params,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询交易流水统计。 */
|
||||
export async function getFinanceTransactionStatsApi(
|
||||
params: FinanceTransactionFilterQuery,
|
||||
) {
|
||||
return requestClient.get<FinanceTransactionStatsDto>(
|
||||
'/finance/transaction/stats',
|
||||
{
|
||||
params,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询交易流水详情。 */
|
||||
export async function getFinanceTransactionDetailApi(params: {
|
||||
storeId: string;
|
||||
transactionId: string;
|
||||
}) {
|
||||
return requestClient.get<FinanceTransactionDetailDto>(
|
||||
'/finance/transaction/detail',
|
||||
{
|
||||
params,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/** 导出交易流水 CSV。 */
|
||||
export async function exportFinanceTransactionCsvApi(
|
||||
params: FinanceTransactionFilterQuery,
|
||||
) {
|
||||
return requestClient.get<FinanceTransactionExportDto>(
|
||||
'/finance/transaction/export',
|
||||
{
|
||||
params,
|
||||
},
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user