## 管理端 / API(Bug 修复) - matches.service:getAdminMatchDetail 返回 markets 时补充 allowSingle、allowParlay 字段 - MatchMarketsPanel:mapMarkets 从接口读取单关/串关开关,不再硬编码为 true - match-form.ts:AdminMarket 类型补充 allowSingle、allowParlay ## 玩家端 — 全局主题(styles.css / index.html / site.webmanifest) - 海军暗色 + 白色强调 token,卡片高光渐变(--gradient-card) - 下拉/弹窗实底不透明(--dropdown-bg: #0A2540) - 统一 sub-toolbar、status-ribbon、filter-tab 等全局样式 - theme-color 同步为 #001A33 ## 玩家端 — 布局与壳层 - MainLayout:详情子页去顶栏/公告,sub-toolbar 全宽铺底 - WalletBalanceCard(新):个人页钱包卡片(反水 + 未结算) - walletStats.ts(新):钱包统计逻辑抽取 ## 玩家端 — 赛事 / 投注 - MatchDetailView:顶栏 8px 顶距、卡片全宽(--detail-gutter-x: 0) - 盘口状态标签(暂停/已关闭)、去掉 MarketTypeTile 右侧箭头 - VsBadge(新):纯文字 VS,删除 vs.png - isMarketLocked:仅关单关但允许串关时仍可点击,支持串关流程 - BetSlipDrawer:仅串关盘口禁用单关提交并提示 slip_parlay_only_hint - betSlip:SlipItem 增加 allowSingle 字段 - MatchBetCard / LeagueAccordionItem:45° 待开赛角标,去掉展开左侧白边 - OutrightEventSection:去掉展开时左侧白色选中条 - FootballView:加大左右边距、筛选栏去 sticky、选中态增强 - BannerCarousel:恢复原始全宽轮播 ## 玩家端 — 钱包 / 个人 / 认证 / 其他页面 - WalletView:移除顶部钱包卡片,保留账单列表 - ProfileView:保留 WalletBalanceCard - 充值/账单/注单/登录注册等页面配色与间距统一 - 公告标签、余额面板、语言切换、区号选择等弹层改为实底 ## 国际化 - zh-CN / en-US / ms-MY:新增 slip_parlay_only_hint(仅串关盘口提示) ## 资产 - 更新 banner.svg、empty-matches.svg 配色 - 删除 vs.png Co-authored-by: Cursor <cursoragent@cursor.com>
276 lines
6.9 KiB
Vue
276 lines
6.9 KiB
Vue
<script setup lang="ts">
|
||
import { computed } from 'vue';
|
||
import { useI18n } from 'vue-i18n';
|
||
import { useRouter } from 'vue-router';
|
||
import { formatMoney } from '../utils/localeDisplay';
|
||
import StatusWatermark from './StatusWatermark.vue';
|
||
import { matchPhaseLabel, matchPhaseVariant, type MatchPhase } from '../utils/matchPhase';
|
||
|
||
export interface BetScore {
|
||
ht: string | null;
|
||
ft: string | null;
|
||
}
|
||
|
||
export interface BetHistoryItem {
|
||
betNo: string;
|
||
betType: string;
|
||
stake: unknown;
|
||
totalOdds?: unknown;
|
||
potentialReturn: unknown;
|
||
actualReturn: unknown;
|
||
status: string;
|
||
placedAt: string;
|
||
isCashbacked?: boolean;
|
||
leagueName?: string;
|
||
matchTitle: string;
|
||
pickLabel: string;
|
||
isParlay?: boolean;
|
||
legCount?: number;
|
||
matchScore?: BetScore | null;
|
||
matchPhase?: MatchPhase | null;
|
||
legs?: Array<{
|
||
marketLabel: string;
|
||
selectionName: string;
|
||
matchTitle: string;
|
||
odds: unknown;
|
||
resultStatus?: string | null;
|
||
score?: BetScore | null;
|
||
}>;
|
||
}
|
||
|
||
const props = defineProps<{ bet: BetHistoryItem }>();
|
||
const { t, locale } = useI18n();
|
||
const router = useRouter();
|
||
|
||
const statusKey = computed(() => {
|
||
const s = props.bet.status.toUpperCase();
|
||
if (s === 'WON' || s === 'WIN') return 'won';
|
||
if (s === 'LOST' || s === 'LOSE') return 'lost';
|
||
if (s === 'PUSH' || s === 'VOID' || s === 'CANCELLED') return 'push';
|
||
return 'pending';
|
||
});
|
||
|
||
const statusLabel = computed(() => t(`history.status_${statusKey.value}`));
|
||
|
||
const watermarkLabel = computed(() => {
|
||
if (statusKey.value === 'pending' && props.bet.matchPhase === 'closed_pending') {
|
||
return matchPhaseLabel(t, 'closed_pending');
|
||
}
|
||
if (statusKey.value === 'pending' && props.bet.matchPhase === 'settled') {
|
||
return matchPhaseLabel(t, 'settled');
|
||
}
|
||
return statusLabel.value;
|
||
});
|
||
|
||
const watermarkVariant = computed(() => {
|
||
if (statusKey.value === 'pending' && props.bet.matchPhase === 'closed_pending') return 'closed';
|
||
if (statusKey.value === 'pending' && props.bet.matchPhase === 'settled') return 'settled';
|
||
return statusKey.value;
|
||
});
|
||
|
||
const placedDate = computed(() =>
|
||
new Date(props.bet.placedAt).toLocaleDateString(locale.value, {
|
||
month: 'short', day: 'numeric',
|
||
}),
|
||
);
|
||
|
||
const title = computed(() => {
|
||
if (props.bet.isParlay) {
|
||
const n = props.bet.legCount ?? props.bet.legs?.length ?? 0;
|
||
return t('history.parlay_title', { n });
|
||
}
|
||
return props.bet.matchTitle;
|
||
});
|
||
|
||
const subtitle = computed(() => {
|
||
if (props.bet.isParlay) return props.bet.leagueName || t('history.parlay_league');
|
||
return props.bet.pickLabel || props.bet.leagueName || '';
|
||
});
|
||
|
||
const stakeAmount = computed(() => formatMoney(props.bet.stake, locale.value));
|
||
|
||
const oddsText = computed(() => {
|
||
const o = props.bet.totalOdds;
|
||
if (o == null || o === '' || o === 0) return '';
|
||
const n = parseFloat(String(o));
|
||
return Number.isFinite(n) ? n.toFixed(2) : String(o);
|
||
});
|
||
|
||
const betTypeLabel = computed(() => {
|
||
if (props.bet.isParlay) return t('bet.parlay');
|
||
return props.bet.betType || '';
|
||
});
|
||
|
||
const returnAmount = computed(() => {
|
||
if (statusKey.value === 'won') return formatMoney(props.bet.actualReturn, locale.value);
|
||
if (statusKey.value === 'pending') return formatMoney(props.bet.potentialReturn, locale.value);
|
||
if (statusKey.value === 'lost') return formatMoney(-parseFloat(String(props.bet.stake ?? 0)), locale.value);
|
||
return formatMoney(props.bet.actualReturn ?? props.bet.potentialReturn, locale.value);
|
||
});
|
||
|
||
const returnHighlight = computed(() => statusKey.value === 'won');
|
||
const returnPending = computed(() => statusKey.value === 'pending');
|
||
const returnLost = computed(() => statusKey.value === 'lost');
|
||
|
||
function goDetail() {
|
||
router.push(`/bets/${props.bet.betNo}`);
|
||
}
|
||
</script>
|
||
|
||
<template>
|
||
<article class="bet-card" @click="goDetail">
|
||
<StatusWatermark :label="watermarkLabel" :variant="watermarkVariant" />
|
||
<div class="card-body">
|
||
<div class="card-header">
|
||
<span v-if="betTypeLabel" class="bet-type-tag">{{ betTypeLabel }}</span>
|
||
<span v-if="bet.isCashbacked" class="cashback-tag">{{ t('history.cashbacked') }}</span>
|
||
<span class="card-date">{{ placedDate }}</span>
|
||
</div>
|
||
<span class="title">{{ title }}</span>
|
||
<div class="card-detail-row">
|
||
<span class="pick-label">{{ subtitle }}</span>
|
||
<span v-if="oddsText" class="odds-badge">@{{ oddsText }}</span>
|
||
</div>
|
||
<div class="card-footer">
|
||
<span class="stake-amt">{{ t('history.stake') }} {{ stakeAmount }}</span>
|
||
<span class="return-amt" :class="{ highlight: returnHighlight, pending: returnPending, lost: returnLost }">
|
||
{{ returnAmount }}
|
||
</span>
|
||
</div>
|
||
</div>
|
||
<span class="chevron">›</span>
|
||
</article>
|
||
</template>
|
||
|
||
<style scoped>
|
||
.bet-card {
|
||
position: relative;
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 10px;
|
||
padding: 14px 16px;
|
||
border-bottom: 1px solid var(--border);
|
||
cursor: pointer;
|
||
transition: background 0.15s;
|
||
-webkit-tap-highlight-color: transparent;
|
||
overflow: hidden;
|
||
}
|
||
|
||
.bet-card:active {
|
||
background: rgba(255, 255, 255, 0.02);
|
||
}
|
||
|
||
.card-body {
|
||
flex: 1;
|
||
min-width: 0;
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 4px;
|
||
}
|
||
|
||
.card-header {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 8px;
|
||
flex-wrap: wrap;
|
||
}
|
||
|
||
.cashback-tag {
|
||
font-size: 10px;
|
||
font-weight: 700;
|
||
color: var(--primary-light);
|
||
background: var(--surface-accent);
|
||
border: 1px solid var(--border-gold-soft);
|
||
border-radius: 4px;
|
||
padding: 1px 6px;
|
||
}
|
||
|
||
.bet-type-tag {
|
||
font-size: 10px;
|
||
font-weight: 700;
|
||
color: var(--primary-light);
|
||
background: var(--surface-accent);
|
||
border: 1px solid var(--border-gold-soft);
|
||
border-radius: 4px;
|
||
padding: 1px 6px;
|
||
letter-spacing: 0.02em;
|
||
}
|
||
|
||
.card-date {
|
||
font-size: 10px;
|
||
color: var(--text-muted);
|
||
font-weight: 600;
|
||
flex-shrink: 0;
|
||
margin-left: auto;
|
||
opacity: 0.7;
|
||
}
|
||
|
||
.title {
|
||
font-size: 14px;
|
||
font-weight: 800;
|
||
color: var(--text);
|
||
white-space: nowrap;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
}
|
||
|
||
.card-detail-row {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 6px;
|
||
}
|
||
|
||
.pick-label {
|
||
font-size: 11px;
|
||
color: var(--text-muted);
|
||
font-weight: 600;
|
||
white-space: nowrap;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
flex: 1;
|
||
min-width: 0;
|
||
}
|
||
|
||
.odds-badge {
|
||
font-size: 11px;
|
||
font-weight: 800;
|
||
color: var(--primary-light);
|
||
background: var(--surface-accent);
|
||
border-radius: 4px;
|
||
padding: 1px 6px;
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
.card-footer {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
gap: 8px;
|
||
margin-top: 2px;
|
||
}
|
||
|
||
.stake-amt {
|
||
font-size: 11px;
|
||
color: var(--text-muted);
|
||
font-weight: 600;
|
||
}
|
||
|
||
.return-amt {
|
||
font-size: 15px;
|
||
font-weight: 900;
|
||
color: var(--text-muted);
|
||
}
|
||
|
||
.return-amt.highlight { color: var(--success); }
|
||
.return-amt.pending { color: var(--primary-light); }
|
||
.return-amt.lost { color: var(--danger); }
|
||
|
||
.chevron {
|
||
flex-shrink: 0;
|
||
font-size: 18px;
|
||
color: var(--neutral);
|
||
margin-left: 2px;
|
||
line-height: 1;
|
||
}
|
||
</style>
|