feat(withdrawal): 增加提现审核对账与历史记录
This commit is contained in:
@@ -2,27 +2,32 @@ import { apiClient } from '@/shared/api/client'
|
||||
|
||||
import type { ApiResponse, PaginatedResult } from '@/shared/types/types'
|
||||
|
||||
// 管理员端提现详情接口
|
||||
export interface WithdrawalDetail {
|
||||
// 管理员端提现列表使用的轻量数据,不包含完整收款凭证和审核详情。
|
||||
export interface WithdrawalListItem {
|
||||
id: number
|
||||
withdraw_no: string
|
||||
user_id: number
|
||||
distribution_site_id?: number
|
||||
distribution_site_name?: string
|
||||
distribution_site_code?: string
|
||||
user_nickname: string
|
||||
user_phone: string
|
||||
amount_cent: number
|
||||
fee_cent: number
|
||||
actual_amount_cent: number
|
||||
payment_account_id: number | null
|
||||
account_type: string
|
||||
account_name: string
|
||||
account_no: string // 管理员可见完整账号
|
||||
account_no: string
|
||||
bank_name: string
|
||||
status: string
|
||||
created_at: string
|
||||
}
|
||||
|
||||
// 管理员端提现完整详情接口
|
||||
export interface WithdrawalDetail extends WithdrawalListItem {
|
||||
distribution_site_code?: string
|
||||
payment_account_id: number | null
|
||||
bank_branch: string
|
||||
certificate_urls: string[] // 收款二维码图片
|
||||
status: string
|
||||
reviewed_by: number | null
|
||||
reviewed_by_name: string
|
||||
reviewed_at: string | null
|
||||
@@ -32,10 +37,79 @@ export interface WithdrawalDetail {
|
||||
paid_at: string | null
|
||||
payment_proof_url: string
|
||||
payment_remark: string
|
||||
created_at: string
|
||||
updated_at: string
|
||||
}
|
||||
|
||||
export interface WithdrawalReviewSummary {
|
||||
owner_order_count: number
|
||||
owner_pickup_count?: number
|
||||
finalized_order_count: number
|
||||
wallet_actual_income_cent: number
|
||||
pickup_income_cent?: number
|
||||
wallet_pickup_income_cent?: number
|
||||
platform_managed_pickup_income_cent?: number
|
||||
platform_managed_income_cent: number
|
||||
withdrawal_count: number
|
||||
withdrawn_amount_cent: number
|
||||
pending_withdrawal_amount_cent: number
|
||||
rejected_withdrawal_count: number
|
||||
reconcile_difference_amount_cent: number
|
||||
}
|
||||
|
||||
export interface WithdrawalReviewPickup {
|
||||
id: number
|
||||
pickup_no: string
|
||||
listing_no: string
|
||||
title: string
|
||||
status: string
|
||||
settlement_mode: string
|
||||
offline_settlement_status: string
|
||||
settle_amount_cent: number
|
||||
settle_adjustment_cent: number
|
||||
effective_settle_amount_cent: number
|
||||
completed_at?: string
|
||||
created_at: string
|
||||
}
|
||||
|
||||
export interface WithdrawalReviewOrder {
|
||||
id: number
|
||||
order_no: string
|
||||
listing_no: string
|
||||
title: string
|
||||
status: string
|
||||
settlement_status: string
|
||||
settlement_mode: string
|
||||
rent_amount_cent: number
|
||||
owner_actual_income_cent?: number
|
||||
created_at: string
|
||||
settled_at?: string
|
||||
}
|
||||
|
||||
export interface WithdrawalReviewHistory {
|
||||
id: number
|
||||
withdraw_no: string
|
||||
amount_cent: number
|
||||
fee_cent: number
|
||||
actual_amount_cent: number
|
||||
status: string
|
||||
created_at: string
|
||||
reviewed_at?: string
|
||||
paid_at?: string
|
||||
}
|
||||
|
||||
export interface WithdrawalReviewContext {
|
||||
summary: WithdrawalReviewSummary
|
||||
orders: WithdrawalReviewOrder[]
|
||||
order_page: number
|
||||
order_page_size: number
|
||||
pickups: WithdrawalReviewPickup[]
|
||||
pickup_page: number
|
||||
pickup_page_size: number
|
||||
withdrawals: WithdrawalReviewHistory[]
|
||||
withdrawal_page: number
|
||||
withdrawal_page_size: number
|
||||
}
|
||||
|
||||
// 审核请求
|
||||
export interface ReviewWithdrawalRequest {
|
||||
approved: boolean
|
||||
@@ -56,7 +130,7 @@ export async function fetchAdminWithdrawals(params: {
|
||||
page?: number
|
||||
page_size?: number
|
||||
}) {
|
||||
const { data } = await apiClient.get<ApiResponse<PaginatedResult<WithdrawalDetail>>>(
|
||||
const { data } = await apiClient.get<ApiResponse<PaginatedResult<WithdrawalListItem>>>(
|
||||
'/admin/withdrawals',
|
||||
{
|
||||
params,
|
||||
@@ -70,6 +144,22 @@ export async function fetchAdminWithdrawal(id: number) {
|
||||
return data.data
|
||||
}
|
||||
|
||||
export async function fetchAdminWithdrawalReviewContext(
|
||||
id: number,
|
||||
params: {
|
||||
order_page?: number
|
||||
pickup_page?: number
|
||||
withdrawal_page?: number
|
||||
page_size?: number
|
||||
} = {}
|
||||
) {
|
||||
const { data } = await apiClient.get<ApiResponse<WithdrawalReviewContext>>(
|
||||
`/admin/withdrawals/${id}/review-context`,
|
||||
{ params }
|
||||
)
|
||||
return data.data
|
||||
}
|
||||
|
||||
export async function reviewWithdrawal(id: number, req: ReviewWithdrawalRequest) {
|
||||
const { data } = await apiClient.post<ApiResponse<WithdrawalDetail>>(
|
||||
`/admin/withdrawals/${id}/review`,
|
||||
|
||||
Reference in New Issue
Block a user