feat(player): 优化赛事详情与串关下注交互

- 合并玩法列表、单选投注单与玩法内确认下单
- 波胆底部确认与核对弹窗;串关底栏固定
- 帮助弹窗与投注单逻辑拆分(详情单关/串关页串关)

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-03 10:54:49 +08:00
parent 451cc3984a
commit d432de6fdf
12 changed files with 1089 additions and 540 deletions

View File

@@ -0,0 +1,253 @@
<script setup lang="ts">
import { computed } from 'vue';
import { useI18n } from 'vue-i18n';
import { formatMoney } from '../../utils/localeDisplay';
export interface CsConfirmLine {
scoreDisplay: string;
odds: string;
stake: number;
}
const props = defineProps<{
open: boolean;
marketLabel: string;
homeTeamName: string;
awayTeamName: string;
lines: CsConfirmLine[];
loading?: boolean;
}>();
const emit = defineEmits<{ confirm: []; close: [] }>();
const { t, locale } = useI18n();
const totalStake = computed(() =>
props.lines.reduce((sum, line) => sum + line.stake, 0),
);
const totalReturn = computed(() =>
props.lines.reduce((sum, line) => {
const odds = parseFloat(line.odds);
return sum + line.stake * (Number.isFinite(odds) ? odds : 0);
}, 0),
);
function formatOdds(odds: string) {
const n = parseFloat(odds);
return Number.isFinite(n) ? n.toFixed(2) : odds;
}
</script>
<template>
<div v-if="open && lines.length" class="overlay" @click.self="emit('close')">
<div class="modal" role="dialog" aria-modal="true">
<button type="button" class="close-x" :aria-label="t('bet.cancel')" @click="emit('close')"></button>
<h3 class="title">{{ t('bet.cs_confirm_title') }}</h3>
<p class="match-line">{{ homeTeamName }} vs {{ awayTeamName }}</p>
<p class="market-tag">{{ marketLabel }}</p>
<p class="count">{{ t('bet.cs_confirm_count', { n: lines.length }) }}</p>
<ul class="line-list">
<li v-for="(line, idx) in lines" :key="idx" class="line-item">
<span class="score">{{ line.scoreDisplay }}</span>
<span class="odds">@ {{ formatOdds(line.odds) }}</span>
<span class="stake">{{ formatMoney(line.stake, locale) }}</span>
</li>
</ul>
<div class="totals">
<div class="total-row">
<span>{{ t('bet.cs_confirm_total_stake') }}</span>
<span class="gold">{{ formatMoney(totalStake, locale) }}</span>
</div>
<div class="total-row">
<span>{{ t('history.est_return') }}</span>
<span class="gold">{{ formatMoney(totalReturn, locale) }}</span>
</div>
</div>
<div class="actions">
<button type="button" class="btn-cancel" :disabled="loading" @click="emit('close')">
{{ t('bet.cancel') }}
</button>
<button
type="button"
class="btn-confirm btn-gold-outline"
:disabled="loading"
@click="emit('confirm')"
>
{{ loading ? t('bet.placing') : t('bet.place_bet_short') }}
</button>
</div>
</div>
</div>
</template>
<style scoped>
.overlay {
position: fixed;
inset: 0;
z-index: 210;
background: rgba(0, 0, 0, 0.72);
display: flex;
align-items: center;
justify-content: center;
padding: 20px;
backdrop-filter: blur(4px);
}
.modal {
position: relative;
width: 100%;
max-width: 320px;
max-height: 85vh;
overflow-y: auto;
background: linear-gradient(165deg, #1a1810 0%, #121212 45%, #0a0a0a 100%);
border: 1px solid var(--border-gold-soft);
border-radius: var(--radius);
padding: 16px 14px 14px;
box-shadow: var(--shadow), 0 0 24px rgba(212, 175, 55, 0.08);
}
.close-x {
position: absolute;
top: 10px;
right: 10px;
width: 28px;
height: 28px;
border-radius: 50%;
background: rgba(255, 255, 255, 0.06);
color: var(--text-muted);
font-size: 14px;
}
.title {
font-size: 16px;
font-weight: 800;
color: var(--primary-light);
text-align: center;
margin-bottom: 6px;
padding-right: 24px;
}
.match-line {
text-align: center;
font-size: 14px;
font-weight: 700;
color: var(--text);
margin-bottom: 4px;
}
.market-tag {
text-align: center;
font-size: 12px;
color: var(--text-muted);
margin-bottom: 4px;
}
.count {
text-align: center;
font-size: 11px;
color: var(--text-muted);
margin-bottom: 12px;
}
.line-list {
list-style: none;
margin: 0 0 12px;
padding: 0;
max-height: 220px;
overflow-y: auto;
border: 1px solid var(--border);
border-radius: 6px;
background: rgba(0, 0, 0, 0.35);
}
.line-item {
display: grid;
grid-template-columns: 1fr auto auto;
gap: 8px;
align-items: center;
padding: 9px 10px;
font-size: 13px;
border-bottom: 1px solid var(--border);
}
.line-item:last-child {
border-bottom: none;
}
.score {
font-weight: 800;
color: var(--primary-light);
}
.odds {
color: var(--text-muted);
font-weight: 600;
font-size: 12px;
}
.stake {
font-weight: 800;
color: var(--text);
text-align: right;
min-width: 56px;
}
.totals {
padding: 10px;
margin-bottom: 12px;
background: rgba(212, 175, 55, 0.06);
border: 1px solid var(--border-gold-soft);
border-radius: 6px;
}
.total-row {
display: flex;
justify-content: space-between;
font-size: 13px;
color: var(--text-muted);
font-weight: 600;
}
.total-row + .total-row {
margin-top: 8px;
padding-top: 8px;
border-top: 1px solid var(--border);
}
.gold {
color: var(--primary-light);
font-weight: 800;
}
.actions {
display: grid;
grid-template-columns: 1fr 1.2fr;
gap: 8px;
}
.btn-cancel {
padding: 10px;
border-radius: 6px;
background: #1a1a1a;
border: 1px solid var(--border);
color: var(--text-muted);
font-size: 14px;
font-weight: 700;
}
.btn-confirm {
padding: 10px;
border-radius: 6px;
font-size: 14px;
font-weight: 800;
}
.btn-confirm:disabled {
opacity: 0.45;
}
</style>

View File

@@ -5,8 +5,6 @@ import { groupCorrectScoreSelections, type CsSelection } from '../../utils/corre
const props = defineProps<{
marketType: string;
homeTeamName: string;
awayTeamName: string;
selections: Array<{
id: string;
selectionCode: string;
@@ -38,11 +36,6 @@ function formatOdds(odds: string) {
<template>
<div class="cs-panel">
<div class="teams-bar">
<div class="team-box">{{ homeTeamName }}</div>
<div class="team-box">{{ awayTeamName }}</div>
</div>
<div class="cols-head">
<span>{{ t('bet.col_home') }}</span>
<span>{{ t('bet.col_draw') }}</span>
@@ -51,20 +44,17 @@ function formatOdds(odds: string) {
<div class="cols-grid">
<div v-for="colKey in ['home', 'draw', 'away'] as const" :key="colKey" class="col">
<div
v-for="sel in columns[colKey]"
:key="sel.id"
class="score-card"
>
<div class="score-line">{{ sel.scoreDisplay }}</div>
<div class="odds-box">{{ formatOdds(sel.odds) }}</div>
<div v-for="sel in columns[colKey]" :key="sel.id" class="score-card">
<span class="score-line">{{ sel.scoreDisplay }}</span>
<span class="odds">{{ formatOdds(sel.odds) }}</span>
<input
type="number"
class="stake-input"
min="0"
step="1"
inputmode="decimal"
:value="stakes[sel.id] ?? 0"
:placeholder="t('bet.stake_placeholder')"
:value="stakes[sel.id] ?? ''"
@input="setStake(sel, ($event.target as HTMLInputElement).value)"
/>
</div>
@@ -75,92 +65,71 @@ function formatOdds(odds: string) {
<style scoped>
.cs-panel {
padding: 0 10px 14px;
}
.teams-bar {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 8px;
margin-bottom: 12px;
}
.team-box {
padding: 10px 8px;
text-align: center;
font-size: 14px;
font-weight: 800;
color: var(--primary-light);
background: #0d0d0d;
border: 1px solid #333;
border-radius: 4px;
padding: 6px 8px 0;
}
.cols-head {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 6px;
margin-bottom: 8px;
gap: 4px;
margin-bottom: 4px;
text-align: center;
font-size: 13px;
font-weight: 800;
color: var(--primary-light);
font-size: 10px;
font-weight: 700;
color: var(--text-muted);
}
.cols-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 6px;
align-items: start;
gap: 4px;
}
.col {
display: flex;
flex-direction: column;
gap: 8px;
gap: 4px;
}
.score-card {
background: #1c1c1c;
border: 1px solid #333;
border-radius: 4px;
padding: 8px 6px 6px;
text-align: center;
display: flex;
flex-direction: column;
align-items: center;
gap: 2px;
padding: 4px 3px;
background: #161616;
border-radius: 3px;
}
.score-line {
font-size: 15px;
font-size: 11px;
font-weight: 800;
color: var(--text);
margin-bottom: 6px;
}
.odds-box {
display: inline-block;
min-width: 52px;
padding: 3px 8px;
margin-bottom: 6px;
border: 1px solid var(--primary);
border-radius: 3px;
font-size: 12px;
font-weight: 800;
.odds {
font-size: 10px;
font-weight: 700;
color: var(--primary-light);
background: rgba(212, 175, 55, 0.08);
}
.stake-input {
width: 100%;
padding: 6px 4px;
border-radius: 3px;
border: none;
background: #f2f2f2;
color: #111;
font-size: 14px;
font-weight: 700;
padding: 4px 2px;
border-radius: 2px;
border: 1px solid #2a2a2a;
background: #0a0a0a;
color: var(--text);
font-size: 12px;
text-align: center;
outline: none;
-moz-appearance: textfield;
}
.stake-input:focus {
border-color: var(--border-gold-soft);
}
.stake-input::-webkit-outer-spin-button,
.stake-input::-webkit-inner-spin-button {
-webkit-appearance: none;

View File

@@ -1,160 +0,0 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
const props = defineProps<{
label: string;
expanded: boolean;
hasMarket: boolean;
rewardActive?: boolean;
}>();
const emit = defineEmits<{
bet: [];
expand: [];
collapse: [];
}>();
const { t } = useI18n();
function onBet() {
if (!props.hasMarket) return;
emit('bet');
}
function onExpand() {
if (!props.hasMarket) return;
emit('expand');
}
function onCollapse() {
emit('collapse');
}
</script>
<template>
<div class="featured-wrap" :class="{ expanded, disabled: !hasMarket }">
<div class="featured-row">
<div class="featured-main">
<span class="market-name">{{ label }}</span>
<span v-if="rewardActive && hasMarket" class="reward-badge">
🏆 {{ t('bet.reward_active') }}
</span>
<span v-else-if="!hasMarket" class="closed-tag">{{ t('bet.market_closed') }}</span>
</div>
<div class="featured-actions">
<button type="button" class="btn-bet btn-gold-outline" :disabled="!hasMarket" @click="onBet">
{{ t('bet.place_bet_short') }}
</button>
<button
type="button"
class="btn-icon btn-gold-outline"
:disabled="!hasMarket"
:aria-label="expanded ? t('bet.collapse_market') : t('bet.expand_market')"
@click="expanded ? onCollapse() : onExpand()"
>
{{ expanded ? '' : '+' }}
</button>
<button
type="button"
class="btn-icon btn-gold-outline"
:aria-label="t('bet.collapse_market')"
@click="onCollapse"
>
×
</button>
</div>
</div>
<div v-if="expanded && hasMarket" class="panel-slot">
<slot />
</div>
</div>
</template>
<style scoped>
.featured-wrap {
margin-bottom: 10px;
border-radius: 6px;
border: 1px solid #3a3218;
background: #121212;
box-shadow: 0 0 0 1px rgba(212, 175, 55, 0.12);
}
.featured-wrap.expanded {
box-shadow:
0 0 0 1px rgba(212, 175, 55, 0.35),
0 0 12px rgba(212, 175, 55, 0.15);
}
.featured-wrap.disabled {
opacity: 0.55;
}
.featured-row {
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
padding: 12px 10px;
}
.featured-main {
flex: 1;
min-width: 0;
}
.market-name {
display: block;
font-size: 15px;
font-weight: 800;
color: var(--primary-light);
margin-bottom: 4px;
}
.reward-badge {
display: inline-block;
font-size: 11px;
font-weight: 700;
color: #e8c84a;
background: rgba(212, 175, 55, 0.12);
padding: 2px 8px;
border-radius: 4px;
}
.closed-tag {
font-size: 11px;
color: var(--text-muted);
}
.featured-actions {
display: flex;
align-items: center;
gap: 6px;
flex-shrink: 0;
}
.btn-bet {
padding: 8px 14px;
border-radius: 6px;
font-size: 13px;
}
.btn-bet:disabled {
opacity: 0.45;
}
.btn-icon {
width: 32px;
height: 32px;
border-radius: 6px;
font-size: 18px;
font-weight: 900;
line-height: 1;
display: flex;
align-items: center;
justify-content: center;
}
.btn-icon:disabled {
opacity: 0.45;
}
</style>

View File

@@ -6,60 +6,69 @@ defineProps<{
odds: string;
}[];
isSelected: (id: string) => boolean;
compact?: boolean;
}>();
const emit = defineEmits<{ pick: [id: string] }>();
</script>
<template>
<div class="panel">
<button
v-for="sel in selections"
:key="sel.id"
type="button"
class="odds-btn"
:class="{ selected: isSelected(sel.id) }"
@click="emit('pick', sel.id)"
>
<span class="label">{{ sel.selectionName }}</span>
<span class="odds">{{ sel.odds }}</span>
</button>
<div class="wrap" :class="{ compact }">
<div class="panel">
<button
v-for="sel in selections"
:key="sel.id"
type="button"
class="odds-btn"
:class="{ selected: isSelected(sel.id) }"
@click="emit('pick', sel.id)"
>
<span class="label">{{ sel.selectionName }}</span>
<span class="odds">{{ sel.odds }}</span>
</button>
</div>
</div>
</template>
<style scoped>
.wrap {
padding: 6px 8px 8px;
background: #0c0c0c;
}
.panel {
display: flex;
flex-wrap: wrap;
gap: 8px;
padding: 0 10px 12px;
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 4px;
}
.odds-btn {
min-width: calc(33.33% - 6px);
flex: 1 1 calc(33.33% - 6px);
max-width: calc(50% - 4px);
padding: 10px 8px;
border-radius: 6px;
background: #0d0d0d;
border: 1px solid #333;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 2px;
min-height: 44px;
padding: 6px 4px;
border-radius: 4px;
background: #141414;
border: 1px solid #262626;
text-align: center;
}
.odds-btn.selected {
border-color: var(--primary);
background: rgba(212, 175, 55, 0.12);
background: rgba(212, 175, 55, 0.1);
}
.label {
display: block;
font-size: 11px;
font-size: 9px;
color: var(--text-muted);
margin-bottom: 4px;
line-height: 1.15;
}
.odds {
font-size: 15px;
font-size: 14px;
font-weight: 800;
color: var(--primary-light);
}

View File

@@ -3,82 +3,71 @@ import { useI18n } from 'vue-i18n';
defineProps<{
label: string;
active: boolean;
expanded: boolean;
hasMarket: boolean;
}>();
const emit = defineEmits<{ expand: []; collapse: [] }>();
const emit = defineEmits<{ toggle: [] }>();
const { t } = useI18n();
</script>
<template>
<div class="tile" :class="{ active, disabled: !hasMarket }">
<span class="tile-label">{{ label }}</span>
<div class="tile-actions">
<button
type="button"
class="btn-icon btn-gold-outline"
:disabled="!hasMarket"
:aria-label="t('bet.expand_market')"
@click="emit('expand')"
>
+
</button>
<button
type="button"
class="btn-icon btn-gold-outline"
:aria-label="t('bet.collapse_market')"
@click="emit('collapse')"
>
×
</button>
</div>
</div>
<button
type="button"
class="row"
:class="{ expanded, disabled: !hasMarket }"
:disabled="!hasMarket"
@click="emit('toggle')"
>
<span class="row-label">{{ label }}</span>
<span v-if="!hasMarket" class="row-muted">{{ t('bet.market_closed') }}</span>
<span v-else class="row-chevron" aria-hidden="true">{{ expanded ? '▾' : '▸' }}</span>
</button>
</template>
<style scoped>
.tile {
.row {
display: flex;
align-items: center;
justify-content: space-between;
gap: 6px;
padding: 12px 10px;
background: #141414;
border: 1px solid #2a2a2a;
border-radius: 6px;
min-height: 48px;
gap: 8px;
width: 100%;
padding: 10px 12px;
background: transparent;
border: none;
text-align: left;
}
.tile.active {
border-color: var(--primary);
box-shadow: 0 0 8px rgba(212, 175, 55, 0.2);
.row.expanded {
background: rgba(255, 255, 255, 0.03);
}
.tile.disabled {
opacity: 0.5;
.row.disabled {
opacity: 0.4;
}
.tile-label {
font-size: 12px;
font-weight: 800;
color: var(--primary-light);
line-height: 1.25;
.row-label {
flex: 1;
min-width: 0;
font-size: 13px;
font-weight: 700;
color: var(--text);
}
.tile-actions {
display: flex;
gap: 4px;
flex-shrink: 0;
.row.expanded .row-label {
color: var(--primary-light);
}
.btn-icon {
width: 26px;
height: 26px;
border-radius: 5px;
font-size: 16px;
font-weight: 900;
line-height: 1;
.row-muted {
font-size: 10px;
color: var(--text-muted);
}
.row-chevron {
font-size: 11px;
color: var(--text-muted);
}
.row.expanded .row-chevron {
color: var(--primary-light);
}
</style>

View File

@@ -0,0 +1,156 @@
<script setup lang="ts">
import { ref } from 'vue';
import { useI18n } from 'vue-i18n';
const { t } = useI18n();
const open = ref(false);
function close() {
open.value = false;
}
</script>
<template>
<button
type="button"
class="help-btn"
:aria-label="t('bet.guide_help_aria')"
:title="t('bet.guide_help_aria')"
@click="open = true"
>
?
</button>
<Teleport to="body">
<div v-if="open" class="overlay" @click.self="close">
<div class="modal" role="dialog" aria-modal="true" :aria-label="t('bet.guide_title')">
<button type="button" class="close-x" :aria-label="t('bet.cancel')" @click="close"></button>
<h3 class="title">{{ t('bet.guide_title') }}</h3>
<div class="guide-body">
<div class="flow">
<p class="flow-name">{{ t('bet.guide_flow_normal') }}</p>
<ol>
<li>{{ t('bet.guide_normal_1') }}</li>
<li>{{ t('bet.guide_normal_2') }}</li>
<li>{{ t('bet.guide_normal_3') }}</li>
</ol>
</div>
<div class="flow flow--cs">
<p class="flow-name">{{ t('bet.guide_flow_cs') }}</p>
<ol>
<li>{{ t('bet.guide_cs_1') }}</li>
<li>{{ t('bet.guide_cs_2') }}</li>
<li>{{ t('bet.guide_cs_3') }}</li>
</ol>
</div>
</div>
<button type="button" class="btn-ok btn-gold-outline" @click="close">
{{ t('bet.guide_got_it') }}
</button>
</div>
</div>
</Teleport>
</template>
<style scoped>
.help-btn {
flex-shrink: 0;
width: 30px;
height: 30px;
border-radius: 50%;
border: 1px solid var(--border-gold-soft);
background: rgba(0, 0, 0, 0.2);
color: var(--primary-light);
font-size: 14px;
font-weight: 800;
line-height: 1;
padding: 0;
}
.overlay {
position: fixed;
inset: 0;
z-index: 205;
background: rgba(0, 0, 0, 0.72);
display: flex;
align-items: center;
justify-content: center;
padding: 20px;
backdrop-filter: blur(4px);
}
.modal {
position: relative;
width: 100%;
max-width: 340px;
max-height: 85vh;
overflow-y: auto;
background: linear-gradient(165deg, #1a1810 0%, #121212 45%, #0a0a0a 100%);
border: 1px solid var(--border-gold-soft);
border-radius: var(--radius);
padding: 16px 14px 14px;
box-shadow: var(--shadow), 0 0 24px rgba(212, 175, 55, 0.08);
}
.close-x {
position: absolute;
top: 10px;
right: 10px;
width: 28px;
height: 28px;
border-radius: 50%;
background: rgba(255, 255, 255, 0.06);
color: var(--text-muted);
font-size: 14px;
}
.title {
font-size: 16px;
font-weight: 800;
color: var(--primary-light);
text-align: center;
margin-bottom: 12px;
padding-right: 24px;
}
.guide-body {
display: grid;
gap: 10px;
margin-bottom: 14px;
}
.flow-name {
font-size: 13px;
font-weight: 800;
color: var(--primary-light);
margin-bottom: 8px;
}
.flow ol {
margin: 0;
padding-left: 20px;
font-size: 13px;
color: var(--text-muted);
line-height: 1.55;
}
.flow li + li {
margin-top: 6px;
}
.flow--cs {
padding-top: 10px;
border-top: 1px solid var(--border);
}
.btn-ok {
width: 100%;
padding: 10px;
border-radius: 6px;
font-size: 14px;
font-weight: 800;
}
</style>