feat(distribution): 完善分销收号资产双视图、商户提现、自主加价、品牌装修与数据大盘
This commit is contained in:
@@ -115,6 +115,11 @@ export interface Site {
|
||||
display_account_enabled: boolean
|
||||
tax_enabled: boolean
|
||||
tax_rate_bps: number
|
||||
logo_url?: string
|
||||
favicon_url?: string
|
||||
banners_json?: string
|
||||
announcements_json?: string
|
||||
footer_info_json?: string
|
||||
created_at: string
|
||||
}
|
||||
|
||||
@@ -170,6 +175,7 @@ export interface AccountDisplay {
|
||||
account_id: number
|
||||
listing_id: number
|
||||
display_status: string
|
||||
markup_amount_cent?: number
|
||||
listing_no?: string
|
||||
title?: string
|
||||
game_name?: string
|
||||
@@ -402,3 +408,174 @@ export async function listSettlementItems(batchID: number): Promise<SettlementIt
|
||||
const resp = await api.get<ApiResponse<{ items: SettlementItem[] }>>(`/admin/distribution/settlement-batches/${batchID}/items`)
|
||||
return extract(resp).items ?? []
|
||||
}
|
||||
|
||||
export interface ReceivedListing {
|
||||
listing_id: number
|
||||
listing_no: string
|
||||
site_id: number
|
||||
account_id: number
|
||||
owner_id: number
|
||||
owner_phone?: string
|
||||
owner_nickname?: string
|
||||
title: string
|
||||
game_name: string
|
||||
server_region: string
|
||||
login_platform: string
|
||||
rank_level: string
|
||||
haf_coin_amount: number
|
||||
price_cent: number
|
||||
deposit_amount_cent: number
|
||||
status: string
|
||||
review_status: string
|
||||
review_reason: string
|
||||
published_at?: string
|
||||
created_at: string
|
||||
}
|
||||
|
||||
export interface ReceivedListingPage {
|
||||
items: ReceivedListing[]
|
||||
total: number
|
||||
page: number
|
||||
page_size: number
|
||||
}
|
||||
|
||||
export async function fetchReceivedListings(params: {
|
||||
siteID?: number
|
||||
page?: number
|
||||
pageSize?: number
|
||||
status?: string
|
||||
reviewStatus?: string
|
||||
gameName?: string
|
||||
keyword?: string
|
||||
}): Promise<ReceivedListingPage> {
|
||||
const resp = await api.get<ApiResponse<ReceivedListingPage>>('/admin/distribution/received-listings', {
|
||||
params: {
|
||||
site_id: params.siteID,
|
||||
page: params.page || 1,
|
||||
page_size: params.pageSize || 20,
|
||||
status: params.status || undefined,
|
||||
review_status: params.reviewStatus || undefined,
|
||||
game_name: params.gameName || undefined,
|
||||
keyword: params.keyword || undefined,
|
||||
},
|
||||
})
|
||||
return extract(resp)
|
||||
}
|
||||
|
||||
export async function updateReceivedListingStatus(id: number, status: string): Promise<void> {
|
||||
await api.put(`/admin/distribution/received-listings/${id}/status`, { status })
|
||||
}
|
||||
|
||||
export interface SiteWallet {
|
||||
site_id: number
|
||||
available_balance_cent: number
|
||||
frozen_balance_cent: number
|
||||
total_settled_cent: number
|
||||
total_withdrawn_cent: number
|
||||
}
|
||||
|
||||
export async function fetchSiteWallet(siteID: number): Promise<SiteWallet> {
|
||||
const resp = await api.get<ApiResponse<SiteWallet>>(`/admin/distribution/sites/${siteID}/wallet`)
|
||||
return extract(resp)
|
||||
}
|
||||
|
||||
export interface SiteWithdrawal {
|
||||
id: number
|
||||
withdraw_no: string
|
||||
site_id: number
|
||||
amount_cent: number
|
||||
fee_cent: number
|
||||
actual_amount_cent: number
|
||||
account_type: string
|
||||
account_name: string
|
||||
account_no: string
|
||||
bank_name?: string
|
||||
bank_branch?: string
|
||||
status: string
|
||||
review_remark?: string
|
||||
payment_proof_url?: string
|
||||
payment_remark?: string
|
||||
paid_at?: string
|
||||
created_at: string
|
||||
}
|
||||
|
||||
export interface SiteWithdrawalPage {
|
||||
items: SiteWithdrawal[]
|
||||
total: number
|
||||
page: number
|
||||
page_size: number
|
||||
}
|
||||
|
||||
export async function fetchSiteWithdrawals(siteID: number, page = 1, pageSize = 20): Promise<SiteWithdrawalPage> {
|
||||
const resp = await api.get<ApiResponse<SiteWithdrawalPage>>(`/admin/distribution/sites/${siteID}/withdrawals`, {
|
||||
params: { page, page_size: pageSize },
|
||||
})
|
||||
return extract(resp)
|
||||
}
|
||||
|
||||
export interface ApplySiteWithdrawalPayload {
|
||||
site_id: number
|
||||
amount_cent: number
|
||||
account_type: 'alipay' | 'bank'
|
||||
account_name: string
|
||||
account_no: string
|
||||
bank_name?: string
|
||||
bank_branch?: string
|
||||
}
|
||||
|
||||
export async function applySiteWithdrawal(payload: ApplySiteWithdrawalPayload): Promise<SiteWithdrawal> {
|
||||
const resp = await api.post<ApiResponse<SiteWithdrawal>>(`/admin/distribution/sites/${payload.site_id}/withdrawals`, payload)
|
||||
return extract(resp)
|
||||
}
|
||||
|
||||
export interface SiteBrandingPayload {
|
||||
logo_url?: string
|
||||
favicon_url?: string
|
||||
banners_json?: string
|
||||
announcements_json?: string
|
||||
footer_info_json?: string
|
||||
}
|
||||
|
||||
export async function updateSiteBranding(siteID: number, payload: SiteBrandingPayload): Promise<Site> {
|
||||
const resp = await api.put<ApiResponse<Site>>(`/admin/distribution/sites/${siteID}/branding`, payload)
|
||||
return extract(resp)
|
||||
}
|
||||
|
||||
export async function updateAccountMarkup(id: number, markupCent: number): Promise<AccountDisplay> {
|
||||
const resp = await api.put<ApiResponse<AccountDisplay>>(`/admin/distribution/accounts/${id}/markup`, {
|
||||
markup_amount_cent: markupCent,
|
||||
})
|
||||
return extract(resp)
|
||||
}
|
||||
|
||||
export async function batchUpdateAccountMarkup(siteID: number, listingIDs: number[], markupCent: number): Promise<void> {
|
||||
await api.post(`/admin/distribution/accounts/batch-markup`, {
|
||||
listing_ids: listingIDs,
|
||||
markup_amount_cent: markupCent,
|
||||
}, {
|
||||
params: { site_id: siteID },
|
||||
})
|
||||
}
|
||||
|
||||
export interface DistributionAnalytics {
|
||||
today_received_count: number
|
||||
total_received_count: number
|
||||
active_listing_count: number
|
||||
today_order_count: number
|
||||
today_gmv_cent: number
|
||||
today_profit_cent: number
|
||||
month_profit_cent: number
|
||||
available_balance_cent: number
|
||||
trend_days: {
|
||||
date: string
|
||||
received_count: number
|
||||
order_count: number
|
||||
gmv_cent: number
|
||||
profit_cent: number
|
||||
}[]
|
||||
}
|
||||
|
||||
export async function fetchDashboardAnalytics(siteID: number): Promise<DistributionAnalytics> {
|
||||
const resp = await api.get<ApiResponse<DistributionAnalytics>>(`/admin/distribution/sites/${siteID}/analytics`)
|
||||
return extract(resp)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user