Files
thebet365/apps/player/src/components/BetStatsPanel.vue
Mars 24fa1b275c feat(admin,api,player): 优胜赛配置、赛事管理重构与玩家端投注体验优化
管理端拆分赛事/优胜赛 Tab,新增联赛优胜赔率面板(批量、排序、外侧删除);统一 list-chrome 工具栏对齐与列表页布局;Dashboard 失败重试、Users 操作下拉、小屏侧栏等体验修复。

API 扩展优胜赛与赛事目录接口,完善投注与钱包查询;玩家端重构赛事卡片、串关面板、注单/钱包页,新增注单详情、下注成功动画与下拉刷新。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-08 09:55:56 +08:00

155 lines
4.1 KiB
Vue

<script setup lang="ts">
import { computed } from 'vue';
import { useI18n } from 'vue-i18n';
import { formatMoney, parseAmount } from '../utils/localeDisplay';
import type { BetHistoryItem } from './BetHistoryCard.vue';
const props = defineProps<{ items: BetHistoryItem[] }>();
const { t, locale } = useI18n();
const stats = computed(() => {
let total = 0;
let won = 0;
let lost = 0;
let pending = 0;
let push = 0;
let totalStake = 0;
let totalReturn = 0;
for (const bet of props.items) {
total++;
const s = bet.status.toUpperCase();
if (s === 'WON' || s === 'WIN') { won++; totalReturn += parseAmount(bet.actualReturn); }
else if (s === 'LOST' || s === 'LOSE') lost++;
else if (s === 'PUSH' || s === 'VOID' || s === 'CANCELLED') push++;
else pending++;
totalStake += parseAmount(bet.stake);
if (s === 'WON' || s === 'WIN') totalReturn += parseAmount(bet.actualReturn);
else if (s === 'PENDING') totalReturn += parseAmount(bet.potentialReturn);
}
return { total, won, lost, pending, push, totalStake, totalReturn };
});
</script>
<template>
<div class="stats-panel">
<div class="stats-row">
<div class="stat-item">
<span class="stat-val">{{ stats.total }}</span>
<span class="stat-label">{{ t('history.stats_total') }}</span>
</div>
<div class="stat-item won">
<span class="stat-val">{{ stats.won }}</span>
<span class="stat-label">{{ t('history.stats_won') }}</span>
</div>
<div class="stat-item lost">
<span class="stat-val">{{ stats.lost }}</span>
<span class="stat-label">{{ t('history.stats_lost') }}</span>
</div>
<div class="stat-item pending">
<span class="stat-val">{{ stats.pending }}</span>
<span class="stat-label">{{ t('history.stats_pending') }}</span>
</div>
<div class="stat-item push">
<span class="stat-val">{{ stats.push }}</span>
<span class="stat-label">{{ t('history.stats_push') }}</span>
</div>
</div>
<div class="stats-bar">
<div class="bar-seg won" :style="{ flex: stats.won || 0.001 }" />
<div class="bar-seg lost" :style="{ flex: stats.lost || 0.001 }" />
<div class="bar-seg pending" :style="{ flex: stats.pending || 0.001 }" />
<div class="bar-seg push" :style="{ flex: stats.push || 0.001 }" />
</div>
<div class="stats-row secondary">
<div class="stat-item">
<span class="stat-val small">{{ formatMoney(stats.totalStake, locale) }}</span>
<span class="stat-label">{{ t('history.stats_stake') }}</span>
</div>
<div class="stat-item">
<span class="stat-val small gold">{{ formatMoney(stats.totalReturn, locale) }}</span>
<span class="stat-label">{{ t('history.stats_return') }}</span>
</div>
</div>
</div>
</template>
<style scoped>
.stats-panel {
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 14px 12px 10px;
margin-bottom: 12px;
backdrop-filter: blur(10px);
}
.stats-row {
display: flex;
gap: 4px;
margin-bottom: 8px;
}
.stats-row.secondary {
margin-bottom: 0;
margin-top: 8px;
justify-content: space-around;
}
.stat-item {
flex: 1;
text-align: center;
min-width: 0;
}
.stat-val {
display: block;
font-size: 18px;
font-weight: 900;
font-variant-numeric: tabular-nums;
}
.stat-val.small {
font-size: 14px;
color: var(--text-muted);
}
.stat-val.gold {
color: var(--primary-light);
}
.stat-item.won .stat-val { color: #3db865; }
.stat-item.lost .stat-val { color: #e05050; }
.stat-item.pending .stat-val { color: #e8c84a; }
.stat-item.push .stat-val { color: #888; }
.stat-label {
display: block;
font-size: 10px;
font-weight: 700;
color: var(--text-muted);
letter-spacing: 0.04em;
margin-top: 2px;
}
.stats-bar {
display: flex;
height: 4px;
border-radius: 2px;
overflow: hidden;
gap: 2px;
}
.bar-seg {
min-width: 2px;
border-radius: 2px;
transition: flex 0.3s ease;
}
.bar-seg.won { background: #3db865; }
.bar-seg.lost { background: #e05050; }
.bar-seg.pending { background: #e8c84a; }
.bar-seg.push { background: #444; }
</style>