统一金额分制重构
This commit is contained in:
@@ -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">
|
||||
|
||||
Reference in New Issue
Block a user