feat(admin,api,player): 返水流程优化、账单详情与数据库重置
优化返水预览/确认/作废,新增玩家账变详情与后台一键重置为 seed 数据,并修复 dev 启动时 3000 端口占用。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,19 +1,22 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, onUnmounted } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import api from '../api';
|
||||
import { formatMoney } from '../utils/localeDisplay';
|
||||
import { isBetType, isDepositType, isWithdrawType, txTypeKey } from '../utils/walletTx';
|
||||
import GoldSpinner from '../components/GoldSpinner.vue';
|
||||
import WalletStatsPanel from '../components/WalletStatsPanel.vue';
|
||||
import { usePullToRefresh } from '../composables/usePullToRefresh';
|
||||
|
||||
const router = useRouter();
|
||||
const { t, locale } = useI18n();
|
||||
|
||||
type Transaction = {
|
||||
transactionType: string;
|
||||
amount: string;
|
||||
createdAt: string;
|
||||
transactionId?: string;
|
||||
transactionId: string;
|
||||
};
|
||||
|
||||
const items = ref<Transaction[]>([]);
|
||||
@@ -27,26 +30,6 @@ const typeFilter = ref('');
|
||||
const sentinel = ref<HTMLElement | null>(null);
|
||||
let observer: IntersectionObserver | null = null;
|
||||
|
||||
const TX_KEY_MAP: Record<string, string> = {
|
||||
MANUAL_DEPOSIT: 'wallet.tx_deposit',
|
||||
MANUAL_WITHDRAW: 'wallet.tx_withdraw',
|
||||
MANUAL_ADJUST: 'wallet.tx_adjust',
|
||||
BET_FREEZE: 'wallet.tx_bet_freeze',
|
||||
BET_DEDUCT: 'wallet.tx_bet_deduct',
|
||||
BET_SETTLE_WIN: 'wallet.tx_bet_win',
|
||||
BET_SETTLE_LOSE: 'wallet.tx_bet_lose',
|
||||
BET_SETTLE_PUSH: 'wallet.tx_bet_push',
|
||||
BET_WIN: 'wallet.tx_bet_win',
|
||||
BET_REFUND: 'wallet.tx_bet_refund',
|
||||
BET_VOID: 'wallet.tx_bet_void',
|
||||
BET_VOID_REFUND: 'wallet.tx_bet_void',
|
||||
CASHBACK: 'wallet.tx_cashback',
|
||||
CASHBACK_DEPOSIT: 'wallet.tx_cashback',
|
||||
RESETTLE_REVERSE: 'wallet.tx_resettle',
|
||||
DEPOSIT: 'wallet.tx_deposit',
|
||||
WITHDRAW: 'wallet.tx_withdraw',
|
||||
};
|
||||
|
||||
const FILTERS = [
|
||||
{ key: '', label: 'wallet.filter_all' },
|
||||
{ key: 'deposit', label: 'wallet.filter_deposit' },
|
||||
@@ -55,7 +38,7 @@ const FILTERS = [
|
||||
];
|
||||
|
||||
function txLabel(type: string): string {
|
||||
const key = TX_KEY_MAP[type.toUpperCase()];
|
||||
const key = txTypeKey(type);
|
||||
if (key) {
|
||||
const translated = t(key);
|
||||
if (translated !== key) return translated;
|
||||
@@ -63,21 +46,6 @@ function txLabel(type: string): string {
|
||||
return type;
|
||||
}
|
||||
|
||||
function isDepositType(type: string): boolean {
|
||||
const t = type.toUpperCase();
|
||||
return t.includes('DEPOSIT') || t === 'CASHBACK_DEPOSIT';
|
||||
}
|
||||
|
||||
function isWithdrawType(type: string): boolean {
|
||||
const t = type.toUpperCase();
|
||||
return t.includes('WITHDRAW');
|
||||
}
|
||||
|
||||
function isBetType(type: string): boolean {
|
||||
const t = type.toUpperCase();
|
||||
return t.startsWith('BET_');
|
||||
}
|
||||
|
||||
function matchesFilter(tx: Transaction): boolean {
|
||||
if (!typeFilter.value) return true;
|
||||
if (typeFilter.value === 'deposit') return isDepositType(tx.transactionType) || tx.transactionType === 'MANUAL_ADJUST';
|
||||
@@ -86,6 +54,11 @@ function matchesFilter(tx: Transaction): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
function goDetail(tx: Transaction) {
|
||||
if (!tx.transactionId) return;
|
||||
router.push(`/wallet/transactions/${tx.transactionId}`);
|
||||
}
|
||||
|
||||
async function loadPage(p: number) {
|
||||
if (loading.value) return;
|
||||
loading.value = true;
|
||||
@@ -181,17 +154,24 @@ const pullIndicatorStyle = () => ({
|
||||
</div>
|
||||
|
||||
<div v-if="items.length" class="tx-list">
|
||||
<div
|
||||
<button
|
||||
v-for="tx in items"
|
||||
:key="tx.transactionId ?? tx.createdAt + Math.random()"
|
||||
:key="tx.transactionId"
|
||||
type="button"
|
||||
class="tx-row"
|
||||
@click="goDetail(tx)"
|
||||
>
|
||||
<span class="tx-type">{{ txLabel(tx.transactionType) }}</span>
|
||||
<span :class="parseFloat(tx.amount) >= 0 ? 'pos' : 'neg'">
|
||||
{{ formatMoney(tx.amount, locale) }}
|
||||
</span>
|
||||
<span class="tx-time">{{ new Date(tx.createdAt).toLocaleString() }}</span>
|
||||
</div>
|
||||
<div class="tx-main">
|
||||
<span class="tx-type">{{ txLabel(tx.transactionType) }}</span>
|
||||
<span :class="parseFloat(tx.amount) >= 0 ? 'pos' : 'neg'">
|
||||
{{ formatMoney(tx.amount, locale) }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="tx-meta">
|
||||
<span class="tx-time">{{ new Date(tx.createdAt).toLocaleString() }}</span>
|
||||
<span class="tx-arrow">›</span>
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div ref="sentinel" class="sentinel" />
|
||||
@@ -274,22 +254,44 @@ const pullIndicatorStyle = () => ({
|
||||
}
|
||||
|
||||
.tx-row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
display: block;
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
font-size: 14px;
|
||||
padding: 12px 16px;
|
||||
border: none;
|
||||
border-bottom: 1px solid var(--border);
|
||||
flex-wrap: wrap;
|
||||
background: transparent;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.tx-row:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.tx-row:active {
|
||||
background: rgba(255, 255, 255, 0.03);
|
||||
}
|
||||
|
||||
.tx-main {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.tx-meta {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.tx-type { font-weight: 700; color: var(--text); }
|
||||
.pos { color: var(--primary-light); font-weight: 800; font-size: 15px; }
|
||||
.neg { color: var(--danger); font-weight: 700; }
|
||||
.tx-time { width: 100%; font-size: 11px; color: var(--text-muted); margin-top: 4px; }
|
||||
.tx-time { font-size: 11px; color: var(--text-muted); }
|
||||
.tx-arrow { font-size: 16px; color: #555; font-weight: 700; line-height: 1; }
|
||||
|
||||
.sentinel {
|
||||
height: 1px;
|
||||
|
||||
Reference in New Issue
Block a user