[Snow Team] frontend-fixer-2: auto-commit work
This commit is contained in:
@@ -8,8 +8,8 @@ export function useWallet() {
|
||||
const loading = ref(false)
|
||||
const error = ref<string | null>(null)
|
||||
|
||||
const availableBalance = computed(() => balance.value?.available_balance ?? 0)
|
||||
const frozenBalance = computed(() => balance.value?.frozen_balance ?? 0)
|
||||
const availableBalance = computed(() => balance.value?.available_balance_cent ?? 0)
|
||||
const frozenBalance = computed(() => balance.value?.frozen_balance_cent ?? 0)
|
||||
const totalBalance = computed(() => availableBalance.value + frozenBalance.value)
|
||||
|
||||
async function loadBalance() {
|
||||
|
||||
@@ -25,7 +25,7 @@ import {
|
||||
import type { PaymentOrder } from '@/features/orders'
|
||||
import { balanceTypeLabel, ledgerDirectionLabel, walletStatusLabel } from '@/utils/statusLabels'
|
||||
import { formatDateTime } from '@/utils/time'
|
||||
import { formatCent, formatCentWithSymbol } from '@/shared/utils/money'
|
||||
import { formatCentWithSymbol, formatMoney } from '@/shared/utils/money'
|
||||
|
||||
const router = useRouter()
|
||||
const loading = ref(false)
|
||||
@@ -276,7 +276,7 @@ function amountPrefix(direction: string) {
|
||||
</div>
|
||||
<div class="wallet-hero-action">
|
||||
<span>当前可用</span>
|
||||
<strong>{{ account ? formatMoney(account.available_balance) : '¥0.00' }}</strong>
|
||||
<strong>{{ account ? formatCentWithSymbol(account.available_balance_cent) : '¥0.0' }}</strong>
|
||||
<el-button class="withdraw-button" :icon="Money" type="primary" @click="handleWithdraw">
|
||||
申请提现
|
||||
</el-button>
|
||||
@@ -374,10 +374,10 @@ function amountPrefix(direction: string) {
|
||||
</el-tag>
|
||||
</span>
|
||||
<span class="ledger-cell align-right amount-cell" :class="`is-${row.direction}`">
|
||||
{{ amountPrefix(row.direction) }}{{ formatMoney(row.amount) }}
|
||||
{{ amountPrefix(row.direction) }}{{ formatCentWithSymbol(row.amount_cent) }}
|
||||
</span>
|
||||
<span class="ledger-cell muted-cell">{{ balanceTypeLabel(row.balance_type) }}</span>
|
||||
<span class="ledger-cell align-right">{{ formatMoney(row.balance_after) }}</span>
|
||||
<span class="ledger-cell align-right">{{ formatCentWithSymbol(row.balance_after_cent) }}</span>
|
||||
<span class="ledger-cell" :title="row.remark">{{ row.remark || '-' }}</span>
|
||||
<span class="ledger-cell">{{ formatDateTime(row.created_at) }}</span>
|
||||
</div>
|
||||
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
type WithdrawalRequest,
|
||||
} from '../api/withdrawal'
|
||||
import { fetchWalletBalance, type WalletAccount } from '../api/wallet'
|
||||
import { formatMoney, formatMoneyWithSymbol } from '@/shared/utils/money'
|
||||
import { formatMoney, formatMoneyWithSymbol, formatCent, yuanToCent } from '@/shared/utils/money'
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
@@ -74,7 +74,7 @@ const canWithdraw = computed(() => {
|
||||
withdrawForm.value.amount >= MIN_AMOUNT &&
|
||||
withdrawForm.value.amount <= MAX_AMOUNT &&
|
||||
account.value &&
|
||||
withdrawForm.value.amount <= account.value.available_balance
|
||||
yuanToCent(withdrawForm.value.amount) <= account.value.available_balance_cent
|
||||
)
|
||||
})
|
||||
|
||||
@@ -95,7 +95,10 @@ async function handleSubmit() {
|
||||
)
|
||||
|
||||
submitting.value = true
|
||||
await createWithdrawal(withdrawForm.value)
|
||||
await createWithdrawal({
|
||||
payment_account_id: withdrawForm.value.payment_account_id,
|
||||
amount_cent: yuanToCent(withdrawForm.value.amount),
|
||||
})
|
||||
ElMessage.success('提现申请已提交')
|
||||
withdrawForm.value.amount = 0
|
||||
await loadData()
|
||||
@@ -176,7 +179,7 @@ function accountTypeLabel(type: string) {
|
||||
<el-icon><Wallet /></el-icon>
|
||||
可用余额
|
||||
</div>
|
||||
<div class="balance-value">¥{{ formatMoney(account?.available_balance) }}</div>
|
||||
<div class="balance-value">¥{{ formatCent(account?.available_balance_cent) }}</div>
|
||||
</div>
|
||||
<div class="balance-item">
|
||||
<div class="balance-label">
|
||||
@@ -184,7 +187,7 @@ function accountTypeLabel(type: string) {
|
||||
冻结余额
|
||||
</div>
|
||||
<div class="balance-value frozen">
|
||||
¥{{ formatMoney(account?.frozen_balance) }}
|
||||
¥{{ formatCent(account?.frozen_balance_cent) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -258,14 +261,14 @@ function accountTypeLabel(type: string) {
|
||||
|
||||
<el-alert
|
||||
v-if="
|
||||
withdrawForm.amount > 0 && account && withdrawForm.amount > account.available_balance
|
||||
withdrawForm.amount > 0 && account && yuanToCent(withdrawForm.amount) > account.available_balance_cent
|
||||
"
|
||||
type="error"
|
||||
:closable="false"
|
||||
show-icon
|
||||
style="margin-bottom: 16px"
|
||||
>
|
||||
余额不足,可用余额:¥{{ formatMoney(account.available_balance) }}
|
||||
余额不足,可用余额:¥{{ formatCent(account.available_balance_cent) }}
|
||||
</el-alert>
|
||||
|
||||
<el-alert type="info" :closable="false" show-icon style="margin-bottom: 16px">
|
||||
@@ -309,7 +312,7 @@ function accountTypeLabel(type: string) {
|
||||
<el-table-column prop="withdraw_no" label="提现单号" min-width="180" />
|
||||
<el-table-column label="提现金额" width="120">
|
||||
<template #default="{ row }">
|
||||
<span style="color: #f56c6c; font-weight: 600"> ¥{{ formatMoney(row.amount) }} </span>
|
||||
<span style="color: #f56c6c; font-weight: 600"> ¥{{ formatCent(row.amount_cent) }} </span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="收款方式" width="150">
|
||||
|
||||
Reference in New Issue
Block a user