修复平台代管财务差异
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { apiClient } from '@/shared/api/client'
|
||||
import type { ApiResponse, PaginatedResult } from '@/shared/types/types'
|
||||
|
||||
// 结算差异判定阈值(分)。号主应得与实际入账差额绝对值达到此值即标红。
|
||||
// 结算差异判定阈值(分)。号主应得与钱包入账/线下结算差额绝对值达到此值即标红。
|
||||
// 与后端 settlementDiffThresholdCent 保持一致,改口径时两端同步。
|
||||
export const SETTLEMENT_DIFF_THRESHOLD_CENT = 5
|
||||
|
||||
@@ -13,6 +13,9 @@ export interface FinanceSummary {
|
||||
platform_income_amount_cent: number
|
||||
owner_should_income_amount_cent: number
|
||||
owner_wallet_income_amount_cent: number
|
||||
owner_effective_settlement_amount_cent: number
|
||||
offline_settlement_amount_cent: number
|
||||
offline_settlement_pending_amount_cent: number
|
||||
settlement_diff_amount_cent: number
|
||||
estimated_income_amount_cent: number
|
||||
successful_pay_count: number
|
||||
@@ -22,6 +25,7 @@ export interface FinanceSummary {
|
||||
pending_refund_count: number
|
||||
settled_order_count: number
|
||||
pending_settle_order_count: number
|
||||
offline_settlement_pending_count: number
|
||||
financial_exception_count: number
|
||||
}
|
||||
|
||||
@@ -34,6 +38,9 @@ export interface FinanceDailyItem {
|
||||
platform_income_amount_cent: number
|
||||
owner_should_income_amount_cent: number
|
||||
owner_wallet_income_amount_cent: number
|
||||
owner_effective_settlement_amount_cent: number
|
||||
offline_settlement_amount_cent: number
|
||||
offline_settlement_pending_amount_cent: number
|
||||
settlement_diff_amount_cent: number
|
||||
estimated_income_amount_cent: number
|
||||
successful_pay_count: number
|
||||
@@ -42,6 +49,7 @@ export interface FinanceDailyItem {
|
||||
partial_refund_count: number
|
||||
pending_refund_count: number
|
||||
settled_order_count: number
|
||||
offline_settlement_pending_count: number
|
||||
}
|
||||
|
||||
export interface FinancePickupSummary {
|
||||
@@ -64,6 +72,10 @@ export interface FinanceDetail {
|
||||
order_status: string
|
||||
settlement_status: string
|
||||
refund_status: string
|
||||
handoff_mode: string
|
||||
settlement_mode: string
|
||||
offline_settlement_status: string
|
||||
offline_settlement_amount_cent: number
|
||||
renter_id: number
|
||||
renter_phone: string
|
||||
renter_nickname: string
|
||||
@@ -77,6 +89,7 @@ export interface FinanceDetail {
|
||||
checkout_owner_income_cent: number
|
||||
checkout_platform_fee_cent: number
|
||||
owner_wallet_income_amount_cent: number
|
||||
owner_effective_settlement_amount_cent: number
|
||||
paid_amount_cent: number
|
||||
refunded_amount_cent: number
|
||||
refunding_amount_cent: number
|
||||
@@ -87,6 +100,7 @@ export interface FinanceDetail {
|
||||
finance_status: string
|
||||
created_at: string
|
||||
settled_at?: string
|
||||
offline_settled_at?: string
|
||||
}
|
||||
|
||||
export interface FinanceDateQuery {
|
||||
|
||||
@@ -54,6 +54,10 @@ function rowDiffClass(row: FinanceDailyItem) {
|
||||
? 'amount-danger'
|
||||
: ''
|
||||
}
|
||||
|
||||
function rowOfflinePendingClass(row: FinanceDailyItem) {
|
||||
return Number(row.offline_settlement_pending_amount_cent || 0) > 0 ? 'amount-warning' : ''
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -62,7 +66,7 @@ function rowDiffClass(row: FinanceDailyItem) {
|
||||
<div class="page-header">
|
||||
<p class="eyebrow">Finance Dashboard</p>
|
||||
<h1>财务仪表盘</h1>
|
||||
<p>按天查看第三方收款退款、平台收入、号主入账和结算差异。</p>
|
||||
<p>按天查看第三方收款退款、平台收入、号主钱包入账/线下结算和结算差异。</p>
|
||||
</div>
|
||||
<div class="toolbar-actions">
|
||||
<el-date-picker
|
||||
@@ -114,9 +118,14 @@ function rowDiffClass(row: FinanceDailyItem) {
|
||||
<small>结账单口径</small>
|
||||
</div>
|
||||
<div class="metric-card">
|
||||
<span>号主实际入账</span>
|
||||
<strong>{{ moneyCent(dashboard.summary.owner_wallet_income_amount_cent) }}</strong>
|
||||
<small>钱包流水口径</small>
|
||||
<span>号主结算金额</span>
|
||||
<strong>{{ moneyCent(dashboard.summary.owner_effective_settlement_amount_cent) }}</strong>
|
||||
<small>钱包入账 + 平台代管线下结算</small>
|
||||
</div>
|
||||
<div class="metric-card">
|
||||
<span>待线下结算</span>
|
||||
<strong>{{ moneyCent(dashboard.summary.offline_settlement_pending_amount_cent) }}</strong>
|
||||
<small>{{ dashboard.summary.offline_settlement_pending_count }} 笔平台代管待处理</small>
|
||||
</div>
|
||||
<div class="metric-card">
|
||||
<span>退款中</span>
|
||||
@@ -174,8 +183,17 @@ function rowDiffClass(row: FinanceDailyItem) {
|
||||
<el-table-column label="号主应得" width="130">
|
||||
<template #default="{ row }">{{ moneyCent(row.owner_should_income_amount_cent) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="号主入账" width="130">
|
||||
<template #default="{ row }">{{ moneyCent(row.owner_wallet_income_amount_cent) }}</template>
|
||||
<el-table-column label="结算金额" width="130">
|
||||
<template #default="{ row }">{{
|
||||
moneyCent(row.owner_effective_settlement_amount_cent)
|
||||
}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="待线下" width="130">
|
||||
<template #default="{ row }">
|
||||
<span :class="rowOfflinePendingClass(row)">
|
||||
{{ moneyCent(row.offline_settlement_pending_amount_cent) }}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="结算差异" width="130">
|
||||
<template #default="{ row }">
|
||||
@@ -211,6 +229,11 @@ function rowDiffClass(row: FinanceDailyItem) {
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.amount-warning {
|
||||
color: #d97706;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.pickup-grid {
|
||||
margin-top: 12px;
|
||||
}
|
||||
|
||||
@@ -71,6 +71,7 @@ function financeStatusLabel(status: string) {
|
||||
refund_pending: '退款中',
|
||||
refund_failed: '退款失败',
|
||||
settlement_diff: '结算差异',
|
||||
offline_settlement_pending: '待线下结算',
|
||||
}
|
||||
return map[status] || status
|
||||
}
|
||||
@@ -78,7 +79,7 @@ function financeStatusLabel(status: string) {
|
||||
function financeStatusType(status: string) {
|
||||
if (status === 'normal') return 'success'
|
||||
if (status === 'settlement_diff' || status === 'refund_failed') return 'danger'
|
||||
if (status === 'refund_pending') return 'warning'
|
||||
if (status === 'refund_pending' || status === 'offline_settlement_pending') return 'warning'
|
||||
return 'info'
|
||||
}
|
||||
|
||||
@@ -91,6 +92,23 @@ function settlementStatusLabel(status: string) {
|
||||
return map[status] || status || '-'
|
||||
}
|
||||
|
||||
function isPlatformManaged(row: FinanceDetail) {
|
||||
return row.handoff_mode === 'platform' || row.settlement_mode === 'platform_managed'
|
||||
}
|
||||
|
||||
function settlementModeLabel(row: FinanceDetail) {
|
||||
return isPlatformManaged(row) ? '平台代管' : '号主钱包'
|
||||
}
|
||||
|
||||
function offlineSettlementStatusLabel(status: string) {
|
||||
const map: Record<string, string> = {
|
||||
none: '无需线下结算',
|
||||
pending: '待线下结算',
|
||||
settled: '已线下结算',
|
||||
}
|
||||
return map[status] || status || '-'
|
||||
}
|
||||
|
||||
function shortDateTime(value?: string) {
|
||||
if (!value) return '-'
|
||||
const text = formatDateTime(value)
|
||||
@@ -114,7 +132,7 @@ function defaultEndDate() {
|
||||
<div class="page-header">
|
||||
<p class="eyebrow">Finance Details</p>
|
||||
<h1>财务明细</h1>
|
||||
<p>按订单核对收款、退款、平台收入、号主应得与钱包实际入账。</p>
|
||||
<p>按订单核对收款、退款、平台收入、号主应得与钱包入账/线下结算。</p>
|
||||
</div>
|
||||
<div class="toolbar-actions">
|
||||
<el-button @click="resetFilters">重置</el-button>
|
||||
@@ -191,7 +209,7 @@ function defaultEndDate() {
|
||||
<div class="amount-cell">净入</div>
|
||||
<div class="amount-cell">平台</div>
|
||||
<div class="amount-cell">应得</div>
|
||||
<div class="amount-cell">入账</div>
|
||||
<div class="amount-cell">入账/线下</div>
|
||||
<div class="amount-cell">差异</div>
|
||||
</div>
|
||||
|
||||
@@ -206,7 +224,13 @@ function defaultEndDate() {
|
||||
|
||||
<div class="status-stack">
|
||||
<span>{{ orderStatusLabel(row.order_status) }}</span>
|
||||
<small>{{ settlementStatusLabel(row.settlement_status) }}</small>
|
||||
<small
|
||||
>{{ settlementStatusLabel(row.settlement_status) }} ·
|
||||
{{ settlementModeLabel(row) }}</small
|
||||
>
|
||||
<small v-if="isPlatformManaged(row)">
|
||||
{{ offlineSettlementStatusLabel(row.offline_settlement_status) }}
|
||||
</small>
|
||||
<el-tag size="small" :type="financeStatusType(row.finance_status)">
|
||||
{{ financeStatusLabel(row.finance_status) }}
|
||||
</el-tag>
|
||||
@@ -232,7 +256,7 @@ function defaultEndDate() {
|
||||
moneyCent(row.checkout_owner_income_cent)
|
||||
}}</span>
|
||||
<span class="amount-text amount-cell">{{
|
||||
moneyCent(row.owner_wallet_income_amount_cent)
|
||||
moneyCent(row.owner_effective_settlement_amount_cent)
|
||||
}}</span>
|
||||
<span
|
||||
class="amount-text amount-cell"
|
||||
|
||||
Reference in New Issue
Block a user