feat(player): 新增桌面端 UI 与响应式双端路由架构
- 将原移动端页面重命名为 Mobile*,新增 22 个 Desktop* 视图与 DesktopShell 布局体系 - 路由入口改为 Wrapper 视图,通过 useViewport(≥1024px)自动切换移动/桌面端 - 新增投注单面板、盘口弹层、联赛侧栏、数据表格等桌面组件及独立样式令牌 - 扩展 betSlip store、串关筛选、冠军盘、Toast/悬浮信箱等交互与三语 i18n - 公告/消息 Hub 拆分移动与桌面实现;API 投注/钱包/充值记录支持 pageSize 分页
This commit is contained in:
193
apps/player/src/views/desktop/DesktopWalletDetailView.vue
Normal file
193
apps/player/src/views/desktop/DesktopWalletDetailView.vue
Normal file
@@ -0,0 +1,193 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, onActivated } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRouter } from 'vue-router';
|
||||
import api from '../../api';
|
||||
import GoldSpinner from '../../components/GoldSpinner.vue';
|
||||
import { formatMoney } from '../../utils/localeDisplay';
|
||||
import { txTypeKey, txDisplayType, txAmountClass, txSummaryLabel } from '../../utils/walletTx';
|
||||
|
||||
const { t, locale } = useI18n();
|
||||
const router = useRouter();
|
||||
|
||||
function goBack() {
|
||||
if (window.history.state && window.history.state.back) {
|
||||
router.back();
|
||||
} else {
|
||||
router.push('/wallet');
|
||||
}
|
||||
}
|
||||
|
||||
type Transaction = {
|
||||
transactionType: string;
|
||||
displayType?: string;
|
||||
summary?: string | null;
|
||||
referenceType?: string | null;
|
||||
amount: string;
|
||||
createdAt: string;
|
||||
transactionId: string;
|
||||
};
|
||||
|
||||
const items = ref<Transaction[]>([]);
|
||||
const loading = ref(true);
|
||||
const page = ref(1);
|
||||
const hasMore = ref(true);
|
||||
|
||||
function txLabel(tx: Transaction): string {
|
||||
const key = txTypeKey(txDisplayType(tx));
|
||||
if (key) {
|
||||
const translated = t(key);
|
||||
if (translated !== key) return translated;
|
||||
}
|
||||
return tx.transactionType;
|
||||
}
|
||||
|
||||
async function loadPage(p: number) {
|
||||
loading.value = true;
|
||||
try {
|
||||
const { data } = await api.get('/player/wallet/transactions', { params: { page: p } });
|
||||
const result = data.data ?? { items: [], total: 0 };
|
||||
if (p === 1) {
|
||||
items.value = result.items ?? [];
|
||||
} else {
|
||||
items.value = [...items.value, ...(result.items ?? [])];
|
||||
}
|
||||
hasMore.value = items.value.length < (result.total ?? 0);
|
||||
page.value = p;
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => loadPage(1));
|
||||
onActivated(() => loadPage(1));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="desktop-account-page">
|
||||
<main class="account-main">
|
||||
<div class="records-layout">
|
||||
<div class="page-header">
|
||||
<button type="button" class="back-btn" @click="router.back()">‹ {{ t('common.back') }}</button>
|
||||
<h1 class="page-title">{{ t('wallet.all_records') }}</h1>
|
||||
</div>
|
||||
|
||||
<div v-if="loading && items.length === 0" class="loading-state">
|
||||
<GoldSpinner :size="36" />
|
||||
</div>
|
||||
|
||||
<template v-else>
|
||||
<div v-if="items.length" class="table-container">
|
||||
<div class="table-wrap">
|
||||
<table class="dt">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ t('wallet.type') || '类型' }}</th>
|
||||
<th>{{ t('wallet.note') || '备注' }}</th>
|
||||
<th class="num-th">{{ t('wallet.amount') || '金额' }}</th>
|
||||
<th>{{ t('wallet.time') || '时间' }}</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr
|
||||
v-for="tx in items"
|
||||
:key="tx.transactionId"
|
||||
class="hover-row"
|
||||
style="cursor:pointer"
|
||||
@click="router.push(`/wallet/transactions/${tx.transactionId}`)"
|
||||
>
|
||||
<td class="type-cell">{{ txLabel(tx) }}</td>
|
||||
<td class="note-cell">{{ txSummaryLabel(tx, t) || '-' }}</td>
|
||||
<td :class="['num-cell', txAmountClass(tx.amount)]">{{ formatMoney(tx.amount, locale) }}</td>
|
||||
<td class="date-cell">{{ new Date(tx.createdAt).toLocaleString() }}</td>
|
||||
<td class="arrow-cell">›</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div v-if="hasMore" class="load-more">
|
||||
<button type="button" class="load-more-btn" :disabled="loading" @click="loadPage(page + 1)">
|
||||
<GoldSpinner v-if="loading" :size="18" />
|
||||
<span v-else>{{ t('common.load_more') || '加载更多' }}</span>
|
||||
</button>
|
||||
</div>
|
||||
<p v-else class="end-hint">{{ t('common.no_more') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="empty-state">{{ t('wallet.no_records') }}</div>
|
||||
</template>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.desktop-account-page { display: flex; flex-direction: column; min-height: 0; flex: 1; width: 100%; }
|
||||
|
||||
.account-main { flex: 1; min-width: 0; padding: 24px 28px; display: flex; flex-direction: column; overflow: hidden; }
|
||||
|
||||
.records-layout {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
width: 100%;
|
||||
flex: 0 1 auto;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.page-header { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
|
||||
.back-btn { background: none; border: none; color: var(--text-muted); font-size: 14px; font-weight: 700; cursor: pointer; padding: 0; }
|
||||
.back-btn:hover { color: var(--text); }
|
||||
.page-title { font-size: 18px; font-weight: 800; color: var(--primary-light); margin: 0; }
|
||||
.loading-state { display: flex; justify-content: center; align-items: center; padding: 80px 0; }
|
||||
.table-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 0 1 auto;
|
||||
min-height: 0;
|
||||
background: var(--bg-card);
|
||||
backdrop-filter: blur(12px);
|
||||
border: 1px solid rgba(255, 255, 255, 0.08);
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.table-wrap { flex: 1; overflow-x: auto; overflow-y: auto; }
|
||||
.dt { width: 100%; border-collapse: collapse; font-size: 13px; }
|
||||
.dt th {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 10;
|
||||
padding: 9px 12px;
|
||||
text-align: left;
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
color: var(--text-muted);
|
||||
background: #141414;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.06em;
|
||||
border-bottom: 1px solid var(--desktop-border);
|
||||
white-space: nowrap;
|
||||
}
|
||||
.dt th:first-child { border-top-left-radius: 8px; }
|
||||
.dt th:last-child { border-top-right-radius: 8px; }
|
||||
.num-th { text-align: right; }
|
||||
.dt td { padding: 11px 12px; border-bottom: 1px solid rgba(255,255,255,0.04); color: var(--text); vertical-align: middle; }
|
||||
.hover-row { transition: background 0.15s; }
|
||||
.hover-row:hover { background: rgba(255,255,255,0.03); }
|
||||
.type-cell { font-weight: 700; }
|
||||
.note-cell { color: var(--text-muted); font-size: 12px; max-width: 220px; }
|
||||
.num-cell { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
|
||||
.date-cell { white-space: nowrap; color: var(--text-muted); font-size: 12px; }
|
||||
.arrow-cell { color: #555; font-size: 18px; font-weight: 300; text-align: right; width: 24px; }
|
||||
.pos { color: var(--primary-light); }
|
||||
.neg { color: var(--danger); }
|
||||
.zero { color: var(--text-muted); }
|
||||
.load-more { display: flex; justify-content: center; padding: 20px 0 8px; }
|
||||
.load-more-btn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 28px; border-radius: 6px; border: 1px solid var(--desktop-border); background: transparent; color: var(--text-muted); font-size: 13px; font-weight: 700; cursor: pointer; transition: all 0.2s; }
|
||||
.load-more-btn:hover:not(:disabled) { border-color: var(--border-gold-soft); color: var(--primary-light); }
|
||||
.load-more-btn:disabled { opacity: 0.5; cursor: default; }
|
||||
.end-hint { text-align: center; font-size: 12px; color: #444; padding: 16px 0 4px; }
|
||||
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 80px 20px; color: var(--text-muted); font-size: 14px; font-weight: 600; }
|
||||
</style>
|
||||
Reference in New Issue
Block a user