统一金额分制重构

This commit is contained in:
yml
2026-06-09 19:04:11 +08:00
parent 87673288ef
commit 5cd3ead4bd
69 changed files with 886 additions and 1277 deletions
+3 -2
View File
@@ -3,6 +3,7 @@ import { apiClient } from '@/shared/api/client'
import type { ApiResponse, PaginatedResult } from '@/shared/types/types'
import type { BalanceType, LedgerDirection, WalletStatus } from '@/shared/types/status'
import type { PaymentOrder } from '@/features/orders/api/orders'
import { yuanToCent } from '@/shared/utils/money'
export interface WalletAccount {
user_id: number
@@ -42,13 +43,13 @@ export async function fetchWalletLedger(page = 1, pageSize = 20) {
}
export async function rechargeWallet(amountYuan: number) {
const amount_cent = Math.round(amountYuan * 100)
const amount_cent = yuanToCent(amountYuan)
const { data } = await apiClient.post<ApiResponse<WalletAccount>>('/wallet/recharge', { amount_cent })
return data.data
}
export async function startWalletRechargePayment(amountYuan: number) {
const amount_cent = Math.round(amountYuan * 100)
const amount_cent = yuanToCent(amountYuan)
const { data } = await apiClient.post<ApiResponse<PaymentOrder>>('/wallet/recharge/pay', {
amount_cent,
})
@@ -402,8 +402,8 @@ function amountPrefix(direction: string) {
<span>支付金额</span>
<strong>{{
activeRechargePayment
? formatMoney(activeRechargePayment.amount_cent / 100)
: formatMoney(devRechargeAmount)
? formatCentWithSymbol(activeRechargePayment.amount_cent)
: `¥${formatMoney(devRechargeAmount)}`
}}</strong>
</div>
<div v-if="rechargePayURL()" class="cashier-qr">