统一金额分制重构
This commit is contained in:
@@ -10,7 +10,7 @@ export interface DashboardMetrics {
|
||||
total_orders: number
|
||||
renting_orders: number
|
||||
today_orders: number
|
||||
today_ledger_amount: number
|
||||
today_ledger_amount_cent: number
|
||||
}
|
||||
|
||||
export interface DashboardPending {
|
||||
@@ -27,8 +27,8 @@ export interface DashboardRecentOrder {
|
||||
renter_id: number
|
||||
owner_id: number
|
||||
status: OrderStatus
|
||||
rent_amount: number
|
||||
deposit_amount: number
|
||||
rent_amount_cent: number
|
||||
deposit_amount_cent: number
|
||||
created_at: string
|
||||
}
|
||||
|
||||
|
||||
@@ -6,10 +6,10 @@ export interface FinanceSummary {
|
||||
total_refund_amount_cent: number
|
||||
pending_refund_amount_cent: number
|
||||
channel_net_amount_cent: number
|
||||
platform_income_amount: number
|
||||
owner_should_income_amount: number
|
||||
owner_wallet_income_amount: number
|
||||
settlement_diff_amount: number
|
||||
platform_income_amount_cent: number
|
||||
owner_should_income_amount_cent: number
|
||||
owner_wallet_income_amount_cent: number
|
||||
settlement_diff_amount_cent: number
|
||||
successful_pay_count: number
|
||||
successful_refund_count: number
|
||||
pending_refund_count: number
|
||||
@@ -23,10 +23,10 @@ export interface FinanceDailyItem {
|
||||
total_refund_amount_cent: number
|
||||
pending_refund_amount_cent: number
|
||||
channel_net_amount_cent: number
|
||||
platform_income_amount: number
|
||||
owner_should_income_amount: number
|
||||
owner_wallet_income_amount: number
|
||||
settlement_diff_amount: number
|
||||
platform_income_amount_cent: number
|
||||
owner_should_income_amount_cent: number
|
||||
owner_wallet_income_amount_cent: number
|
||||
settlement_diff_amount_cent: number
|
||||
successful_pay_count: number
|
||||
successful_refund_count: number
|
||||
pending_refund_count: number
|
||||
@@ -51,20 +51,20 @@ export interface FinanceDetail {
|
||||
owner_id: number
|
||||
owner_phone: string
|
||||
owner_nickname: string
|
||||
order_rent_amount: number
|
||||
order_deposit_amount: number
|
||||
checkout_rent_amount: number
|
||||
checkout_renter_refund: number
|
||||
checkout_owner_income: number
|
||||
checkout_platform_fee: number
|
||||
owner_wallet_income_amount: number
|
||||
order_rent_amount_cent: number
|
||||
order_deposit_amount_cent: number
|
||||
checkout_rent_amount_cent: number
|
||||
checkout_renter_refund_cent: number
|
||||
checkout_owner_income_cent: number
|
||||
checkout_platform_fee_cent: number
|
||||
owner_wallet_income_amount_cent: number
|
||||
paid_amount_cent: number
|
||||
refunded_amount_cent: number
|
||||
refunding_amount_cent: number
|
||||
failed_refund_amount_cent: number
|
||||
channel_net_amount_cent: number
|
||||
platform_net_amount: number
|
||||
settlement_diff_amount: number
|
||||
platform_net_amount_cent: number
|
||||
settlement_diff_amount_cent: number
|
||||
finance_status: string
|
||||
created_at: string
|
||||
settled_at?: string
|
||||
|
||||
@@ -10,9 +10,9 @@ export interface AdminUserItem {
|
||||
realname_status: RealnameStatusValue
|
||||
risk_status: RiskStatus
|
||||
credit_score: number
|
||||
deposit_free_quota: number
|
||||
deposit_free_used: number
|
||||
deposit_free_remaining: number
|
||||
deposit_free_quota_cent: number
|
||||
deposit_free_used_cent: number
|
||||
deposit_free_remaining_cent: number
|
||||
status: UserStatus
|
||||
order_count: number
|
||||
listing_count: number
|
||||
@@ -44,10 +44,10 @@ export async function unfreezeAdminUser(id: number) {
|
||||
return data.data
|
||||
}
|
||||
|
||||
export async function setAdminUserDepositFreeQuota(id: number, amount: number) {
|
||||
export async function setAdminUserDepositFreeQuota(id: number, amountCent: number) {
|
||||
const { data } = await apiClient.post<ApiResponse<AdminUserItem>>(
|
||||
`/admin/users/${id}/deposit-free-quota`,
|
||||
{ amount }
|
||||
{ amount_cent: amountCent }
|
||||
)
|
||||
return data.data
|
||||
}
|
||||
|
||||
@@ -12,9 +12,6 @@ export interface WithdrawalDetail {
|
||||
amount_cent: number
|
||||
fee_cent: number
|
||||
actual_amount_cent: number
|
||||
amount?: number
|
||||
fee?: number
|
||||
actual_amount?: number
|
||||
payment_account_id: number | null
|
||||
account_type: string
|
||||
account_name: string
|
||||
|
||||
@@ -17,12 +17,10 @@ import {
|
||||
} from '@element-plus/icons-vue'
|
||||
import { fetchAdminDashboard, type AdminDashboard } from '@/features/admin/api/adminDashboard'
|
||||
import { useAdminTable } from '@/features/admin/composables/useAdminTable'
|
||||
import { useMoney } from '@/shared/composables/useMoney'
|
||||
import { formatCentWithSymbol } from '@/shared/utils/money'
|
||||
import { disputeStatusLabel, orderStatusLabel } from '@/utils/statusLabels'
|
||||
import { formatDateTime } from '@/utils/time'
|
||||
|
||||
const money = useMoney()
|
||||
|
||||
const {
|
||||
loading,
|
||||
error,
|
||||
@@ -98,7 +96,7 @@ const {
|
||||
</div>
|
||||
<div class="metric-content">
|
||||
<span>今日流水</span>
|
||||
<strong>{{ money(dashboard.metrics.today_ledger_amount) }}</strong>
|
||||
<strong>{{ formatCentWithSymbol(dashboard.metrics.today_ledger_amount_cent) }}</strong>
|
||||
<small>今日订单 {{ dashboard.metrics.today_orders }} 个</small>
|
||||
</div>
|
||||
</div>
|
||||
@@ -224,9 +222,9 @@ const {
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="rent_amount" label="金额" width="100">
|
||||
<el-table-column prop="rent_amount_cent" label="金额" width="100">
|
||||
<template #default="{ row }">
|
||||
<span class="amount">{{ money(row.rent_amount) }}</span>
|
||||
<span class="amount">{{ formatCentWithSymbol(row.rent_amount_cent) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建时间" min-width="180">
|
||||
|
||||
@@ -7,6 +7,7 @@ import { fetchAdminFileBlob } from '@/shared/api/files'
|
||||
import { disputeStatusLabel } from '@/utils/statusLabels'
|
||||
import { formatDateTime } from '@/utils/time'
|
||||
import { formatListingNo } from '@/utils/listingDisplay'
|
||||
import { yuanToCent } from '@/shared/utils/money'
|
||||
import AdminTablePagination from '../components/AdminTablePagination.vue'
|
||||
|
||||
const loading = ref(false)
|
||||
@@ -100,7 +101,7 @@ async function handleArbitrate() {
|
||||
await arbitrateDispute(activeDispute.value.id, {
|
||||
result: result.value,
|
||||
remark: remark.value.trim(),
|
||||
amount: amount.value,
|
||||
amount_cent: amount.value ? yuanToCent(amount.value) : undefined,
|
||||
})
|
||||
ElMessage.success('仲裁结果已保存,双方已收到通知')
|
||||
activeDispute.value = null
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
type FinanceDashboard,
|
||||
type FinanceDailyItem,
|
||||
} from '@/features/admin/api/adminFinance'
|
||||
import { formatMoneyWithSymbol } from '@/shared/utils/money'
|
||||
import { formatCentWithSymbol } from '@/shared/utils/money'
|
||||
import { formatDateTime } from '@/utils/time'
|
||||
|
||||
const loading = ref(false)
|
||||
@@ -31,11 +31,7 @@ async function loadDashboard() {
|
||||
}
|
||||
|
||||
function moneyCent(value: number) {
|
||||
return formatMoneyWithSymbol(Number(value || 0) / 100)
|
||||
}
|
||||
|
||||
function money(value: number) {
|
||||
return formatMoneyWithSymbol(value)
|
||||
return formatCentWithSymbol(value)
|
||||
}
|
||||
|
||||
function defaultStartDate() {
|
||||
@@ -53,11 +49,11 @@ function formatInputDate(date: Date) {
|
||||
}
|
||||
|
||||
function diffType(value: number) {
|
||||
return Math.abs(Number(value || 0)) >= 0.05 ? 'danger' : 'success'
|
||||
return Math.abs(Number(value || 0)) >= 5 ? 'danger' : 'success'
|
||||
}
|
||||
|
||||
function rowDiffClass(row: FinanceDailyItem) {
|
||||
return Math.abs(Number(row.settlement_diff_amount || 0)) >= 0.05 ? 'amount-danger' : ''
|
||||
return Math.abs(Number(row.settlement_diff_amount_cent || 0)) >= 5 ? 'amount-danger' : ''
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -107,17 +103,17 @@ function rowDiffClass(row: FinanceDailyItem) {
|
||||
</div>
|
||||
<div class="metric-card">
|
||||
<span>平台收入</span>
|
||||
<strong>{{ money(dashboard.summary.platform_income_amount) }}</strong>
|
||||
<strong>{{ moneyCent(dashboard.summary.platform_income_amount_cent) }}</strong>
|
||||
<small>{{ dashboard.summary.settled_order_count }} 个已结算订单</small>
|
||||
</div>
|
||||
<div class="metric-card">
|
||||
<span>号主应得</span>
|
||||
<strong>{{ money(dashboard.summary.owner_should_income_amount) }}</strong>
|
||||
<strong>{{ moneyCent(dashboard.summary.owner_should_income_amount_cent) }}</strong>
|
||||
<small>结账单口径</small>
|
||||
</div>
|
||||
<div class="metric-card">
|
||||
<span>号主实际入账</span>
|
||||
<strong>{{ money(dashboard.summary.owner_wallet_income_amount) }}</strong>
|
||||
<strong>{{ moneyCent(dashboard.summary.owner_wallet_income_amount_cent) }}</strong>
|
||||
<small>钱包流水口径</small>
|
||||
</div>
|
||||
<div class="metric-card">
|
||||
@@ -128,8 +124,8 @@ function rowDiffClass(row: FinanceDailyItem) {
|
||||
<div class="metric-card">
|
||||
<span>结算差异</span>
|
||||
<strong>
|
||||
<el-tag :type="diffType(dashboard.summary.settlement_diff_amount)">
|
||||
{{ money(dashboard.summary.settlement_diff_amount) }}
|
||||
<el-tag :type="diffType(dashboard.summary.settlement_diff_amount_cent)">
|
||||
{{ moneyCent(dashboard.summary.settlement_diff_amount_cent) }}
|
||||
</el-tag>
|
||||
</strong>
|
||||
<small>{{ dashboard.summary.financial_exception_count }} 个异常订单</small>
|
||||
@@ -148,17 +144,17 @@ function rowDiffClass(row: FinanceDailyItem) {
|
||||
<template #default="{ row }">{{ moneyCent(row.channel_net_amount_cent) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="平台收入" width="130">
|
||||
<template #default="{ row }">{{ money(row.platform_income_amount) }}</template>
|
||||
<template #default="{ row }">{{ moneyCent(row.platform_income_amount_cent) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="号主应得" width="130">
|
||||
<template #default="{ row }">{{ money(row.owner_should_income_amount) }}</template>
|
||||
<template #default="{ row }">{{ moneyCent(row.owner_should_income_amount_cent) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="号主入账" width="130">
|
||||
<template #default="{ row }">{{ money(row.owner_wallet_income_amount) }}</template>
|
||||
<template #default="{ row }">{{ moneyCent(row.owner_wallet_income_amount_cent) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="结算差异" width="130">
|
||||
<template #default="{ row }">
|
||||
<span :class="rowDiffClass(row)">{{ money(row.settlement_diff_amount) }}</span>
|
||||
<span :class="rowDiffClass(row)">{{ moneyCent(row.settlement_diff_amount_cent) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="收款/退款/结算" min-width="170">
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
fetchFinanceDetails,
|
||||
type FinanceDetail,
|
||||
} from '@/features/admin/api/adminFinance'
|
||||
import { formatMoneyWithSymbol } from '@/shared/utils/money'
|
||||
import { formatCentWithSymbol } from '@/shared/utils/money'
|
||||
import { orderStatusLabel } from '@/utils/statusLabels'
|
||||
import { formatDateTime } from '@/utils/time'
|
||||
import AdminTablePagination from '../components/AdminTablePagination.vue'
|
||||
@@ -59,12 +59,8 @@ async function handlePageChange() {
|
||||
await loadDetails()
|
||||
}
|
||||
|
||||
function money(value: number) {
|
||||
return formatMoneyWithSymbol(value)
|
||||
}
|
||||
|
||||
function moneyCent(value: number) {
|
||||
return formatMoneyWithSymbol(Number(value || 0) / 100)
|
||||
return formatCentWithSymbol(value)
|
||||
}
|
||||
|
||||
function financeStatusLabel(status: string) {
|
||||
@@ -226,14 +222,14 @@ function formatInputDate(date: Date) {
|
||||
{{ moneyCent(row.refunding_amount_cent) }}
|
||||
</span>
|
||||
<span class="amount-text amount-cell">{{ moneyCent(row.channel_net_amount_cent) }}</span>
|
||||
<span class="amount-text amount-cell">{{ money(row.checkout_platform_fee) }}</span>
|
||||
<span class="amount-text amount-cell">{{ money(row.checkout_owner_income) }}</span>
|
||||
<span class="amount-text amount-cell">{{ money(row.owner_wallet_income_amount) }}</span>
|
||||
<span class="amount-text amount-cell">{{ moneyCent(row.checkout_platform_fee_cent) }}</span>
|
||||
<span class="amount-text amount-cell">{{ moneyCent(row.checkout_owner_income_cent) }}</span>
|
||||
<span class="amount-text amount-cell">{{ moneyCent(row.owner_wallet_income_amount_cent) }}</span>
|
||||
<span
|
||||
class="amount-text amount-cell"
|
||||
:class="{ 'amount-danger': Math.abs(row.settlement_diff_amount) >= 0.05 }"
|
||||
:class="{ 'amount-danger': Math.abs(row.settlement_diff_amount_cent) >= 5 }"
|
||||
>
|
||||
{{ money(row.settlement_diff_amount) }}
|
||||
{{ moneyCent(row.settlement_diff_amount_cent) }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -5,7 +5,7 @@ import { computed, onMounted, ref } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
|
||||
import { fetchAdminFileBlob } from '@/shared/api/files'
|
||||
import { formatMoneyWithSymbol } from '@/shared/utils/money'
|
||||
import { formatCentWithSymbol } from '@/shared/utils/money'
|
||||
import {
|
||||
adminMarkListingAbnormal,
|
||||
adminOfflineListing,
|
||||
@@ -78,12 +78,12 @@ async function submitAction() {
|
||||
}
|
||||
}
|
||||
|
||||
function money(value: number) {
|
||||
return formatMoneyWithSymbol(value)
|
||||
function moneyCent(value: number) {
|
||||
return formatCentWithSymbol(value)
|
||||
}
|
||||
|
||||
function listingPrice(row: Listing) {
|
||||
return money(row.price)
|
||||
return moneyCent(row.price_cent)
|
||||
}
|
||||
|
||||
function extractObjectKey(url: string) {
|
||||
@@ -150,7 +150,7 @@ function readError(error: unknown, fallback: string) {
|
||||
</div>
|
||||
<div class="metric-card">
|
||||
<span>押金</span>
|
||||
<strong>{{ money(listing.deposit_amount) }}</strong>
|
||||
<strong>{{ moneyCent(listing.deposit_amount_cent) }}</strong>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -172,7 +172,7 @@ function readError(error: unknown, fallback: string) {
|
||||
<p>号主:{{ listing.owner_phone || listing.owner_nickname || listing.owner_id }}</p>
|
||||
<p>号主 ID:{{ listing.owner_id }}</p>
|
||||
<p>价格:{{ listingPrice(listing) }}</p>
|
||||
<p>押金:{{ money(listing.deposit_amount) }}</p>
|
||||
<p>押金:{{ moneyCent(listing.deposit_amount_cent) }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { computed, nextTick, onBeforeUnmount, onMounted, reactive, ref, watch } from 'vue'
|
||||
|
||||
import { fetchAdminFileBlob } from '@/shared/api/files'
|
||||
import { formatMoneyWithSymbol } from '@/shared/utils/money'
|
||||
import { centToYuan, formatCent, formatMoneyWithSymbol, yuanToCent } from '@/shared/utils/money'
|
||||
import {
|
||||
adjustListingReviewPrice,
|
||||
approveListing,
|
||||
@@ -185,10 +185,10 @@ async function handleSavePriceAdjust() {
|
||||
reason: priceAdjustForm.reason.trim(),
|
||||
}
|
||||
: {
|
||||
buyer_total_price: Number(priceAdjustForm.buyer_total_price || 0),
|
||||
buyer_total_price_cent: yuanToCent(Number(priceAdjustForm.buyer_total_price || 0)),
|
||||
reason: priceAdjustForm.reason.trim(),
|
||||
}
|
||||
if ((payload.buyer_ratio || payload.buyer_total_price || 0) <= 0) {
|
||||
if ((payload.buyer_ratio || payload.buyer_total_price_cent || 0) <= 0) {
|
||||
ElMessage.warning('请填写有效的加价后比例或价格')
|
||||
return
|
||||
}
|
||||
@@ -298,8 +298,9 @@ function roundPreviewRatio(value: number) {
|
||||
function sellerTotalPrice(row: Listing) {
|
||||
const value = breakdownNumber(row, 'seller_total_price')
|
||||
if (value > 0) return value
|
||||
const fallback = Number(row.price || 0) - getListingConsumablePrice(row)
|
||||
return fallback > 0 ? fallback : Number(row.price || 0)
|
||||
const price = centToYuan(row.price_cent)
|
||||
const fallback = price - getListingConsumablePrice(row)
|
||||
return fallback > 0 ? fallback : price
|
||||
}
|
||||
|
||||
function sellerCoinBasePrice(row: Listing) {
|
||||
@@ -318,7 +319,7 @@ function sellerRatio(row: Listing) {
|
||||
|
||||
function buyerTotalPrice(row: Listing) {
|
||||
const value = breakdownNumber(row, 'buyer_total_price')
|
||||
return value > 0 ? value : Number(row.price || 0)
|
||||
return value > 0 ? value : centToYuan(row.price_cent)
|
||||
}
|
||||
|
||||
function buyerCoinBasePrice(row: Listing) {
|
||||
@@ -463,7 +464,7 @@ function riskItems(row: Listing): RiskItem[] {
|
||||
if (hasBanRecord(row)) items.push({ label: `封禁记录:${banRecordText(row)}`, level: 'danger' })
|
||||
if (
|
||||
getListingConsumablePrice(row) > 0 &&
|
||||
Number(row.deposit_amount || 0) <= getListingConsumablePrice(row)
|
||||
centToYuan(row.deposit_amount_cent) <= getListingConsumablePrice(row)
|
||||
) {
|
||||
items.push({ label: '押金不高于消耗品价值', level: 'danger' })
|
||||
}
|
||||
@@ -646,7 +647,7 @@ function readError(error: unknown, fallback: string) {
|
||||
<span>KD {{ assetNumberText(item, 'secret_kd') }}</span>
|
||||
</div>
|
||||
<div class="queue-footer">
|
||||
<span>{{ money(item.price) }} / 押 {{ money(item.deposit_amount) }}</span>
|
||||
<span>¥{{ formatCent(item.price_cent) }} / 押 ¥{{ formatCent(item.deposit_amount_cent) }}</span>
|
||||
<el-tag v-if="isExternalUpload(item)" size="small" type="info">{{
|
||||
uploaderName(item)
|
||||
}}</el-tag>
|
||||
@@ -733,7 +734,7 @@ function readError(error: unknown, fallback: string) {
|
||||
</div>
|
||||
<div class="price-decision-card deposit">
|
||||
<span>押金与损耗</span>
|
||||
<strong>{{ money(selectedListing.deposit_amount) }}</strong>
|
||||
<strong>¥{{ formatCent(selectedListing.deposit_amount_cent) }}</strong>
|
||||
<p>每日损耗 {{ dailyLossText(selectedListing) }}</p>
|
||||
<small>哈夫币 {{ formatHafCoinM(getCoinWan(selectedListing)) }}</small>
|
||||
</div>
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
type Listing,
|
||||
} from '@/features/listings'
|
||||
import { useAdminTable } from '@/features/admin/composables/useAdminTable'
|
||||
import { useMoney } from '@/shared/composables/useMoney'
|
||||
import { formatCentWithSymbol } from '@/shared/utils/money'
|
||||
import {
|
||||
assetRegions,
|
||||
formatEstimatedRentalDuration,
|
||||
@@ -23,8 +23,6 @@ import {
|
||||
getSkinGroup,
|
||||
} from '@/utils/listingDisplay'
|
||||
|
||||
const money = useMoney()
|
||||
|
||||
const filters = reactive<AdminListingQuery>({
|
||||
owner_id: '',
|
||||
status: '',
|
||||
@@ -322,7 +320,7 @@ function readScreenshotError(error: unknown, fallback: string) {
|
||||
}
|
||||
|
||||
function listingPrice(row: Listing) {
|
||||
return money(row.price)
|
||||
return formatCentWithSymbol(row.price_cent)
|
||||
}
|
||||
|
||||
function listingCoinM(row: Listing) {
|
||||
@@ -372,7 +370,7 @@ function characterAndWeaponSkinText(row: Listing) {
|
||||
}
|
||||
|
||||
function rentAndDepositText(row: Listing) {
|
||||
return `${listingPrice(row)}/${money(row.deposit_amount)}`
|
||||
return `${listingPrice(row)}/${formatCentWithSymbol(row.deposit_amount_cent)}`
|
||||
}
|
||||
|
||||
function estimateTitle(row: Listing) {
|
||||
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
type RefundStatus,
|
||||
} from '@/features/orders'
|
||||
import { fetchAdminPayments, type AdminPayment } from '@/features/admin/api/adminPayments'
|
||||
import { centToYuan, formatMoney, formatMoneyWithSymbol } from '@/shared/utils/money'
|
||||
import { centToYuan, formatCentWithSymbol, formatMoney } from '@/shared/utils/money'
|
||||
import { handoffStatusLabel, orderStatusLabel } from '@/utils/statusLabels'
|
||||
import { formatDateTime } from '@/utils/time'
|
||||
import { formatListingNo } from '@/utils/listingDisplay'
|
||||
@@ -111,9 +111,9 @@ function money(value: unknown) {
|
||||
return formatMoney(Number(value || 0))
|
||||
}
|
||||
|
||||
function amountYuan(cent: unknown, legacyYuan?: unknown) {
|
||||
function amountYuan(cent: unknown) {
|
||||
if (cent !== undefined && cent !== null) return centToYuan(Number(cent || 0))
|
||||
return Number(legacyYuan || 0)
|
||||
return 0
|
||||
}
|
||||
|
||||
async function handleRefund() {
|
||||
@@ -173,7 +173,7 @@ function paymentBizTypeLabel(type: string) {
|
||||
}
|
||||
|
||||
function moneyCent(value: number) {
|
||||
return formatMoneyWithSymbol(Number(value || 0) / 100)
|
||||
return formatCentWithSymbol(value)
|
||||
}
|
||||
|
||||
function formatHandoffRecordType(type: string) {
|
||||
@@ -232,15 +232,15 @@ function formatHandoffRecordType(type: string) {
|
||||
</div>
|
||||
<div class="metric-card">
|
||||
<span>订单金额</span>
|
||||
<strong>¥{{ money(amountYuan(order.rent_amount_cent, order.rent_amount)) }}</strong>
|
||||
<strong>¥{{ money(amountYuan(order.rent_amount_cent)) }}</strong>
|
||||
</div>
|
||||
<div class="metric-card">
|
||||
<span>平台费用</span>
|
||||
<strong>¥{{ money(amountYuan(order.platform_fee_cent, order.platform_fee)) }}</strong>
|
||||
<strong>¥{{ money(amountYuan(order.platform_fee_cent)) }}</strong>
|
||||
</div>
|
||||
<div class="metric-card">
|
||||
<span>押金</span>
|
||||
<strong>¥{{ money(amountYuan(order.deposit_amount_cent, order.deposit_amount)) }}</strong>
|
||||
<strong>¥{{ money(amountYuan(order.deposit_amount_cent)) }}</strong>
|
||||
</div>
|
||||
<div v-if="refundStatus" class="metric-card">
|
||||
<span>退款状态</span>
|
||||
|
||||
@@ -37,9 +37,9 @@ const filteredOrders = computed(() => {
|
||||
return orders.value.filter(item => item.status === status.value)
|
||||
})
|
||||
|
||||
function amountYuan(cent: unknown, legacyYuan?: unknown) {
|
||||
function amountYuan(cent: unknown) {
|
||||
if (cent !== undefined && cent !== null) return centToYuan(Number(cent || 0))
|
||||
return Number(legacyYuan || 0)
|
||||
return 0
|
||||
}
|
||||
|
||||
function money(value: unknown) {
|
||||
@@ -95,10 +95,10 @@ function money(value: unknown) {
|
||||
<template #default="{ row }">{{ settlementStatusLabel(row.settlement_status) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="订单金额" width="100">
|
||||
<template #default="{ row }">¥{{ money(amountYuan(row.rent_amount_cent, row.rent_amount)) }}</template>
|
||||
<template #default="{ row }">¥{{ money(amountYuan(row.rent_amount_cent)) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="押金" width="100">
|
||||
<template #default="{ row }">¥{{ money(amountYuan(row.deposit_amount_cent, row.deposit_amount)) }}</template>
|
||||
<template #default="{ row }">¥{{ money(amountYuan(row.deposit_amount_cent)) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建时间" min-width="180">
|
||||
<template #default="{ row }">{{ formatDateTime(row.created_at) }}</template>
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
type PaymentConfig,
|
||||
} from '@/features/admin/api/paymentConfig'
|
||||
import { formatDateTime } from '@/utils/time'
|
||||
import { formatMoney } from '@/shared/utils/money'
|
||||
import { formatCent } from '@/shared/utils/money'
|
||||
import { readError } from '@/utils/error'
|
||||
import PaymentConfigDialog from '../components/PaymentConfigDialog.vue'
|
||||
|
||||
@@ -231,7 +231,7 @@ function formatEnvironment(env: string) {
|
||||
}
|
||||
|
||||
function formatAmount(amountCent: number) {
|
||||
return formatMoney(amountCent / 100)
|
||||
return formatCent(amountCent)
|
||||
}
|
||||
|
||||
function getStatusType(status: string) {
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Document, Search } from '@element-plus/icons-vue'
|
||||
import { computed, onMounted, reactive, ref } from 'vue'
|
||||
|
||||
import { fetchAdminPayments, type AdminPayment } from '@/features/admin/api/adminPayments'
|
||||
import { formatMoneyWithSymbol } from '@/shared/utils/money'
|
||||
import { formatCentWithSymbol } from '@/shared/utils/money'
|
||||
import { formatDateTime } from '@/utils/time'
|
||||
import AdminTablePagination from '../components/AdminTablePagination.vue'
|
||||
|
||||
@@ -70,7 +70,7 @@ async function handlePageChange() {
|
||||
}
|
||||
|
||||
function moneyCent(value: number) {
|
||||
return formatMoneyWithSymbol(Number(value || 0) / 100)
|
||||
return formatCentWithSymbol(value)
|
||||
}
|
||||
|
||||
function paymentStatusType(status: string) {
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
unfreezeAdminUser,
|
||||
type AdminUserItem,
|
||||
} from '@/features/admin/api/adminUsers'
|
||||
import { formatMoney } from '@/shared/utils/money'
|
||||
import { centToYuan, formatCent, yuanToCent } from '@/shared/utils/money'
|
||||
import { useAdminPaginatedTable } from '@/features/admin/composables/useAdminPaginatedTable'
|
||||
import { userStatusLabel } from '@/utils/statusLabels'
|
||||
import { formatDateTime } from '@/utils/time'
|
||||
@@ -39,14 +39,14 @@ function openFreeze(row: AdminUserItem) {
|
||||
|
||||
function openDepositQuota(row: AdminUserItem) {
|
||||
quotaUser.value = row
|
||||
quotaAmount.value = Number(row.deposit_free_quota || 0)
|
||||
quotaAmount.value = centToYuan(row.deposit_free_quota_cent)
|
||||
}
|
||||
|
||||
async function handleSetDepositQuota() {
|
||||
if (!quotaUser.value) return
|
||||
submitting.value = true
|
||||
try {
|
||||
await setAdminUserDepositFreeQuota(quotaUser.value.id, quotaAmount.value)
|
||||
await setAdminUserDepositFreeQuota(quotaUser.value.id, yuanToCent(quotaAmount.value))
|
||||
ElMessage.success('免押额度已更新')
|
||||
quotaUser.value = null
|
||||
await loadUsers()
|
||||
@@ -93,8 +93,8 @@ function readError(error: unknown, fallback: string) {
|
||||
return fallback
|
||||
}
|
||||
|
||||
function money(value: number | string | undefined) {
|
||||
return formatMoney(Number(value || 0))
|
||||
function moneyCent(value: number | string | undefined) {
|
||||
return formatCent(Number(value || 0))
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -117,13 +117,13 @@ function money(value: number | string | undefined) {
|
||||
<template #default="{ row }">{{ userStatusLabel(row.status) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="免押额度" width="130">
|
||||
<template #default="{ row }">¥{{ money(row.deposit_free_quota) }}</template>
|
||||
<template #default="{ row }">¥{{ moneyCent(row.deposit_free_quota_cent) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="已占用" width="120">
|
||||
<template #default="{ row }">¥{{ money(row.deposit_free_used) }}</template>
|
||||
<template #default="{ row }">¥{{ moneyCent(row.deposit_free_used_cent) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="剩余免押" width="120">
|
||||
<template #default="{ row }">¥{{ money(row.deposit_free_remaining) }}</template>
|
||||
<template #default="{ row }">¥{{ moneyCent(row.deposit_free_remaining_cent) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="注册时间" min-width="180">
|
||||
<template #default="{ row }">{{ formatDateTime(row.created_at) }}</template>
|
||||
@@ -195,8 +195,8 @@ function money(value: number | string | undefined) {
|
||||
<strong>{{ quotaUser.phone }}</strong> · {{ quotaUser.nickname }}
|
||||
</p>
|
||||
<p>
|
||||
已占用 ¥{{ money(quotaUser.deposit_free_used) }},剩余 ¥{{
|
||||
money(quotaUser.deposit_free_remaining)
|
||||
已占用 ¥{{ moneyCent(quotaUser.deposit_free_used_cent) }},剩余 ¥{{
|
||||
moneyCent(quotaUser.deposit_free_remaining_cent)
|
||||
}}
|
||||
</p>
|
||||
<el-input-number
|
||||
|
||||
Reference in New Issue
Block a user