2026-01-16 13:35:17 +08:00
|
|
|
|
<template>
|
2026-01-16 19:00:07 +08:00
|
|
|
|
<div class="bg-white dark:bg-slate-50 rounded-3xl shadow-2xl flex flex-col overflow-hidden h-full">
|
|
|
|
|
|
<!-- Header -->
|
|
|
|
|
|
<header class="px-8 py-6 border-b border-slate-100 dark:border-slate-200/60 bg-white/50 backdrop-blur-md">
|
|
|
|
|
|
<div class="flex flex-wrap items-center gap-4">
|
|
|
|
|
|
<div class="relative flex-1 min-w-[200px]">
|
|
|
|
|
|
<select
|
|
|
|
|
|
v-model="searchForm.country"
|
|
|
|
|
|
class="w-full bg-slate-50 border-none rounded-xl py-3 pl-4 pr-10 text-sm text-slate-600 appearance-none focus:ring-2 focus:ring-primary/20 shadow-soft-inner outline-none"
|
|
|
|
|
|
>
|
|
|
|
|
|
<option value="">{{ $t('hostList.selectAll') }}</option>
|
|
|
|
|
|
<option v-for="item in options" :key="item.value" :value="item.value">{{ item.label }}</option>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
<span class="material-icons-round absolute right-3 top-1/2 -translate-y-1/2 text-slate-400 pointer-events-none">expand_more</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="relative flex-1 min-w-[200px]">
|
|
|
|
|
|
<span class="material-icons-round absolute left-3 top-1/2 -translate-y-1/2 text-slate-400 text-sm">calendar_today</span>
|
|
|
|
|
|
<input
|
|
|
|
|
|
v-model="searchForm.createTime"
|
|
|
|
|
|
type="date"
|
|
|
|
|
|
class="w-full bg-slate-50 border-none rounded-xl py-3 pl-10 pr-4 text-sm text-slate-600 focus:ring-2 focus:ring-primary/20 shadow-soft-inner outline-none"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="relative flex-[1.5] min-w-[240px]">
|
|
|
|
|
|
<input
|
|
|
|
|
|
v-model="searchForm.hostsId"
|
|
|
|
|
|
class="w-full bg-slate-50 border-none rounded-xl py-3 px-4 text-sm text-slate-600 focus:ring-2 focus:ring-primary/20 shadow-soft-inner outline-none"
|
|
|
|
|
|
:placeholder="$t('hostList.placeHostId')"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="flex items-center gap-2 ml-auto">
|
|
|
|
|
|
<button
|
|
|
|
|
|
@click="serch"
|
|
|
|
|
|
class="bg-primary hover:bg-blue-700 text-white px-8 py-3 rounded-xl font-medium text-sm transition-all shadow-lg shadow-primary/20 flex items-center gap-2"
|
|
|
|
|
|
>
|
|
|
|
|
|
<span class="material-icons-round text-sm">search</span>
|
|
|
|
|
|
{{ $t('hostList.query') }}
|
|
|
|
|
|
</button>
|
|
|
|
|
|
<button
|
|
|
|
|
|
@click="filterdialogVisible = true"
|
|
|
|
|
|
class="bg-slate-100 hover:bg-slate-200 text-slate-600 p-3 rounded-xl transition-all"
|
|
|
|
|
|
>
|
|
|
|
|
|
<span class="material-icons-round">tune</span>
|
|
|
|
|
|
</button>
|
|
|
|
|
|
</div>
|
2025-07-01 21:02:39 +08:00
|
|
|
|
</div>
|
2026-01-16 19:00:07 +08:00
|
|
|
|
</header>
|
2025-07-01 21:02:39 +08:00
|
|
|
|
|
2026-01-16 19:00:07 +08:00
|
|
|
|
<!-- Table -->
|
|
|
|
|
|
<div class="flex-1 overflow-auto p-8 relative">
|
|
|
|
|
|
<div v-if="loading" class="absolute inset-0 bg-white/50 z-10 flex items-center justify-center">
|
|
|
|
|
|
<span class="material-icons-round animate-spin text-primary text-4xl">sync</span>
|
2025-07-01 21:02:39 +08:00
|
|
|
|
</div>
|
2026-01-16 19:00:07 +08:00
|
|
|
|
<table class="w-full text-left border-separate border-spacing-0">
|
|
|
|
|
|
<thead>
|
|
|
|
|
|
<tr class="text-slate-400 text-xs font-semibold uppercase tracking-wider sticky top-0 bg-white z-0">
|
|
|
|
|
|
<!-- Selection Header -->
|
|
|
|
|
|
<th class="pb-4 pl-4 font-normal bg-white">
|
|
|
|
|
|
<!-- Select All Logic not full implemented yet, just visual for design match -->
|
|
|
|
|
|
<input type="checkbox" class="rounded border-slate-300 text-primary focus:ring-primary/20" />
|
|
|
|
|
|
</th>
|
|
|
|
|
|
<th class="pb-4 font-semibold bg-white">{{ $t('hostList.hostId') }}</th>
|
|
|
|
|
|
<th class="pb-4 font-semibold bg-white">{{ $t('hostList.grade') }}</th>
|
|
|
|
|
|
<th class="pb-4 font-semibold bg-white">{{ $t('hostList.invitationType') }}</th>
|
|
|
|
|
|
<th class="pb-4 font-semibold bg-white">{{ $t('hostList.liveSessions') }} / {{ $t('hostList.liveRevenue') }}</th>
|
|
|
|
|
|
<th class="pb-4 font-semibold bg-white">{{ $t('hostList.country') }}</th>
|
|
|
|
|
|
<th class="pb-4 font-semibold bg-white">{{ $t('hostList.creationTime') }}</th>
|
|
|
|
|
|
<th class="pb-4 font-semibold bg-white">{{ $t('hostList.anchorcoins') }}</th>
|
|
|
|
|
|
<th class="pb-4 font-semibold text-right pr-4 bg-white">操作</th>
|
|
|
|
|
|
</tr>
|
|
|
|
|
|
</thead>
|
|
|
|
|
|
<tbody class="text-sm text-slate-600">
|
|
|
|
|
|
<tr v-if="tableData.length === 0" class="text-center">
|
|
|
|
|
|
<td colspan="9" class="py-10 text-slate-400">暂无数据</td>
|
|
|
|
|
|
</tr>
|
|
|
|
|
|
<tr v-for="row in tableData" :key="row.hostId" class="group hover:bg-slate-50/80 transition-colors">
|
|
|
|
|
|
<!-- Checkbox -->
|
|
|
|
|
|
<td class="py-5 pl-4 border-b border-slate-50 group-last:border-none">
|
|
|
|
|
|
<input
|
|
|
|
|
|
type="checkbox"
|
|
|
|
|
|
class="rounded border-slate-300 text-primary focus:ring-primary/20"
|
|
|
|
|
|
:value="row.hostId"
|
|
|
|
|
|
v-model="selectHostList"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</td>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- Host ID -->
|
|
|
|
|
|
<td class="py-5 border-b border-slate-50 group-last:border-none">
|
|
|
|
|
|
<span
|
|
|
|
|
|
@click="openHTML(row.hostId)"
|
|
|
|
|
|
class="font-medium text-slate-900 border-b border-transparent group-hover:border-primary/30 transition-all cursor-pointer hover:text-primary"
|
|
|
|
|
|
>
|
|
|
|
|
|
{{ row.hostId }}
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</td>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- Level -->
|
|
|
|
|
|
<td class="py-5 border-b border-slate-50 group-last:border-none">
|
|
|
|
|
|
{{ row.hostlevel }}
|
|
|
|
|
|
</td>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- Invitation Type -->
|
|
|
|
|
|
<td class="py-5 border-b border-slate-50 group-last:border-none">
|
|
|
|
|
|
<span
|
|
|
|
|
|
class="px-3 py-1 text-[10px] font-bold uppercase rounded-full"
|
|
|
|
|
|
:class="row.invitationType == 1 ? 'bg-green-50 text-green-600' : 'bg-amber-50 text-amber-600'"
|
|
|
|
|
|
>
|
|
|
|
|
|
{{ row.invitationType == 1 ? $t('hostList.invitationType1') : $t('hostList.invitationType2') }}
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</td>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- Data Buttons -->
|
|
|
|
|
|
<td class="py-5 border-b border-slate-50 group-last:border-none">
|
|
|
|
|
|
<div class="flex gap-2">
|
|
|
|
|
|
<button
|
|
|
|
|
|
@click="getliveHost(row.hostId)"
|
|
|
|
|
|
class="px-3 py-1.5 bg-blue-50 text-blue-600 hover:bg-blue-600 hover:text-white rounded-lg text-xs font-medium transition-all"
|
|
|
|
|
|
>
|
|
|
|
|
|
{{ $t('hostList.viewSessions') }}
|
|
|
|
|
|
</button>
|
|
|
|
|
|
<button
|
|
|
|
|
|
@click="getRevenueStats(row.hostId)"
|
|
|
|
|
|
class="px-3 py-1.5 bg-sky-50 text-sky-600 hover:bg-sky-600 hover:text-white rounded-lg text-xs font-medium transition-all"
|
|
|
|
|
|
>
|
|
|
|
|
|
{{ $t('hostList.viewRevenue') }}
|
|
|
|
|
|
</button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</td>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- Country -->
|
|
|
|
|
|
<td class="py-5 border-b border-slate-50 group-last:border-none">
|
|
|
|
|
|
{{ row.country }}
|
|
|
|
|
|
</td>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- Time -->
|
|
|
|
|
|
<td class="py-5 border-b border-slate-50 group-last:border-none">
|
|
|
|
|
|
<div class="flex flex-col">
|
|
|
|
|
|
<span>{{ formatTimeOnlyDate(row.createTime) }}</span>
|
|
|
|
|
|
<span class="text-[10px] text-slate-400">{{ formatTimeOnlyTime(row.createTime) }}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</td>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- Coins -->
|
|
|
|
|
|
<td class="py-5 border-b border-slate-50 group-last:border-none font-semibold text-slate-900">
|
|
|
|
|
|
{{ row.hostsCoins }}
|
|
|
|
|
|
</td>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- Actions -->
|
|
|
|
|
|
<td class="py-5 border-b border-slate-50 group-last:border-none text-right pr-4">
|
|
|
|
|
|
<button class="p-1 hover:bg-slate-200 rounded transition-colors text-slate-400">
|
|
|
|
|
|
<span class="material-icons-round text-lg">more_horiz</span>
|
|
|
|
|
|
</button>
|
|
|
|
|
|
</td>
|
|
|
|
|
|
</tr>
|
|
|
|
|
|
</tbody>
|
|
|
|
|
|
</table>
|
2025-07-01 21:02:39 +08:00
|
|
|
|
</div>
|
2026-01-16 19:00:07 +08:00
|
|
|
|
|
|
|
|
|
|
<!-- Footer / Pagination -->
|
|
|
|
|
|
<footer class="px-8 py-6 border-t border-slate-100 dark:border-slate-200/60 bg-white/50 backdrop-blur-md flex flex-wrap items-center justify-between gap-4">
|
|
|
|
|
|
<div class="flex items-center gap-4">
|
|
|
|
|
|
<div class="relative">
|
|
|
|
|
|
<select
|
|
|
|
|
|
v-model="pageSize"
|
|
|
|
|
|
@change="handleSizeChange"
|
|
|
|
|
|
class="bg-slate-50 border-none rounded-lg py-2 pl-4 pr-10 text-sm text-slate-600 appearance-none focus:ring-2 focus:ring-primary/20 shadow-soft-inner outline-none"
|
|
|
|
|
|
>
|
|
|
|
|
|
<option :value="10">10/page</option>
|
|
|
|
|
|
<option :value="20">20/page</option>
|
|
|
|
|
|
<option :value="50">50/page</option>
|
|
|
|
|
|
<option :value="100">100/page</option>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
<span class="material-icons-round absolute right-2 top-1/2 -translate-y-1/2 text-slate-400 text-sm pointer-events-none">expand_more</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<span class="text-xs text-slate-400 font-medium">总条数: <span class="text-primary">{{ total }}</span></span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="flex items-center gap-1">
|
|
|
|
|
|
<button
|
|
|
|
|
|
@click="changePage(page - 1)"
|
|
|
|
|
|
:disabled="page <= 1"
|
|
|
|
|
|
class="p-2 text-slate-400 hover:bg-slate-100 rounded-lg transition-colors disabled:opacity-50"
|
|
|
|
|
|
>
|
|
|
|
|
|
<span class="material-icons-round text-lg">chevron_left</span>
|
|
|
|
|
|
</button>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- Simplified Pagination Logic -->
|
|
|
|
|
|
<button class="w-8 h-8 rounded-lg bg-slate-900 text-white text-xs font-bold transition-all shadow-md">{{ page }}</button>
|
|
|
|
|
|
|
|
|
|
|
|
<button
|
|
|
|
|
|
@click="changePage(page + 1)"
|
|
|
|
|
|
:disabled="page * pageSize >= total"
|
|
|
|
|
|
class="p-2 text-slate-400 hover:bg-slate-100 rounded-lg transition-colors disabled:opacity-50"
|
|
|
|
|
|
>
|
|
|
|
|
|
<span class="material-icons-round text-lg">chevron_right</span>
|
|
|
|
|
|
</button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</footer>
|
2025-07-01 21:02:39 +08:00
|
|
|
|
|
2026-01-16 19:00:07 +08:00
|
|
|
|
<!-- Filter Dialog (Preserved Element Plus) -->
|
2025-07-01 21:02:39 +08:00
|
|
|
|
<el-dialog v-model="filterdialogVisible" width="800px" :before-close="handleClose">
|
|
|
|
|
|
<el-row v-for="(field, index) in fields" :key="index" :gutter="20" style="margin-bottom: 10px">
|
|
|
|
|
|
<el-col :span="4">
|
2026-01-16 19:00:07 +08:00
|
|
|
|
<div style="height: 100%; padding-top: 10px" class="flex items-center justify-center">
|
2025-07-01 21:02:39 +08:00
|
|
|
|
{{ field.label }}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
<el-col :span="10">
|
2026-01-16 19:00:07 +08:00
|
|
|
|
<div><label class="text-sm text-slate-500 mb-1 block">{{ $t('hostList.min') }}</label></div>
|
2025-07-01 21:02:39 +08:00
|
|
|
|
<el-input type="number" :oninput="'if(value.length>9)value=value.slice(0,9)'"
|
|
|
|
|
|
v-model.number="searchForm[field.minModel]" :placeholder="$t('hostList.placeMin')" />
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
<el-col :span="10">
|
2026-01-16 19:00:07 +08:00
|
|
|
|
<div><label class="text-sm text-slate-500 mb-1 block">{{ $t('hostList.max') }}</label></div>
|
2025-07-01 21:02:39 +08:00
|
|
|
|
<el-input type="number" :oninput="'if(value.length>9)value=value.slice(0,9)'"
|
|
|
|
|
|
v-model.number="searchForm[field.maxModel]" :placeholder="$t('hostList.placeMax')" />
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
</el-row>
|
|
|
|
|
|
|
2026-01-16 19:00:07 +08:00
|
|
|
|
<el-row :gutter="20" class="mt-4">
|
2025-07-01 21:02:39 +08:00
|
|
|
|
<el-col :span="4">
|
2026-01-16 19:00:07 +08:00
|
|
|
|
<div style="height: 100%;padding-top: 10px;" class="flex items-center justify-center">
|
2025-07-01 21:02:39 +08:00
|
|
|
|
{{ $t('hostList.sort') }}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
<el-col :span="10">
|
2026-01-16 19:00:07 +08:00
|
|
|
|
<div><label class="text-sm text-slate-500 mb-1 block">{{ $t('hostList.sortType') }}</label></div>
|
2026-01-16 13:35:17 +08:00
|
|
|
|
<el-select v-model="sortData.sortType" filterable :placeholder="$t('hostList.selectPlaceholder')"
|
2026-01-16 19:00:07 +08:00
|
|
|
|
class="w-full">
|
2025-07-01 21:02:39 +08:00
|
|
|
|
<el-option v-for="item in sortNameOptions" :key="item.type" :label="item.label" :value="item.type" />
|
|
|
|
|
|
</el-select>
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
<el-col :span="10">
|
2026-01-16 19:00:07 +08:00
|
|
|
|
<div><label class="text-sm text-slate-500 mb-1 block">{{ $t('hostList.ascending') }}/{{ $t('hostList.descending') }}</label></div>
|
2026-01-16 13:35:17 +08:00
|
|
|
|
<el-select v-model="sortData.sortForm" filterable :placeholder="$t('hostList.selectPlaceholder')"
|
2026-01-16 19:00:07 +08:00
|
|
|
|
class="w-full">
|
2025-07-01 21:02:39 +08:00
|
|
|
|
<el-option
|
|
|
|
|
|
v-for="item in [{ label: $t('hostList.ascending'), value: 'asc' }, { label: $t('hostList.descending'), value: 'desc' }]"
|
|
|
|
|
|
:key="item.value" :label="item.label" :value="item.value" />
|
|
|
|
|
|
</el-select>
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
|
|
|
|
<template #footer>
|
|
|
|
|
|
<span class="dialog-footer">
|
2026-01-16 19:00:07 +08:00
|
|
|
|
<el-button @click="reset">
|
2025-07-01 21:02:39 +08:00
|
|
|
|
{{ $t('hostList.reset') }}
|
|
|
|
|
|
</el-button>
|
2026-01-16 19:00:07 +08:00
|
|
|
|
<el-button type="primary" @click="handelClick" class="bg-primary">
|
2025-07-01 21:02:39 +08:00
|
|
|
|
{{ $t('hostList.sure') }}
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-dialog>
|
|
|
|
|
|
|
2026-01-16 19:00:07 +08:00
|
|
|
|
<!-- Dialogs -->
|
|
|
|
|
|
<LiveRecordDialog v-model:modelValue="liveDetailDialogVisible" :rows="liveDetailRecords" @select="handleLiveSelect" />
|
2026-01-07 18:57:30 +08:00
|
|
|
|
|
2026-01-16 13:35:17 +08:00
|
|
|
|
<el-dialog v-model="revenueDialogVisible" :title="$t('hostList.liveRevenue')" width="80vw" top="6vh"
|
|
|
|
|
|
:close-on-click-modal="false" destroy-on-close>
|
|
|
|
|
|
<el-table :data="revenueRecords" border height="62vh" style="width: 100%" v-loading="revenueLoading"
|
|
|
|
|
|
table-layout="auto">
|
|
|
|
|
|
<el-table-column prop="displayId" :label="$t('hostList.revenueHost')" />
|
|
|
|
|
|
<el-table-column prop="todayRevenue" :label="$t('hostList.todayRevenueUsd')" />
|
|
|
|
|
|
<el-table-column prop="totalRevenue" :label="$t('hostList.totalRevenueUsd')" />
|
|
|
|
|
|
<el-table-column prop="lastDaysCount" :label="$t('hostList.liveDays')" />
|
|
|
|
|
|
<el-table-column prop="history" :label="$t('hostList.historyRevenueUsd')">
|
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
|
<el-tooltip v-if="hasHistory(row.history)" effect="dark" placement="top">
|
|
|
|
|
|
<template #content>{{ buildHistoryTitle(row.history) }}</template>
|
|
|
|
|
|
<div class="history-sparkline-wrap">
|
|
|
|
|
|
<div class="history-sparkline-top">
|
|
|
|
|
|
<span class="history-sparkline-min-top">
|
|
|
|
|
|
{{ $t('hostList.revenueLow') }}: {{ formatRevenueValue(getHistoryMin(row.history)) }}
|
|
|
|
|
|
</span>
|
|
|
|
|
|
<span class="history-sparkline-max">
|
|
|
|
|
|
{{ $t('hostList.revenueHigh') }}: {{ formatRevenueValue(getHistoryMax(row.history)) }}
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<svg class="history-sparkline" viewBox="0 0 180 48" preserveAspectRatio="none">
|
|
|
|
|
|
<line x1="2" y1="46" x2="178" y2="46" stroke="#e6eef7" stroke-width="1" />
|
|
|
|
|
|
<polyline :points="buildSparklinePoints(row.history)" fill="none" stroke="#45a1ff" stroke-width="2" />
|
|
|
|
|
|
</svg>
|
|
|
|
|
|
<div class="history-sparkline-bottom">
|
|
|
|
|
|
<div class="history-sparkline-dates">
|
|
|
|
|
|
<span class="history-sparkline-date">{{ getHistoryStartDate(row.history) }}</span>
|
|
|
|
|
|
<span class="history-sparkline-date">{{ getHistoryEndDate(row.history) }}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</el-tooltip>
|
|
|
|
|
|
<span v-else>-</span>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
<el-table-column prop="createdAt" :label="$t('hostList.revenueTime')">
|
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
|
{{ formatTimestamp(scope.row.createdAt) }}
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
</el-table>
|
|
|
|
|
|
<template #footer>
|
|
|
|
|
|
<el-button @click="revenueDialogVisible = false">{{ $t('hostList.close') }}</el-button>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-dialog>
|
|
|
|
|
|
|
2025-07-01 21:02:39 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup>
|
2026-01-16 19:00:07 +08:00
|
|
|
|
import { tkhostdata, getCountryinfo, liveHostDetail, revenueStats } from '@/api/account';
|
|
|
|
|
|
import { usePythonBridge } from '@/utils/pythonBridge'
|
|
|
|
|
|
import { getUser } from '@/utils/storage'
|
2025-07-01 21:02:39 +08:00
|
|
|
|
import { ref, reactive, onMounted } from 'vue';
|
|
|
|
|
|
import { useI18n } from 'vue-i18n'
|
2026-01-07 18:57:30 +08:00
|
|
|
|
import LiveRecordDialog from '@/components/LiveRecordDialog.vue'
|
2025-07-01 21:02:39 +08:00
|
|
|
|
|
|
|
|
|
|
const { t } = useI18n()
|
|
|
|
|
|
const loading = ref(false)
|
|
|
|
|
|
const { givePyAnchorId, exportToExcel } = usePythonBridge();
|
|
|
|
|
|
|
|
|
|
|
|
const userInfo = ref(getUser())
|
2026-01-16 19:00:07 +08:00
|
|
|
|
|
2025-07-01 21:02:39 +08:00
|
|
|
|
const tableData = ref([])
|
2026-01-16 19:00:07 +08:00
|
|
|
|
const searchForm = ref({
|
|
|
|
|
|
country: '',
|
|
|
|
|
|
createTime: '',
|
|
|
|
|
|
hostsId: '',
|
|
|
|
|
|
fansMin: null, fansMax: null,
|
|
|
|
|
|
onlineFansMin: null, onlineFansMax: null,
|
|
|
|
|
|
hostsCoinsMin: null, hostsCoinsMax: null,
|
|
|
|
|
|
fllowernumMin: null, fllowernumMax: null
|
|
|
|
|
|
})
|
|
|
|
|
|
|
2025-07-01 21:02:39 +08:00
|
|
|
|
const fields = [
|
|
|
|
|
|
{ label: t('hostList.fansNum'), minModel: 'fansMin', maxModel: 'fansMax' },
|
|
|
|
|
|
{ label: t('hostList.onlineFans'), minModel: 'onlineFansMin', maxModel: 'onlineFansMax' },
|
|
|
|
|
|
{ label: t('hostList.anchorcoins'), minModel: 'hostsCoinsMin', maxModel: 'hostsCoinsMax' },
|
|
|
|
|
|
{ label: t('hostList.followersNum'), minModel: 'fllowernumMin', maxModel: 'fllowernumMax' },
|
|
|
|
|
|
]
|
|
|
|
|
|
|
2026-01-16 19:00:07 +08:00
|
|
|
|
let sortData = ref({ sortForm: 'desc', sortType: "createTime" })
|
2025-07-01 21:02:39 +08:00
|
|
|
|
let sortNameOptions = ref([
|
|
|
|
|
|
{ label: t('hostList.creationTime'), type: 'createTime' },
|
|
|
|
|
|
{ label: t('hostList.anchorcoins'), type: 'hostsCoins' },
|
|
|
|
|
|
{ label: t('hostList.fansNum'), type: 'fans' },
|
|
|
|
|
|
{ label: t('hostList.yesterdayGoldCoins'), type: 'yesterdayCoins' },
|
|
|
|
|
|
{ label: t('hostList.onlineFans'), type: 'onlineFans' },
|
|
|
|
|
|
{ label: t('hostList.followersNum'), type: 'fllowernum' },
|
|
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
|
|
let selectHostList = ref([])
|
|
|
|
|
|
let filterdialogVisible = ref(false)
|
2026-01-07 18:57:30 +08:00
|
|
|
|
let liveDetailDialogVisible = ref(false)
|
|
|
|
|
|
let liveDetailRecords = ref([])
|
2026-01-16 13:35:17 +08:00
|
|
|
|
let revenueDialogVisible = ref(false)
|
|
|
|
|
|
let revenueRecords = ref([])
|
|
|
|
|
|
let revenueLoading = ref(false)
|
2026-01-16 19:00:07 +08:00
|
|
|
|
|
2025-07-01 21:02:39 +08:00
|
|
|
|
let pageSize = ref(10)
|
|
|
|
|
|
let page = ref(1)
|
|
|
|
|
|
let total = ref(0)
|
|
|
|
|
|
let options = ref([])
|
|
|
|
|
|
|
|
|
|
|
|
onMounted(() => {
|
2026-01-16 19:00:07 +08:00
|
|
|
|
getCountry();
|
|
|
|
|
|
getlist();
|
2025-07-01 21:02:39 +08:00
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
function serch() {
|
|
|
|
|
|
page.value = 1
|
|
|
|
|
|
getlist();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-16 19:00:07 +08:00
|
|
|
|
function handleSizeChange() {
|
|
|
|
|
|
page.value = 1
|
2025-07-01 21:02:39 +08:00
|
|
|
|
getlist();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-16 19:00:07 +08:00
|
|
|
|
function changePage(newPage) {
|
|
|
|
|
|
if (newPage < 1 || (newPage - 1) * pageSize.value >= total.value) return
|
|
|
|
|
|
page.value = newPage
|
|
|
|
|
|
getlist()
|
2025-07-01 21:02:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-01-16 19:00:07 +08:00
|
|
|
|
const getlist = () => {
|
2025-07-01 21:02:39 +08:00
|
|
|
|
loading.value = true
|
|
|
|
|
|
tkhostdata({
|
|
|
|
|
|
tenantId: Number(userInfo.value.tenantId),
|
2026-01-16 19:00:07 +08:00
|
|
|
|
sort: sortData.value.sortForm,
|
|
|
|
|
|
sortName: sortData.value.sortType,
|
2025-07-01 21:02:39 +08:00
|
|
|
|
"current": page.value,
|
|
|
|
|
|
"pageSize": pageSize.value,
|
2026-01-16 19:00:07 +08:00
|
|
|
|
...searchForm.value,
|
2025-07-01 21:02:39 +08:00
|
|
|
|
}).then(res => {
|
|
|
|
|
|
loading.value = false
|
|
|
|
|
|
if (res) {
|
|
|
|
|
|
console.log('主播列表', res)
|
|
|
|
|
|
total.value = Number(res.total)
|
|
|
|
|
|
tableData.value = res.records.map(item => ({
|
2026-01-16 19:00:07 +08:00
|
|
|
|
hostId: item.hostsId,
|
|
|
|
|
|
hostlevel: item.hostsLevel,
|
2025-07-01 21:02:39 +08:00
|
|
|
|
country: item.country,
|
|
|
|
|
|
createTime: item.createTime,
|
|
|
|
|
|
fans: item.fans,
|
|
|
|
|
|
fllowernum: item.fllowernum,
|
|
|
|
|
|
hostsCoins: item.hostsCoins,
|
|
|
|
|
|
hostsKind: item.hostsKind,
|
|
|
|
|
|
onlineFans: item.onlineFans,
|
|
|
|
|
|
yesterdayCoins: item.yesterdayCoins,
|
|
|
|
|
|
belongBy: item.belongBy,
|
|
|
|
|
|
useable: item.useable,
|
|
|
|
|
|
invitationType: item.invitationType,
|
|
|
|
|
|
}));
|
|
|
|
|
|
}
|
2026-01-16 19:00:07 +08:00
|
|
|
|
}).catch(() => {
|
|
|
|
|
|
loading.value = false
|
2025-07-01 21:02:39 +08:00
|
|
|
|
})
|
|
|
|
|
|
}
|
2026-01-16 19:00:07 +08:00
|
|
|
|
|
2025-07-01 21:02:39 +08:00
|
|
|
|
function handelClick() {
|
|
|
|
|
|
filterdialogVisible.value = false
|
2026-01-16 19:00:07 +08:00
|
|
|
|
getlist()
|
2025-07-01 21:02:39 +08:00
|
|
|
|
}
|
2026-01-16 19:00:07 +08:00
|
|
|
|
|
2025-07-01 21:02:39 +08:00
|
|
|
|
function reset() {
|
|
|
|
|
|
searchForm.value.fansMin = null
|
|
|
|
|
|
searchForm.value.fansMax = null
|
|
|
|
|
|
searchForm.value.onlineFansMin = null
|
|
|
|
|
|
searchForm.value.onlineFansMax = null
|
|
|
|
|
|
searchForm.value.hostsCoinsMin = null
|
|
|
|
|
|
searchForm.value.hostsCoinsMax = null
|
|
|
|
|
|
searchForm.value.fllowernumMin = null
|
|
|
|
|
|
searchForm.value.fllowernumMax = null
|
|
|
|
|
|
}
|
2026-01-16 19:00:07 +08:00
|
|
|
|
|
2025-07-01 21:02:39 +08:00
|
|
|
|
function handleClose(done) {
|
|
|
|
|
|
done()
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-07 18:57:30 +08:00
|
|
|
|
function getliveHost(hostId) {
|
2026-01-16 19:00:07 +08:00
|
|
|
|
liveHostDetail({
|
2026-01-07 18:57:30 +08:00
|
|
|
|
"hostsId": hostId,
|
2025-12-18 20:09:21 +08:00
|
|
|
|
"tenantId": userInfo.value.tenantId
|
2026-01-16 19:00:07 +08:00
|
|
|
|
}).then(res => {
|
2026-01-07 18:57:30 +08:00
|
|
|
|
const detailList = Array.isArray(res) ? res : (res?.records || [])
|
|
|
|
|
|
liveDetailRecords.value = detailList
|
|
|
|
|
|
liveDetailDialogVisible.value = true
|
2025-12-18 20:09:21 +08:00
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-07 18:57:30 +08:00
|
|
|
|
function handleLiveSelect(row) {
|
|
|
|
|
|
liveDetailDialogVisible.value = false
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-16 13:35:17 +08:00
|
|
|
|
function getRevenueStats(hostId) {
|
|
|
|
|
|
revenueLoading.value = true
|
|
|
|
|
|
revenueStats(hostId).then(res => {
|
|
|
|
|
|
const detailList = Array.isArray(res) ? res : (res?.records || [])
|
|
|
|
|
|
revenueRecords.value = detailList
|
|
|
|
|
|
revenueDialogVisible.value = true
|
|
|
|
|
|
}).finally(() => {
|
|
|
|
|
|
revenueLoading.value = false
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-16 19:00:07 +08:00
|
|
|
|
function openHTML(id) {
|
|
|
|
|
|
givePyAnchorId(id)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function getCountry() {
|
|
|
|
|
|
getCountryinfo({}).then(res => {
|
|
|
|
|
|
res.forEach(item => {
|
|
|
|
|
|
if (item.countryGroupName) {
|
|
|
|
|
|
options.value.push({ value: item.countryGroupName, label: item.countryGroupName })
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function formatTimeOnlyDate(val) {
|
|
|
|
|
|
if(!val) return ''
|
|
|
|
|
|
return val.split(' ')[0] || val
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function formatTimeOnlyTime(val) {
|
|
|
|
|
|
if(!val) return ''
|
|
|
|
|
|
return val.split(' ')[1] || ''
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// History parsing helpers (preserved from original)
|
2026-01-16 13:35:17 +08:00
|
|
|
|
function parseHistoryItems(history) {
|
|
|
|
|
|
if (!history) return []
|
|
|
|
|
|
let arr = history
|
|
|
|
|
|
if (typeof history === 'string') {
|
2026-01-16 19:00:07 +08:00
|
|
|
|
try { arr = JSON.parse(history) } catch { return [] }
|
2026-01-16 13:35:17 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (!Array.isArray(arr)) return []
|
2026-01-16 19:00:07 +08:00
|
|
|
|
return arr.map((item, index) => {
|
|
|
|
|
|
if (typeof item === 'number') return { date: `Day ${index + 1}`, value: item }
|
|
|
|
|
|
if (item && typeof item === 'object') return { date: item.date ? String(item.date) : '', value: Number(item.value ?? 0) }
|
2026-01-16 13:35:17 +08:00
|
|
|
|
return null
|
2026-01-16 19:00:07 +08:00
|
|
|
|
}).filter(Boolean)
|
2026-01-16 13:35:17 +08:00
|
|
|
|
}
|
2026-01-16 19:00:07 +08:00
|
|
|
|
function hasHistory(history) { return parseHistoryItems(history).length > 0 }
|
2026-01-16 13:35:17 +08:00
|
|
|
|
function getHistoryStats(history) {
|
|
|
|
|
|
const items = parseHistoryItems(history)
|
2026-01-16 19:00:07 +08:00
|
|
|
|
if (items.length === 0) return { min: 0, max: 0, start: '', end: '' }
|
2026-01-16 13:35:17 +08:00
|
|
|
|
const values = items.map(item => item.value)
|
2026-01-16 19:00:07 +08:00
|
|
|
|
return { min: Math.min(...values), max: Math.max(...values), start: items[0].date || '', end: items[items.length - 1].date || '' }
|
2026-01-16 13:35:17 +08:00
|
|
|
|
}
|
2026-01-16 19:00:07 +08:00
|
|
|
|
function getHistoryMin(history) { return getHistoryStats(history).min }
|
|
|
|
|
|
function getHistoryMax(history) { return getHistoryStats(history).max }
|
|
|
|
|
|
function getHistoryStartDate(history) { return getHistoryStats(history).start }
|
|
|
|
|
|
function getHistoryEndDate(history) { return getHistoryStats(history).end }
|
2026-01-16 13:35:17 +08:00
|
|
|
|
function formatRevenueValue(value) {
|
|
|
|
|
|
const num = Number(value)
|
|
|
|
|
|
if (!Number.isFinite(num)) return ''
|
2026-01-16 19:00:07 +08:00
|
|
|
|
return num.toFixed(3).replace(/\.0+$/, '').replace(/(\.\d*?)0+$/, '$1')
|
2026-01-16 13:35:17 +08:00
|
|
|
|
}
|
|
|
|
|
|
function buildHistoryTitle(history) {
|
|
|
|
|
|
const items = parseHistoryItems(history)
|
2026-01-16 19:00:07 +08:00
|
|
|
|
return items.length ? items.map(item => `${item.date}: ${formatRevenueValue(item.value)}`).join('\n') : '-'
|
2026-01-16 13:35:17 +08:00
|
|
|
|
}
|
|
|
|
|
|
function buildSparklinePoints(history) {
|
|
|
|
|
|
const items = parseHistoryItems(history)
|
|
|
|
|
|
if (items.length === 0) return ''
|
|
|
|
|
|
const values = items.map(item => item.value)
|
|
|
|
|
|
const min = Math.min(...values)
|
|
|
|
|
|
const max = Math.max(...values)
|
|
|
|
|
|
const range = max - min || 1
|
2026-01-16 19:00:07 +08:00
|
|
|
|
const width = 180, height = 48, padding = 2
|
2026-01-16 13:35:17 +08:00
|
|
|
|
const step = items.length > 1 ? (width - padding * 2) / (items.length - 1) : 0
|
|
|
|
|
|
return items.map((item, index) => {
|
|
|
|
|
|
const x = padding + index * step
|
|
|
|
|
|
const y = padding + (height - padding * 2) * (1 - (item.value - min) / range)
|
|
|
|
|
|
return `${x},${y}`
|
|
|
|
|
|
}).join(' ')
|
|
|
|
|
|
}
|
|
|
|
|
|
function formatTimestamp(value) {
|
2026-01-16 19:00:07 +08:00
|
|
|
|
if (!value) return ''
|
|
|
|
|
|
const date = new Date(value)
|
|
|
|
|
|
return date.toLocaleString()
|
2026-01-16 13:35:17 +08:00
|
|
|
|
}
|
2025-07-01 21:02:39 +08:00
|
|
|
|
</script>
|
2026-01-16 19:00:07 +08:00
|
|
|
|
<style scoped>
|
|
|
|
|
|
/* Only keep essential overrides that Tailwind can't easily handle, like svg styling */
|
2026-01-16 13:35:17 +08:00
|
|
|
|
.history-sparkline-wrap {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
2026-01-16 19:00:07 +08:00
|
|
|
|
background-color: #f8fafc;
|
|
|
|
|
|
border: 1px solid #e2e8f0;
|
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
|
padding: 4px;
|
|
|
|
|
|
width: 190px;
|
2026-01-16 13:35:17 +08:00
|
|
|
|
}
|
2026-01-16 19:00:07 +08:00
|
|
|
|
.history-sparkline-top,
|
2026-01-16 13:35:17 +08:00
|
|
|
|
.history-sparkline-bottom {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
justify-content: space-between;
|
2026-01-16 19:00:07 +08:00
|
|
|
|
font-size: 10px;
|
|
|
|
|
|
color: #64748b;
|
|
|
|
|
|
margin-bottom: 2px;
|
2026-01-16 13:35:17 +08:00
|
|
|
|
}
|
2026-01-16 19:00:07 +08:00
|
|
|
|
.history-sparkline {
|
|
|
|
|
|
background-color: #fff;
|
|
|
|
|
|
border-radius: 2px;
|
2025-07-01 21:02:39 +08:00
|
|
|
|
height: 48px;
|
2026-01-16 19:00:07 +08:00
|
|
|
|
width: 100%;
|
2025-07-01 21:02:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
</style>
|