feat: split admin dashboard, improve match ops, and player closed-match UX
Admin: add match/player overview sub-nav; refine settlement flow and league match management UI; improve action button enabled/disabled styles; enhance logo upload and outright odds sync. API: expose matchPhase/bettingOpen for closed matches; league publish guards; settlement preview with auto score save; outright team auto-sync. Player: watermark for closed/settled states; keep match and bet details visible; remove default login credentials. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -418,7 +418,7 @@ body {
|
||||
-webkit-text-fill-color: #fff !important;
|
||||
}
|
||||
|
||||
.el-button { background: #141414 !important; border-color: #2a2a2a !important; color: #aaa !important; }
|
||||
.el-button { background: #141414 !important; border-color: #2a2a2a !important; color: #aaa !important; transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s !important; }
|
||||
.el-button:hover { background: #1e1e1e !important; border-color: #3a3a3a !important; color: #fff !important; }
|
||||
.el-button--primary {
|
||||
background: var(--primary-grad) !important;
|
||||
@@ -435,18 +435,104 @@ body {
|
||||
box-shadow: 0 1px 0 rgba(255, 255, 255, 0.18) inset, 0 4px 14px rgba(0, 0, 0, 0.5), 0 0 24px rgba(47, 181, 106, 0.28) !important;
|
||||
}
|
||||
.el-button--success {
|
||||
background: var(--green-surface) !important;
|
||||
border: 1px solid var(--green-border) !important;
|
||||
color: var(--green-text) !important;
|
||||
backdrop-filter: blur(6px);
|
||||
background: linear-gradient(165deg, #42b86e 0%, #248f54 52%, #1a6b40 100%) !important;
|
||||
border: 1px solid rgba(77, 214, 138, 0.35) !important;
|
||||
color: #ffffff !important;
|
||||
font-weight: 700 !important;
|
||||
box-shadow: 0 1px 0 rgba(255, 255, 255, 0.12) inset, 0 2px 8px rgba(0, 0, 0, 0.35) !important;
|
||||
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
.el-button--success:hover {
|
||||
background: rgba(36, 143, 84, 0.35) !important;
|
||||
background: linear-gradient(165deg, #52cc7e 0%, #2ea864 52%, #1f7a48 100%) !important;
|
||||
border-color: rgba(120, 230, 170, 0.45) !important;
|
||||
color: #d4fde5 !important;
|
||||
color: #ffffff !important;
|
||||
box-shadow: 0 1px 0 rgba(255, 255, 255, 0.16) inset, 0 4px 12px rgba(0, 0, 0, 0.4), 0 0 18px rgba(47, 181, 106, 0.22) !important;
|
||||
}
|
||||
.el-button--warning {
|
||||
background: linear-gradient(165deg, #e8a820 0%, #c48412 52%, #9a6508 100%) !important;
|
||||
border: 1px solid rgba(251, 191, 36, 0.4) !important;
|
||||
color: #ffffff !important;
|
||||
font-weight: 700 !important;
|
||||
box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1) inset, 0 2px 8px rgba(0, 0, 0, 0.35) !important;
|
||||
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.25);
|
||||
}
|
||||
.el-button--warning:hover {
|
||||
background: linear-gradient(165deg, #f0b830 0%, #d49218 52%, #aa720a 100%) !important;
|
||||
border-color: rgba(251, 191, 36, 0.55) !important;
|
||||
color: #ffffff !important;
|
||||
box-shadow: 0 1px 0 rgba(255, 255, 255, 0.14) inset, 0 4px 12px rgba(0, 0, 0, 0.4), 0 0 16px rgba(251, 191, 36, 0.18) !important;
|
||||
}
|
||||
.el-button--warning { background: rgba(251,191,36,0.1) !important; border-color: rgba(251,191,36,0.35) !important; color: #fbbf24 !important; }
|
||||
.el-button--danger { background: rgba(255,69,58,0.1) !important; border-color: rgba(255,69,58,0.35) !important; color: #ff453a !important; }
|
||||
|
||||
/* ── Disabled: muted ghost, clearly non-interactive ── */
|
||||
.el-button.is-disabled,
|
||||
.el-button.is-disabled:hover,
|
||||
.el-button.is-disabled:focus,
|
||||
.el-button:disabled {
|
||||
cursor: not-allowed !important;
|
||||
pointer-events: none;
|
||||
transform: none !important;
|
||||
filter: none;
|
||||
box-shadow: none !important;
|
||||
text-shadow: none !important;
|
||||
opacity: 1 !important;
|
||||
}
|
||||
|
||||
.el-button.is-disabled,
|
||||
.el-button.is-disabled:hover,
|
||||
.el-button:disabled {
|
||||
background: rgba(255, 255, 255, 0.04) !important;
|
||||
border-color: rgba(255, 255, 255, 0.08) !important;
|
||||
color: rgba(255, 255, 255, 0.28) !important;
|
||||
}
|
||||
|
||||
.el-button--primary.is-disabled,
|
||||
.el-button--primary.is-disabled:hover,
|
||||
.el-button--primary:disabled {
|
||||
background: rgba(36, 143, 84, 0.1) !important;
|
||||
border-color: rgba(36, 143, 84, 0.14) !important;
|
||||
color: rgba(154, 232, 188, 0.32) !important;
|
||||
}
|
||||
|
||||
.el-button--primary.is-plain.is-disabled,
|
||||
.el-button--primary.is-plain.is-disabled:hover,
|
||||
.el-button--primary.is-plain:disabled {
|
||||
background: rgba(36, 143, 84, 0.06) !important;
|
||||
border-color: rgba(36, 143, 84, 0.12) !important;
|
||||
color: rgba(154, 232, 188, 0.28) !important;
|
||||
}
|
||||
|
||||
.el-button--success.is-disabled,
|
||||
.el-button--success.is-disabled:hover,
|
||||
.el-button--success:disabled {
|
||||
background: rgba(36, 143, 84, 0.08) !important;
|
||||
border-color: rgba(36, 143, 84, 0.12) !important;
|
||||
color: rgba(154, 232, 188, 0.28) !important;
|
||||
}
|
||||
|
||||
.el-button--warning.is-disabled,
|
||||
.el-button--warning.is-disabled:hover,
|
||||
.el-button--warning:disabled {
|
||||
background: rgba(196, 132, 18, 0.1) !important;
|
||||
border-color: rgba(196, 132, 18, 0.14) !important;
|
||||
color: rgba(251, 191, 36, 0.28) !important;
|
||||
}
|
||||
|
||||
.el-button--danger.is-plain.is-disabled,
|
||||
.el-button--danger.is-plain.is-disabled:hover,
|
||||
.el-button--danger.is-plain:disabled {
|
||||
background: rgba(255, 69, 58, 0.06) !important;
|
||||
border-color: rgba(255, 69, 58, 0.1) !important;
|
||||
color: rgba(255, 107, 98, 0.28) !important;
|
||||
}
|
||||
|
||||
.el-button--danger.is-disabled,
|
||||
.el-button--danger.is-disabled:hover,
|
||||
.el-button--danger:disabled {
|
||||
background: rgba(255, 69, 58, 0.06) !important;
|
||||
border-color: rgba(255, 69, 58, 0.1) !important;
|
||||
color: rgba(255, 107, 98, 0.28) !important;
|
||||
}
|
||||
.el-button--primary.is-plain {
|
||||
background: rgba(36, 143, 84, 0.12) !important;
|
||||
border-color: var(--green-border) !important;
|
||||
@@ -459,15 +545,16 @@ body {
|
||||
color: #d4fde5 !important;
|
||||
}
|
||||
.el-button--danger.is-plain {
|
||||
background: rgba(255, 69, 58, 0.08) !important;
|
||||
border-color: rgba(255, 69, 58, 0.35) !important;
|
||||
background: rgba(255, 69, 58, 0.14) !important;
|
||||
border-color: rgba(255, 69, 58, 0.45) !important;
|
||||
color: #ff6b62 !important;
|
||||
font-weight: 600 !important;
|
||||
box-shadow: none !important;
|
||||
}
|
||||
.el-button--danger.is-plain:hover {
|
||||
background: rgba(255, 69, 58, 0.16) !important;
|
||||
border-color: rgba(255, 120, 110, 0.5) !important;
|
||||
color: #ff8a82 !important;
|
||||
background: rgba(255, 69, 58, 0.24) !important;
|
||||
border-color: rgba(255, 120, 110, 0.55) !important;
|
||||
color: #ff9a92 !important;
|
||||
}
|
||||
.el-button.is-text,
|
||||
.el-button.is-link.el-button--default {
|
||||
@@ -481,26 +568,6 @@ body {
|
||||
color: #d4fde5 !important;
|
||||
background: rgba(36, 143, 84, 0.1) !important;
|
||||
}
|
||||
.el-button--primary.is-plain {
|
||||
background: rgba(36, 143, 84, 0.12) !important;
|
||||
border-color: var(--green-border) !important;
|
||||
color: var(--green-text) !important;
|
||||
}
|
||||
.el-button--primary.is-plain:hover {
|
||||
background: rgba(36, 143, 84, 0.22) !important;
|
||||
border-color: rgba(120, 230, 170, 0.45) !important;
|
||||
color: #d4fde5 !important;
|
||||
}
|
||||
.el-button--danger.is-plain {
|
||||
background: rgba(255, 69, 58, 0.08) !important;
|
||||
border-color: rgba(255, 69, 58, 0.35) !important;
|
||||
color: #ff6961 !important;
|
||||
}
|
||||
.el-button--danger.is-plain:hover {
|
||||
background: rgba(255, 69, 58, 0.18) !important;
|
||||
border-color: rgba(255, 120, 110, 0.5) !important;
|
||||
color: #ff8a82 !important;
|
||||
}
|
||||
|
||||
.el-tag { border-radius: 4px !important; font-size: 11px !important; font-weight: 600 !important; }
|
||||
.el-tag--success {
|
||||
|
||||
91
apps/admin/src/components/DashboardSubNav.vue
Normal file
91
apps/admin/src/components/DashboardSubNav.vue
Normal file
@@ -0,0 +1,91 @@
|
||||
<script setup lang="ts">
|
||||
import { RouterLink, useRoute } from 'vue-router';
|
||||
import { useAdminLocale } from '../composables/useAdminLocale';
|
||||
|
||||
const { t } = useAdminLocale();
|
||||
const route = useRoute();
|
||||
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
embedded?: boolean;
|
||||
}>(),
|
||||
{ embedded: false },
|
||||
);
|
||||
|
||||
const tabs = [
|
||||
{ path: '/', labelKey: 'nav.dashboard.matches' },
|
||||
{ path: '/dashboard/players', labelKey: 'nav.dashboard.players' },
|
||||
];
|
||||
|
||||
function isActive(path: string) {
|
||||
if (path === '/dashboard/players') {
|
||||
return route.path === '/dashboard/players';
|
||||
}
|
||||
return route.path === '/' || route.path === '/dashboard/matches';
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<nav
|
||||
class="dashboard-subnav"
|
||||
:class="{ 'dashboard-subnav--embedded': embedded }"
|
||||
aria-label="Dashboard sections"
|
||||
>
|
||||
<RouterLink
|
||||
v-for="tab in tabs"
|
||||
:key="tab.path"
|
||||
:to="tab.path"
|
||||
class="dashboard-subnav__item"
|
||||
:class="{ 'dashboard-subnav__item--active': isActive(tab.path) }"
|
||||
>
|
||||
{{ t(tab.labelKey) }}
|
||||
</RouterLink>
|
||||
</nav>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.dashboard-subnav {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
margin-bottom: 16px;
|
||||
padding: 6px;
|
||||
border-radius: 10px;
|
||||
background: rgba(255, 255, 255, 0.03);
|
||||
border: 1px solid rgba(255, 255, 255, 0.06);
|
||||
flex-shrink: 0;
|
||||
min-height: 48px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.dashboard-subnav--embedded {
|
||||
margin-bottom: 0;
|
||||
padding: 0 14px 0 0;
|
||||
border: none;
|
||||
border-right: 1px solid rgba(255, 255, 255, 0.08);
|
||||
background: transparent;
|
||||
flex-shrink: 0;
|
||||
height: 44px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.dashboard-subnav__item {
|
||||
padding: 0 14px;
|
||||
height: 36px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-sizing: border-box;
|
||||
border-radius: 8px;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: #888;
|
||||
transition: color 0.15s, background 0.15s;
|
||||
}
|
||||
.dashboard-subnav__item:hover {
|
||||
color: #ccc;
|
||||
background: rgba(255, 255, 255, 0.04);
|
||||
}
|
||||
.dashboard-subnav__item--active {
|
||||
color: var(--green-text);
|
||||
background: rgba(0, 200, 83, 0.1);
|
||||
}
|
||||
</style>
|
||||
@@ -1,5 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, watch, computed } from 'vue';
|
||||
import { ref, watch, computed, nextTick } from 'vue';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import CountryFlagSelect from './outright/CountryFlagSelect.vue';
|
||||
import {
|
||||
countryLogoUrl,
|
||||
@@ -11,33 +12,61 @@ import {
|
||||
type CountryLogoKind,
|
||||
} from '../data/builtinCountries';
|
||||
import { useAdminLocale } from '../composables/useAdminLocale';
|
||||
import api from '../api';
|
||||
|
||||
const LOGO_ACCEPT = 'image/png,image/jpeg,image/webp,image/gif,image/svg+xml';
|
||||
|
||||
const props = defineProps<{
|
||||
modelValue: string;
|
||||
teamCode?: string;
|
||||
/** 上传分类,默认 teams */
|
||||
uploadCategory?: string;
|
||||
/** 表格等窄布局:隐藏 URL 输入框,仅国家 + 国旗/队徽 */
|
||||
compact?: boolean;
|
||||
/** 仅上传与 URL,不显示国家选择 */
|
||||
uploadOnly?: boolean;
|
||||
/** 是否标记删除旧资源(父组件保存时执行) */
|
||||
deleteOld?: boolean;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:modelValue': [value: string];
|
||||
'update:deleteOld': [value: boolean];
|
||||
pick: [country: BuiltinCountry];
|
||||
}>();
|
||||
|
||||
const { t } = useAdminLocale();
|
||||
const countryCode = ref('');
|
||||
const logoKind = ref<CountryLogoKind>('crest');
|
||||
const uploading = ref(false);
|
||||
const dragging = ref(false);
|
||||
const fileInputRef = ref<HTMLInputElement | null>(null);
|
||||
|
||||
const canPickCrest = computed(() => {
|
||||
const code = countryCode.value;
|
||||
return code ? hasCountryCrest(code) : false;
|
||||
});
|
||||
|
||||
const previewUrl = computed(() => props.modelValue.trim() || '');
|
||||
const previewUrl = computed(() => localUrl.value.trim() || '');
|
||||
|
||||
/** Local URL mirror for immediate preview updates regardless of parent sync */
|
||||
const localUrl = ref(props.modelValue);
|
||||
watch(() => props.modelValue, (v) => { localUrl.value = v; }, { immediate: true });
|
||||
|
||||
/**
|
||||
* Update URL both locally (instant preview) and emit to parent.
|
||||
* nextTick ensures Vue processes the parent update before continuing.
|
||||
*/
|
||||
async function updateUrl(url: string) {
|
||||
localUrl.value = url;
|
||||
emit('update:modelValue', url);
|
||||
await nextTick();
|
||||
}
|
||||
|
||||
watch(
|
||||
() => [props.modelValue, props.teamCode] as const,
|
||||
([url, code]) => {
|
||||
() => [props.modelValue, props.teamCode, props.uploadOnly] as const,
|
||||
([url, code, uploadOnly]) => {
|
||||
if (uploadOnly) return;
|
||||
countryCode.value = resolveCountryCode(code, url || null);
|
||||
if (url) {
|
||||
logoKind.value = detectCountryLogoKind(url, countryCode.value);
|
||||
@@ -47,6 +76,7 @@ watch(
|
||||
);
|
||||
|
||||
watch(countryCode, (code, prev) => {
|
||||
if (props.uploadOnly) return;
|
||||
if (!code && prev && (logoKind.value === 'flag' || logoKind.value === 'crest')) {
|
||||
emit('update:modelValue', '');
|
||||
}
|
||||
@@ -56,7 +86,7 @@ function applyLogoForCountry(country: BuiltinCountry) {
|
||||
const kind =
|
||||
logoKind.value === 'crest' && hasCountryCrest(country) ? 'crest' : 'flag';
|
||||
logoKind.value = kind;
|
||||
emit('update:modelValue', countryLogoUrl(country, kind));
|
||||
updateUrl(countryLogoUrl(country, kind));
|
||||
}
|
||||
|
||||
function onCountryPick(country: BuiltinCountry) {
|
||||
@@ -73,18 +103,88 @@ function onLogoKindChange(kind: CountryLogoKind) {
|
||||
const country = getBuiltinCountry(countryCode.value);
|
||||
if (!country) return;
|
||||
logoKind.value = kind === 'crest' && !hasCountryCrest(country) ? 'flag' : kind;
|
||||
emit('update:modelValue', countryLogoUrl(country, logoKind.value as 'flag' | 'crest'));
|
||||
updateUrl(countryLogoUrl(country, logoKind.value as 'flag' | 'crest'));
|
||||
}
|
||||
|
||||
function onCustomUrlInput(value: string) {
|
||||
logoKind.value = detectCountryLogoKind(value, countryCode.value);
|
||||
emit('update:modelValue', value);
|
||||
updateUrl(value);
|
||||
}
|
||||
|
||||
function triggerUpload() {
|
||||
fileInputRef.value?.click();
|
||||
}
|
||||
|
||||
async function onFileChange(e: Event) {
|
||||
const input = e.target as HTMLInputElement;
|
||||
const file = input.files?.[0];
|
||||
if (!file) return;
|
||||
input.value = '';
|
||||
uploading.value = true;
|
||||
try {
|
||||
const fd = new FormData();
|
||||
fd.append('file', file);
|
||||
const category = props.uploadCategory || 'teams';
|
||||
const { data } = await api.post(`/admin/uploads?category=${category}`, fd, {
|
||||
headers: { 'Content-Type': 'multipart/form-data' },
|
||||
});
|
||||
const url = data.data?.url as string;
|
||||
if (url) {
|
||||
logoKind.value = 'custom';
|
||||
await updateUrl(url);
|
||||
ElMessage.success(t('content.upload.success'));
|
||||
}
|
||||
} catch (err: any) {
|
||||
const msg = err?.response?.data?.message || t('content.upload.failed');
|
||||
ElMessage.error(String(msg));
|
||||
} finally {
|
||||
uploading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function onDragOver(e: DragEvent) {
|
||||
e.preventDefault();
|
||||
dragging.value = true;
|
||||
}
|
||||
|
||||
function onDragLeave() {
|
||||
dragging.value = false;
|
||||
}
|
||||
|
||||
async function onFileDrop(e: DragEvent) {
|
||||
e.preventDefault();
|
||||
dragging.value = false;
|
||||
const file = e.dataTransfer?.files[0];
|
||||
if (!file || !file.type.startsWith('image/')) return;
|
||||
uploading.value = true;
|
||||
try {
|
||||
const fd = new FormData();
|
||||
fd.append('file', file);
|
||||
const category = props.uploadCategory || 'teams';
|
||||
const { data } = await api.post(`/admin/uploads?category=${category}`, fd, {
|
||||
headers: { 'Content-Type': 'multipart/form-data' },
|
||||
});
|
||||
const url = data.data?.url as string;
|
||||
if (url) {
|
||||
logoKind.value = 'custom';
|
||||
await updateUrl(url);
|
||||
ElMessage.success(t('content.upload.success'));
|
||||
}
|
||||
} catch (err: any) {
|
||||
const msg = err?.response?.data?.message || t('content.upload.failed');
|
||||
ElMessage.error(String(msg));
|
||||
} finally {
|
||||
uploading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
/** Track the original URL (from when component mounted) so user can mark old resource for deletion */
|
||||
const oldUrl = ref(props.modelValue);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="logo-url-field" :class="{ compact }">
|
||||
<div class="pick-row">
|
||||
<div class="logo-url-field" :class="{ compact, 'upload-only': uploadOnly }">
|
||||
<template v-if="!uploadOnly">
|
||||
<CountryFlagSelect
|
||||
v-model="countryCode"
|
||||
hide-preview
|
||||
@@ -103,11 +203,46 @@ function onCustomUrlInput(value: string) {
|
||||
{{ t('teamLogo.kind.crest') }}
|
||||
</el-radio-button>
|
||||
</el-radio-group>
|
||||
<img v-if="previewUrl" :src="previewUrl" alt="" class="logo-preview" loading="lazy" />
|
||||
</template>
|
||||
<div class="upload-row">
|
||||
<div
|
||||
class="drop-zone"
|
||||
:class="{ 'is-dragging': dragging }"
|
||||
@click="triggerUpload"
|
||||
@dragover.prevent="onDragOver"
|
||||
@dragleave="onDragLeave"
|
||||
@drop="onFileDrop"
|
||||
>
|
||||
<img v-if="previewUrl" :src="previewUrl" alt="" class="drop-preview" loading="lazy" />
|
||||
<div v-else class="drop-placeholder">
|
||||
<svg class="drop-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round">
|
||||
<path d="M12 5v14M5 12h14" />
|
||||
</svg>
|
||||
<span class="drop-text">{{ uploading ? '上传中…' : '拖拽或点击上传' }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<label
|
||||
v-if="oldUrl"
|
||||
class="delete-old-check"
|
||||
>
|
||||
<input
|
||||
type="checkbox"
|
||||
:checked="deleteOld"
|
||||
@change="emit('update:deleteOld', ($event.target as HTMLInputElement).checked)"
|
||||
/>
|
||||
<span>保存时删除旧图</span>
|
||||
</label>
|
||||
</div>
|
||||
<input
|
||||
ref="fileInputRef"
|
||||
type="file"
|
||||
:accept="LOGO_ACCEPT"
|
||||
style="display: none"
|
||||
@change="onFileChange"
|
||||
/>
|
||||
<el-input
|
||||
v-if="!compact"
|
||||
:model-value="modelValue"
|
||||
:model-value="localUrl"
|
||||
size="small"
|
||||
:placeholder="t('matchEditor.ph.logo_url')"
|
||||
clearable
|
||||
@@ -121,44 +256,107 @@ function onCustomUrlInput(value: string) {
|
||||
.logo-url-field {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.pick-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.flag-part {
|
||||
flex: 1;
|
||||
min-width: 120px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.kind-group {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.logo-preview {
|
||||
.upload-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.drop-zone {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
flex-shrink: 0;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
object-fit: contain;
|
||||
border: 2px dashed #2a2a2a;
|
||||
border-radius: 8px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s;
|
||||
background: rgba(255, 255, 255, 0.02);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.delete-old-check {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
font-size: 11px;
|
||||
color: #e55;
|
||||
cursor: pointer;
|
||||
padding: 2px 4px;
|
||||
border-radius: 4px;
|
||||
background: #0d0d0d;
|
||||
border: 1px solid #2a2a2a;
|
||||
transition: background 0.15s;
|
||||
white-space: nowrap;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.delete-old-check:hover {
|
||||
background: rgba(238, 85, 85, 0.1);
|
||||
}
|
||||
|
||||
.delete-old-check input[type="checkbox"] {
|
||||
accent-color: #e55;
|
||||
margin: 0;
|
||||
width: 13px;
|
||||
height: 13px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.drop-zone:hover {
|
||||
border-color: rgba(47, 181, 106, 0.4);
|
||||
background: rgba(47, 181, 106, 0.04);
|
||||
}
|
||||
|
||||
.drop-zone.is-dragging {
|
||||
border-color: #2fb56a;
|
||||
background: rgba(47, 181, 106, 0.1);
|
||||
}
|
||||
|
||||
.drop-preview {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
.drop-placeholder {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
color: #555;
|
||||
}
|
||||
|
||||
.drop-icon {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
}
|
||||
|
||||
.drop-text {
|
||||
font-size: 11px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.url-part {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.logo-url-field.compact .flag-part {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
.logo-url-field.compact .drop-zone {
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -53,25 +53,27 @@ function isActive(path: string) {
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
margin-bottom: 16px;
|
||||
padding: 4px;
|
||||
padding: 6px;
|
||||
border-radius: 10px;
|
||||
background: rgba(255, 255, 255, 0.03);
|
||||
border: 1px solid rgba(255, 255, 255, 0.06);
|
||||
flex-shrink: 0;
|
||||
min-height: 48px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.matches-subnav--embedded {
|
||||
margin-bottom: 0;
|
||||
padding: 0 12px 0 0;
|
||||
padding: 0 14px 0 0;
|
||||
border: none;
|
||||
border-right: 1px solid rgba(255, 255, 255, 0.08);
|
||||
background: transparent;
|
||||
flex-shrink: 0;
|
||||
height: 32px;
|
||||
height: 44px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.matches-subnav__item {
|
||||
padding: 0 12px;
|
||||
height: 32px;
|
||||
padding: 0 14px;
|
||||
height: 36px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
126
apps/admin/src/composables/useAdminDashboard.ts
Normal file
126
apps/admin/src/composables/useAdminDashboard.ts
Normal file
@@ -0,0 +1,126 @@
|
||||
import { ref, computed } from 'vue';
|
||||
import api from '../api';
|
||||
import type { AdminDashboard } from '../views/dashboard-types';
|
||||
import { formatAmount, formatAmountFull } from '../utils/format-amount';
|
||||
import { useAdminLocale } from './useAdminLocale';
|
||||
|
||||
const stats = ref<AdminDashboard | null>(null);
|
||||
const loading = ref(false);
|
||||
const loadError = ref(false);
|
||||
let inflight: Promise<void> | null = null;
|
||||
|
||||
export function useAdminDashboard() {
|
||||
const { t, locale, localeTag } = useAdminLocale();
|
||||
|
||||
const s = computed(() => stats.value);
|
||||
|
||||
async function load(force = false) {
|
||||
if (inflight && !force) return inflight;
|
||||
if (stats.value && !force) return;
|
||||
|
||||
loading.value = true;
|
||||
loadError.value = false;
|
||||
|
||||
inflight = (async () => {
|
||||
try {
|
||||
const { data } = await api.get('/admin/dashboard');
|
||||
stats.value = data.data as AdminDashboard;
|
||||
} catch {
|
||||
stats.value = null;
|
||||
loadError.value = true;
|
||||
} finally {
|
||||
loading.value = false;
|
||||
inflight = null;
|
||||
}
|
||||
})();
|
||||
|
||||
return inflight;
|
||||
}
|
||||
|
||||
function fmtCount(val: number | undefined) {
|
||||
return (val ?? 0).toLocaleString(localeTag.value, { maximumFractionDigits: 0 });
|
||||
}
|
||||
|
||||
function formatTime(v: string) {
|
||||
return new Date(v).toLocaleString(localeTag.value, {
|
||||
month: '2-digit',
|
||||
day: '2-digit',
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
});
|
||||
}
|
||||
|
||||
function toNum(v: string | number | undefined) {
|
||||
const n = typeof v === 'number' ? v : parseFloat(v ?? '0');
|
||||
return Number.isFinite(n) ? n : 0;
|
||||
}
|
||||
|
||||
function pctChange(today: string | number, yesterday: string | number) {
|
||||
const t0 = toNum(today);
|
||||
const y = toNum(yesterday);
|
||||
if (y === 0) return t0 > 0 ? '+100%' : '—';
|
||||
const p = ((t0 - y) / y) * 100;
|
||||
const sign = p > 0 ? '+' : '';
|
||||
return `${sign}${p.toFixed(1)}%`;
|
||||
}
|
||||
|
||||
const chartI18n = computed(() => ({
|
||||
locale: locale.value,
|
||||
betCountSeries: t('dash.chart_bet_count'),
|
||||
axisAmount: t('dash.axis_amount'),
|
||||
axisCount: t('dash.axis_count'),
|
||||
countSuffix: t('dash.count_suffix'),
|
||||
pieTooltip: t('dash.chart_tooltip'),
|
||||
noData: t('common.no_data'),
|
||||
pieEmpty: t('dash.pie_empty'),
|
||||
}));
|
||||
|
||||
const trendLabels = computed(() => s.value?.trend7d?.map((d) => d.label) ?? []);
|
||||
|
||||
const kpiPrimary = computed(() => {
|
||||
if (!s.value) return [];
|
||||
const td = s.value.today;
|
||||
const y = s.value.yesterday;
|
||||
const yLabel = t('common.yesterday');
|
||||
return [
|
||||
{
|
||||
label: t('dash.kpi_bet_count'),
|
||||
value: fmtCount(td.betCount),
|
||||
sub: `${yLabel} ${fmtCount(y.betCount)}`,
|
||||
delta: pctChange(td.betCount, y.betCount),
|
||||
},
|
||||
{
|
||||
label: t('dash.kpi_stake'),
|
||||
value: formatAmount(td.stake, 2, locale.value),
|
||||
sub: formatAmountFull(td.stake, locale.value),
|
||||
delta: pctChange(td.stake, y.stake),
|
||||
},
|
||||
{
|
||||
label: t('dash.kpi_payout'),
|
||||
value: formatAmount(td.payout, 2, locale.value),
|
||||
sub: `${yLabel} ${formatAmount(y.payout, 2, locale.value)}`,
|
||||
delta: pctChange(td.payout, y.payout),
|
||||
},
|
||||
{
|
||||
label: t('dash.kpi_ggr'),
|
||||
value: formatAmount(td.ggr, 2, locale.value),
|
||||
sub: `${yLabel} ${formatAmount(y.ggr, 2, locale.value)}`,
|
||||
delta: pctChange(td.ggr, y.ggr),
|
||||
},
|
||||
];
|
||||
});
|
||||
|
||||
return {
|
||||
stats,
|
||||
s,
|
||||
loading,
|
||||
loadError,
|
||||
load,
|
||||
fmtCount,
|
||||
formatTime,
|
||||
toNum,
|
||||
chartI18n,
|
||||
trendLabels,
|
||||
kpiPrimary,
|
||||
};
|
||||
}
|
||||
@@ -63,7 +63,7 @@ export function useAdminPlayerTransfer(onSuccess?: () => void | Promise<void>) {
|
||||
transferTarget.value = row;
|
||||
transferContext.value = null;
|
||||
transferAmount.value = 100;
|
||||
transferRemark.value = type === 'deposit' ? t('user.deposit_remark_default') : '';
|
||||
transferRemark.value = type === 'deposit' ? t('user.deposit_remark_default') : t('user.withdraw_remark_default');
|
||||
transferVisible.value = true;
|
||||
transferContextLoading.value = true;
|
||||
try {
|
||||
|
||||
@@ -31,6 +31,8 @@ const zh: Record<string, string> = {
|
||||
'login.captcha_refresh': '点击刷新',
|
||||
|
||||
'nav.dashboard': '概览',
|
||||
'nav.dashboard.matches': '赛事概览',
|
||||
'nav.dashboard.players': '玩家概览',
|
||||
'nav.users': '玩家管理',
|
||||
'nav.agents': '代理管理',
|
||||
'nav.agents_players': '代理&玩家',
|
||||
@@ -126,6 +128,22 @@ const zh: Record<string, string> = {
|
||||
'dash.user_suspended': '停用',
|
||||
'dash.user_direct': '直属',
|
||||
'dash.user_agents': '代理',
|
||||
'dash.section_matches_hint': '投注经营与赛事状态分布',
|
||||
'dash.section_players_hint': '玩家、代理与资金概况',
|
||||
'dash.kpi_match_total': '赛事总数',
|
||||
'dash.kpi_match_total_sub': '草稿 {draft} · 已发布 {published}',
|
||||
'dash.kpi_match_closed': '已封盘',
|
||||
'dash.kpi_match_closed_sub': '已取消 {n} 场',
|
||||
'dash.kpi_match_settled': '已结算赛事',
|
||||
'dash.kpi_match_settled_sub': '已完成结算的场次',
|
||||
'dash.kpi_agents_active': '活跃代理',
|
||||
'dash.kpi_agents_active_sub': '停用玩家 {suspended} 人',
|
||||
'dash.recent_players': '最新注册玩家',
|
||||
'dash.recent_bets': '最新注单',
|
||||
'dash.col_parent': '上级',
|
||||
'dash.col_bet_no': '注单号',
|
||||
'dash.col_stake': '投注额',
|
||||
'dash.col_placed_at': '下注时间',
|
||||
|
||||
'page.users.title': '玩家管理',
|
||||
'page.users.desc': '创建玩家、查看余额与投注概况,支持上分与状态管理',
|
||||
@@ -213,6 +231,8 @@ const en: Record<string, string> = {
|
||||
'login.captcha_refresh': 'Click to refresh',
|
||||
|
||||
'nav.dashboard': 'Overview',
|
||||
'nav.dashboard.matches': 'Match overview',
|
||||
'nav.dashboard.players': 'Player overview',
|
||||
'nav.users': 'Players',
|
||||
'nav.agents': 'Agents',
|
||||
'nav.agents_players': 'Agents & Players',
|
||||
@@ -308,6 +328,22 @@ const en: Record<string, string> = {
|
||||
'dash.user_suspended': 'Suspended',
|
||||
'dash.user_direct': 'Direct',
|
||||
'dash.user_agents': 'Agents',
|
||||
'dash.section_matches_hint': 'Betting performance and match distribution',
|
||||
'dash.section_players_hint': 'Players, agents, and wallet summary',
|
||||
'dash.kpi_match_total': 'Total matches',
|
||||
'dash.kpi_match_total_sub': 'Draft {draft} · Published {published}',
|
||||
'dash.kpi_match_closed': 'Closed',
|
||||
'dash.kpi_match_closed_sub': '{n} cancelled',
|
||||
'dash.kpi_match_settled': 'Settled matches',
|
||||
'dash.kpi_match_settled_sub': 'Matches fully settled',
|
||||
'dash.kpi_agents_active': 'Active agents',
|
||||
'dash.kpi_agents_active_sub': '{suspended} suspended players',
|
||||
'dash.recent_players': 'Recent sign-ups',
|
||||
'dash.recent_bets': 'Recent bets',
|
||||
'dash.col_parent': 'Parent',
|
||||
'dash.col_bet_no': 'Bet No.',
|
||||
'dash.col_stake': 'Stake',
|
||||
'dash.col_placed_at': 'Placed at',
|
||||
|
||||
'page.users.title': 'Players',
|
||||
'page.users.desc': 'Create players, balances, stakes, top-ups, and status',
|
||||
@@ -395,6 +431,8 @@ const ms: Record<string, string> = {
|
||||
'login.captcha_refresh': 'Klik untuk muat semula',
|
||||
|
||||
'nav.dashboard': 'Gambaran',
|
||||
'nav.dashboard.matches': 'Gambaran perlawanan',
|
||||
'nav.dashboard.players': 'Gambaran pemain',
|
||||
'nav.users': 'Pemain',
|
||||
'nav.agents': 'Ejen',
|
||||
'nav.agents_players': 'Ejen & Pemain',
|
||||
@@ -490,6 +528,22 @@ const ms: Record<string, string> = {
|
||||
'dash.user_suspended': 'Digantung',
|
||||
'dash.user_direct': 'Terus',
|
||||
'dash.user_agents': 'Ejen',
|
||||
'dash.section_matches_hint': 'Prestasi pertaruhan dan taburan perlawanan',
|
||||
'dash.section_players_hint': 'Pemain, ejen, dan ringkasan dana',
|
||||
'dash.kpi_match_total': 'Jumlah perlawanan',
|
||||
'dash.kpi_match_total_sub': 'Draf {draft} · Diterbitkan {published}',
|
||||
'dash.kpi_match_closed': 'Ditutup',
|
||||
'dash.kpi_match_closed_sub': '{n} dibatalkan',
|
||||
'dash.kpi_match_settled': 'Perlawanan diselesaikan',
|
||||
'dash.kpi_match_settled_sub': 'Perlawanan yang telah diselesaikan',
|
||||
'dash.kpi_agents_active': 'Ejen aktif',
|
||||
'dash.kpi_agents_active_sub': '{suspended} pemain digantung',
|
||||
'dash.recent_players': 'Pendaftaran terkini',
|
||||
'dash.recent_bets': 'Pertaruhan terkini',
|
||||
'dash.col_parent': 'Induk',
|
||||
'dash.col_bet_no': 'No. pertaruhan',
|
||||
'dash.col_stake': 'Stake',
|
||||
'dash.col_placed_at': 'Masa pertaruhan',
|
||||
|
||||
'page.users.title': 'Pemain',
|
||||
'page.users.desc': 'Cipta pemain, baki, stake, tambah baki dan status',
|
||||
|
||||
@@ -96,6 +96,7 @@ export const adminPagesMs: Record<string, string> = {
|
||||
'user.btn.save_profile': 'Simpan',
|
||||
'user.btn.confirm_deposit': 'Sahkan tambah baki',
|
||||
'user.deposit_remark_default': 'Tambah baki admin',
|
||||
'user.withdraw_remark_default': 'Pengeluaran admin',
|
||||
'user.field.account_type': 'Jenis akaun',
|
||||
'user.type.player': 'Pemain',
|
||||
'user.type.tier1_agent': 'Ejen peringkat 1',
|
||||
@@ -162,14 +163,19 @@ export const adminPagesMs: Record<string, string> = {
|
||||
'finance.tx.deposit': 'Deposit',
|
||||
'finance.tx.withdraw': 'Pengeluaran',
|
||||
'finance.tx.request_id': 'ID permintaan',
|
||||
'finance.remark.agent_deposit': 'Deposit ejen',
|
||||
'finance.remark.agent_withdraw': 'Pengeluaran ejen',
|
||||
'finance.remark.admin_deposit': 'Deposit admin',
|
||||
'finance.remark.admin_withdraw': 'Pengeluaran admin',
|
||||
'finance.remark.initial_balance': 'Baki permulaan akaun',
|
||||
'agent.col.no_records': 'Tiada rekod',
|
||||
'agent.btn.confirm_adjust': 'Sahkan',
|
||||
'agent.field.select_user': 'Pilih pengguna',
|
||||
'agent.ph.select_user': 'Cari nama pengguna pemain',
|
||||
'agent.hint.select_user': 'Pilih akaun pemain sedia ada untuk naik taraf ke ejen peringkat 1',
|
||||
|
||||
'match.create_btn': '+ Kejohanan baharu',
|
||||
'match.create_fixture_btn': '+ Perlawanan tunggal',
|
||||
'match.create_btn': '+ Liga baharu',
|
||||
'match.create_fixture_btn': '+ Perlawanan baharu',
|
||||
'match.btn.markets': 'Pasaran',
|
||||
'match.filter.keyword_ph': 'Nama kejohanan / kod pasukan',
|
||||
'match.col.league': 'Kejohanan',
|
||||
@@ -182,6 +188,7 @@ export const adminPagesMs: Record<string, string> = {
|
||||
'match.col.matchup': 'Perlawanan',
|
||||
'match.col.kickoff': 'Masa mula',
|
||||
'match.dialog.create_league': 'Kejohanan baharu',
|
||||
'match.dialog.edit_league': 'Edit kejohanan',
|
||||
'match.dialog.create_fixture': 'Perlawanan tunggal baharu',
|
||||
'match.dialog.create': 'Perlawanan tunggal baharu',
|
||||
'match.dialog.edit': 'Edit perlawanan tunggal',
|
||||
@@ -204,11 +211,17 @@ export const adminPagesMs: Record<string, string> = {
|
||||
'match.field.away_ms': 'Pelawat (MS)',
|
||||
'match.field.featured': 'Pilihan utama',
|
||||
'match.hint.create_draft': 'Disimpan sebagai draf; kembangkan kejohanan dan terbitkan setiap perlawanan tunggal.',
|
||||
'match.hint.create_league': 'Cipta kejohanan dahulu, kemudian kembangkan untuk tambah perlawanan tunggal.',
|
||||
'match.hint.create_league': 'Kejohanan baharu tidak diterbitkan secara lalai; terbitkan untuk paparan pemain, kemudian kembangkan untuk tambah perlawanan.',
|
||||
'league.status.PUBLISHED': 'Diterbitkan',
|
||||
'league.status.UNPUBLISHED': 'Tidak diterbitkan',
|
||||
'league.btn.unpublish': 'Nyahterbit',
|
||||
'msg.league_published': 'Kejohanan diterbitkan',
|
||||
'msg.league_unpublished': 'Kejohanan dinyahterbit',
|
||||
'match.hint.edit_published': 'Diterbitkan: edit masa mula, pilihan utama, nama paparan; tertutup/selesai dikunci.',
|
||||
'match.expand_league_hint': 'Kembangkan liga untuk urus perlawanan; odds juara di tab Odds juara.',
|
||||
'match.expand_outright_hint': 'Kembangkan liga untuk sunting odds juara; pasukan perlawanan disegerakkan auto, boleh tambah pasukan belum dijadualkan.',
|
||||
'outright.odds_only_hint': 'Pasukan daripada perlawanan disegerakkan auto; boleh tambah pasukan manual dan sunting odds di sini.',
|
||||
'outright.fixture_sync_added': '{n} pasukan disegerakkan auto daripada perlawanan',
|
||||
'outright.col.teams_from_fixtures': 'Pasukan (daripada perlawanan)',
|
||||
'outright.col.teams_total': 'Pasukan odds juara',
|
||||
'outright.empty_no_teams': 'Tiada pasukan — tambah perlawanan di Konfigurasi atau klik Tambah pasukan.',
|
||||
@@ -365,6 +378,7 @@ export const adminPagesMs: Record<string, string> = {
|
||||
'matchEditor.field.line_value': 'Garisan',
|
||||
'matchEditor.ph.kickoff': 'Pilih tarikh & masa mula',
|
||||
'matchEditor.group.league': 'Liga',
|
||||
'matchEditor.hint.league_readonly': 'Nama dan logo liga diselenggara dalam senarai kejohanan; paparan di sini hanya baca.',
|
||||
'matchEditor.group.home': 'Tuan rumah',
|
||||
'matchEditor.group.away': 'Pelawat',
|
||||
'matchEditor.group.schedule': 'Jadual & paparan',
|
||||
@@ -441,7 +455,7 @@ export const adminPagesMs: Record<string, string> = {
|
||||
'settlement.ht_score': 'Skor separuh masa',
|
||||
'settlement.ft_score': 'Skor penuh masa',
|
||||
'settlement.record_score': 'Simpan skor',
|
||||
'settlement.preview_hint': 'Skor di atas disimpan secara automatik sebelum pratonton',
|
||||
'settlement.preview_hint': 'Isi skor dan klik pratonton — skor disimpan secara automatik',
|
||||
'settlement.preview_btn': 'Pratonton penyelesaian',
|
||||
'settlement.preview_failed': 'Gagal menjana pratonton penyelesaian',
|
||||
'settlement.err_score_not_recorded': 'Sila masukkan skor separuh masa dan penuh masa sebelum penyelesaian',
|
||||
@@ -506,6 +520,7 @@ export const adminPagesMs: Record<string, string> = {
|
||||
'msg.deleted': 'Dipadam',
|
||||
'msg.delete_failed': 'Gagal memadam',
|
||||
'msg.league_created': 'Kejohanan dicipta',
|
||||
'msg.league_updated': 'Kejohanan dikemas kini',
|
||||
'msg.match_created_draft': 'Perlawanan tunggal dicipta (draf)',
|
||||
'msg.published': 'Diterbitkan dengan pasaran',
|
||||
'msg.closed': 'Pertaruhan ditutup',
|
||||
@@ -604,6 +619,16 @@ export const adminPagesMs: Record<string, string> = {
|
||||
'outright.btn.add_team': 'Tambah pasukan',
|
||||
'outright.add.filter_fixture': 'Pasukan sedia ada',
|
||||
'outright.add.filter_all': 'Semua terbina dalam',
|
||||
'outright.add.filter_custom': 'Tersuai',
|
||||
'outright.add.custom_hint': 'Isi kod pasukan dan nama Cina/Inggeris; logo melalui muat naik atau URL.',
|
||||
'outright.add.field_code': 'Kod pasukan',
|
||||
'outright.add.field_logo': 'Logo',
|
||||
'outright.add.ph_code': 'cth. TEAM01',
|
||||
'outright.add.ph_name_zh': 'Nama Cina',
|
||||
'outright.add.ph_name_en': 'Nama Inggeris',
|
||||
'outright.add.err_code_required': 'Sila isi kod pasukan',
|
||||
'outright.add.err_name_required': 'Sila isi sekurang-kurangnya nama Cina atau Inggeris',
|
||||
'outright.add.err_duplicate': 'Kod pasukan ini sudah ada dalam pasaran juara',
|
||||
'outright.add.select_all': 'Pilih semua',
|
||||
'outright.add.clear_selection': 'Kosongkan pilihan',
|
||||
'outright.add.selected_count': '{n} dipilih',
|
||||
|
||||
@@ -96,6 +96,7 @@ export const adminPagesZh: Record<string, string> = {
|
||||
'user.btn.save_profile': '保存资料',
|
||||
'user.btn.confirm_deposit': '确认上分',
|
||||
'user.deposit_remark_default': '管理员上分',
|
||||
'user.withdraw_remark_default': '管理员下分',
|
||||
'user.field.account_type': '账号类型',
|
||||
'user.type.player': '玩家',
|
||||
'user.type.tier1_agent': '一级代理',
|
||||
@@ -165,6 +166,11 @@ export const adminPagesZh: Record<string, string> = {
|
||||
'finance.tx.deposit': '上分',
|
||||
'finance.tx.withdraw': '下分',
|
||||
'finance.tx.request_id': '请求 ID',
|
||||
'finance.remark.agent_deposit': '代理上分',
|
||||
'finance.remark.agent_withdraw': '代理下分',
|
||||
'finance.remark.admin_deposit': '管理员上分',
|
||||
'finance.remark.admin_withdraw': '管理员下分',
|
||||
'finance.remark.initial_balance': '开户初始余额',
|
||||
'agent.col.no_records': '暂无记录',
|
||||
'agent.btn.confirm_adjust': '确认调整',
|
||||
'agent.field.select_user': '选择用户',
|
||||
@@ -183,8 +189,8 @@ export const adminPagesZh: Record<string, string> = {
|
||||
'agent.msg.cascade_freeze_done': '已停用代理并冻结其直属玩家',
|
||||
'agent.msg.freeze_done': '已{action}',
|
||||
|
||||
'match.create_btn': '+ 新增赛事',
|
||||
'match.create_fixture_btn': '+ 新增单场',
|
||||
'match.create_btn': '+ 新增联赛',
|
||||
'match.create_fixture_btn': '+ 新增本场赛事',
|
||||
'match.btn.markets': '盘口',
|
||||
'match.filter.keyword_ph': '赛事名 / 球队代码',
|
||||
'match.filter.status_hint': '仅筛选展开后的单场列表与「单场」列计数,不会隐藏新建的空联赛',
|
||||
@@ -198,6 +204,7 @@ export const adminPagesZh: Record<string, string> = {
|
||||
'match.col.matchup': '对阵',
|
||||
'match.col.kickoff': '开赛时间',
|
||||
'match.dialog.create_league': '新增赛事',
|
||||
'match.dialog.edit_league': '编辑赛事',
|
||||
'match.dialog.create_fixture': '新增单场',
|
||||
'match.dialog.create': '新增单场',
|
||||
'match.dialog.edit': '编辑单场',
|
||||
@@ -220,11 +227,17 @@ export const adminPagesZh: Record<string, string> = {
|
||||
'match.field.away_ms': '客队(马来)',
|
||||
'match.field.featured': '热门',
|
||||
'match.hint.create_draft': '创建后为草稿,请展开赛事后在单场行点击「发布」并生成盘口。',
|
||||
'match.hint.create_league': '创建赛事(联赛)后,展开该行可添加多场单场比赛。',
|
||||
'match.hint.create_league': '新建联赛默认为未发布,请在列表点击「发布」后玩家端可见;展开该行可添加单场。',
|
||||
'league.status.PUBLISHED': '已发布',
|
||||
'league.status.UNPUBLISHED': '未发布',
|
||||
'league.btn.unpublish': '下架',
|
||||
'msg.league_published': '联赛已发布',
|
||||
'msg.league_unpublished': '联赛已下架',
|
||||
'match.hint.edit_published': '已发布:可修改开赛时间、热门及显示名称;封盘/已结算后不可编辑。',
|
||||
'match.expand_league_hint': '展开联赛可管理单场赛事;夺冠盘口请在「优胜赛配置(盘口)」中设置赔率。',
|
||||
'match.expand_outright_hint': '展开联赛可编辑夺冠赔率;单场球队会自动同步,也可手动补充尚未赛程的球队。',
|
||||
'outright.odds_only_hint': '单场赛程中的球队会自动加入;可手动添加尚未参赛的球队,并在此调整赔率。',
|
||||
'outright.fixture_sync_added': '已从单场自动同步 {n} 支球队',
|
||||
'outright.col.teams_from_fixtures': '参赛球队(来自单场)',
|
||||
'outright.col.teams_total': '冠军盘球队',
|
||||
'outright.empty_no_teams': '暂无球队,请先在「赛事配置」添加单场或点击「添加队伍」。',
|
||||
@@ -381,6 +394,7 @@ export const adminPagesZh: Record<string, string> = {
|
||||
'matchEditor.field.line_value': '盘口线',
|
||||
'matchEditor.ph.kickoff': '选择开赛日期与时间',
|
||||
'matchEditor.group.league': '联赛信息',
|
||||
'matchEditor.hint.league_readonly': '联赛名称与 Logo 请在赛事管理列表中点击「编辑」维护,此处仅展示。',
|
||||
'matchEditor.group.home': '主队',
|
||||
'matchEditor.group.away': '客队',
|
||||
'matchEditor.group.schedule': '赛程与展示',
|
||||
@@ -457,10 +471,10 @@ export const adminPagesZh: Record<string, string> = {
|
||||
'settlement.ht_score': '半场比分',
|
||||
'settlement.ft_score': '全场比分',
|
||||
'settlement.record_score': '录入比分',
|
||||
'settlement.preview_hint': '生成预览前会自动保存上方比分',
|
||||
'settlement.preview_hint': '填写比分后点击生成预览,系统将自动保存并计算派彩',
|
||||
'settlement.preview_btn': '生成结算预览',
|
||||
'settlement.preview_failed': '生成结算预览失败',
|
||||
'settlement.err_score_not_recorded': '请先录入半场与全场比分后再结算',
|
||||
'settlement.err_score_not_recorded': '请先填写半场与全场比分后再生成预览',
|
||||
'settlement.preview_title': '结算预览',
|
||||
'settlement.single_count': '单关注单数',
|
||||
'settlement.preview_pending_bets': '待结算注单',
|
||||
@@ -572,6 +586,7 @@ export const adminPagesZh: Record<string, string> = {
|
||||
'msg.deleted': '已删除',
|
||||
'msg.delete_failed': '删除失败',
|
||||
'msg.league_created': '赛事已创建',
|
||||
'msg.league_updated': '赛事已更新',
|
||||
'msg.match_created_draft': '单场已创建(草稿)',
|
||||
'msg.published': '已发布并生成盘口',
|
||||
'msg.closed': '已封盘',
|
||||
@@ -671,6 +686,16 @@ export const adminPagesZh: Record<string, string> = {
|
||||
'outright.btn.add_team': '添加队伍',
|
||||
'outright.add.filter_fixture': '已有队伍',
|
||||
'outright.add.filter_all': '全部内置',
|
||||
'outright.add.filter_custom': '自定义',
|
||||
'outright.add.custom_hint': '手动填写球队代码与中/英文名称,Logo 可上传或填写 URL。',
|
||||
'outright.add.field_code': '球队代码',
|
||||
'outright.add.field_logo': 'Logo',
|
||||
'outright.add.ph_code': '如 TEAM01',
|
||||
'outright.add.ph_name_zh': '中文队名',
|
||||
'outright.add.ph_name_en': '英文队名',
|
||||
'outright.add.err_code_required': '请填写球队代码',
|
||||
'outright.add.err_name_required': '请至少填写中文或英文队名',
|
||||
'outright.add.err_duplicate': '该球队代码已在冠军盘中',
|
||||
'outright.add.select_all': '全选',
|
||||
'outright.add.clear_selection': '取消全选',
|
||||
'outright.add.selected_count': '已选 {n} 支',
|
||||
@@ -902,6 +927,7 @@ export const adminPagesEn: Record<string, string> = {
|
||||
'user.btn.save_profile': 'Save',
|
||||
'user.btn.confirm_deposit': 'Confirm top-up',
|
||||
'user.deposit_remark_default': 'Admin top-up',
|
||||
'user.withdraw_remark_default': 'Admin withdraw',
|
||||
'user.field.account_type': 'Account type',
|
||||
'user.type.player': 'Player',
|
||||
'user.type.tier1_agent': 'Tier-1 agent',
|
||||
@@ -971,6 +997,11 @@ export const adminPagesEn: Record<string, string> = {
|
||||
'finance.tx.deposit': 'Deposit',
|
||||
'finance.tx.withdraw': 'Withdraw',
|
||||
'finance.tx.request_id': 'Request ID',
|
||||
'finance.remark.agent_deposit': 'Agent deposit',
|
||||
'finance.remark.agent_withdraw': 'Agent withdraw',
|
||||
'finance.remark.admin_deposit': 'Admin deposit',
|
||||
'finance.remark.admin_withdraw': 'Admin withdraw',
|
||||
'finance.remark.initial_balance': 'Initial account balance',
|
||||
'agent.col.no_records': 'No records',
|
||||
'agent.btn.confirm_adjust': 'Confirm',
|
||||
'agent.field.select_user': 'Select user',
|
||||
@@ -989,8 +1020,8 @@ export const adminPagesEn: Record<string, string> = {
|
||||
'agent.msg.cascade_freeze_done': 'Agent suspended and direct players frozen',
|
||||
'agent.msg.freeze_done': '{action} completed',
|
||||
|
||||
'match.create_btn': '+ New tournament',
|
||||
'match.create_fixture_btn': '+ Add fixture',
|
||||
'match.create_btn': '+ New league',
|
||||
'match.create_fixture_btn': '+ Add match',
|
||||
'match.btn.markets': 'Markets',
|
||||
'match.filter.keyword_ph': 'Tournament / team code',
|
||||
'match.filter.status_hint': 'Filters fixtures inside a league and the fixture count column; empty leagues stay visible',
|
||||
@@ -1004,6 +1035,7 @@ export const adminPagesEn: Record<string, string> = {
|
||||
'match.col.matchup': 'Matchup',
|
||||
'match.col.kickoff': 'Kickoff',
|
||||
'match.dialog.create_league': 'New tournament',
|
||||
'match.dialog.edit_league': 'Edit tournament',
|
||||
'match.dialog.create_fixture': 'New fixture',
|
||||
'match.dialog.create': 'New fixture',
|
||||
'match.dialog.edit': 'Edit fixture',
|
||||
@@ -1026,11 +1058,17 @@ export const adminPagesEn: Record<string, string> = {
|
||||
'match.field.away_ms': 'Away (MS)',
|
||||
'match.field.featured': 'Featured',
|
||||
'match.hint.create_draft': 'Saved as draft; expand the tournament and publish each fixture to open markets.',
|
||||
'match.hint.create_league': 'Create a tournament first, then expand it to add fixtures.',
|
||||
'match.hint.create_league': 'New tournaments are unpublished by default; use Publish in the list for player visibility, then expand to add fixtures.',
|
||||
'league.status.PUBLISHED': 'Published',
|
||||
'league.status.UNPUBLISHED': 'Unpublished',
|
||||
'league.btn.unpublish': 'Unpublish',
|
||||
'msg.league_published': 'Tournament published',
|
||||
'msg.league_unpublished': 'Tournament unpublished',
|
||||
'match.hint.edit_published': 'Published: edit kickoff, featured, display names; closed/settled are locked.',
|
||||
'match.expand_league_hint': 'Expand a league to manage fixtures; set winner odds under Outright odds.',
|
||||
'match.expand_outright_hint': 'Expand a league to edit winner odds; fixture teams sync automatically, and you can add teams not yet on the schedule.',
|
||||
'outright.odds_only_hint': 'Teams from fixtures are added automatically; add extra teams manually and edit winner odds here.',
|
||||
'outright.fixture_sync_added': '{n} team(s) synced automatically from fixtures',
|
||||
'outright.col.teams_from_fixtures': 'Teams (from fixtures)',
|
||||
'outright.col.teams_total': 'Outright teams',
|
||||
'outright.empty_no_teams': 'No teams yet — add fixtures under Fixtures or click Add team.',
|
||||
@@ -1187,6 +1225,7 @@ export const adminPagesEn: Record<string, string> = {
|
||||
'matchEditor.field.line_value': 'Line',
|
||||
'matchEditor.ph.kickoff': 'Select kickoff date & time',
|
||||
'matchEditor.group.league': 'League',
|
||||
'matchEditor.hint.league_readonly': 'Edit league name and logo from the tournament list; shown here read-only.',
|
||||
'matchEditor.group.home': 'Home team',
|
||||
'matchEditor.group.away': 'Away team',
|
||||
'matchEditor.group.schedule': 'Schedule & display',
|
||||
@@ -1263,10 +1302,10 @@ export const adminPagesEn: Record<string, string> = {
|
||||
'settlement.ht_score': 'Half-time score',
|
||||
'settlement.ft_score': 'Full-time score',
|
||||
'settlement.record_score': 'Save score',
|
||||
'settlement.preview_hint': 'Current scores are saved automatically before preview',
|
||||
'settlement.preview_hint': 'Enter scores and click preview — scores are saved automatically',
|
||||
'settlement.preview_btn': 'Preview settlement',
|
||||
'settlement.preview_failed': 'Failed to generate settlement preview',
|
||||
'settlement.err_score_not_recorded': 'Enter half-time and full-time scores before settling',
|
||||
'settlement.err_score_not_recorded': 'Enter half-time and full-time scores before preview',
|
||||
'settlement.preview_title': 'Settlement preview',
|
||||
'settlement.single_count': 'Single bets',
|
||||
'settlement.preview_pending_bets': 'Pending bets',
|
||||
@@ -1379,6 +1418,7 @@ export const adminPagesEn: Record<string, string> = {
|
||||
'msg.deleted': 'Deleted',
|
||||
'msg.delete_failed': 'Delete failed',
|
||||
'msg.league_created': 'Tournament created',
|
||||
'msg.league_updated': 'Tournament updated',
|
||||
'msg.match_created_draft': 'Fixture created (draft)',
|
||||
'msg.published': 'Published with markets',
|
||||
'msg.closed': 'Betting closed',
|
||||
@@ -1478,6 +1518,16 @@ export const adminPagesEn: Record<string, string> = {
|
||||
'outright.btn.add_team': 'Add team',
|
||||
'outright.add.filter_fixture': 'From fixtures',
|
||||
'outright.add.filter_all': 'All built-in',
|
||||
'outright.add.filter_custom': 'Custom',
|
||||
'outright.add.custom_hint': 'Enter team code and Chinese/English names; logo via upload or URL.',
|
||||
'outright.add.field_code': 'Team code',
|
||||
'outright.add.field_logo': 'Logo',
|
||||
'outright.add.ph_code': 'e.g. TEAM01',
|
||||
'outright.add.ph_name_zh': 'Chinese name',
|
||||
'outright.add.ph_name_en': 'English name',
|
||||
'outright.add.err_code_required': 'Team code is required',
|
||||
'outright.add.err_name_required': 'Enter at least Chinese or English name',
|
||||
'outright.add.err_duplicate': 'This team code is already on the outright market',
|
||||
'outright.add.select_all': 'Select all',
|
||||
'outright.add.clear_selection': 'Clear selection',
|
||||
'outright.add.selected_count': '{n} selected',
|
||||
|
||||
@@ -15,7 +15,7 @@ const sidebarOpen = ref(false);
|
||||
const isMobileNav = ref(false);
|
||||
|
||||
const adminMenus = computed(() => [
|
||||
{ path: '/', label: t('nav.dashboard') },
|
||||
{ path: '/', label: t('nav.dashboard'), matchPrefix: true },
|
||||
{ path: '/matches', label: t('nav.matches'), matchPrefix: true },
|
||||
{ path: '/users', label: t('nav.agents_players') },
|
||||
{ path: '/finance-logs', label: t('nav.finance_logs') },
|
||||
@@ -45,9 +45,14 @@ function isMatchesSectionPath(path: string) {
|
||||
);
|
||||
}
|
||||
|
||||
function isDashboardSectionPath(path: string) {
|
||||
return path === '/' || path === '/dashboard/players';
|
||||
}
|
||||
|
||||
const currentLabel = computed(() => {
|
||||
const hit = menus.value.find((m) => {
|
||||
if ('matchPrefix' in m && m.matchPrefix) {
|
||||
if (m.path === '/') return isDashboardSectionPath(route.path);
|
||||
return isMatchesSectionPath(route.path);
|
||||
}
|
||||
return route.path === m.path;
|
||||
@@ -136,7 +141,11 @@ watch(() => route.path, () => {
|
||||
:class="{
|
||||
active:
|
||||
route.path === m.path ||
|
||||
('matchPrefix' in m && m.matchPrefix && isMatchesSectionPath(route.path)),
|
||||
('matchPrefix' in m &&
|
||||
m.matchPrefix &&
|
||||
(m.path === '/'
|
||||
? isDashboardSectionPath(route.path)
|
||||
: isMatchesSectionPath(route.path))),
|
||||
}"
|
||||
@click="onNavClick"
|
||||
>
|
||||
|
||||
@@ -11,7 +11,20 @@ const router = createRouter({
|
||||
component: () => import('../layouts/ManageLayout.vue'),
|
||||
meta: { auth: true },
|
||||
children: [
|
||||
{ path: '', component: () => import('../views/HomeEntry.vue') },
|
||||
{
|
||||
path: '',
|
||||
component: () => import('../views/HomeEntry.vue'),
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
component: () => import('../views/dashboard/DashboardMatches.vue'),
|
||||
},
|
||||
{
|
||||
path: 'dashboard/players',
|
||||
component: () => import('../views/dashboard/DashboardPlayers.vue'),
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: 'users',
|
||||
component: () => import('../views/AgentManager.vue'),
|
||||
@@ -140,6 +153,10 @@ router.beforeEach(async (to) => {
|
||||
return '/';
|
||||
}
|
||||
|
||||
if (to.path.startsWith('/dashboard/') && !auth.isAdmin.value) {
|
||||
return '/';
|
||||
}
|
||||
|
||||
if (to.meta.agentOnly && !auth.isAgent.value) {
|
||||
return '/';
|
||||
}
|
||||
|
||||
@@ -32,6 +32,12 @@ export function resolveAdminBreadcrumb(
|
||||
{ label: t('nav.matches.outrights') },
|
||||
];
|
||||
}
|
||||
if (path === '/dashboard/players') {
|
||||
return [
|
||||
{ label: t('nav.dashboard'), to: '/' },
|
||||
{ label: t('nav.dashboard.players') },
|
||||
];
|
||||
}
|
||||
if (/^\/outrights\/[^/]+\/edit/.test(path)) {
|
||||
return [
|
||||
{ label: t('nav.matches'), to: '/matches' },
|
||||
|
||||
@@ -81,6 +81,27 @@ function transferTypeLabel(type: string) {
|
||||
return type;
|
||||
}
|
||||
|
||||
const TRANSFER_REMARK_KEYS: Record<string, string> = {
|
||||
'Agent deposit': 'finance.remark.agent_deposit',
|
||||
'Agent withdraw': 'finance.remark.agent_withdraw',
|
||||
'代理上分': 'finance.remark.agent_deposit',
|
||||
'代理下分': 'finance.remark.agent_withdraw',
|
||||
'管理员上分': 'finance.remark.admin_deposit',
|
||||
'管理员下分': 'finance.remark.admin_withdraw',
|
||||
'开户初始余额': 'finance.remark.initial_balance',
|
||||
};
|
||||
|
||||
function transferRemarkLabel(remark: string | null | undefined, transactionType: string) {
|
||||
const raw = remark?.trim();
|
||||
if (!raw) {
|
||||
if (transactionType === 'MANUAL_DEPOSIT') return t('finance.remark.agent_deposit');
|
||||
if (transactionType === 'MANUAL_WITHDRAW') return t('finance.remark.agent_withdraw');
|
||||
return '—';
|
||||
}
|
||||
const key = TRANSFER_REMARK_KEYS[raw];
|
||||
return key ? t(key) : raw;
|
||||
}
|
||||
|
||||
function formatTime(v: string) {
|
||||
return new Date(v).toLocaleString(localeTag.value, {
|
||||
year: 'numeric',
|
||||
@@ -417,7 +438,9 @@ watch(
|
||||
<el-table-column :label="t('agent.credit_tx.col.operator')" min-width="100">
|
||||
<template #default="{ row }">{{ row.operatorUsername ?? '—' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="remark" :label="t('user.field.remark')" min-width="120" show-overflow-tooltip />
|
||||
<el-table-column :label="t('user.field.remark')" min-width="120" show-overflow-tooltip>
|
||||
<template #default="{ row }">{{ transferRemarkLabel(row.remark, row.transactionType) }}</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="pager">
|
||||
|
||||
@@ -1,28 +1,46 @@
|
||||
<script setup lang="ts">
|
||||
import { shallowRef, onBeforeMount, type Component } from 'vue';
|
||||
import { RouterView } from 'vue-router';
|
||||
import { useAuthStore } from '../stores/auth';
|
||||
import { ensureStaffSession } from '../utils/session-hydrate';
|
||||
import DashboardSubNav from '../components/DashboardSubNav.vue';
|
||||
|
||||
const auth = useAuthStore();
|
||||
const dashboardView = shallowRef<Component | null>(null);
|
||||
const agentDashboard = shallowRef<Component | null>(null);
|
||||
const booting = shallowRef(true);
|
||||
|
||||
onBeforeMount(async () => {
|
||||
await ensureStaffSession();
|
||||
dashboardView.value = auth.isAdmin.value
|
||||
? (await import('./Dashboard.vue')).default
|
||||
: (await import('./agent/Dashboard.vue')).default;
|
||||
if (!auth.isAdmin.value) {
|
||||
agentDashboard.value = (await import('./agent/Dashboard.vue')).default;
|
||||
}
|
||||
booting.value = false;
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div v-if="booting" v-loading="true" class="home-boot" />
|
||||
<component v-else :is="dashboardView" />
|
||||
<template v-else-if="auth.isAdmin.value">
|
||||
<div class="dashboard-shell">
|
||||
<div class="list-chrome">
|
||||
<div class="list-chrome__row">
|
||||
<div class="list-chrome__left">
|
||||
<DashboardSubNav embedded />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<RouterView />
|
||||
</div>
|
||||
</template>
|
||||
<component v-else :is="agentDashboard" />
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.home-boot {
|
||||
min-height: 240px;
|
||||
}
|
||||
|
||||
.dashboard-shell :deep(.list-chrome) {
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -8,6 +8,7 @@ import { ElMessage } from 'element-plus';
|
||||
import LeagueMatchesPanel from './matches/LeagueMatchesPanel.vue';
|
||||
import MatchesSubNav from '../components/MatchesSubNav.vue';
|
||||
import CountryFlagSelect from '../components/outright/CountryFlagSelect.vue';
|
||||
import LogoUrlField from '../components/LogoUrlField.vue';
|
||||
import { getBuiltinCountry } from '../data/builtinCountries';
|
||||
import {
|
||||
readMatchesListUiState,
|
||||
@@ -34,13 +35,19 @@ const expandedRowKeys = ref<string[]>([]);
|
||||
|
||||
const createLeagueVisible = ref(false);
|
||||
const createLeagueLoading = ref(false);
|
||||
const leagueForm = ref({ leagueEn: '', leagueZh: '', leagueMs: '', logoUrl: '' });
|
||||
const leagueDialogMode = ref<'create' | 'edit'>('create');
|
||||
const leagueEditingId = ref('');
|
||||
const leagueForm = ref({ leagueEn: '', leagueZh: '', leagueMs: '', logoUrl: '', deleteOldLogo: false, originalLogoUrl: '' });
|
||||
const publishingLeagueId = ref('');
|
||||
|
||||
const leagueDialogTitle = computed(() =>
|
||||
leagueDialogMode.value === 'edit'
|
||||
? t('match.dialog.edit_league')
|
||||
: t('match.dialog.create_league'),
|
||||
);
|
||||
|
||||
const createVisible = ref(false);
|
||||
const importVisible = ref(false);
|
||||
const createLoading = ref(false);
|
||||
const importLoading = ref(false);
|
||||
const importJson = ref('');
|
||||
const form = ref<MatchCreateForm>(emptyMatchForm());
|
||||
const createUnderLeagueLabel = ref('');
|
||||
|
||||
@@ -123,30 +130,89 @@ function onSizeChange(size: number) {
|
||||
}
|
||||
|
||||
function openCreateLeague() {
|
||||
leagueForm.value = { leagueEn: '', leagueZh: '', leagueMs: '', logoUrl: '' };
|
||||
leagueDialogMode.value = 'create';
|
||||
leagueEditingId.value = '';
|
||||
leagueForm.value = { leagueEn: '', leagueZh: '', leagueMs: '', logoUrl: '', deleteOldLogo: false, originalLogoUrl: '' };
|
||||
createLeagueVisible.value = true;
|
||||
}
|
||||
|
||||
async function submitCreateLeague() {
|
||||
const { leagueEn, leagueZh, leagueMs, logoUrl } = leagueForm.value;
|
||||
function openEditLeague(row: unknown) {
|
||||
const r = rowOf(row);
|
||||
leagueDialogMode.value = 'edit';
|
||||
leagueEditingId.value = String(r.id ?? '');
|
||||
const currentLogoUrl = String(r.logoUrl ?? '');
|
||||
leagueForm.value = {
|
||||
leagueEn: String(r.leagueEn ?? ''),
|
||||
leagueZh: String(r.leagueZh ?? ''),
|
||||
leagueMs: String(r.leagueMs ?? ''),
|
||||
logoUrl: currentLogoUrl,
|
||||
deleteOldLogo: false,
|
||||
originalLogoUrl: currentLogoUrl,
|
||||
};
|
||||
createLeagueVisible.value = true;
|
||||
}
|
||||
|
||||
async function toggleLeaguePublish(row: unknown) {
|
||||
const r = rowOf(row);
|
||||
const id = String(r.id ?? '');
|
||||
if (leagueIsPublished(row)) return;
|
||||
publishingLeagueId.value = id;
|
||||
try {
|
||||
await api.put(`/admin/leagues/${id}`, {
|
||||
leagueEn: String(r.leagueEn ?? ''),
|
||||
leagueZh: String(r.leagueZh ?? ''),
|
||||
leagueMs: String(r.leagueMs ?? ''),
|
||||
logoUrl: String(r.logoUrl ?? '').trim() || undefined,
|
||||
isActive: true,
|
||||
});
|
||||
ElMessage.success(t('msg.league_published'));
|
||||
await load({ keepExpand: true });
|
||||
} catch (e: unknown) {
|
||||
const err = e as { response?: { data?: { error?: string } } };
|
||||
ElMessage.error(err.response?.data?.error ?? t('msg.save_failed'));
|
||||
} finally {
|
||||
publishingLeagueId.value = '';
|
||||
}
|
||||
}
|
||||
|
||||
async function submitLeagueForm() {
|
||||
const { leagueEn, leagueZh, leagueMs, logoUrl, deleteOldLogo, originalLogoUrl } = leagueForm.value;
|
||||
if (!leagueZh.trim() && !leagueEn.trim()) {
|
||||
ElMessage.warning(t('err.league_required'));
|
||||
return;
|
||||
}
|
||||
createLeagueLoading.value = true;
|
||||
try {
|
||||
await api.post('/admin/leagues', {
|
||||
const body = {
|
||||
leagueEn: leagueEn.trim(),
|
||||
leagueZh: leagueZh.trim(),
|
||||
leagueMs: leagueMs.trim() || undefined,
|
||||
logoUrl: logoUrl.trim() || undefined,
|
||||
});
|
||||
ElMessage.success(t('msg.league_created'));
|
||||
...(leagueDialogMode.value === 'create' ? { isActive: false } : {}),
|
||||
};
|
||||
if (leagueDialogMode.value === 'edit') {
|
||||
await api.put(`/admin/leagues/${leagueEditingId.value}`, body);
|
||||
ElMessage.success(t('msg.league_updated'));
|
||||
} else {
|
||||
await api.post('/admin/leagues', body);
|
||||
ElMessage.success(t('msg.league_created'));
|
||||
}
|
||||
|
||||
// Delete old resource if user checked the option and the URL actually changed
|
||||
if (deleteOldLogo && originalLogoUrl && originalLogoUrl !== logoUrl.trim()) {
|
||||
try {
|
||||
await api.delete('/admin/uploads/by-url', { data: { url: originalLogoUrl } });
|
||||
ElMessage.success('旧资源已删除');
|
||||
} catch {
|
||||
ElMessage.warning('旧资源删除失败,可稍后在媒体库中清理');
|
||||
}
|
||||
}
|
||||
|
||||
createLeagueVisible.value = false;
|
||||
load({ keepExpand: true });
|
||||
} catch (e: unknown) {
|
||||
const err = e as { response?: { data?: { error?: string } } };
|
||||
ElMessage.error(err.response?.data?.error ?? t('msg.create_failed'));
|
||||
ElMessage.error(err.response?.data?.error ?? t('msg.save_failed'));
|
||||
} finally {
|
||||
createLeagueLoading.value = false;
|
||||
}
|
||||
@@ -172,11 +238,6 @@ function openCreateFixture(leagueRow: unknown) {
|
||||
createVisible.value = true;
|
||||
}
|
||||
|
||||
function openImport() {
|
||||
importJson.value = '';
|
||||
importVisible.value = true;
|
||||
}
|
||||
|
||||
async function submitCreate() {
|
||||
let payload: ReturnType<typeof buildPlatformPayload>;
|
||||
try {
|
||||
@@ -205,41 +266,6 @@ async function submitCreate() {
|
||||
}
|
||||
}
|
||||
|
||||
async function submitImport() {
|
||||
let payload: unknown;
|
||||
try {
|
||||
payload = JSON.parse(importJson.value);
|
||||
} catch {
|
||||
ElMessage.error(t('msg.invalid_json'));
|
||||
return;
|
||||
}
|
||||
importLoading.value = true;
|
||||
try {
|
||||
const { data } = await api.post('/admin/matches/import', payload);
|
||||
const r = data.data as {
|
||||
imported: number;
|
||||
skipped: number;
|
||||
failed: number;
|
||||
total: number;
|
||||
};
|
||||
ElMessage.success(
|
||||
t('msg.import_done', {
|
||||
imported: r.imported,
|
||||
skipped: r.skipped,
|
||||
failed: r.failed,
|
||||
total: r.total,
|
||||
}),
|
||||
);
|
||||
importVisible.value = false;
|
||||
load({ keepExpand: true });
|
||||
} catch (e: unknown) {
|
||||
const err = e as { response?: { data?: { error?: string } } };
|
||||
ElMessage.error(err.response?.data?.error ?? t('msg.import_failed'));
|
||||
} finally {
|
||||
importLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function onExpandChange(_row: unknown, expanded: unknown[]) {
|
||||
expandedRowKeys.value = expanded.map((r) => leagueId(r));
|
||||
persistListUiState();
|
||||
@@ -280,6 +306,18 @@ function leagueMatchCount(row: unknown) {
|
||||
return Number(rowOf(row).matchCount ?? 0);
|
||||
}
|
||||
|
||||
function leagueIsPublished(row: unknown) {
|
||||
return Boolean(rowOf(row).isPublished);
|
||||
}
|
||||
|
||||
function leagueStatusLabel(row: unknown) {
|
||||
return leagueIsPublished(row) ? t('league.status.PUBLISHED') : t('league.status.UNPUBLISHED');
|
||||
}
|
||||
|
||||
function leagueStatusTagType(row: unknown): 'success' | 'info' {
|
||||
return leagueIsPublished(row) ? 'success' : 'info';
|
||||
}
|
||||
|
||||
function leagueBetStats(row: unknown) {
|
||||
return rowOf(row).betStats as
|
||||
| { betCount?: number; totalStake?: string; pendingCount?: number }
|
||||
@@ -335,16 +373,11 @@ function isLeagueExpanded(id: string) {
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="list-chrome__actions">
|
||||
<el-button @click="openImport">{{ t('common.import') }}</el-button>
|
||||
<el-button type="primary" @click="openCreateLeague">{{ t('match.create_btn') }}</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<p v-if="filterStatus" class="list-hint">{{ t('match.filter.status_hint') }}</p>
|
||||
</div>
|
||||
|
||||
<section class="list-panel">
|
||||
<p class="list-hint">{{ t('match.expand_league_hint') }}</p>
|
||||
<div class="table-wrap">
|
||||
<el-table
|
||||
:data="leagues"
|
||||
@@ -387,6 +420,13 @@ function isLeagueExpanded(id: string) {
|
||||
<span class="league-en">{{ leagueNameEn(row) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('common.status')" width="88" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="leagueStatusTagType(row)" size="small" effect="plain">
|
||||
{{ leagueStatusLabel(row) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('match.col.fixture_count')" width="88" align="center">
|
||||
<template #default="{ row }">{{ leagueMatchCount(row) }}</template>
|
||||
</el-table-column>
|
||||
@@ -406,9 +446,37 @@ function isLeagueExpanded(id: string) {
|
||||
<span v-else class="bet-stat-zero">0</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('match.col.league_code')" width="140" show-overflow-tooltip>
|
||||
<el-table-column :label="t('match.col.league_code')" width="120" show-overflow-tooltip>
|
||||
<template #default="{ row }">{{ rowOf(row).code }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="168" align="center" fixed="right">
|
||||
<template #header>
|
||||
<div class="actions-col-header">
|
||||
<span class="actions-col-header__label">{{ t('common.actions') }}</span>
|
||||
<el-button type="primary" size="small" @click.stop="openCreateLeague">
|
||||
{{ t('match.create_btn') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
<template #default="{ row }">
|
||||
<div class="league-row-actions">
|
||||
<div class="league-action-group">
|
||||
<el-button size="small" type="primary" @click.stop="openEditLeague(row)">
|
||||
{{ t('common.edit') }}
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="!leagueIsPublished(row)"
|
||||
size="small"
|
||||
type="success"
|
||||
:loading="publishingLeagueId === leagueId(row)"
|
||||
@click.stop="toggleLeaguePublish(row)"
|
||||
>
|
||||
{{ t('common.publish') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="pager">
|
||||
@@ -425,7 +493,7 @@ function isLeagueExpanded(id: string) {
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<el-dialog v-model="createLeagueVisible" :title="t('match.dialog.create_league')" width="520px" destroy-on-close>
|
||||
<el-dialog v-model="createLeagueVisible" :title="leagueDialogTitle" width="520px" destroy-on-close>
|
||||
<el-form label-width="96px">
|
||||
<el-form-item :label="t('match.field.league_zh')">
|
||||
<el-input v-model="leagueForm.leagueZh" :placeholder="t('match.ph.league_zh')" />
|
||||
@@ -437,14 +505,19 @@ function isLeagueExpanded(id: string) {
|
||||
<el-input v-model="leagueForm.leagueMs" :placeholder="t('match.ph.league_ms')" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="t('match.field.league_logo')">
|
||||
<el-input v-model="leagueForm.logoUrl" :placeholder="t('matchEditor.ph.logo_url')" />
|
||||
<LogoUrlField
|
||||
v-model="leagueForm.logoUrl"
|
||||
v-model:delete-old="leagueForm.deleteOldLogo"
|
||||
upload-only
|
||||
upload-category="banners"
|
||||
/>
|
||||
</el-form-item>
|
||||
<p class="field-hint">{{ t('match.hint.create_league') }}</p>
|
||||
<p v-if="leagueDialogMode === 'create'" class="field-hint">{{ t('match.hint.create_league') }}</p>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="createLeagueVisible = false">{{ t('common.cancel') }}</el-button>
|
||||
<el-button type="primary" :loading="createLeagueLoading" @click="submitCreateLeague">
|
||||
{{ t('user.btn.create') }}
|
||||
<el-button type="primary" :loading="createLeagueLoading" @click="submitLeagueForm">
|
||||
{{ leagueDialogMode === 'edit' ? t('common.save') : t('user.btn.create') }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
@@ -452,7 +525,7 @@ function isLeagueExpanded(id: string) {
|
||||
<el-dialog
|
||||
v-model="createVisible"
|
||||
:title="t('match.dialog.create_fixture')"
|
||||
width="560px"
|
||||
width="860px"
|
||||
destroy-on-close
|
||||
>
|
||||
<el-form label-width="96px">
|
||||
@@ -476,22 +549,56 @@ function isLeagueExpanded(id: string) {
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="t('match.field.home_team')" required>
|
||||
<CountryFlagSelect
|
||||
v-model="form.homeTeamCode"
|
||||
size="default"
|
||||
class="team-country-select"
|
||||
@update:model-value="onTeamCodeChange('home', $event)"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="t('match.field.away_team')" required>
|
||||
<CountryFlagSelect
|
||||
v-model="form.awayTeamCode"
|
||||
size="default"
|
||||
class="team-country-select"
|
||||
@update:model-value="onTeamCodeChange('away', $event)"
|
||||
/>
|
||||
</el-form-item>
|
||||
<div class="teams-row">
|
||||
<!-- Home Team Column -->
|
||||
<div class="team-col">
|
||||
<div class="team-col-title">{{ t('match.field.home_team') }}</div>
|
||||
<el-form-item :label="t('match.field.home_team')" required>
|
||||
<CountryFlagSelect
|
||||
v-model="form.homeTeamCode"
|
||||
size="default"
|
||||
class="team-country-select"
|
||||
@update:model-value="onTeamCodeChange('home', $event)"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="t('match.field.home_en')" label-width="108px">
|
||||
<el-input v-model="form.homeTeamEn" :placeholder="t('match.ph.home_en')" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="t('match.field.home_zh')" label-width="108px">
|
||||
<el-input v-model="form.homeTeamZh" :placeholder="t('match.ph.home_zh')" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="t('match.field.home_ms')" label-width="108px">
|
||||
<el-input v-model="form.homeTeamMs" :placeholder="t('match.ph.home_ms')" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="t('matchEditor.field.home_logo')" label-width="108px">
|
||||
<LogoUrlField v-model="form.homeTeamLogoUrl" :team-code="form.homeTeamCode" upload-category="teams" />
|
||||
</el-form-item>
|
||||
</div>
|
||||
<!-- Away Team Column -->
|
||||
<div class="team-col">
|
||||
<div class="team-col-title">{{ t('match.field.away_team') }}</div>
|
||||
<el-form-item :label="t('match.field.away_team')" required>
|
||||
<CountryFlagSelect
|
||||
v-model="form.awayTeamCode"
|
||||
size="default"
|
||||
class="team-country-select"
|
||||
@update:model-value="onTeamCodeChange('away', $event)"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="t('match.field.away_en')" label-width="108px">
|
||||
<el-input v-model="form.awayTeamEn" :placeholder="t('match.ph.away_en')" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="t('match.field.away_zh')" label-width="108px">
|
||||
<el-input v-model="form.awayTeamZh" :placeholder="t('match.ph.away_zh')" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="t('match.field.away_ms')" label-width="108px">
|
||||
<el-input v-model="form.awayTeamMs" :placeholder="t('match.ph.away_ms')" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="t('matchEditor.field.away_logo')" label-width="108px">
|
||||
<LogoUrlField v-model="form.awayTeamLogoUrl" :team-code="form.awayTeamCode" upload-category="teams" />
|
||||
</el-form-item>
|
||||
</div>
|
||||
</div>
|
||||
<el-form-item :label="t('match.field.featured')">
|
||||
<el-switch v-model="form.isHot" />
|
||||
</el-form-item>
|
||||
@@ -502,37 +609,35 @@ function isLeagueExpanded(id: string) {
|
||||
<el-button type="primary" :loading="createLoading" @click="submitCreate">{{ t('user.btn.create') }}</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog v-model="importVisible" :title="t('match.dialog.import')" width="640px" destroy-on-close>
|
||||
<p class="dialog-hint">{{ t('match.import_hint') }}</p>
|
||||
<el-input
|
||||
v-model="importJson"
|
||||
type="textarea"
|
||||
:rows="14"
|
||||
:placeholder="t('match.import_json_ph')"
|
||||
/>
|
||||
<template #footer>
|
||||
<el-button @click="importVisible = false">{{ t('common.cancel') }}</el-button>
|
||||
<el-button type="primary" :loading="importLoading" @click="submitImport">{{ t('match.import_start') }}</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.dialog-hint {
|
||||
font-size: 13px;
|
||||
color: #666;
|
||||
margin: 0 0 12px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
.team-country-select {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.dialog-hint code {
|
||||
color: #aaa;
|
||||
.teams-row {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 0 20px;
|
||||
}
|
||||
|
||||
.team-col {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.team-col-title {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: #bbb;
|
||||
margin-bottom: 10px;
|
||||
padding-bottom: 6px;
|
||||
border-bottom: 1px solid #2a2a2a;
|
||||
}
|
||||
|
||||
.field-hint {
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
@@ -600,6 +705,78 @@ function isLeagueExpanded(id: string) {
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.actions-col-header {
|
||||
display: inline-flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
padding: 0 4px;
|
||||
box-sizing: border-box;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.actions-col-header__label {
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
color: #aaa;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.actions-col-header :deep(.el-button) {
|
||||
margin: 0 !important;
|
||||
padding: 6px 10px !important;
|
||||
height: 28px !important;
|
||||
min-height: 28px !important;
|
||||
font-size: 12px !important;
|
||||
font-weight: 600;
|
||||
border-radius: 6px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.matches-page .table-wrap :deep(.el-table__header .el-table__cell) {
|
||||
padding: 6px 0;
|
||||
}
|
||||
|
||||
.matches-page .table-wrap :deep(.el-table__header .cell) {
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.league-row-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 6px 8px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.league-action-group {
|
||||
display: inline-flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 4px;
|
||||
padding: 2px 4px;
|
||||
border-radius: 8px;
|
||||
background: rgba(255, 255, 255, 0.02);
|
||||
border: 1px solid rgba(255, 255, 255, 0.05);
|
||||
}
|
||||
|
||||
.league-row-actions :deep(.el-button) {
|
||||
margin: 0 !important;
|
||||
min-width: 52px;
|
||||
padding: 4px 10px !important;
|
||||
font-size: 12px !important;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.league-row-actions :deep(.el-button:not(.is-disabled):not(:disabled)) {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.league-row-actions :deep(.el-button.is-disabled),
|
||||
.league-row-actions :deep(.el-button:disabled) {
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
:deep(.logo-url-field) {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
@@ -381,10 +381,12 @@ async function doUpload() {
|
||||
.file-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
|
||||
align-content: start;
|
||||
gap: 14px;
|
||||
overflow-y: auto;
|
||||
flex: 1;
|
||||
padding-right: 4px;
|
||||
padding-bottom: 8px;
|
||||
}
|
||||
|
||||
.file-card {
|
||||
@@ -448,7 +450,6 @@ async function doUpload() {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
flex: 1;
|
||||
}
|
||||
.card-filename {
|
||||
font-size: 12px;
|
||||
@@ -526,6 +527,14 @@ async function doUpload() {
|
||||
}
|
||||
.muted { color: #333; }
|
||||
|
||||
.file-grid::-webkit-scrollbar { width: 6px; }
|
||||
.file-grid::-webkit-scrollbar-track { background: transparent; }
|
||||
.file-grid::-webkit-scrollbar-thumb {
|
||||
background: #2a2a2a;
|
||||
border-radius: 3px;
|
||||
}
|
||||
.file-grid::-webkit-scrollbar-thumb:hover { background: #444; }
|
||||
|
||||
/* ── Upload dialog ── */
|
||||
.dialog-overlay {
|
||||
position: fixed;
|
||||
|
||||
@@ -69,6 +69,7 @@ const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
||||
const loading = ref(false);
|
||||
const previewing = ref(false);
|
||||
const match = ref<AdminMatchDetail | null>(null);
|
||||
const score = ref({ htHome: 0, htAway: 0, ftHome: 0, ftAway: 0 });
|
||||
const preview = ref<Record<string, unknown> | null>(null);
|
||||
@@ -340,20 +341,6 @@ function settlementApiError(e: unknown, fallback: string) {
|
||||
return raw;
|
||||
}
|
||||
|
||||
async function saveScore() {
|
||||
await api.post(`/admin/matches/${matchId.value}/settlement/score`, score.value);
|
||||
}
|
||||
|
||||
async function recordScore() {
|
||||
try {
|
||||
await saveScore();
|
||||
ElMessage.success(t('msg.score_recorded'));
|
||||
await loadMatch();
|
||||
} catch (e: unknown) {
|
||||
ElMessage.error(settlementApiError(e, t('msg.save_failed')));
|
||||
}
|
||||
}
|
||||
|
||||
async function loadPreviewItems(page = previewPage.value, pageSize = previewPageSize.value) {
|
||||
const batch = preview.value?.batch as { id: string } | undefined;
|
||||
if (!batch) return;
|
||||
@@ -374,9 +361,10 @@ async function loadPreviewItems(page = previewPage.value, pageSize = previewPage
|
||||
async function previewSettlement() {
|
||||
preview.value = null;
|
||||
previewPage.value = 1;
|
||||
previewing.value = true;
|
||||
try {
|
||||
await saveScore();
|
||||
const { data } = await api.post(`/admin/matches/${matchId.value}/settlement/preview`, {
|
||||
...score.value,
|
||||
page: 1,
|
||||
pageSize: previewPageSize.value,
|
||||
});
|
||||
@@ -386,6 +374,8 @@ async function previewSettlement() {
|
||||
previewPageSize.value = itemsPage.pageSize;
|
||||
} catch (e: unknown) {
|
||||
ElMessage.error(settlementApiError(e, t('settlement.preview_failed')));
|
||||
} finally {
|
||||
previewing.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -426,77 +416,76 @@ onMounted(() => {
|
||||
|
||||
<el-card v-if="match" class="settle-top-card" shadow="never">
|
||||
<p v-if="leagueLabel" class="match-league">{{ leagueLabel }}</p>
|
||||
<div class="settle-top-row">
|
||||
<div class="match-inline">
|
||||
<div class="team-chip">
|
||||
<img
|
||||
v-if="match.homeTeamLogoUrl"
|
||||
:src="match.homeTeamLogoUrl"
|
||||
alt=""
|
||||
class="team-logo-sm"
|
||||
loading="lazy"
|
||||
/>
|
||||
<span class="team-name-inline">{{ homeLabel }}</span>
|
||||
<div class="match-inline">
|
||||
<div class="team-chip">
|
||||
<img
|
||||
v-if="match.homeTeamLogoUrl"
|
||||
:src="match.homeTeamLogoUrl"
|
||||
alt=""
|
||||
class="team-logo-sm"
|
||||
loading="lazy"
|
||||
/>
|
||||
<span class="team-name-inline">{{ homeLabel }}</span>
|
||||
</div>
|
||||
<span class="vs">VS</span>
|
||||
<div class="team-chip">
|
||||
<img
|
||||
v-if="match.awayTeamLogoUrl"
|
||||
:src="match.awayTeamLogoUrl"
|
||||
alt=""
|
||||
class="team-logo-sm"
|
||||
loading="lazy"
|
||||
/>
|
||||
<span class="team-name-inline">{{ awayLabel }}</span>
|
||||
</div>
|
||||
<span class="kickoff-inline">
|
||||
<span class="meta-k">{{ t('settlement.kickoff') }}</span>
|
||||
{{ kickoffLabel }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="settle-score-row">
|
||||
<div class="score-inline-group">
|
||||
<div class="score-block compact">
|
||||
<span class="score-title">{{ t('settlement.ht_score') }}</span>
|
||||
<div class="score-inputs">
|
||||
<el-input-number v-model="score.htHome" :min="0" controls-position="right" style="width: 88px" />
|
||||
<span class="score-sep">—</span>
|
||||
<el-input-number v-model="score.htAway" :min="0" controls-position="right" style="width: 88px" />
|
||||
</div>
|
||||
</div>
|
||||
<span class="vs">VS</span>
|
||||
<div class="team-chip">
|
||||
<img
|
||||
v-if="match.awayTeamLogoUrl"
|
||||
:src="match.awayTeamLogoUrl"
|
||||
alt=""
|
||||
class="team-logo-sm"
|
||||
loading="lazy"
|
||||
/>
|
||||
<span class="team-name-inline">{{ awayLabel }}</span>
|
||||
<div class="score-block compact">
|
||||
<span class="score-title">{{ t('settlement.ft_score') }}</span>
|
||||
<div class="score-inputs">
|
||||
<el-input-number v-model="score.ftHome" :min="0" controls-position="right" style="width: 88px" />
|
||||
<span class="score-sep">—</span>
|
||||
<el-input-number v-model="score.ftAway" :min="0" controls-position="right" style="width: 88px" />
|
||||
</div>
|
||||
</div>
|
||||
<span class="kickoff-inline">
|
||||
<span class="meta-k">{{ t('settlement.kickoff') }}</span>
|
||||
{{ kickoffLabel }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="score-panel">
|
||||
<div class="score-inline-group">
|
||||
<div class="score-block compact">
|
||||
<span class="score-title">{{ t('settlement.ht_score') }}</span>
|
||||
<div class="score-inputs">
|
||||
<el-input-number v-model="score.htHome" :min="0" controls-position="right" style="width: 88px" />
|
||||
<span class="score-sep">—</span>
|
||||
<el-input-number v-model="score.htAway" :min="0" controls-position="right" style="width: 88px" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="score-block compact">
|
||||
<span class="score-title">{{ t('settlement.ft_score') }}</span>
|
||||
<div class="score-inputs">
|
||||
<el-input-number v-model="score.ftHome" :min="0" controls-position="right" style="width: 88px" />
|
||||
<span class="score-sep">—</span>
|
||||
<el-input-number v-model="score.ftAway" :min="0" controls-position="right" style="width: 88px" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="action-row">
|
||||
<!-- 智能比分入口已关闭
|
||||
<el-button size="small" type="warning" plain @click="openSmartDialog">
|
||||
{{ t('settlement.smart.btn') }}
|
||||
</el-button>
|
||||
-->
|
||||
<el-button size="small" @click="recordScore">{{ t('settlement.record_score') }}</el-button>
|
||||
<el-button type="primary" size="small" @click="previewSettlement">
|
||||
<div class="settle-actions">
|
||||
<template v-if="!isSettled">
|
||||
<el-button
|
||||
type="primary"
|
||||
:loading="previewing"
|
||||
@click="previewSettlement"
|
||||
>
|
||||
{{ t('settlement.preview_btn') }}
|
||||
</el-button>
|
||||
<span class="preview-hint">{{ t('settlement.preview_hint') }}</span>
|
||||
<template v-if="isSettled">
|
||||
<el-input
|
||||
v-model="resettleReason"
|
||||
size="small"
|
||||
:placeholder="t('settlement.resettle_reason')"
|
||||
style="width: 200px"
|
||||
/>
|
||||
<el-button type="warning" size="small" plain @click="previewResettlement">
|
||||
{{ t('settlement.resettle_preview') }}
|
||||
</el-button>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<el-input
|
||||
v-model="resettleReason"
|
||||
size="small"
|
||||
:placeholder="t('settlement.resettle_reason')"
|
||||
class="settle-resettle-reason"
|
||||
/>
|
||||
<el-button type="warning" plain @click="previewResettlement">
|
||||
{{ t('settlement.resettle_preview') }}
|
||||
</el-button>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
@@ -741,12 +730,27 @@ onMounted(() => {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.settle-top-row {
|
||||
.settle-score-row {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
justify-content: space-between;
|
||||
gap: 16px 24px;
|
||||
flex-wrap: wrap;
|
||||
margin-top: 12px;
|
||||
padding-top: 12px;
|
||||
border-top: 1px solid #2a2a2a;
|
||||
}
|
||||
|
||||
.settle-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 20px;
|
||||
gap: 10px;
|
||||
flex-wrap: wrap;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.settle-resettle-reason {
|
||||
width: 220px;
|
||||
}
|
||||
|
||||
.match-inline {
|
||||
@@ -789,14 +793,6 @@ onMounted(() => {
|
||||
margin-right: 4px;
|
||||
}
|
||||
|
||||
.score-panel {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 12px 16px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.score-inline-group {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
@@ -949,13 +945,6 @@ onMounted(() => {
|
||||
font-weight: 300;
|
||||
}
|
||||
|
||||
.action-row {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.preview-hint {
|
||||
font-size: 12px;
|
||||
color: var(--el-text-color-secondary);
|
||||
|
||||
198
apps/admin/src/views/dashboard/DashboardMatches.vue
Normal file
198
apps/admin/src/views/dashboard/DashboardMatches.vue
Normal file
@@ -0,0 +1,198 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useAdminDashboard } from '../../composables/useAdminDashboard';
|
||||
import EChartPanel from '../../components/dashboard/EChartPanel.vue';
|
||||
import { buildCombinedTrendOption, buildTriplePieOption } from '../../utils/dashboard-charts';
|
||||
import { betStatusLabel } from '../../utils/bet-labels';
|
||||
import { useAdminLocale } from '../../composables/useAdminLocale';
|
||||
|
||||
const { t } = useAdminLocale();
|
||||
const router = useRouter();
|
||||
const {
|
||||
s,
|
||||
loading,
|
||||
loadError,
|
||||
load,
|
||||
formatTime,
|
||||
toNum,
|
||||
chartI18n,
|
||||
trendLabels,
|
||||
kpiPrimary,
|
||||
fmtCount,
|
||||
} = useAdminDashboard();
|
||||
|
||||
onMounted(() => {
|
||||
void load();
|
||||
});
|
||||
|
||||
type KpiLink = { path: string; query?: Record<string, string> };
|
||||
|
||||
function goKpiLink(link: KpiLink) {
|
||||
router.push(link.query ? { path: link.path, query: link.query } : link.path);
|
||||
}
|
||||
|
||||
const mainTrendOption = computed(() =>
|
||||
buildCombinedTrendOption(
|
||||
trendLabels.value,
|
||||
[
|
||||
{
|
||||
name: t('dash.chart_stake'),
|
||||
color: '#248f54',
|
||||
values: s.value?.trend7d?.map((d) => toNum(d.stake)) ?? [],
|
||||
},
|
||||
{
|
||||
name: t('dash.chart_payout'),
|
||||
color: '#60a5fa',
|
||||
values: s.value?.trend7d?.map((d) => toNum(d.payout)) ?? [],
|
||||
},
|
||||
{
|
||||
name: t('dash.chart_ggr'),
|
||||
color: '#a78bfa',
|
||||
values: s.value?.trend7d?.map((d) => toNum(d.ggr)) ?? [],
|
||||
},
|
||||
],
|
||||
s.value?.trend7d?.map((d) => d.betCount) ?? [],
|
||||
chartI18n.value,
|
||||
),
|
||||
);
|
||||
|
||||
const distributionOption = computed(() => {
|
||||
const m = s.value?.matches;
|
||||
const raw = s.value?.bets.todayByStatus ?? {};
|
||||
const betColors: Record<string, string> = {
|
||||
PENDING: '#fb923c',
|
||||
WON: '#248f54',
|
||||
LOST: '#f87171',
|
||||
VOID: '#6b7280',
|
||||
REFUNDED: '#60a5fa',
|
||||
};
|
||||
|
||||
const matchSegs = m
|
||||
? [
|
||||
{ label: t('dash.match_draft'), value: m.draft, color: '#6b7280' },
|
||||
{ label: t('dash.match_published'), value: m.published, color: '#248f54' },
|
||||
{ label: t('dash.match_closed'), value: m.closed, color: '#60a5fa' },
|
||||
{ label: t('dash.match_pending_settle'), value: m.pendingSettlement, color: '#fb923c' },
|
||||
{ label: t('dash.match_settled'), value: m.settled ?? 0, color: '#5eead4' },
|
||||
].filter((x) => x.value > 0)
|
||||
: [];
|
||||
|
||||
const betSegs = ['PENDING', 'WON', 'LOST', 'VOID', 'REFUNDED']
|
||||
.filter((k) => raw[k]?.count)
|
||||
.map((k) => ({
|
||||
label: betStatusLabel(k),
|
||||
value: raw[k].count,
|
||||
color: betColors[k] ?? '#888',
|
||||
}));
|
||||
|
||||
return buildTriplePieOption(
|
||||
[
|
||||
{ title: t('dash.pie_matches'), segments: matchSegs },
|
||||
{ title: t('dash.pie_bets'), segments: betSegs },
|
||||
{ title: '', segments: [] },
|
||||
],
|
||||
chartI18n.value,
|
||||
);
|
||||
});
|
||||
|
||||
const kpiMatch = computed(() => {
|
||||
if (!s.value) return [];
|
||||
const m = s.value.matches;
|
||||
const pendingMatches = m.pendingSettlement ?? 0;
|
||||
return [
|
||||
{
|
||||
label: t('dash.kpi_match_total'),
|
||||
value: fmtCount(m.total),
|
||||
sub: t('dash.kpi_match_total_sub', {
|
||||
draft: fmtCount(m.draft),
|
||||
published: fmtCount(m.published),
|
||||
}),
|
||||
},
|
||||
{
|
||||
label: t('dash.kpi_match_closed'),
|
||||
value: fmtCount(m.closed),
|
||||
sub: t('dash.kpi_match_closed_sub', { n: fmtCount(m.cancelled ?? 0) }),
|
||||
},
|
||||
{
|
||||
label: t('dash.kpi_pending'),
|
||||
value: `${fmtCount(s.value.bets.pendingTotal)} ${t('common.bets_unit')}`,
|
||||
sub: t('dash.kpi_pending_sub', {
|
||||
bets: fmtCount(s.value.bets.pendingTotal),
|
||||
matches: fmtCount(pendingMatches),
|
||||
}),
|
||||
link:
|
||||
pendingMatches > 0
|
||||
? { path: '/matches', query: { status: 'PENDING_SETTLEMENT' } }
|
||||
: undefined,
|
||||
},
|
||||
{
|
||||
label: t('dash.kpi_match_settled'),
|
||||
value: fmtCount(m.settled ?? 0),
|
||||
sub: t('dash.kpi_match_settled_sub'),
|
||||
},
|
||||
];
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="dashboard-page" v-loading="loading">
|
||||
<el-card v-if="!loading && loadError" class="state-card" shadow="never">
|
||||
<p class="state-title">{{ t('msg.load_failed') }}</p>
|
||||
<p class="state-hint">{{ t('dash.load_error_hint') }}</p>
|
||||
<el-button type="primary" size="small" @click="load(true)">{{ t('common.retry') }}</el-button>
|
||||
</el-card>
|
||||
|
||||
<template v-else-if="s">
|
||||
<el-card class="overview-board" shadow="never">
|
||||
<div v-if="s.generatedAt" class="board-head">
|
||||
<span class="board-hint">{{ t('dash.section_matches_hint') }}</span>
|
||||
<span class="dash-updated">
|
||||
{{ t('common.updated_at') }} {{ formatTime(s.generatedAt) }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="kpi-grid kpi-primary">
|
||||
<div v-for="item in kpiPrimary" :key="item.label" class="kpi-cell">
|
||||
<span class="kpi-label">{{ item.label }}</span>
|
||||
<span class="kpi-value">{{ item.value }}</span>
|
||||
<span class="kpi-sub">{{ item.sub }}</span>
|
||||
<span
|
||||
class="kpi-delta"
|
||||
:class="{ up: item.delta.startsWith('+'), down: item.delta.startsWith('-') }"
|
||||
>
|
||||
{{ t('common.vs_yesterday') }} {{ item.delta }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="kpi-grid kpi-secondary">
|
||||
<div
|
||||
v-for="item in kpiMatch"
|
||||
:key="item.label"
|
||||
class="kpi-cell compact"
|
||||
:class="{ 'kpi-cell--link': item.link }"
|
||||
:role="item.link ? 'button' : undefined"
|
||||
:tabindex="item.link ? 0 : undefined"
|
||||
@click="item.link && goKpiLink(item.link)"
|
||||
@keydown.enter.prevent="item.link && goKpiLink(item.link)"
|
||||
>
|
||||
<span class="kpi-label">{{ item.label }}</span>
|
||||
<span class="kpi-value sm">{{ item.value }}</span>
|
||||
<span class="kpi-sub">{{ item.sub }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="charts-stack">
|
||||
<EChartPanel title="" :option="mainTrendOption" height="300px" class="chart-main" />
|
||||
<div class="chart-main-caption">{{ t('dash.trend_caption') }}</div>
|
||||
<EChartPanel title="" :option="distributionOption" height="200px" class="chart-dist" />
|
||||
</div>
|
||||
</el-card>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
@import './dashboard-board.css';
|
||||
</style>
|
||||
191
apps/admin/src/views/dashboard/DashboardPlayers.vue
Normal file
191
apps/admin/src/views/dashboard/DashboardPlayers.vue
Normal file
@@ -0,0 +1,191 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted } from 'vue';
|
||||
import { useAdminDashboard } from '../../composables/useAdminDashboard';
|
||||
import EChartPanel from '../../components/dashboard/EChartPanel.vue';
|
||||
import { buildTriplePieOption } from '../../utils/dashboard-charts';
|
||||
import { betStatusLabel } from '../../utils/bet-labels';
|
||||
import { formatAmount } from '../../utils/format-amount';
|
||||
import { useAdminLocale } from '../../composables/useAdminLocale';
|
||||
|
||||
const { t, locale, localeTag } = useAdminLocale();
|
||||
const {
|
||||
s,
|
||||
loading,
|
||||
loadError,
|
||||
load,
|
||||
formatTime,
|
||||
chartI18n,
|
||||
fmtCount,
|
||||
} = useAdminDashboard();
|
||||
|
||||
onMounted(() => {
|
||||
void load();
|
||||
});
|
||||
|
||||
const kpiPlayer = computed(() => {
|
||||
if (!s.value) return [];
|
||||
return [
|
||||
{
|
||||
label: t('dash.kpi_users'),
|
||||
value: `${fmtCount(s.value.users.playersTotal)} / ${fmtCount(s.value.users.agentsTotal)}`,
|
||||
sub: t('dash.kpi_new_players', { n: fmtCount(s.value.today.newPlayers) }),
|
||||
},
|
||||
{
|
||||
label: t('dash.kpi_agents_active'),
|
||||
value: fmtCount(s.value.users.agentsActive),
|
||||
sub: t('dash.kpi_agents_active_sub', {
|
||||
suspended: fmtCount(s.value.users.playersSuspended),
|
||||
}),
|
||||
},
|
||||
{
|
||||
label: t('dash.kpi_wallet'),
|
||||
value: formatAmount(s.value.wallets.totalAvailable, 2, locale.value),
|
||||
sub: `${t('common.frozen')} ${formatAmount(s.value.wallets.totalFrozen, 2, locale.value)}`,
|
||||
},
|
||||
{
|
||||
label: t('dash.kpi_credit'),
|
||||
value: formatAmount(s.value.agents.totalAvailableCredit, 2, locale.value),
|
||||
sub: `${t('common.used')} ${formatAmount(s.value.agents.totalUsedCredit, 2, locale.value)}`,
|
||||
},
|
||||
];
|
||||
});
|
||||
|
||||
const userDistributionOption = computed(() => {
|
||||
const u = s.value?.users;
|
||||
const userSegs = u
|
||||
? [
|
||||
{ label: t('dash.user_active'), value: u.playersActive, color: '#248f54' },
|
||||
{ label: t('dash.user_suspended'), value: u.playersSuspended, color: '#f87171' },
|
||||
{ label: t('dash.user_direct'), value: u.playersDirect, color: '#60a5fa' },
|
||||
{ label: t('dash.user_agents'), value: u.agentsTotal, color: '#a78bfa' },
|
||||
].filter((x) => x.value > 0)
|
||||
: [];
|
||||
|
||||
return buildTriplePieOption(
|
||||
[
|
||||
{ title: t('dash.pie_users'), segments: userSegs },
|
||||
{ title: '', segments: [] },
|
||||
{ title: '', segments: [] },
|
||||
],
|
||||
chartI18n.value,
|
||||
);
|
||||
});
|
||||
|
||||
function formatBetTime(v: string) {
|
||||
return new Date(v).toLocaleString(localeTag.value, {
|
||||
month: '2-digit',
|
||||
day: '2-digit',
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="dashboard-page" v-loading="loading">
|
||||
<el-card v-if="!loading && loadError" class="state-card" shadow="never">
|
||||
<p class="state-title">{{ t('msg.load_failed') }}</p>
|
||||
<p class="state-hint">{{ t('dash.load_error_hint') }}</p>
|
||||
<el-button type="primary" size="small" @click="load(true)">{{ t('common.retry') }}</el-button>
|
||||
</el-card>
|
||||
|
||||
<template v-else-if="s">
|
||||
<el-card class="overview-board" shadow="never">
|
||||
<div v-if="s.generatedAt" class="board-head">
|
||||
<span class="board-hint">{{ t('dash.section_players_hint') }}</span>
|
||||
<span class="dash-updated">
|
||||
{{ t('common.updated_at') }} {{ formatTime(s.generatedAt) }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="kpi-grid kpi-secondary">
|
||||
<div v-for="item in kpiPlayer" :key="item.label" class="kpi-cell compact">
|
||||
<span class="kpi-label">{{ item.label }}</span>
|
||||
<span class="kpi-value sm">{{ item.value }}</span>
|
||||
<span class="kpi-sub">{{ item.sub }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="charts-stack">
|
||||
<EChartPanel title="" :option="userDistributionOption" height="200px" class="chart-dist" />
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
<div class="recent-grid">
|
||||
<el-card class="recent-card" shadow="never">
|
||||
<h3 class="recent-title">{{ t('dash.recent_players') }}</h3>
|
||||
<el-table :data="s.recentPlayers" stripe empty-text="—" size="small">
|
||||
<el-table-column prop="username" :label="t('user.col.username')" min-width="120" />
|
||||
<el-table-column prop="parentUsername" :label="t('dash.col_parent')" min-width="100">
|
||||
<template #default="{ row }">
|
||||
{{ row.parentUsername || t('common.platform_direct') }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="status" :label="t('common.status')" width="88" />
|
||||
<el-table-column prop="createdAt" :label="t('user.col.created')" min-width="120">
|
||||
<template #default="{ row }">
|
||||
{{ formatBetTime(row.createdAt) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
|
||||
<el-card class="recent-card" shadow="never">
|
||||
<h3 class="recent-title">{{ t('dash.recent_bets') }}</h3>
|
||||
<el-table :data="s.recentBets" stripe empty-text="—" size="small">
|
||||
<el-table-column prop="betNo" :label="t('dash.col_bet_no')" min-width="120" />
|
||||
<el-table-column prop="username" :label="t('user.col.username')" min-width="100" />
|
||||
<el-table-column prop="stake" :label="t('dash.col_stake')" min-width="88">
|
||||
<template #default="{ row }">
|
||||
{{ formatAmount(row.stake, 2, locale) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="status" :label="t('common.status')" width="88">
|
||||
<template #default="{ row }">
|
||||
{{ betStatusLabel(row.status) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="placedAt" :label="t('dash.col_placed_at')" min-width="120">
|
||||
<template #default="{ row }">
|
||||
{{ formatBetTime(row.placedAt) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
@import './dashboard-board.css';
|
||||
|
||||
.recent-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.recent-card {
|
||||
border-radius: 14px;
|
||||
border: 1px solid #1e1e1e;
|
||||
background: rgba(255, 255, 255, 0.02);
|
||||
}
|
||||
|
||||
.recent-card :deep(.el-card__body) {
|
||||
padding: 16px 18px 12px;
|
||||
}
|
||||
|
||||
.recent-title {
|
||||
margin: 0 0 12px;
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
color: #ccc;
|
||||
}
|
||||
|
||||
@media (max-width: 960px) {
|
||||
.recent-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
179
apps/admin/src/views/dashboard/dashboard-board.css
Normal file
179
apps/admin/src/views/dashboard/dashboard-board.css
Normal file
@@ -0,0 +1,179 @@
|
||||
.dashboard-page {
|
||||
padding-bottom: 32px;
|
||||
}
|
||||
|
||||
.state-card {
|
||||
border-radius: 14px;
|
||||
border: 1px solid #2a2220;
|
||||
background: rgba(255, 69, 58, 0.06);
|
||||
text-align: center;
|
||||
padding: 8px 0 4px;
|
||||
}
|
||||
|
||||
.state-title {
|
||||
font-size: 15px;
|
||||
font-weight: 700;
|
||||
color: #ff8a80;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
.state-hint {
|
||||
font-size: 13px;
|
||||
color: #888;
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
|
||||
.overview-board {
|
||||
border-radius: 14px;
|
||||
border: 1px solid #1e1e1e;
|
||||
background: linear-gradient(180deg, rgba(36, 143, 84, 0.06) 0%, rgba(0, 0, 0, 0) 120px);
|
||||
margin-bottom: 28px;
|
||||
}
|
||||
|
||||
.overview-board :deep(.el-card__body) {
|
||||
padding: 20px 22px 16px;
|
||||
}
|
||||
|
||||
.board-head {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
margin: -4px 0 14px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.board-hint {
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.dash-updated {
|
||||
font-size: 11px;
|
||||
color: #555;
|
||||
letter-spacing: 0.02em;
|
||||
}
|
||||
|
||||
.kpi-grid {
|
||||
display: grid;
|
||||
gap: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.kpi-primary {
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
}
|
||||
|
||||
.kpi-secondary {
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
|
||||
.kpi-cell {
|
||||
padding: 12px 14px;
|
||||
border-radius: 10px;
|
||||
border: 1px solid #222;
|
||||
background: rgba(255, 255, 255, 0.03);
|
||||
}
|
||||
|
||||
.kpi-cell.compact {
|
||||
padding: 10px 12px;
|
||||
}
|
||||
|
||||
.kpi-cell--link {
|
||||
cursor: pointer;
|
||||
transition: border-color 0.15s, background 0.15s;
|
||||
}
|
||||
|
||||
.kpi-cell--link:hover,
|
||||
.kpi-cell--link:focus-visible {
|
||||
border-color: rgba(77, 214, 138, 0.35);
|
||||
background: rgba(36, 143, 84, 0.1);
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.kpi-label {
|
||||
display: block;
|
||||
font-size: 11px;
|
||||
color: #666;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
.kpi-value {
|
||||
display: block;
|
||||
font-size: 22px;
|
||||
font-weight: 800;
|
||||
color: var(--green-text);
|
||||
line-height: 1.15;
|
||||
letter-spacing: -0.5px;
|
||||
}
|
||||
|
||||
.kpi-value.sm {
|
||||
font-size: 17px;
|
||||
}
|
||||
|
||||
.kpi-sub {
|
||||
display: block;
|
||||
font-size: 11px;
|
||||
color: #555;
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.kpi-delta {
|
||||
display: inline-block;
|
||||
margin-top: 6px;
|
||||
font-size: 10px;
|
||||
font-weight: 600;
|
||||
color: #888;
|
||||
padding: 2px 6px;
|
||||
border-radius: 4px;
|
||||
background: rgba(255, 255, 255, 0.04);
|
||||
}
|
||||
|
||||
.kpi-delta.up {
|
||||
color: #4ade80;
|
||||
}
|
||||
|
||||
.kpi-delta.down {
|
||||
color: #f87171;
|
||||
}
|
||||
|
||||
.charts-stack {
|
||||
border-top: 1px solid #1a1a1a;
|
||||
padding-top: 12px;
|
||||
}
|
||||
|
||||
.chart-main-caption {
|
||||
font-size: 11px;
|
||||
color: #555;
|
||||
text-align: center;
|
||||
margin: -8px 0 8px;
|
||||
}
|
||||
|
||||
.charts-stack :deep(.chart-panel) {
|
||||
border: none;
|
||||
background: transparent;
|
||||
padding: 8px 0 0;
|
||||
}
|
||||
|
||||
.charts-stack :deep(.chart-title:empty) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.chart-dist {
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
@media (max-width: 1200px) {
|
||||
.kpi-primary,
|
||||
.kpi-secondary {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.kpi-primary,
|
||||
.kpi-secondary {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
@@ -83,6 +83,8 @@ export type AdminMatchDetail = {
|
||||
isHot: boolean;
|
||||
displayOrder: number;
|
||||
startTime: string;
|
||||
leagueId?: string;
|
||||
leagueCode?: string;
|
||||
leagueEn: string;
|
||||
leagueZh: string;
|
||||
leagueMs: string;
|
||||
@@ -127,7 +129,7 @@ export function normalizeStartTimeForApi(value: string): string {
|
||||
|
||||
export function formFromDetail(d: AdminMatchDetail): MatchCreateForm {
|
||||
return {
|
||||
leagueId: '',
|
||||
leagueId: d.leagueId ?? '',
|
||||
leagueEn: d.leagueEn,
|
||||
leagueZh: d.leagueZh,
|
||||
leagueMs: d.leagueMs ?? '',
|
||||
@@ -246,3 +248,47 @@ export function buildPlatformPayload(form: MatchCreateForm) {
|
||||
awayTeamLogoUrl: form.awayTeamLogoUrl.trim() || undefined,
|
||||
};
|
||||
}
|
||||
|
||||
/** 编辑单场基本信息(不含联赛字段,联赛在赛事列表单独维护) */
|
||||
export function buildMatchUpdatePayload(form: MatchCreateForm) {
|
||||
if (!form.startTime.trim()) {
|
||||
throw new FormValidationError('err.kickoff_required');
|
||||
}
|
||||
const homeCode = form.homeTeamCode.trim().toUpperCase();
|
||||
const awayCode = form.awayTeamCode.trim().toUpperCase();
|
||||
if (homeCode && awayCode) {
|
||||
if (homeCode === awayCode) {
|
||||
throw new FormValidationError('err.teams_same');
|
||||
}
|
||||
} else if (homeCode || awayCode) {
|
||||
throw new FormValidationError('err.team_country_required');
|
||||
} else {
|
||||
const homeOk = form.homeTeamZh.trim() || form.homeTeamEn.trim() || form.homeTeamMs.trim();
|
||||
const awayOk = form.awayTeamZh.trim() || form.awayTeamEn.trim() || form.awayTeamMs.trim();
|
||||
if (!homeOk || !awayOk) {
|
||||
throw new FormValidationError('err.team_country_required');
|
||||
}
|
||||
const homeKey = `${form.homeTeamZh.trim()}|${form.homeTeamEn.trim()}|${form.homeTeamMs.trim()}`.toLowerCase();
|
||||
const awayKey = `${form.awayTeamZh.trim()}|${form.awayTeamEn.trim()}|${form.awayTeamMs.trim()}`.toLowerCase();
|
||||
if (homeKey === awayKey) {
|
||||
throw new FormValidationError('err.teams_same');
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
homeTeamEn: form.homeTeamEn.trim(),
|
||||
homeTeamZh: form.homeTeamZh.trim(),
|
||||
homeTeamMs: form.homeTeamMs.trim() || undefined,
|
||||
awayTeamEn: form.awayTeamEn.trim(),
|
||||
awayTeamZh: form.awayTeamZh.trim(),
|
||||
awayTeamMs: form.awayTeamMs.trim() || undefined,
|
||||
startTime: normalizeStartTimeForApi(form.startTime),
|
||||
isHot: form.isHot,
|
||||
displayOrder: form.displayOrder,
|
||||
matchName: form.matchName.trim() || undefined,
|
||||
stage: form.stage.trim() || undefined,
|
||||
groupName: form.groupName.trim() || undefined,
|
||||
homeTeamLogoUrl: form.homeTeamLogoUrl.trim() || undefined,
|
||||
awayTeamLogoUrl: form.awayTeamLogoUrl.trim() || undefined,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -193,11 +193,6 @@ defineExpose({ reload: load });
|
||||
|
||||
<template>
|
||||
<div class="league-matches-panel">
|
||||
<div class="panel-toolbar">
|
||||
<el-button type="primary" size="small" @click="emit('add-match')">
|
||||
{{ t('match.create_fixture_btn') }}
|
||||
</el-button>
|
||||
</div>
|
||||
<el-table v-loading="loading" :data="matches" stripe row-key="id" class="nested-match-table">
|
||||
<el-table-column prop="id" label="ID" width="64" />
|
||||
<el-table-column :label="t('match.col.matchup')" min-width="180">
|
||||
@@ -229,7 +224,15 @@ defineExpose({ reload: load });
|
||||
<span v-else class="bet-stat-zero">0</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('common.actions')" width="460" align="center">
|
||||
<el-table-column width="460" align="center">
|
||||
<template #header>
|
||||
<div class="actions-col-header">
|
||||
<span class="actions-col-header__label">{{ t('common.actions') }}</span>
|
||||
<el-button type="primary" size="small" @click.stop="emit('add-match')">
|
||||
{{ t('match.create_fixture_btn') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
<template #default="{ row }">
|
||||
<div class="action-btns">
|
||||
<div class="action-group">
|
||||
@@ -299,8 +302,41 @@ defineExpose({ reload: load });
|
||||
padding: 10px 12px 12px;
|
||||
background: #0a0a0a;
|
||||
}
|
||||
.panel-toolbar {
|
||||
margin-bottom: 8px;
|
||||
.actions-col-header {
|
||||
display: inline-flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
padding: 0 4px;
|
||||
box-sizing: border-box;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.actions-col-header__label {
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
color: #aaa;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.actions-col-header :deep(.el-button) {
|
||||
margin: 0 !important;
|
||||
padding: 6px 10px !important;
|
||||
height: 28px !important;
|
||||
min-height: 28px !important;
|
||||
font-size: 12px !important;
|
||||
font-weight: 600;
|
||||
border-radius: 6px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.nested-match-table :deep(.el-table__header .el-table__cell) {
|
||||
padding: 6px 0;
|
||||
}
|
||||
|
||||
.nested-match-table :deep(.el-table__header .cell) {
|
||||
overflow: visible;
|
||||
}
|
||||
.empty-hint {
|
||||
font-size: 12px;
|
||||
@@ -338,5 +374,15 @@ defineExpose({ reload: load });
|
||||
min-width: 52px;
|
||||
padding: 4px 10px !important;
|
||||
font-size: 12px !important;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.action-btns :deep(.el-button:not(.is-disabled):not(:disabled)) {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.action-btns :deep(.el-button.is-disabled),
|
||||
.action-btns :deep(.el-button:disabled) {
|
||||
cursor: not-allowed;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -3,6 +3,7 @@ import { computed, ref, watch } from 'vue';
|
||||
import { ElMessage, ElMessageBox } from 'element-plus';
|
||||
import { useAdminLocale } from '../../composables/useAdminLocale';
|
||||
import api from '../../api';
|
||||
import LogoUrlField from '../../components/LogoUrlField.vue';
|
||||
import {
|
||||
BUILTIN_COUNTRIES,
|
||||
countryFlagUrl,
|
||||
@@ -28,7 +29,7 @@ interface AddableTeam {
|
||||
logoUrl: string | null;
|
||||
}
|
||||
|
||||
type AddFilter = 'fixture' | 'all';
|
||||
type AddFilter = 'all' | 'custom';
|
||||
type SortKey = 'rank' | 'name' | 'code' | 'odds' | 'saved_odds';
|
||||
type SortDir = 'asc' | 'desc';
|
||||
|
||||
@@ -57,13 +58,13 @@ const savingOdds = ref(false);
|
||||
const adding = ref(false);
|
||||
const matchId = ref('');
|
||||
const selections = ref<SelectionRow[]>([]);
|
||||
const addableFixtureTeams = ref<AddableTeam[]>([]);
|
||||
|
||||
const addVisible = ref(false);
|
||||
const addFilter = ref<AddFilter>('fixture');
|
||||
const addFilter = ref<AddFilter>('all');
|
||||
const addSearch = ref('');
|
||||
const selectedCodes = ref<Set<string>>(new Set());
|
||||
const defaultOdds = ref(10);
|
||||
const customTeam = ref({ teamCode: '', teamZh: '', teamEn: '', logoUrl: '' });
|
||||
|
||||
const batchMode = ref(false);
|
||||
const batchSelectedIds = ref<Set<string>>(new Set());
|
||||
@@ -86,11 +87,7 @@ const allBuiltinAddable = computed<AddableTeam[]>(() =>
|
||||
})),
|
||||
);
|
||||
|
||||
const sourceTeams = computed<AddableTeam[]>(() =>
|
||||
addFilter.value === 'fixture'
|
||||
? addableFixtureTeams.value
|
||||
: allBuiltinAddable.value,
|
||||
);
|
||||
const sourceTeams = computed<AddableTeam[]>(() => allBuiltinAddable.value);
|
||||
|
||||
const visibleAddTeams = computed(() => {
|
||||
const q = addSearch.value.trim().toLowerCase();
|
||||
@@ -143,6 +140,8 @@ async function load() {
|
||||
const { data } = await api.get(`/admin/leagues/${props.leagueId}/outright`);
|
||||
const payload = data.data as {
|
||||
id: string;
|
||||
fixtureSyncAdded?: number;
|
||||
fixtureSyncReopened?: number;
|
||||
selections: Array<{
|
||||
id: string;
|
||||
teamCode: string;
|
||||
@@ -153,10 +152,8 @@ async function load() {
|
||||
odds: string;
|
||||
status: string;
|
||||
}>;
|
||||
addableFixtureTeams?: AddableTeam[];
|
||||
};
|
||||
matchId.value = payload.id;
|
||||
addableFixtureTeams.value = payload.addableFixtureTeams ?? [];
|
||||
selections.value = (payload.selections ?? [])
|
||||
.filter((s) => s.status === 'OPEN')
|
||||
.map((s) => ({
|
||||
@@ -168,6 +165,10 @@ async function load() {
|
||||
batchSelectedIds.value = new Set(
|
||||
[...batchSelectedIds.value].filter((id) => openIds.has(id)),
|
||||
);
|
||||
const added = payload.fixtureSyncAdded ?? 0;
|
||||
if (added > 0) {
|
||||
ElMessage.success(t('outright.fixture_sync_added', { n: added }));
|
||||
}
|
||||
} catch (e: unknown) {
|
||||
const err = e as { response?: { data?: { error?: string } } };
|
||||
ElMessage.error(err.response?.data?.error ?? t('msg.load_failed'));
|
||||
@@ -176,23 +177,26 @@ async function load() {
|
||||
}
|
||||
}
|
||||
|
||||
function resetCustomTeamForm() {
|
||||
customTeam.value = { teamCode: '', teamZh: '', teamEn: '', logoUrl: '' };
|
||||
}
|
||||
|
||||
function onCustomCodeInput(value: string) {
|
||||
customTeam.value.teamCode = value.toUpperCase().replace(/[^A-Z0-9_]/g, '');
|
||||
}
|
||||
|
||||
function openAddDialog() {
|
||||
addFilter.value = 'fixture';
|
||||
addFilter.value = 'all';
|
||||
addSearch.value = '';
|
||||
defaultOdds.value = 10;
|
||||
selectedCodes.value = new Set(
|
||||
addableFixtureTeams.value.map((team) => team.teamCode),
|
||||
);
|
||||
resetCustomTeamForm();
|
||||
selectedCodes.value = new Set();
|
||||
addVisible.value = true;
|
||||
}
|
||||
|
||||
function onAddFilterChange() {
|
||||
addSearch.value = '';
|
||||
if (addFilter.value === 'fixture') {
|
||||
selectedCodes.value = new Set(
|
||||
addableFixtureTeams.value.map((team) => team.teamCode),
|
||||
);
|
||||
} else {
|
||||
if (addFilter.value === 'all') {
|
||||
selectedCodes.value = new Set();
|
||||
}
|
||||
}
|
||||
@@ -319,6 +323,58 @@ async function saveOdds() {
|
||||
}
|
||||
}
|
||||
|
||||
async function submitCustomAdd() {
|
||||
if (!matchId.value) return;
|
||||
const code = customTeam.value.teamCode.trim().toUpperCase();
|
||||
const teamZh = customTeam.value.teamZh.trim();
|
||||
const teamEn = customTeam.value.teamEn.trim();
|
||||
if (!code) {
|
||||
ElMessage.warning(t('outright.add.err_code_required'));
|
||||
return;
|
||||
}
|
||||
if (!teamZh && !teamEn) {
|
||||
ElMessage.warning(t('outright.add.err_name_required'));
|
||||
return;
|
||||
}
|
||||
if (defaultOdds.value <= 1) {
|
||||
ElMessage.warning(t('outright.err_odds_min'));
|
||||
return;
|
||||
}
|
||||
if (openTeamCodes.value.has(code)) {
|
||||
ElMessage.warning(t('outright.add.err_duplicate'));
|
||||
return;
|
||||
}
|
||||
|
||||
adding.value = true;
|
||||
try {
|
||||
await api.post(`/admin/outrights/${matchId.value}/selections`, {
|
||||
teamCode: code,
|
||||
teamZh: teamZh || teamEn,
|
||||
teamEn: teamEn || teamZh,
|
||||
logoUrl: customTeam.value.logoUrl.trim() || undefined,
|
||||
odds: defaultOdds.value,
|
||||
});
|
||||
ElMessage.success(t('msg.saved'));
|
||||
addVisible.value = false;
|
||||
resetCustomTeamForm();
|
||||
await load();
|
||||
emit('updated');
|
||||
} catch (e: unknown) {
|
||||
const err = e as { response?: { data?: { error?: string } } };
|
||||
ElMessage.error(err.response?.data?.error ?? t('msg.save_failed'));
|
||||
} finally {
|
||||
adding.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function onAddConfirm() {
|
||||
if (addFilter.value === 'custom') {
|
||||
void submitCustomAdd();
|
||||
return;
|
||||
}
|
||||
void submitAdd();
|
||||
}
|
||||
|
||||
async function submitAdd() {
|
||||
if (!matchId.value) return;
|
||||
if (selectedCodes.value.size === 0) {
|
||||
@@ -331,10 +387,7 @@ async function submitAdd() {
|
||||
}
|
||||
|
||||
const byCode = new Map(
|
||||
[...addableFixtureTeams.value, ...allBuiltinAddable.value].map((team) => [
|
||||
team.teamCode,
|
||||
team,
|
||||
]),
|
||||
allBuiltinAddable.value.map((team) => [team.teamCode, team]),
|
||||
);
|
||||
|
||||
const items = [...selectedCodes.value]
|
||||
@@ -578,17 +631,15 @@ watch(
|
||||
>
|
||||
<div class="add-teams-dialog__toolbar">
|
||||
<el-radio-group v-model="addFilter" size="small" @change="onAddFilterChange">
|
||||
<el-radio-button value="fixture">
|
||||
{{ t('outright.add.filter_fixture') }}
|
||||
<span v-if="addableFixtureTeams.length" class="add-teams-dialog__badge">
|
||||
{{ addableFixtureTeams.length }}
|
||||
</span>
|
||||
</el-radio-button>
|
||||
<el-radio-button value="all">
|
||||
{{ t('outright.add.filter_all') }}
|
||||
</el-radio-button>
|
||||
<el-radio-button value="custom">
|
||||
{{ t('outright.add.filter_custom') }}
|
||||
</el-radio-button>
|
||||
</el-radio-group>
|
||||
<el-input
|
||||
v-if="addFilter !== 'custom'"
|
||||
v-model="addSearch"
|
||||
size="small"
|
||||
clearable
|
||||
@@ -597,6 +648,45 @@ watch(
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div v-if="addFilter === 'custom'" class="add-teams-dialog__custom">
|
||||
<p class="add-teams-dialog__custom-hint">{{ t('outright.add.custom_hint') }}</p>
|
||||
<el-form label-width="88px" label-position="left" @submit.prevent="onAddConfirm">
|
||||
<el-form-item :label="t('outright.add.field_code')" required>
|
||||
<el-input
|
||||
:model-value="customTeam.teamCode"
|
||||
size="small"
|
||||
maxlength="32"
|
||||
:placeholder="t('outright.add.ph_code')"
|
||||
@update:model-value="onCustomCodeInput"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="t('match.field.lang_zh')">
|
||||
<el-input v-model="customTeam.teamZh" size="small" :placeholder="t('outright.add.ph_name_zh')" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="t('match.field.lang_en')">
|
||||
<el-input v-model="customTeam.teamEn" size="small" :placeholder="t('outright.add.ph_name_en')" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="t('outright.add.field_logo')">
|
||||
<LogoUrlField
|
||||
v-model="customTeam.logoUrl"
|
||||
upload-only
|
||||
upload-category="teams"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="t('outright.add.default_odds')" required>
|
||||
<el-input-number
|
||||
v-model="defaultOdds"
|
||||
:min="1.01"
|
||||
:step="0.05"
|
||||
:precision="2"
|
||||
size="small"
|
||||
controls-position="right"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<template v-else>
|
||||
<div class="add-teams-dialog__actions">
|
||||
<el-button size="small" link type="primary" @click="selectAllVisible">
|
||||
{{ t('outright.add.select_all') }}
|
||||
@@ -645,20 +735,17 @@ watch(
|
||||
</button>
|
||||
</div>
|
||||
<p v-else class="add-teams-dialog__empty">
|
||||
{{
|
||||
addFilter === 'fixture'
|
||||
? t('outright.add.empty_fixture')
|
||||
: t('outright.add.empty_all')
|
||||
}}
|
||||
{{ t('outright.add.empty_all') }}
|
||||
</p>
|
||||
</template>
|
||||
|
||||
<template #footer>
|
||||
<el-button @click="addVisible = false">{{ t('common.cancel') }}</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
:loading="adding"
|
||||
:disabled="selectedCount === 0"
|
||||
@click="submitAdd"
|
||||
:disabled="addFilter !== 'custom' && selectedCount === 0"
|
||||
@click="onAddConfirm"
|
||||
>
|
||||
{{ t('common.confirm') }}
|
||||
</el-button>
|
||||
@@ -980,6 +1067,25 @@ watch(
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.add-teams-dialog__custom {
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.add-teams-dialog__custom-hint {
|
||||
margin: 0 0 12px;
|
||||
font-size: 12px;
|
||||
color: #888;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.add-teams-dialog__custom :deep(.el-form-item) {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.add-teams-dialog__custom :deep(.el-form-item__label) {
|
||||
color: #8e8e93;
|
||||
}
|
||||
|
||||
.add-teams-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
|
||||
|
||||
@@ -8,7 +8,7 @@ import api from '../../api';
|
||||
import LogoUrlField from '../../components/LogoUrlField.vue';
|
||||
import { countryDisplayName, type BuiltinCountry } from '../../data/builtinCountries';
|
||||
import {
|
||||
buildPlatformPayload,
|
||||
buildMatchUpdatePayload,
|
||||
emptyMatchForm,
|
||||
formFromDetail,
|
||||
type AdminMatchDetail,
|
||||
@@ -70,9 +70,9 @@ async function load() {
|
||||
watch(matchId, load, { immediate: true });
|
||||
|
||||
async function saveMeta() {
|
||||
let payload: ReturnType<typeof buildPlatformPayload>;
|
||||
let payload: ReturnType<typeof buildMatchUpdatePayload>;
|
||||
try {
|
||||
payload = buildPlatformPayload(form.value);
|
||||
payload = buildMatchUpdatePayload(form.value);
|
||||
} catch (e) {
|
||||
ElMessage.warning(resolveFormError(e, t));
|
||||
return;
|
||||
@@ -108,31 +108,28 @@ async function saveMeta() {
|
||||
</div>
|
||||
|
||||
<el-form label-width="72px" label-position="left" class="meta-form compact-form">
|
||||
<div class="form-section">
|
||||
<div class="form-section league-readonly-block">
|
||||
<div class="section-label">{{ t('matchEditor.group.league') }}</div>
|
||||
<el-row :gutter="12">
|
||||
<el-col :xs="24" :sm="8">
|
||||
<el-form-item :label="t('match.field.lang_zh')">
|
||||
<el-input v-model="form.leagueZh" size="small" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :xs="24" :sm="8">
|
||||
<el-form-item :label="t('match.field.lang_en')">
|
||||
<el-input v-model="form.leagueEn" size="small" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :xs="24" :sm="8">
|
||||
<el-form-item :label="t('match.field.lang_ms')">
|
||||
<el-input v-model="form.leagueMs" size="small" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<div class="logo-inline">
|
||||
<span class="logo-inline-label">{{ t('matchEditor.field.league_logo') }}</span>
|
||||
<LogoUrlField v-model="form.leagueLogoUrl" />
|
||||
<p class="field-hint">{{ t('matchEditor.hint.league_readonly') }}</p>
|
||||
<div class="league-readonly-grid">
|
||||
<div v-if="form.leagueLogoUrl" class="league-readonly-logo">
|
||||
<img :src="form.leagueLogoUrl" alt="" />
|
||||
</div>
|
||||
<div class="league-readonly-names">
|
||||
<div v-if="form.leagueZh.trim()" class="league-readonly-line">
|
||||
<span class="league-readonly-lang">{{ t('match.field.lang_zh') }}</span>
|
||||
<span>{{ form.leagueZh }}</span>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<div v-if="form.leagueEn.trim()" class="league-readonly-line">
|
||||
<span class="league-readonly-lang">{{ t('match.field.lang_en') }}</span>
|
||||
<span>{{ form.leagueEn }}</span>
|
||||
</div>
|
||||
<div v-if="form.leagueMs.trim()" class="league-readonly-line">
|
||||
<span class="league-readonly-lang">{{ t('match.field.lang_ms') }}</span>
|
||||
<span>{{ form.leagueMs }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-section">
|
||||
@@ -339,4 +336,45 @@ async function saveMeta() {
|
||||
.meta-form :deep(.el-input-number .el-input__inner) {
|
||||
color: #fff !important;
|
||||
}
|
||||
|
||||
.field-hint {
|
||||
margin: 0 0 8px;
|
||||
font-size: 12px;
|
||||
color: #8e8e93;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.league-readonly-grid {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.league-readonly-logo img {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
object-fit: contain;
|
||||
border-radius: 6px;
|
||||
background: #1a1a1a;
|
||||
}
|
||||
|
||||
.league-readonly-names {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.league-readonly-line {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
font-size: 13px;
|
||||
color: #ddd;
|
||||
}
|
||||
|
||||
.league-readonly-lang {
|
||||
flex: 0 0 28px;
|
||||
color: #8e8e93;
|
||||
font-size: 12px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -373,6 +373,10 @@ class CreatePlatformLeagueDto {
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
displayOrder?: number;
|
||||
|
||||
@IsOptional()
|
||||
@IsBoolean()
|
||||
isActive?: boolean;
|
||||
}
|
||||
|
||||
class CreatePlatformMatchDto {
|
||||
@@ -456,6 +460,59 @@ class CreatePlatformMatchDto {
|
||||
awayTeamLogoUrl?: string;
|
||||
}
|
||||
|
||||
class UpdatePlatformMatchDto {
|
||||
@IsString()
|
||||
homeTeamEn!: string;
|
||||
|
||||
@IsString()
|
||||
homeTeamZh!: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
homeTeamMs?: string;
|
||||
|
||||
@IsString()
|
||||
awayTeamEn!: string;
|
||||
|
||||
@IsString()
|
||||
awayTeamZh!: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
awayTeamMs?: string;
|
||||
|
||||
@IsString()
|
||||
startTime!: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsBoolean()
|
||||
isHot?: boolean;
|
||||
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
displayOrder?: number;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
matchName?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
stage?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
groupName?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
homeTeamLogoUrl?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
awayTeamLogoUrl?: string;
|
||||
}
|
||||
|
||||
class BatchMatchOddsDto {
|
||||
@IsArray()
|
||||
updates!: OutrightOddsUpdateItemDto[];
|
||||
@@ -518,6 +575,16 @@ class ScoreDto {
|
||||
winnerTeamId?: number;
|
||||
}
|
||||
|
||||
class SettlementPreviewDto extends ScoreDto {
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
page?: number;
|
||||
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
pageSize?: number;
|
||||
}
|
||||
|
||||
/* 智能比分推荐已关闭
|
||||
class SmartScoreSuggestDto {
|
||||
@IsOptional()
|
||||
@@ -1252,6 +1319,7 @@ export class AdminController {
|
||||
leagueMs: body.leagueMs,
|
||||
logoUrl: body.logoUrl,
|
||||
displayOrder: body.displayOrder,
|
||||
isActive: body.isActive,
|
||||
});
|
||||
return jsonResponse(league);
|
||||
}
|
||||
@@ -1260,6 +1328,23 @@ export class AdminController {
|
||||
return jsonResponse(league);
|
||||
}
|
||||
|
||||
@Put('leagues/:leagueId')
|
||||
@RequirePermissions(P.matches)
|
||||
async updateLeague(
|
||||
@Param('leagueId') leagueId: string,
|
||||
@Body() dto: CreatePlatformLeagueDto,
|
||||
) {
|
||||
const league = await this.matches.updatePlatformLeague(BigInt(leagueId), {
|
||||
leagueEn: dto.leagueEn,
|
||||
leagueZh: dto.leagueZh,
|
||||
leagueMs: dto.leagueMs,
|
||||
logoUrl: dto.logoUrl,
|
||||
displayOrder: dto.displayOrder,
|
||||
isActive: dto.isActive,
|
||||
});
|
||||
return jsonResponse(league);
|
||||
}
|
||||
|
||||
@Get('leagues')
|
||||
@RequirePermissions(P.matches, P.reports)
|
||||
async listLeagues(
|
||||
@@ -1360,12 +1445,9 @@ export class AdminController {
|
||||
async updateMatch(
|
||||
@CurrentUser('id') operatorId: bigint,
|
||||
@Param('id') id: string,
|
||||
@Body() dto: CreatePlatformMatchDto,
|
||||
@Body() dto: UpdatePlatformMatchDto,
|
||||
) {
|
||||
const match = await this.matches.updatePlatformMatch(BigInt(id), {
|
||||
leagueEn: dto.leagueEn ?? '',
|
||||
leagueZh: dto.leagueZh ?? '',
|
||||
leagueMs: dto.leagueMs,
|
||||
homeTeamEn: dto.homeTeamEn,
|
||||
homeTeamZh: dto.homeTeamZh,
|
||||
homeTeamMs: dto.homeTeamMs,
|
||||
@@ -1378,11 +1460,11 @@ export class AdminController {
|
||||
matchName: dto.matchName,
|
||||
stage: dto.stage,
|
||||
groupName: dto.groupName,
|
||||
leagueLogoUrl: dto.leagueLogoUrl,
|
||||
homeTeamLogoUrl: dto.homeTeamLogoUrl,
|
||||
awayTeamLogoUrl: dto.awayTeamLogoUrl,
|
||||
updatedBy: operatorId,
|
||||
});
|
||||
await this.outright.syncOutrightTeamsForLeagueIfExists(match.leagueId);
|
||||
return jsonResponse(match);
|
||||
}
|
||||
|
||||
@@ -1420,6 +1502,7 @@ export class AdminController {
|
||||
awayTeamLogoUrl: dto.awayTeamLogoUrl,
|
||||
createdBy: operatorId,
|
||||
});
|
||||
await this.outright.syncOutrightTeamsForLeagueIfExists(match.leagueId);
|
||||
return jsonResponse(match);
|
||||
}
|
||||
|
||||
@@ -1712,9 +1795,27 @@ export class AdminController {
|
||||
async settlementPreview(
|
||||
@CurrentUser('id') operatorId: bigint,
|
||||
@Param('id') id: string,
|
||||
@Body() dto?: { page?: number; pageSize?: number },
|
||||
@Body() dto?: SettlementPreviewDto,
|
||||
) {
|
||||
const preview = await this.settlement.previewSettlement(BigInt(id), operatorId, {
|
||||
const matchId = BigInt(id);
|
||||
const hasScore =
|
||||
dto?.htHome !== undefined ||
|
||||
dto?.htAway !== undefined ||
|
||||
dto?.ftHome !== undefined ||
|
||||
dto?.ftAway !== undefined ||
|
||||
dto?.winnerTeamId !== undefined;
|
||||
if (hasScore) {
|
||||
await this.settlement.recordScore(
|
||||
matchId,
|
||||
dto!.htHome ?? 0,
|
||||
dto!.htAway ?? 0,
|
||||
dto!.ftHome ?? 0,
|
||||
dto!.ftAway ?? 0,
|
||||
operatorId,
|
||||
dto!.winnerTeamId != null ? BigInt(dto!.winnerTeamId) : undefined,
|
||||
);
|
||||
}
|
||||
const preview = await this.settlement.previewSettlement(matchId, operatorId, {
|
||||
page: dto?.page ? Math.max(1, dto.page) : 1,
|
||||
pageSize: dto?.pageSize ? Math.min(100, Math.max(1, dto.pageSize)) : 10,
|
||||
});
|
||||
@@ -1980,6 +2081,24 @@ export class AdminController {
|
||||
return jsonResponse({ ok: true });
|
||||
}
|
||||
|
||||
@Delete('uploads/by-url')
|
||||
@RequirePermissions(P.content, P.matches)
|
||||
async deleteFileByUrl(@Body() body: { url: string }) {
|
||||
const { url } = body;
|
||||
if (!url || typeof url !== 'string') throw new BadRequestException('url is required');
|
||||
|
||||
const record = await this.prisma.uploadedFile.findFirst({ where: { url } });
|
||||
if (!record) return jsonResponse({ ok: true, note: 'not_found' });
|
||||
|
||||
const root = getUploadRoot();
|
||||
try {
|
||||
await unlink(join(root, record.category, record.filename));
|
||||
} catch { /* already gone */ }
|
||||
await this.prisma.uploadedFile.delete({ where: { id: record.id } });
|
||||
|
||||
return jsonResponse({ ok: true });
|
||||
}
|
||||
|
||||
private async getUsedFileUrls(): Promise<Set<string>> {
|
||||
const [ctRows, leagueRows, teamRows, prefRows] = await Promise.all([
|
||||
this.prisma.contentTranslation.findMany({ select: { imageUrl: true } }),
|
||||
|
||||
@@ -98,14 +98,14 @@ class TransferDto {
|
||||
|
||||
@IsString()
|
||||
requestId!: string;
|
||||
}
|
||||
|
||||
class CreditDto extends TransferDto {
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
remark?: string;
|
||||
}
|
||||
|
||||
class CreditDto extends TransferDto {}
|
||||
|
||||
class UpdateSubAgentDto {
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@@ -249,7 +249,13 @@ export class AgentPortalController {
|
||||
@Param('id') playerId: string,
|
||||
@Body() dto: TransferDto,
|
||||
) {
|
||||
const result = await this.agents.depositToPlayer(agentId, BigInt(playerId), dto.amount, dto.requestId);
|
||||
const result = await this.agents.depositToPlayer(
|
||||
agentId,
|
||||
BigInt(playerId),
|
||||
dto.amount,
|
||||
dto.requestId,
|
||||
dto.remark,
|
||||
);
|
||||
return jsonResponse(result);
|
||||
}
|
||||
|
||||
@@ -259,7 +265,13 @@ export class AgentPortalController {
|
||||
@Param('id') playerId: string,
|
||||
@Body() dto: TransferDto,
|
||||
) {
|
||||
const result = await this.agents.withdrawFromPlayer(agentId, BigInt(playerId), dto.amount, dto.requestId);
|
||||
const result = await this.agents.withdrawFromPlayer(
|
||||
agentId,
|
||||
BigInt(playerId),
|
||||
dto.amount,
|
||||
dto.requestId,
|
||||
dto.remark,
|
||||
);
|
||||
return jsonResponse(result);
|
||||
}
|
||||
|
||||
@@ -335,10 +347,7 @@ export class AgentPortalController {
|
||||
const p = Math.max(1, page ? parseInt(page, 10) : 1);
|
||||
const size = Math.min(Math.max(1, pageSize ? parseInt(pageSize, 10) : 10), 100);
|
||||
const skip = (p - 1) * size;
|
||||
const descendants = await this.prisma.agentClosure.findMany({
|
||||
where: { ancestorId: agentId },
|
||||
});
|
||||
const agentIds = descendants.map((d) => d.descendantId);
|
||||
const agentIds = await this.agents.getSubtreeAgentIds(agentId);
|
||||
|
||||
const [items, total] = await Promise.all([
|
||||
this.prisma.bet.findMany({
|
||||
|
||||
@@ -252,7 +252,7 @@ export class AgentsService {
|
||||
playerId,
|
||||
amount,
|
||||
operatorId,
|
||||
remark,
|
||||
remark ?? '管理员上分',
|
||||
requestId,
|
||||
);
|
||||
const player = await this.prisma.user.findUnique({
|
||||
@@ -277,7 +277,7 @@ export class AgentsService {
|
||||
playerId,
|
||||
amount,
|
||||
operatorId,
|
||||
remark,
|
||||
remark ?? '管理员下分',
|
||||
requestId,
|
||||
);
|
||||
const player = await this.prisma.user.findUnique({
|
||||
@@ -432,7 +432,7 @@ export class AgentsService {
|
||||
|
||||
await this.assertAgentDepositLimits(agentId, amt);
|
||||
|
||||
await this.wallet.deposit(playerId, amt, agentId, remark ?? 'Agent deposit', requestId);
|
||||
await this.wallet.deposit(playerId, amt, agentId, remark ?? '代理上分', requestId);
|
||||
await this.recalculateUsedCredit(agentId);
|
||||
|
||||
return { success: true };
|
||||
@@ -443,10 +443,11 @@ export class AgentsService {
|
||||
playerId: bigint,
|
||||
amount: number,
|
||||
requestId: string,
|
||||
remark?: string,
|
||||
) {
|
||||
await this.requireDirectPlayer(agentId, playerId);
|
||||
|
||||
await this.wallet.withdraw(playerId, amount, agentId, 'Agent withdraw', requestId);
|
||||
await this.wallet.withdraw(playerId, amount, agentId, remark ?? '代理下分', requestId);
|
||||
await this.recalculateUsedCredit(agentId);
|
||||
|
||||
return { success: true };
|
||||
@@ -1481,11 +1482,27 @@ export class AgentsService {
|
||||
}
|
||||
|
||||
async getSubtreeAgentIds(agentId: bigint) {
|
||||
const descendants = await this.prisma.agentClosure.findMany({
|
||||
where: { ancestorId: agentId },
|
||||
select: { descendantId: true },
|
||||
});
|
||||
return descendants.map((d) => d.descendantId);
|
||||
const ids: bigint[] = [];
|
||||
const queue: bigint[] = [agentId];
|
||||
const seen = new Set<string>();
|
||||
|
||||
while (queue.length > 0) {
|
||||
const current = queue.shift()!;
|
||||
const key = current.toString();
|
||||
if (seen.has(key)) continue;
|
||||
seen.add(key);
|
||||
ids.push(current);
|
||||
|
||||
const children = await this.prisma.agentProfile.findMany({
|
||||
where: { parentAgentId: current },
|
||||
select: { userId: true },
|
||||
});
|
||||
for (const child of children) {
|
||||
queue.push(child.userId);
|
||||
}
|
||||
}
|
||||
|
||||
return ids;
|
||||
}
|
||||
|
||||
async getReportSummary(agentId: bigint) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Injectable, NotFoundException, BadRequestException } from '@nestjs/common';
|
||||
import { resolveTranslationFallback } from '@thebet365/shared';
|
||||
import { isPreMatchKickoff, resolveTranslationFallback } from '@thebet365/shared';
|
||||
import { Cron, CronExpression } from '@nestjs/schedule';
|
||||
import { Prisma } from '@prisma/client';
|
||||
import { Decimal } from '@prisma/client/runtime/library';
|
||||
@@ -213,6 +213,7 @@ export class MatchesService {
|
||||
leagueMs?: string;
|
||||
logoUrl?: string;
|
||||
displayOrder?: number;
|
||||
isActive?: boolean;
|
||||
}) {
|
||||
const leagueEn = data.leagueEn.trim();
|
||||
const leagueZh = data.leagueZh.trim();
|
||||
@@ -229,12 +230,12 @@ export class MatchesService {
|
||||
'ms-MY': data.leagueMs.trim(),
|
||||
});
|
||||
}
|
||||
const updates: { logoUrl?: string; displayOrder?: number } = {};
|
||||
const updates: { logoUrl?: string; displayOrder?: number; isActive: boolean } = {
|
||||
isActive: data.isActive ?? false,
|
||||
};
|
||||
if (data.logoUrl?.trim()) updates.logoUrl = data.logoUrl.trim();
|
||||
if (data.displayOrder != null) updates.displayOrder = data.displayOrder;
|
||||
if (Object.keys(updates).length) {
|
||||
await this.prisma.league.update({ where: { id: league.id }, data: updates });
|
||||
}
|
||||
await this.prisma.league.update({ where: { id: league.id }, data: updates });
|
||||
const [en, zh, ms] = await Promise.all([
|
||||
this.getTranslationExact('LEAGUE', league.id, 'en-US'),
|
||||
this.getTranslationExact('LEAGUE', league.id, 'zh-CN'),
|
||||
@@ -246,6 +247,68 @@ export class MatchesService {
|
||||
code: fresh.code,
|
||||
logoUrl: fresh.logoUrl,
|
||||
displayOrder: fresh.displayOrder,
|
||||
isPublished: fresh.isActive,
|
||||
leagueEn: en,
|
||||
leagueZh: zh,
|
||||
leagueMs: ms,
|
||||
};
|
||||
}
|
||||
|
||||
async updatePlatformLeague(
|
||||
leagueId: bigint,
|
||||
data: {
|
||||
leagueEn: string;
|
||||
leagueZh: string;
|
||||
leagueMs?: string;
|
||||
logoUrl?: string;
|
||||
displayOrder?: number;
|
||||
isActive?: boolean;
|
||||
},
|
||||
) {
|
||||
const league = await this.prisma.league.findFirst({
|
||||
where: { id: leagueId, deletedAt: null },
|
||||
});
|
||||
if (!league) throw new NotFoundException('赛事不存在');
|
||||
|
||||
const leagueEn = data.leagueEn.trim();
|
||||
const leagueZh = data.leagueZh.trim();
|
||||
if (!leagueEn && !leagueZh) {
|
||||
throw new BadRequestException('请填写赛事名称(中文或英文至少一项)');
|
||||
}
|
||||
|
||||
await this.upsertEntityTranslations('LEAGUE', leagueId, {
|
||||
'zh-CN': leagueZh,
|
||||
'en-US': leagueEn,
|
||||
'ms-MY': (data.leagueMs ?? '').trim(),
|
||||
});
|
||||
|
||||
const updates: { logoUrl?: string | null; displayOrder?: number; isActive?: boolean } = {};
|
||||
if (data.logoUrl !== undefined) {
|
||||
updates.logoUrl = data.logoUrl.trim() || null;
|
||||
}
|
||||
if (data.displayOrder != null) updates.displayOrder = data.displayOrder;
|
||||
if (data.isActive !== undefined) {
|
||||
if (league.isActive && data.isActive === false) {
|
||||
throw new BadRequestException('已发布的联赛不可下架');
|
||||
}
|
||||
updates.isActive = data.isActive;
|
||||
}
|
||||
if (Object.keys(updates).length) {
|
||||
await this.prisma.league.update({ where: { id: leagueId }, data: updates });
|
||||
}
|
||||
|
||||
const [en, zh, ms] = await Promise.all([
|
||||
this.getTranslationExact('LEAGUE', leagueId, 'en-US'),
|
||||
this.getTranslationExact('LEAGUE', leagueId, 'zh-CN'),
|
||||
this.getTranslationExact('LEAGUE', leagueId, 'ms-MY'),
|
||||
]);
|
||||
const fresh = await this.prisma.league.findUniqueOrThrow({ where: { id: leagueId } });
|
||||
return {
|
||||
id: fresh.id.toString(),
|
||||
code: fresh.code,
|
||||
logoUrl: fresh.logoUrl,
|
||||
displayOrder: fresh.displayOrder,
|
||||
isPublished: fresh.isActive,
|
||||
leagueEn: en,
|
||||
leagueZh: zh,
|
||||
leagueMs: ms,
|
||||
@@ -329,6 +392,7 @@ export class MatchesService {
|
||||
code: league.code,
|
||||
logoUrl: league.logoUrl,
|
||||
displayOrder: league.displayOrder,
|
||||
isPublished: league.isActive,
|
||||
leagueEn,
|
||||
leagueZh,
|
||||
leagueMs,
|
||||
@@ -819,9 +883,6 @@ export class MatchesService {
|
||||
async updatePlatformMatch(
|
||||
matchId: bigint,
|
||||
data: {
|
||||
leagueEn: string;
|
||||
leagueZh: string;
|
||||
leagueMs?: string;
|
||||
homeTeamZh: string;
|
||||
homeTeamEn: string;
|
||||
homeTeamMs?: string;
|
||||
@@ -834,7 +895,6 @@ export class MatchesService {
|
||||
matchName?: string;
|
||||
stage?: string;
|
||||
groupName?: string;
|
||||
leagueLogoUrl?: string;
|
||||
homeTeamLogoUrl?: string;
|
||||
awayTeamLogoUrl?: string;
|
||||
updatedBy?: bigint;
|
||||
@@ -853,11 +913,6 @@ export class MatchesService {
|
||||
`${data.homeTeamEn.trim() || data.homeTeamZh.trim() || data.homeTeamMs?.trim() || ''} - ${data.awayTeamEn.trim() || data.awayTeamZh.trim() || data.awayTeamMs?.trim() || ''}`;
|
||||
|
||||
await Promise.all([
|
||||
this.upsertEntityTranslations('LEAGUE', match.leagueId, {
|
||||
'zh-CN': data.leagueZh.trim(),
|
||||
'en-US': data.leagueEn.trim(),
|
||||
'ms-MY': (data.leagueMs ?? '').trim(),
|
||||
}),
|
||||
this.upsertEntityTranslations('TEAM', match.homeTeamId, {
|
||||
'zh-CN': data.homeTeamZh.trim(),
|
||||
'en-US': data.homeTeamEn.trim(),
|
||||
@@ -871,14 +926,6 @@ export class MatchesService {
|
||||
]);
|
||||
|
||||
const logoUpdates: Promise<unknown>[] = [];
|
||||
if (data.leagueLogoUrl !== undefined) {
|
||||
logoUpdates.push(
|
||||
this.prisma.league.update({
|
||||
where: { id: match.leagueId },
|
||||
data: { logoUrl: data.leagueLogoUrl.trim() || null },
|
||||
}),
|
||||
);
|
||||
}
|
||||
if (data.homeTeamLogoUrl !== undefined) {
|
||||
logoUpdates.push(
|
||||
this.prisma.team.update({
|
||||
@@ -1093,6 +1140,12 @@ export class MatchesService {
|
||||
homeTeam?: { code: string; logoUrl?: string | null };
|
||||
awayTeam?: { code: string; logoUrl?: string | null };
|
||||
league?: { logoUrl?: string | null };
|
||||
score?: {
|
||||
htHomeScore: number;
|
||||
htAwayScore: number;
|
||||
ftHomeScore: number;
|
||||
ftAwayScore: number;
|
||||
} | null;
|
||||
markets?: Array<Record<string, unknown>>;
|
||||
};
|
||||
const [leagueName, homeName, awayName] = await Promise.all([
|
||||
@@ -1118,6 +1171,30 @@ export class MatchesService {
|
||||
stage: m.stage ?? null,
|
||||
groupName: m.groupName ?? null,
|
||||
status: m.status ?? 'PUBLISHED',
|
||||
score: m.score
|
||||
? {
|
||||
htHome: m.score.htHomeScore,
|
||||
htAway: m.score.htAwayScore,
|
||||
ftHome: m.score.ftHomeScore,
|
||||
ftAway: m.score.ftAwayScore,
|
||||
}
|
||||
: null,
|
||||
bettingOpen: this.isMatchBettingOpen({
|
||||
status: m.status,
|
||||
startTime: m.startTime,
|
||||
markets: (m.markets ?? []) as Array<{
|
||||
status: string;
|
||||
selections: Array<{ status: string }>;
|
||||
}>,
|
||||
}),
|
||||
matchPhase: this.resolvePlayerMatchPhase(m.status ?? 'PUBLISHED', {
|
||||
status: m.status,
|
||||
startTime: m.startTime,
|
||||
markets: (m.markets ?? []) as Array<{
|
||||
status: string;
|
||||
selections: Array<{ status: string }>;
|
||||
}>,
|
||||
}),
|
||||
};
|
||||
if (m.markets) {
|
||||
return {
|
||||
@@ -1126,6 +1203,7 @@ export class MatchesService {
|
||||
id: (market.id as bigint).toString(),
|
||||
marketType: market.marketType as string,
|
||||
period: market.period as string,
|
||||
status: (market.status as string) ?? 'OPEN',
|
||||
lineValue: market.lineValue != null ? Number(market.lineValue) : null,
|
||||
allowParlay: (market.allowParlay as boolean | undefined) ?? true,
|
||||
promoLabel: (market.promoLabel as string | null | undefined) ?? null,
|
||||
@@ -1133,6 +1211,7 @@ export class MatchesService {
|
||||
id: (s.id as bigint).toString(),
|
||||
selectionCode: s.selectionCode as string,
|
||||
selectionName: s.selectionName as string,
|
||||
status: (s.status as string) ?? 'OPEN',
|
||||
odds: Number(s.odds),
|
||||
oddsVersion: (s.oddsVersion as bigint).toString(),
|
||||
})),
|
||||
@@ -1142,26 +1221,69 @@ export class MatchesService {
|
||||
return base;
|
||||
}
|
||||
|
||||
private resolvePlayerMatchPhaseFromStatus(
|
||||
status: string,
|
||||
startTime: Date,
|
||||
): 'open' | 'closed_pending' | 'settled' {
|
||||
if (status === 'SETTLED') return 'settled';
|
||||
if (status === 'CLOSED' || status === 'PENDING_SETTLEMENT') return 'closed_pending';
|
||||
if (status === 'PUBLISHED' && !isPreMatchKickoff(startTime)) return 'closed_pending';
|
||||
return 'open';
|
||||
}
|
||||
|
||||
private resolvePlayerMatchPhase(
|
||||
status: string,
|
||||
m: {
|
||||
status?: string;
|
||||
startTime: Date;
|
||||
markets?: Array<{ status: string; selections: Array<{ status: string }> }>;
|
||||
},
|
||||
): 'open' | 'closed_pending' | 'settled' {
|
||||
if (status === 'SETTLED') return 'settled';
|
||||
if (status === 'CLOSED' || status === 'PENDING_SETTLEMENT') return 'closed_pending';
|
||||
if (status === 'PUBLISHED' && !this.isMatchBettingOpen(m)) return 'closed_pending';
|
||||
return 'open';
|
||||
}
|
||||
|
||||
private isMatchBettingOpen(m: {
|
||||
status?: string;
|
||||
startTime: Date;
|
||||
markets?: Array<{ status: string; selections: Array<{ status: string }> }>;
|
||||
}): boolean {
|
||||
if (m.status !== 'PUBLISHED') return false;
|
||||
if (!isPreMatchKickoff(m.startTime)) return false;
|
||||
return (m.markets ?? []).some(
|
||||
(mk) => mk.status === 'OPEN' && mk.selections.some((s) => s.status === 'OPEN'),
|
||||
);
|
||||
}
|
||||
|
||||
private playerMarketInclude = {
|
||||
where: { status: { in: ['OPEN', 'SUSPENDED', 'CLOSED'] } },
|
||||
include: {
|
||||
selections: {
|
||||
where: { status: { in: ['OPEN', 'SUSPENDED', 'CLOSED'] } },
|
||||
orderBy: { sortOrder: 'asc' as const },
|
||||
},
|
||||
},
|
||||
orderBy: { sortOrder: 'asc' as const },
|
||||
};
|
||||
|
||||
async listPublished(locale = 'en-US', leagueId?: bigint) {
|
||||
const now = new Date();
|
||||
const matches = await this.prisma.match.findMany({
|
||||
where: {
|
||||
status: 'PUBLISHED',
|
||||
status: { in: ['PUBLISHED', 'CLOSED', 'PENDING_SETTLEMENT', 'SETTLED'] },
|
||||
isOutright: false,
|
||||
sportType: 'FOOTBALL',
|
||||
deletedAt: null,
|
||||
startTime: { gt: now },
|
||||
league: { isActive: true, deletedAt: null },
|
||||
...(leagueId ? { leagueId } : {}),
|
||||
},
|
||||
include: {
|
||||
league: true,
|
||||
homeTeam: true,
|
||||
awayTeam: true,
|
||||
markets: {
|
||||
where: { status: 'OPEN' },
|
||||
include: { selections: { where: { status: 'OPEN' }, orderBy: { sortOrder: 'asc' } } },
|
||||
orderBy: { sortOrder: 'asc' },
|
||||
},
|
||||
score: true,
|
||||
markets: this.playerMarketInclude,
|
||||
},
|
||||
orderBy: [{ isHot: 'desc' }, { displayOrder: 'asc' }, { startTime: 'asc' }],
|
||||
});
|
||||
@@ -1176,17 +1298,14 @@ export class MatchesService {
|
||||
deletedAt: null,
|
||||
sportType: 'FOOTBALL',
|
||||
isOutright: false,
|
||||
status: { in: ['PUBLISHED', 'CLOSED'] },
|
||||
status: { in: ['PUBLISHED', 'CLOSED', 'PENDING_SETTLEMENT', 'SETTLED'] },
|
||||
league: { isActive: true, deletedAt: null },
|
||||
},
|
||||
include: {
|
||||
league: true,
|
||||
homeTeam: true,
|
||||
awayTeam: true,
|
||||
markets: {
|
||||
where: { status: 'OPEN' },
|
||||
include: { selections: { where: { status: 'OPEN' }, orderBy: { sortOrder: 'asc' } } },
|
||||
orderBy: { sortOrder: 'asc' },
|
||||
},
|
||||
markets: this.playerMarketInclude,
|
||||
score: true,
|
||||
},
|
||||
});
|
||||
@@ -1325,6 +1444,7 @@ export class MatchesService {
|
||||
leagueName: string;
|
||||
matchTitle: string;
|
||||
isOutright: boolean;
|
||||
matchPhase: 'open' | 'closed_pending' | 'settled';
|
||||
score: { ht: string | null; ft: string | null } | null;
|
||||
}
|
||||
>();
|
||||
@@ -1348,6 +1468,7 @@ export class MatchesService {
|
||||
leagueName,
|
||||
matchTitle: m.isOutright ? leagueName : `${homeName} vs ${awayName}`,
|
||||
isOutright: m.isOutright,
|
||||
matchPhase: this.resolvePlayerMatchPhaseFromStatus(m.status, m.startTime),
|
||||
score: ftScore || htScore ? { ht: htScore, ft: ftScore } : null,
|
||||
});
|
||||
}
|
||||
@@ -1396,6 +1517,7 @@ export class MatchesService {
|
||||
legs,
|
||||
isParlay,
|
||||
matchScore: isParlay ? null : firstScore,
|
||||
matchPhase: isParlay ? null : meta?.matchPhase ?? null,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
@@ -168,11 +168,6 @@ export class OutrightService {
|
||||
this.getOutrightTitle(match.id, 'ms-MY'),
|
||||
]);
|
||||
|
||||
const addableFixtureTeams = await this.listAddableFixtureTeams(
|
||||
match.leagueId,
|
||||
fullMarket.id,
|
||||
);
|
||||
|
||||
return {
|
||||
id: match.id.toString(),
|
||||
leagueId: match.leagueId.toString(),
|
||||
@@ -192,49 +187,9 @@ export class OutrightService {
|
||||
playerVisible: visibility.playerVisible,
|
||||
playerHiddenReason: visibility.playerHiddenReason,
|
||||
selections,
|
||||
addableFixtureTeams,
|
||||
};
|
||||
}
|
||||
|
||||
private async listAddableFixtureTeams(leagueId: bigint, marketId: bigint) {
|
||||
const teams = await this.collectFixtureTeamsForLeague(leagueId);
|
||||
const openCodes = new Set(
|
||||
(
|
||||
await this.prisma.marketSelection.findMany({
|
||||
where: {
|
||||
marketId,
|
||||
status: 'OPEN',
|
||||
selectionCode: { not: PLACEHOLDER_TEAM_CODE },
|
||||
},
|
||||
select: { selectionCode: true },
|
||||
})
|
||||
).map((s) => s.selectionCode),
|
||||
);
|
||||
|
||||
const result: Array<{
|
||||
teamCode: string;
|
||||
teamZh: string;
|
||||
teamEn: string;
|
||||
logoUrl: string | null;
|
||||
}> = [];
|
||||
|
||||
for (const team of teams) {
|
||||
if (openCodes.has(team.code)) continue;
|
||||
const [teamZh, teamEn] = await Promise.all([
|
||||
this.getTranslation('TEAM', team.id, 'zh-CN'),
|
||||
this.getTranslation('TEAM', team.id, 'en-US'),
|
||||
]);
|
||||
result.push({
|
||||
teamCode: team.code,
|
||||
teamZh: teamZh || team.code,
|
||||
teamEn: teamEn || team.code,
|
||||
logoUrl: team.logoUrl ?? null,
|
||||
});
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/** 按联赛获取或创建冠军盘,并从单场赛程同步参赛队伍 */
|
||||
async getOrCreateAndSyncForLeague(leagueId: bigint) {
|
||||
let match = await this.prisma.match.findFirst({
|
||||
@@ -263,6 +218,22 @@ export class OutrightService {
|
||||
orderBy: { id: 'asc' },
|
||||
});
|
||||
}
|
||||
const sync = await this.syncSelectionsFromLeagueFixtures(match.id);
|
||||
const data = await this.getForAdmin(match.id);
|
||||
return {
|
||||
...data,
|
||||
fixtureSyncAdded: sync.addedCount,
|
||||
fixtureSyncReopened: sync.reopenedCount,
|
||||
};
|
||||
}
|
||||
|
||||
/** 若联赛已有冠军盘,则从单场同步球队(不自动创建冠军盘) */
|
||||
async syncOutrightTeamsForLeagueIfExists(leagueId: bigint) {
|
||||
const match = await this.prisma.match.findFirst({
|
||||
where: { leagueId, isOutright: true, deletedAt: null },
|
||||
orderBy: { id: 'asc' },
|
||||
});
|
||||
if (!match) return { addedCount: 0, reopenedCount: 0 };
|
||||
return this.syncSelectionsFromLeagueFixtures(match.id);
|
||||
}
|
||||
|
||||
@@ -279,19 +250,21 @@ export class OutrightService {
|
||||
},
|
||||
});
|
||||
|
||||
// 仅当球队重新出现在单场赛程时,恢复曾被关闭的选项;不因「暂无单场」而自动关闭
|
||||
const existingCodes = new Set(existing.map((s) => s.selectionCode));
|
||||
let sortOrder = existing.reduce((max, s) => Math.max(max, s.sortOrder), -1);
|
||||
let addedCount = 0;
|
||||
let reopenedCount = 0;
|
||||
|
||||
for (const sel of existing) {
|
||||
if (fixtureCodes.has(sel.selectionCode) && sel.status === 'CLOSED') {
|
||||
await this.prisma.marketSelection.update({
|
||||
where: { id: sel.id },
|
||||
data: { status: 'OPEN' },
|
||||
});
|
||||
reopenedCount += 1;
|
||||
}
|
||||
}
|
||||
|
||||
const existingCodes = new Set(existing.map((s) => s.selectionCode));
|
||||
let sortOrder = existing.reduce((max, s) => Math.max(max, s.sortOrder), -1);
|
||||
|
||||
for (const team of teams) {
|
||||
if (existingCodes.has(team.code)) continue;
|
||||
const [teamZh, teamEn] = await Promise.all([
|
||||
@@ -309,9 +282,10 @@ export class OutrightService {
|
||||
status: 'OPEN',
|
||||
},
|
||||
});
|
||||
addedCount += 1;
|
||||
}
|
||||
|
||||
return this.getForAdmin(matchId);
|
||||
return { addedCount, reopenedCount };
|
||||
}
|
||||
|
||||
private async collectFixtureTeamsForLeague(leagueId: bigint) {
|
||||
|
||||
@@ -624,6 +624,20 @@ export async function runSeed(client: PrismaClient) {
|
||||
update: {},
|
||||
});
|
||||
|
||||
const agent2 = await prisma.user.findUnique({ where: { username: 'agent2' }, select: { id: true } });
|
||||
if (agent2) {
|
||||
await prisma.agentClosure.upsert({
|
||||
where: { ancestorId_descendantId: { ancestorId: agent2.id, descendantId: agent2.id } },
|
||||
create: { ancestorId: agent2.id, descendantId: agent2.id, depth: 0 },
|
||||
update: {},
|
||||
});
|
||||
await prisma.agentClosure.upsert({
|
||||
where: { ancestorId_descendantId: { ancestorId: agent1.id, descendantId: agent2.id } },
|
||||
create: { ancestorId: agent1.id, descendantId: agent2.id, depth: 1 },
|
||||
update: {},
|
||||
});
|
||||
}
|
||||
|
||||
await prisma.user.upsert({
|
||||
where: { username: 'player1' },
|
||||
create: {
|
||||
|
||||
@@ -3,6 +3,8 @@ 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;
|
||||
@@ -24,6 +26,7 @@ export interface BetHistoryItem {
|
||||
isParlay?: boolean;
|
||||
legCount?: number;
|
||||
matchScore?: BetScore | null;
|
||||
matchPhase?: MatchPhase | null;
|
||||
legs?: Array<{
|
||||
marketLabel: string;
|
||||
selectionName: string;
|
||||
@@ -48,6 +51,22 @@ const statusKey = computed(() => {
|
||||
|
||||
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',
|
||||
@@ -87,10 +106,7 @@ function goDetail() {
|
||||
|
||||
<template>
|
||||
<article class="bet-card" @click="goDetail">
|
||||
<span
|
||||
class="watermark"
|
||||
:class="statusKey"
|
||||
>{{ statusLabel }}</span>
|
||||
<StatusWatermark :label="watermarkLabel" :variant="watermarkVariant" />
|
||||
<div class="card-left">
|
||||
<span class="title">{{ title }}</span>
|
||||
<span class="subtitle">{{ subtitle }} · {{ placedDate }}</span>
|
||||
@@ -125,28 +141,6 @@ function goDetail() {
|
||||
background: rgba(255, 255, 255, 0.02);
|
||||
}
|
||||
|
||||
.watermark {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%) rotate(-35deg);
|
||||
font-size: 28px;
|
||||
font-weight: 900;
|
||||
letter-spacing: 0.06em;
|
||||
white-space: nowrap;
|
||||
pointer-events: none;
|
||||
text-transform: uppercase;
|
||||
opacity: 0.18;
|
||||
max-width: 90%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.watermark.won { color: #3db865; }
|
||||
.watermark.lost { color: #e05050; }
|
||||
.watermark.push { color: #888; }
|
||||
.watermark.pending { color: #e8c84a; }
|
||||
|
||||
.card-left {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
|
||||
@@ -16,6 +16,14 @@ defineProps<{
|
||||
homeTeamLogoUrl?: string | null;
|
||||
awayTeamLogoUrl?: string | null;
|
||||
startTime: string;
|
||||
bettingOpen?: boolean;
|
||||
matchPhase?: import('../utils/matchPhase').MatchPhase;
|
||||
score?: {
|
||||
htHome: number;
|
||||
htAway: number;
|
||||
ftHome: number;
|
||||
ftAway: number;
|
||||
} | null;
|
||||
}[];
|
||||
}>();
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
import { computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { teamFlagUrl } from '../utils/teamFlag';
|
||||
import StatusWatermark from './StatusWatermark.vue';
|
||||
import { matchPhaseLabel, matchPhaseVariant, type MatchPhase } from '../utils/matchPhase';
|
||||
|
||||
const props = defineProps<{
|
||||
match: {
|
||||
@@ -13,6 +15,14 @@ const props = defineProps<{
|
||||
homeTeamLogoUrl?: string | null;
|
||||
awayTeamLogoUrl?: string | null;
|
||||
startTime: string;
|
||||
bettingOpen?: boolean;
|
||||
matchPhase?: MatchPhase;
|
||||
score?: {
|
||||
htHome: number;
|
||||
htAway: number;
|
||||
ftHome: number;
|
||||
ftAway: number;
|
||||
} | null;
|
||||
};
|
||||
}>();
|
||||
|
||||
@@ -44,12 +54,36 @@ const awayFlagUrl = computed(() =>
|
||||
|
||||
const homeIsLogo = computed(() => Boolean(props.match.homeTeamLogoUrl?.trim()));
|
||||
const awayIsLogo = computed(() => Boolean(props.match.awayTeamLogoUrl?.trim()));
|
||||
|
||||
const bettingOpen = computed(() => props.match.bettingOpen !== false);
|
||||
|
||||
const phase = computed(
|
||||
() => props.match.matchPhase ?? (bettingOpen.value ? 'open' : 'closed_pending'),
|
||||
);
|
||||
|
||||
const phaseLabel = computed(() => matchPhaseLabel(t, phase.value));
|
||||
|
||||
const liveScoreText = computed(() => {
|
||||
const s = props.match.score;
|
||||
if (!s) return '';
|
||||
return `${s.ftHome} - ${s.ftAway}`;
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<article class="match-card">
|
||||
<article
|
||||
class="match-card"
|
||||
:class="{ 'match-card--phase': phase !== 'open' }"
|
||||
@click="emit('bet', match.id)"
|
||||
>
|
||||
<StatusWatermark
|
||||
v-if="phase !== 'open'"
|
||||
:label="phaseLabel"
|
||||
:variant="matchPhaseVariant(phase)"
|
||||
size="sm"
|
||||
/>
|
||||
|
||||
<div class="teams-row">
|
||||
<!-- Home -->
|
||||
<div class="team">
|
||||
<span class="team-name">{{ match.homeTeamName }}</span>
|
||||
<img
|
||||
@@ -61,13 +95,12 @@ const awayIsLogo = computed(() => Boolean(props.match.awayTeamLogoUrl?.trim()));
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- Center -->
|
||||
<div class="center-col">
|
||||
<span class="kickoff">{{ kickoffText }}</span>
|
||||
<span class="vs">VS</span>
|
||||
<span v-if="phase !== 'open' && liveScoreText" class="live-score">{{ liveScoreText }}</span>
|
||||
<span v-else class="vs">VS</span>
|
||||
</div>
|
||||
|
||||
<!-- Away -->
|
||||
<div class="team">
|
||||
<span class="team-name">{{ match.awayTeamName }}</span>
|
||||
<img
|
||||
@@ -80,14 +113,20 @@ const awayIsLogo = computed(() => Boolean(props.match.awayTeamLogoUrl?.trim()));
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button type="button" class="bet-btn btn-gold-outline" @click="emit('bet', match.id)">
|
||||
{{ t('bet.place_bet_short') }}
|
||||
<button
|
||||
type="button"
|
||||
class="bet-btn"
|
||||
:class="bettingOpen ? 'btn-gold-outline' : 'bet-btn--view'"
|
||||
@click.stop="emit('bet', match.id)"
|
||||
>
|
||||
{{ bettingOpen ? t('bet.place_bet_short') : t('bet.view_match') }}
|
||||
</button>
|
||||
</article>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.match-card {
|
||||
position: relative;
|
||||
background: #0d0d0d;
|
||||
border: 1px solid rgba(255, 215, 0, 0.25);
|
||||
border-radius: 6px;
|
||||
@@ -97,9 +136,17 @@ const awayIsLogo = computed(() => Boolean(props.match.awayTeamLogoUrl?.trim()));
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.match-card--phase {
|
||||
border-color: rgba(140, 140, 140, 0.35);
|
||||
}
|
||||
|
||||
.teams-row {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
@@ -132,6 +179,10 @@ const awayIsLogo = computed(() => Boolean(props.match.awayTeamLogoUrl?.trim()));
|
||||
align-self: stretch;
|
||||
}
|
||||
|
||||
.match-card--phase .team-name {
|
||||
color: #d8d8d8;
|
||||
}
|
||||
|
||||
.team-flag {
|
||||
width: 72px;
|
||||
height: 48px;
|
||||
@@ -165,6 +216,14 @@ const awayIsLogo = computed(() => Boolean(props.match.awayTeamLogoUrl?.trim()));
|
||||
text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
|
||||
}
|
||||
|
||||
.live-score {
|
||||
font-size: 20px;
|
||||
font-weight: 900;
|
||||
color: #fff;
|
||||
line-height: 1;
|
||||
letter-spacing: 0.04em;
|
||||
}
|
||||
|
||||
.vs {
|
||||
font-size: 22px;
|
||||
font-weight: 900;
|
||||
@@ -175,6 +234,8 @@ const awayIsLogo = computed(() => Boolean(props.match.awayTeamLogoUrl?.trim()));
|
||||
}
|
||||
|
||||
.bet-btn {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
width: auto;
|
||||
min-width: 80px;
|
||||
padding: 5px 24px;
|
||||
@@ -183,4 +244,10 @@ const awayIsLogo = computed(() => Boolean(props.match.awayTeamLogoUrl?.trim()));
|
||||
letter-spacing: 0.04em;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.bet-btn--view {
|
||||
background: #1a1a1a;
|
||||
border: 1px solid #444;
|
||||
color: #aaa;
|
||||
}
|
||||
</style>
|
||||
|
||||
68
apps/player/src/components/StatusWatermark.vue
Normal file
68
apps/player/src/components/StatusWatermark.vue
Normal file
@@ -0,0 +1,68 @@
|
||||
<script setup lang="ts">
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
label: string;
|
||||
variant?: 'pending' | 'won' | 'lost' | 'push' | 'closed' | 'settled';
|
||||
size?: 'sm' | 'md' | 'lg';
|
||||
}>(),
|
||||
{ variant: 'pending', size: 'md' },
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<span class="status-watermark" :class="[variant, size]">{{ label }}</span>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.status-watermark {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%) rotate(-35deg);
|
||||
font-weight: 900;
|
||||
letter-spacing: 0.06em;
|
||||
white-space: nowrap;
|
||||
pointer-events: none;
|
||||
opacity: 0.2;
|
||||
max-width: 92%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.status-watermark.sm {
|
||||
font-size: 22px;
|
||||
}
|
||||
|
||||
.status-watermark.md {
|
||||
font-size: 28px;
|
||||
}
|
||||
|
||||
.status-watermark.lg {
|
||||
font-size: 34px;
|
||||
}
|
||||
|
||||
.status-watermark.won {
|
||||
color: #3db865;
|
||||
}
|
||||
|
||||
.status-watermark.lost {
|
||||
color: #e05050;
|
||||
}
|
||||
|
||||
.status-watermark.push {
|
||||
color: #888;
|
||||
}
|
||||
|
||||
.status-watermark.pending {
|
||||
color: #e8c84a;
|
||||
}
|
||||
|
||||
.status-watermark.closed {
|
||||
color: #c9a84a;
|
||||
}
|
||||
|
||||
.status-watermark.settled {
|
||||
color: #7a9ab8;
|
||||
}
|
||||
</style>
|
||||
@@ -13,6 +13,7 @@ const props = defineProps<{
|
||||
oddsVersion: string;
|
||||
}>;
|
||||
stakes: Record<string, number>;
|
||||
locked?: boolean;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
@@ -26,6 +27,7 @@ const columns = computed(() =>
|
||||
);
|
||||
|
||||
function setStake(sel: CsSelection, raw: string) {
|
||||
if (props.locked) return;
|
||||
const n = Math.max(0, Number(raw) || 0);
|
||||
emit('update:stakes', { ...props.stakes, [sel.id]: n });
|
||||
}
|
||||
@@ -37,7 +39,7 @@ function formatOdds(odds: string) {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="cs-panel">
|
||||
<div class="cs-panel" :class="{ 'cs-panel--locked': locked }">
|
||||
<div class="cols-head">
|
||||
<span>{{ t('bet.col_home') }}</span>
|
||||
<span>{{ t('bet.col_draw') }}</span>
|
||||
@@ -57,6 +59,7 @@ function formatOdds(odds: string) {
|
||||
inputmode="decimal"
|
||||
:placeholder="t('bet.stake_placeholder')"
|
||||
:value="stakes[sel.id] ?? ''"
|
||||
:disabled="locked"
|
||||
@input="setStake(sel, ($event.target as HTMLInputElement).value)"
|
||||
/>
|
||||
</div>
|
||||
@@ -70,6 +73,14 @@ function formatOdds(odds: string) {
|
||||
padding: 6px 8px 0;
|
||||
}
|
||||
|
||||
.cs-panel--locked {
|
||||
opacity: 0.72;
|
||||
}
|
||||
|
||||
.cs-panel--locked .stake-input {
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.cols-head {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
|
||||
@@ -11,6 +11,7 @@ const props = defineProps<{
|
||||
}[];
|
||||
isSelected: (id: string) => boolean;
|
||||
compact?: boolean;
|
||||
locked?: boolean;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{ pick: [id: string] }>();
|
||||
@@ -22,18 +23,24 @@ function label(sel: (typeof props.selections)[number]) {
|
||||
}
|
||||
return sel.selectionName;
|
||||
}
|
||||
|
||||
function onPick(id: string) {
|
||||
if (props.locked) return;
|
||||
emit('pick', id);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="wrap" :class="{ compact }">
|
||||
<div class="wrap" :class="{ compact, locked }">
|
||||
<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)"
|
||||
:class="{ selected: isSelected(sel.id), 'odds-btn--locked': locked }"
|
||||
:disabled="locked"
|
||||
@click="onPick(sel.id)"
|
||||
>
|
||||
<span class="label">{{ label(sel) }}</span>
|
||||
<span class="odds">{{ sel.odds }}</span>
|
||||
@@ -48,6 +55,10 @@ function label(sel: (typeof props.selections)[number]) {
|
||||
background: #0c0c0c;
|
||||
}
|
||||
|
||||
.wrap.locked {
|
||||
opacity: 0.78;
|
||||
}
|
||||
|
||||
.panel {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
@@ -73,6 +84,17 @@ function label(sel: (typeof props.selections)[number]) {
|
||||
background: rgba(212, 175, 55, 0.1);
|
||||
}
|
||||
|
||||
.odds-btn--locked {
|
||||
background: #111;
|
||||
border-color: #333;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.odds-btn--locked .label,
|
||||
.odds-btn--locked .odds {
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.label {
|
||||
font-size: 9px;
|
||||
color: var(--text-muted);
|
||||
|
||||
@@ -8,6 +8,8 @@ import { PARLAY_MARKET_TYPES, PARLAY_SELECTION_KEYS, PARLAY_MARKET_GROUPS } from
|
||||
import BetGuideHelp from '../BetGuideHelp.vue';
|
||||
import GoldSpinner from '../GoldSpinner.vue';
|
||||
import TeamEmblem from '../TeamEmblem.vue';
|
||||
import StatusWatermark from '../StatusWatermark.vue';
|
||||
import { matchPhaseLabel, matchPhaseVariant, type MatchPhase } from '../../utils/matchPhase';
|
||||
import { useOnLocaleChange } from '../../composables/useOnLocaleChange';
|
||||
|
||||
type TimeFilter = 'all' | 'today';
|
||||
@@ -39,6 +41,14 @@ interface ParlayMatch {
|
||||
homeTeamLogoUrl?: string | null;
|
||||
awayTeamLogoUrl?: string | null;
|
||||
startTime: string;
|
||||
bettingOpen?: boolean;
|
||||
matchPhase?: MatchPhase;
|
||||
score?: {
|
||||
htHome: number;
|
||||
htAway: number;
|
||||
ftHome: number;
|
||||
ftAway: number;
|
||||
} | null;
|
||||
markets: Market[];
|
||||
}
|
||||
|
||||
@@ -213,6 +223,7 @@ function isPicked(selectionId: string) {
|
||||
const parlayHint = ref('');
|
||||
|
||||
function pickSelection(match: ParlayMatch, market: Market, sel: Selection) {
|
||||
if (match.bettingOpen === false) return;
|
||||
const err = slip.addParlayLeg({
|
||||
selectionId: sel.id,
|
||||
oddsVersion: String(sel.oddsVersion),
|
||||
@@ -280,8 +291,22 @@ function toggleCollapse(id: string) {
|
||||
</div>
|
||||
|
||||
<div v-else-if="filteredMatches.length" class="match-list">
|
||||
<div v-for="match in filteredMatches" :key="match.id" class="match-card" :class="{ collapsed: collapsed.has(match.id) }">
|
||||
<div
|
||||
v-for="match in filteredMatches"
|
||||
:key="match.id"
|
||||
class="match-card"
|
||||
:class="{
|
||||
collapsed: collapsed.has(match.id),
|
||||
'match-card--phase': (match.matchPhase ?? (match.bettingOpen === false ? 'closed_pending' : 'open')) !== 'open',
|
||||
}"
|
||||
>
|
||||
<button type="button" class="match-head" @click="toggleCollapse(match.id)">
|
||||
<StatusWatermark
|
||||
v-if="(match.matchPhase ?? (match.bettingOpen === false ? 'closed_pending' : 'open')) !== 'open'"
|
||||
:label="matchPhaseLabel(t, match.matchPhase ?? 'closed_pending')"
|
||||
:variant="matchPhaseVariant(match.matchPhase ?? 'closed_pending')"
|
||||
size="sm"
|
||||
/>
|
||||
<div class="match-head-top">
|
||||
<span class="m-league">{{ match.leagueName }}</span>
|
||||
<span class="toggle-dot" :class="{ open: !collapsed.has(match.id) }">
|
||||
@@ -299,7 +324,13 @@ function toggleCollapse(id: string) {
|
||||
<span class="m-name">{{ match.homeTeamName }}</span>
|
||||
</div>
|
||||
<div class="m-center">
|
||||
<span class="m-time">{{ formatKickoff(match.startTime) }}</span>
|
||||
<span
|
||||
v-if="(match.matchPhase ?? (match.bettingOpen === false ? 'closed_pending' : 'open')) !== 'open' && match.score"
|
||||
class="m-score"
|
||||
>
|
||||
{{ match.score.ftHome }} - {{ match.score.ftAway }}
|
||||
</span>
|
||||
<span v-else class="m-time">{{ formatKickoff(match.startTime) }}</span>
|
||||
<span class="m-vs">VS</span>
|
||||
</div>
|
||||
<div class="m-team away">
|
||||
@@ -335,7 +366,11 @@ function toggleCollapse(id: string) {
|
||||
:key="sel.id"
|
||||
type="button"
|
||||
class="odd-btn"
|
||||
:class="{ picked: isPicked(sel.id) }"
|
||||
:class="{
|
||||
picked: isPicked(sel.id),
|
||||
'odd-btn--locked': match.bettingOpen === false,
|
||||
}"
|
||||
:disabled="match.bettingOpen === false"
|
||||
@click="pickSelection(match, getMarket(match, col.key)!, sel)"
|
||||
>
|
||||
<span class="odd-label">{{ selLabel(sel) }}</span>
|
||||
@@ -467,6 +502,8 @@ function toggleCollapse(id: string) {
|
||||
}
|
||||
|
||||
.match-head {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -647,6 +684,27 @@ function toggleCollapse(id: string) {
|
||||
background: rgba(212, 175, 55, 0.15);
|
||||
}
|
||||
|
||||
.odd-btn--locked {
|
||||
opacity: 0.65;
|
||||
cursor: not-allowed;
|
||||
border-color: #333;
|
||||
}
|
||||
|
||||
.odd-btn--locked .odd-label,
|
||||
.odd-btn--locked .odd-val {
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.match-card--phase {
|
||||
opacity: 0.94;
|
||||
}
|
||||
|
||||
.m-score {
|
||||
font-size: 12px;
|
||||
font-weight: 800;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.odd-label {
|
||||
font-size: 8.5px;
|
||||
font-weight: 700;
|
||||
|
||||
@@ -196,6 +196,9 @@ const i18n = createI18n({
|
||||
download: '下载',
|
||||
reward_active: '奖励生效中!',
|
||||
market_closed: '暂未开盘',
|
||||
match_phase_closed_pending: '封盘待结算',
|
||||
match_phase_settled: '已结算',
|
||||
view_match: '查看赛况',
|
||||
expand_market: '展开玩法',
|
||||
collapse_market: '收起玩法',
|
||||
market_cs: '波胆',
|
||||
@@ -502,6 +505,9 @@ const i18n = createI18n({
|
||||
download: 'Download',
|
||||
reward_active: 'Reward active!',
|
||||
market_closed: 'Not open',
|
||||
match_phase_closed_pending: 'Closed pending',
|
||||
match_phase_settled: 'Settled',
|
||||
view_match: 'View match',
|
||||
expand_market: 'Expand',
|
||||
collapse_market: 'Collapse',
|
||||
market_cs: 'Correct Score',
|
||||
@@ -814,6 +820,9 @@ const i18n = createI18n({
|
||||
download: 'Muat turun',
|
||||
reward_active: 'Ganjaran aktif!',
|
||||
market_closed: 'Belum dibuka',
|
||||
match_phase_closed_pending: 'Ditutup menunggu',
|
||||
match_phase_settled: 'Selesai',
|
||||
view_match: 'Lihat perlawanan',
|
||||
expand_market: 'Kembang',
|
||||
collapse_market: 'Tutup',
|
||||
market_cs: 'Skor Tepat',
|
||||
|
||||
13
apps/player/src/utils/matchPhase.ts
Normal file
13
apps/player/src/utils/matchPhase.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
export type MatchPhase = 'open' | 'closed_pending' | 'settled';
|
||||
|
||||
export function matchPhaseLabel(t: (key: string) => string, phase?: MatchPhase | null) {
|
||||
if (phase === 'closed_pending') return t('bet.match_phase_closed_pending');
|
||||
if (phase === 'settled') return t('bet.match_phase_settled');
|
||||
return '';
|
||||
}
|
||||
|
||||
export function matchPhaseVariant(phase?: MatchPhase | null): 'closed' | 'settled' | 'pending' {
|
||||
if (phase === 'settled') return 'settled';
|
||||
if (phase === 'closed_pending') return 'closed';
|
||||
return 'pending';
|
||||
}
|
||||
@@ -6,6 +6,8 @@ import api from '../api';
|
||||
import { formatMoney } from '../utils/localeDisplay';
|
||||
import GoldSpinner from '../components/GoldSpinner.vue';
|
||||
import { usePullToRefresh } from '../composables/usePullToRefresh';
|
||||
import StatusWatermark from '../components/StatusWatermark.vue';
|
||||
import { matchPhaseLabel, matchPhaseVariant, type MatchPhase } from '../utils/matchPhase';
|
||||
import type { BetHistoryItem } from '../components/BetHistoryCard.vue';
|
||||
|
||||
const route = useRoute();
|
||||
@@ -122,6 +124,12 @@ const myPick = computed(() => {
|
||||
if (ci < 0) return raw;
|
||||
return raw.slice(0, ci + 2) + translateSel(raw.slice(ci + 2));
|
||||
});
|
||||
|
||||
const matchPhase = computed(
|
||||
(): MatchPhase | null => bet.value?.matchPhase ?? null,
|
||||
);
|
||||
|
||||
const matchPhaseText = computed(() => matchPhaseLabel(t, matchPhase.value));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -164,7 +172,13 @@ const myPick = computed(() => {
|
||||
<div class="match-name">{{ matchTitle }}</div>
|
||||
|
||||
<!-- single bet: score comparison -->
|
||||
<div v-if="!bet.isParlay" class="score-block">
|
||||
<div v-if="!bet.isParlay" class="score-block" :class="{ 'score-block--phase': matchPhase && matchPhase !== 'open' }">
|
||||
<StatusWatermark
|
||||
v-if="matchPhase && matchPhase !== 'open'"
|
||||
:label="matchPhaseText"
|
||||
:variant="matchPhaseVariant(matchPhase)"
|
||||
size="md"
|
||||
/>
|
||||
<!-- my pick row -->
|
||||
<div class="row-label-val">
|
||||
<span class="row-label">{{ t('history.my_pick') }}</span>
|
||||
@@ -364,11 +378,17 @@ const myPick = computed(() => {
|
||||
|
||||
/* score block */
|
||||
.score-block {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.score-block--phase {
|
||||
padding: 8px 0 4px;
|
||||
}
|
||||
|
||||
.row-label-val {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
@@ -11,6 +11,7 @@ import emptyMatchesImg from '../assets/images/empty-matches.svg';
|
||||
import { useOnLocaleChange } from '../composables/useOnLocaleChange';
|
||||
import GoldSpinner from '../components/GoldSpinner.vue';
|
||||
import { usePullToRefresh } from '../composables/usePullToRefresh';
|
||||
import type { MatchPhase } from '../utils/matchPhase';
|
||||
|
||||
type MainTab = 'matches' | 'outright' | 'parlay';
|
||||
type TimeTab = 'today' | 'early';
|
||||
@@ -29,6 +30,15 @@ interface Match {
|
||||
leagueLogoUrl?: string | null;
|
||||
displayOrder?: number;
|
||||
isHot?: boolean;
|
||||
status?: string;
|
||||
bettingOpen?: boolean;
|
||||
matchPhase?: MatchPhase;
|
||||
score?: {
|
||||
htHome: number;
|
||||
htAway: number;
|
||||
ftHome: number;
|
||||
ftAway: number;
|
||||
} | null;
|
||||
}
|
||||
|
||||
interface LeagueGroup {
|
||||
|
||||
@@ -13,8 +13,8 @@ const { initFromUser } = useAppLocale();
|
||||
const auth = useAuthStore();
|
||||
const router = useRouter();
|
||||
const captchaRef = ref<InstanceType<typeof RobotVerify> | null>(null);
|
||||
const username = ref('player1');
|
||||
const password = ref('Player@123');
|
||||
const username = ref('');
|
||||
const password = ref('');
|
||||
const error = ref('');
|
||||
const loading = ref(false);
|
||||
|
||||
|
||||
@@ -19,6 +19,8 @@ import { usePullToRefresh } from '../composables/usePullToRefresh';
|
||||
import vsImg from '../assets/images/vs.png';
|
||||
import GoldSpinner from '../components/GoldSpinner.vue';
|
||||
import BetSuccessOverlay from '../components/BetSuccessOverlay.vue';
|
||||
import StatusWatermark from '../components/StatusWatermark.vue';
|
||||
import { matchPhaseLabel, matchPhaseVariant, type MatchPhase } from '../utils/matchPhase';
|
||||
import cardBg from '../assets/images/card-bg.png';
|
||||
|
||||
const heroCardBg = `url(${cardBg})`;
|
||||
@@ -59,6 +61,15 @@ interface MatchDetail {
|
||||
startTime: string;
|
||||
stage?: string | null;
|
||||
groupName?: string | null;
|
||||
status?: string;
|
||||
bettingOpen?: boolean;
|
||||
matchPhase?: MatchPhase;
|
||||
score?: {
|
||||
htHome: number;
|
||||
htAway: number;
|
||||
ftHome: number;
|
||||
ftAway: number;
|
||||
} | null;
|
||||
markets: Market[];
|
||||
}
|
||||
|
||||
@@ -96,6 +107,21 @@ const kickoff = computed(() => {
|
||||
});
|
||||
});
|
||||
|
||||
const bettingOpen = computed(() => match.value?.bettingOpen !== false);
|
||||
|
||||
const matchPhase = computed(
|
||||
(): MatchPhase =>
|
||||
match.value?.matchPhase ?? (bettingOpen.value ? 'open' : 'closed_pending'),
|
||||
);
|
||||
|
||||
const phaseLabel = computed(() => matchPhaseLabel(t, matchPhase.value));
|
||||
|
||||
const liveScoreText = computed(() => {
|
||||
const s = match.value?.score;
|
||||
if (!s) return '';
|
||||
return `${s.ftHome} - ${s.ftAway}`;
|
||||
});
|
||||
|
||||
function marketLabel(marketType: string) {
|
||||
const key = MARKET_I18N_KEY[marketType];
|
||||
return key ? t(key) : marketType;
|
||||
@@ -170,6 +196,7 @@ async function confirmCorrectScoreBets() {
|
||||
}
|
||||
|
||||
async function placeCorrectScoreBets(marketType: string) {
|
||||
if (!bettingOpen.value) return;
|
||||
const market = marketsByType.value.get(marketType);
|
||||
if (!market || !match.value) return;
|
||||
const entries = market.selections.filter((s) => (correctScoreStakes.value[s.id] ?? 0) > 0);
|
||||
@@ -228,7 +255,7 @@ function isSelected(id: string) {
|
||||
}
|
||||
|
||||
function toggleSelection(sel: Selection, market: Market) {
|
||||
if (!match.value) return;
|
||||
if (!match.value || !bettingOpen.value) return;
|
||||
slip.addItem({
|
||||
selectionId: sel.id,
|
||||
oddsVersion: String(sel.oddsVersion),
|
||||
@@ -295,7 +322,13 @@ function hasSlipPickForMarket(marketType: string) {
|
||||
<GoldSpinner :size="36" />
|
||||
</div>
|
||||
<template v-else-if="match">
|
||||
<section class="match-hero">
|
||||
<section class="match-hero" :class="{ 'match-hero--phase': matchPhase !== 'open' }">
|
||||
<StatusWatermark
|
||||
v-if="matchPhase !== 'open'"
|
||||
:label="phaseLabel"
|
||||
:variant="matchPhaseVariant(matchPhase)"
|
||||
size="lg"
|
||||
/>
|
||||
<div class="hero-teams">
|
||||
<!-- home -->
|
||||
<div class="hero-team">
|
||||
@@ -348,6 +381,7 @@ function hasSlipPickForMarket(marketType: string) {
|
||||
</div>
|
||||
|
||||
<p class="kickoff">{{ t('bet.kickoff_time') }}{{ kickoff }}</p>
|
||||
<p v-if="liveScoreText" class="live-score">{{ liveScoreText }}</p>
|
||||
</section>
|
||||
|
||||
<section class="markets-section">
|
||||
@@ -379,14 +413,22 @@ function hasSlipPickForMarket(marketType: string) {
|
||||
@toggle="toggleMarket(marketType)"
|
||||
/>
|
||||
<template v-if="isExpanded(marketType) && marketsByType.get(marketType)">
|
||||
<div class="market-panel-wrap" :class="{ locked: !bettingOpen }">
|
||||
<StatusWatermark
|
||||
v-if="!bettingOpen"
|
||||
:label="phaseLabel"
|
||||
:variant="matchPhaseVariant(matchPhase)"
|
||||
size="md"
|
||||
/>
|
||||
<CorrectScorePanel
|
||||
v-if="isCorrectScoreMarket(marketType)"
|
||||
:market-type="marketType"
|
||||
:selections="marketsByType.get(marketType)!.selections"
|
||||
:locked="!bettingOpen"
|
||||
v-model:stakes="correctScoreStakes"
|
||||
/>
|
||||
<button
|
||||
v-if="isCorrectScoreMarket(marketType)"
|
||||
v-if="isCorrectScoreMarket(marketType) && bettingOpen"
|
||||
type="button"
|
||||
class="market-foot-btn"
|
||||
@click="openCorrectScoreConfirm(marketType)"
|
||||
@@ -396,18 +438,20 @@ function hasSlipPickForMarket(marketType: string) {
|
||||
<MarketSelectionsPanel
|
||||
v-else
|
||||
compact
|
||||
:locked="!bettingOpen"
|
||||
:selections="marketsByType.get(marketType)!.selections"
|
||||
:is-selected="isSelected"
|
||||
@pick="onPickSelection($event, marketType)"
|
||||
/>
|
||||
<button
|
||||
v-if="!isCorrectScoreMarket(marketType) && hasSlipPickForMarket(marketType)"
|
||||
v-if="!isCorrectScoreMarket(marketType) && bettingOpen && hasSlipPickForMarket(marketType)"
|
||||
type="button"
|
||||
class="market-foot-btn"
|
||||
@click="openBetSlipDrawer"
|
||||
>
|
||||
{{ t('bet.cs_confirm_cell') }}
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
@@ -501,6 +545,19 @@ function hasSlipPickForMarket(marketType: string) {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.match-hero--phase {
|
||||
opacity: 0.98;
|
||||
}
|
||||
|
||||
.market-panel-wrap {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.market-panel-wrap.locked {
|
||||
opacity: 0.82;
|
||||
}
|
||||
|
||||
.kickoff {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
@@ -511,6 +568,17 @@ function hasSlipPickForMarket(marketType: string) {
|
||||
padding-left: 2px;
|
||||
}
|
||||
|
||||
.live-score {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
margin: 8px 0 0;
|
||||
font-size: 28px;
|
||||
font-weight: 900;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
letter-spacing: 0.06em;
|
||||
}
|
||||
|
||||
.hero-teams {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
|
||||
Reference in New Issue
Block a user