feat: 手动充值、邀请码注册与后台管理增强
新增玩家手动充值全流程(收款方式配置、充值下单/审核、钱包上分), 支持邀请码注册、邀请历史与专属返水率;完善后台代理/玩家管理与响应式操作栏, 并补充前台注册、充值页及多语言错误码。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
331
apps/admin/src/views/DepositOrders.vue
Normal file
331
apps/admin/src/views/DepositOrders.vue
Normal file
@@ -0,0 +1,331 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted } from 'vue';
|
||||
import { useAdminLocale } from '../composables/useAdminLocale';
|
||||
import api from '../api';
|
||||
import AdminTableEmpty from '../components/AdminTableEmpty.vue';
|
||||
import { formatAmount } from '../utils/format-amount';
|
||||
|
||||
const { t } = useAdminLocale();
|
||||
|
||||
interface DepositOrderRow {
|
||||
id: string;
|
||||
orderNo: string;
|
||||
playerId: string;
|
||||
playerUsername: string | null;
|
||||
methodType: string;
|
||||
amount: string;
|
||||
screenshotUrl: string;
|
||||
status: string;
|
||||
approvedAmount: string | null;
|
||||
reviewerId: string | null;
|
||||
reviewerUsername: string | null;
|
||||
rejectReason: string | null;
|
||||
remark: string | null;
|
||||
createdAt: string;
|
||||
reviewedAt: string | null;
|
||||
paymentMethodName: string | null;
|
||||
}
|
||||
|
||||
const items = ref<DepositOrderRow[]>([]);
|
||||
const total = ref(0);
|
||||
const page = ref(1);
|
||||
const pageSize = ref(20);
|
||||
const loading = ref(false);
|
||||
|
||||
// Filters
|
||||
const statusFilter = ref('');
|
||||
const keywordFilter = ref('');
|
||||
const methodTypeFilter = ref('');
|
||||
|
||||
// Approve dialog
|
||||
const approveDialogVisible = ref(false);
|
||||
const approveTarget = ref<DepositOrderRow | null>(null);
|
||||
const approveAmount = ref<number>(0);
|
||||
const approveRemark = ref('');
|
||||
|
||||
// Reject dialog
|
||||
const rejectDialogVisible = ref(false);
|
||||
const rejectTarget = ref<DepositOrderRow | null>(null);
|
||||
const rejectReason = ref('');
|
||||
|
||||
// Screenshot preview
|
||||
const previewUrl = ref('');
|
||||
const previewVisible = ref(false);
|
||||
|
||||
async function fetchList() {
|
||||
loading.value = true;
|
||||
try {
|
||||
const params: any = { page: page.value, pageSize: pageSize.value };
|
||||
if (statusFilter.value) params.status = statusFilter.value;
|
||||
if (keywordFilter.value) params.keyword = keywordFilter.value;
|
||||
if (methodTypeFilter.value) params.methodType = methodTypeFilter.value;
|
||||
const { data } = await api.get('/admin/deposit-orders', { params });
|
||||
const result = data.data ?? { items: [], total: 0 };
|
||||
items.value = result.items ?? [];
|
||||
total.value = result.total ?? 0;
|
||||
} catch { /* */ } finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function openApprove(row: DepositOrderRow) {
|
||||
approveTarget.value = row;
|
||||
approveAmount.value = parseFloat(row.amount);
|
||||
approveRemark.value = '';
|
||||
approveDialogVisible.value = true;
|
||||
}
|
||||
|
||||
function openReject(row: DepositOrderRow) {
|
||||
rejectTarget.value = row;
|
||||
rejectReason.value = '';
|
||||
rejectDialogVisible.value = true;
|
||||
}
|
||||
|
||||
function openScreenshot(url: string) {
|
||||
previewUrl.value = url;
|
||||
previewVisible.value = true;
|
||||
}
|
||||
|
||||
async function handleApprove() {
|
||||
if (!approveTarget.value) return;
|
||||
try {
|
||||
await api.post(`/admin/deposit-orders/${approveTarget.value.id}/approve`, {
|
||||
approvedAmount: approveAmount.value,
|
||||
remark: approveRemark.value || undefined,
|
||||
});
|
||||
approveDialogVisible.value = false;
|
||||
await fetchList();
|
||||
} catch (e: any) {
|
||||
alert(e.response?.data?.message || 'Error');
|
||||
}
|
||||
}
|
||||
|
||||
async function handleReject() {
|
||||
if (!rejectTarget.value) return;
|
||||
if (!rejectReason.value.trim()) {
|
||||
alert(t('deposit.reason_required'));
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await api.post(`/admin/deposit-orders/${rejectTarget.value.id}/reject`, {
|
||||
reason: rejectReason.value.trim(),
|
||||
});
|
||||
rejectDialogVisible.value = false;
|
||||
await fetchList();
|
||||
} catch (e: any) {
|
||||
alert(e.response?.data?.message || 'Error');
|
||||
}
|
||||
}
|
||||
|
||||
function statusClass(s: string) {
|
||||
if (s === 'APPROVED') return 'status-approved';
|
||||
if (s === 'REJECTED') return 'status-rejected';
|
||||
return 'status-pending';
|
||||
}
|
||||
|
||||
function statusLabel(s: string) {
|
||||
if (s === 'APPROVED') return '✓ ' + t('deposit.status_approved');
|
||||
if (s === 'REJECTED') return '✗ ' + t('deposit.status_rejected');
|
||||
return '● ' + t('deposit.status_pending');
|
||||
}
|
||||
|
||||
function prevPage() { if (page.value > 1) { page.value--; fetchList(); } }
|
||||
function nextPage() { if (page.value * pageSize.value < total.value) { page.value++; fetchList(); } }
|
||||
|
||||
onMounted(fetchList);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="page-deposit-orders">
|
||||
<div class="toolbar">
|
||||
<h2>{{ t('deposit.deposit_orders_title') }}</h2>
|
||||
</div>
|
||||
|
||||
<div class="filters">
|
||||
<select v-model="statusFilter" @change="page = 1; fetchList()">
|
||||
<option value="">{{ t('deposit.all_status') }}</option>
|
||||
<option value="PENDING">{{ t('deposit.status_pending') }}</option>
|
||||
<option value="APPROVED">{{ t('deposit.status_approved') }}</option>
|
||||
<option value="REJECTED">{{ t('deposit.status_rejected') }}</option>
|
||||
</select>
|
||||
<select v-model="methodTypeFilter" @change="page = 1; fetchList()">
|
||||
<option value="">{{ t('deposit.all_types') }}</option>
|
||||
<option value="BANK">Bank</option>
|
||||
<option value="USDT">USDT</option>
|
||||
</select>
|
||||
<input
|
||||
v-model="keywordFilter"
|
||||
:placeholder="t('deposit.search_player_ph')"
|
||||
@keydown.enter="page = 1; fetchList()"
|
||||
/>
|
||||
<button class="btn-search" @click="page = 1; fetchList()">{{ t('common.search') }}</button>
|
||||
</div>
|
||||
|
||||
<AdminTableEmpty v-if="!loading && !items.length" />
|
||||
|
||||
<table v-if="items.length" class="data-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ t('deposit.order_no') }}</th>
|
||||
<th>{{ t('deposit.player') }}</th>
|
||||
<th>{{ t('common.type') }}</th>
|
||||
<th>{{ t('deposit.amount') }}</th>
|
||||
<th>{{ t('deposit.screenshot') }}</th>
|
||||
<th>{{ t('common.status') }}</th>
|
||||
<th>{{ t('deposit.approved_amount') }}</th>
|
||||
<th>{{ t('deposit.reviewer') }}</th>
|
||||
<th>{{ t('deposit.time') }}</th>
|
||||
<th>{{ t('common.actions') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="row in items" :key="row.id">
|
||||
<td class="mono">{{ row.orderNo }}</td>
|
||||
<td>{{ row.playerUsername || row.playerId }}</td>
|
||||
<td><span :class="['badge', row.methodType === 'BANK' ? 'badge-blue' : 'badge-green']">{{ row.methodType }}</span></td>
|
||||
<td class="amount">{{ formatAmount(row.amount) }}</td>
|
||||
<td>
|
||||
<img
|
||||
v-if="row.screenshotUrl"
|
||||
:src="row.screenshotUrl"
|
||||
class="screenshot-thumb"
|
||||
@click="openScreenshot(row.screenshotUrl)"
|
||||
/>
|
||||
</td>
|
||||
<td><span :class="statusClass(row.status)">{{ statusLabel(row.status) }}</span></td>
|
||||
<td>{{ row.approvedAmount ? formatAmount(row.approvedAmount) : '-' }}</td>
|
||||
<td>{{ row.reviewerUsername || '-' }}</td>
|
||||
<td class="time-cell">{{ new Date(row.createdAt).toLocaleString() }}</td>
|
||||
<td>
|
||||
<template v-if="row.status === 'PENDING'">
|
||||
<button class="btn-sm btn-approve" @click="openApprove(row)">{{ t('deposit.approve') }}</button>
|
||||
<button class="btn-sm btn-reject" @click="openReject(row)">{{ t('deposit.reject') }}</button>
|
||||
</template>
|
||||
<template v-else-if="row.status === 'REJECTED'">
|
||||
<span class="reject-reason" :title="row.rejectReason || ''">{{ row.rejectReason }}</span>
|
||||
</template>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div v-if="total > pageSize" class="pagination">
|
||||
<button :disabled="page <= 1" @click="prevPage">{{ t('deposit.prev') }}</button>
|
||||
<span>{{ page }} / {{ Math.ceil(total / pageSize) }}</span>
|
||||
<button :disabled="page * pageSize >= total" @click="nextPage">{{ t('deposit.next') }}</button>
|
||||
</div>
|
||||
|
||||
<!-- Approve Dialog -->
|
||||
<div v-if="approveDialogVisible" class="dialog-overlay" @click.self="approveDialogVisible = false">
|
||||
<div class="dialog-box">
|
||||
<h3>{{ t('deposit.approve_title') }}</h3>
|
||||
<div v-if="approveTarget" class="approve-content">
|
||||
<div class="info-row">
|
||||
<span>{{ t('deposit.player') }}:</span> <strong>{{ approveTarget.playerUsername }}</strong>
|
||||
</div>
|
||||
<div class="info-row">
|
||||
<span>{{ t('deposit.submitted_amount') }}:</span> <strong>{{ formatAmount(approveTarget.amount) }}</strong>
|
||||
</div>
|
||||
<div class="info-row">
|
||||
<span>{{ t('deposit.screenshot') }}:</span>
|
||||
<img :src="approveTarget.screenshotUrl" class="approve-screenshot" @click="openScreenshot(approveTarget.screenshotUrl)" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>{{ t('deposit.approved_amount_label') }}</label>
|
||||
<input v-model.number="approveAmount" type="number" step="0.01" min="0.01" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>{{ t('deposit.remark_label') }}</label>
|
||||
<input v-model="approveRemark" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="dialog-actions">
|
||||
<button class="btn-cancel" @click="approveDialogVisible = false">{{ t('common.cancel') }}</button>
|
||||
<button class="btn-primary" @click="handleApprove">{{ t('deposit.confirm_approve') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Reject Dialog -->
|
||||
<div v-if="rejectDialogVisible" class="dialog-overlay" @click.self="rejectDialogVisible = false">
|
||||
<div class="dialog-box">
|
||||
<h3>{{ t('deposit.reject_title') }}</h3>
|
||||
<div v-if="rejectTarget" class="reject-content">
|
||||
<div class="info-row">
|
||||
<span>{{ t('deposit.player') }}:</span> <strong>{{ rejectTarget.playerUsername }}</strong>
|
||||
</div>
|
||||
<div class="info-row">
|
||||
<span>{{ t('deposit.amount') }}:</span> <strong>{{ formatAmount(rejectTarget.amount) }}</strong>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>{{ t('deposit.reject_reason_label') }}</label>
|
||||
<textarea v-model="rejectReason" rows="3" :placeholder="t('deposit.reject_reason_ph')"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="dialog-actions">
|
||||
<button class="btn-cancel" @click="rejectDialogVisible = false">{{ t('common.cancel') }}</button>
|
||||
<button class="btn-danger-full" @click="handleReject">{{ t('deposit.confirm_reject') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Screenshot Preview -->
|
||||
<div v-if="previewVisible" class="dialog-overlay" @click.self="previewVisible = false">
|
||||
<div class="preview-box">
|
||||
<img :src="previewUrl" class="preview-image" />
|
||||
<button class="close-preview" @click="previewVisible = false">✕</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.page-deposit-orders { padding: 16px; }
|
||||
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
|
||||
.toolbar h2 { margin: 0; font-size: 18px; }
|
||||
.filters { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
|
||||
.filters select, .filters input { padding: 6px 10px; border-radius: 4px; border: 1px solid #444; background: #1e1e1e; color: #eee; font-size: 13px; }
|
||||
.filters input { min-width: 160px; }
|
||||
.btn-search { background: #409eff; color: #fff; border: none; border-radius: 4px; padding: 6px 14px; cursor: pointer; font-weight: 600; font-size: 13px; }
|
||||
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
|
||||
.data-table th, .data-table td { padding: 10px 6px; border-bottom: 1px solid #333; text-align: left; }
|
||||
.data-table th { font-weight: 700; color: #aaa; font-size: 11px; text-transform: uppercase; }
|
||||
.mono { font-family: monospace; font-size: 11px; }
|
||||
.amount { font-weight: 700; }
|
||||
.time-cell { font-size: 11px; color: #888; }
|
||||
.screenshot-thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 4px; cursor: pointer; border: 1px solid #444; }
|
||||
.badge { padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 700; }
|
||||
.badge-blue { background: #1e3a5f; color: #66b1ff; }
|
||||
.badge-green { background: rgba(201, 162, 39, 0.12); color: var(--gold-text); }
|
||||
.status-pending { color: #e6a23c; font-weight: 700; font-size: 12px; }
|
||||
.status-approved { color: var(--success-text); font-weight: 700; font-size: 12px; }
|
||||
.status-rejected { color: #f56c6c; font-weight: 700; font-size: 12px; }
|
||||
.btn-sm { border: none; border-radius: 4px; padding: 4px 10px; font-size: 11px; cursor: pointer; margin-right: 4px; }
|
||||
.btn-approve { background: rgba(61, 115, 88, 0.16); color: var(--success-text); }
|
||||
.btn-approve:hover { background: rgba(61, 115, 88, 0.24); }
|
||||
.btn-reject { background: #3a1a1a; color: #f56c6c; }
|
||||
.btn-reject:hover { background: #4a2525; }
|
||||
.reject-reason { font-size: 11px; color: #f56c6c; max-width: 120px; display: inline-block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.pagination { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 16px; }
|
||||
.pagination button { background: #333; color: #ddd; border: none; border-radius: 4px; padding: 6px 14px; cursor: pointer; }
|
||||
.pagination button:disabled { opacity: 0.4; cursor: default; }
|
||||
|
||||
.dialog-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; z-index: 999; }
|
||||
.dialog-box { background: #1e1e1e; border-radius: 8px; padding: 24px; min-width: 440px; max-width: 560px; }
|
||||
.dialog-box h3 { margin: 0 0 16px; font-size: 16px; }
|
||||
.info-row { margin-bottom: 8px; font-size: 13px; }
|
||||
.info-row span { color: #888; margin-right: 4px; }
|
||||
.approve-screenshot { width: 200px; max-height: 200px; object-fit: contain; border-radius: 4px; cursor: pointer; margin-top: 4px; }
|
||||
.form-group { margin-bottom: 12px; }
|
||||
.form-group label { display: block; font-size: 12px; color: #aaa; margin-bottom: 4px; font-weight: 600; }
|
||||
.form-group input, .form-group textarea { width: 100%; padding: 8px; border: 1px solid #444; border-radius: 4px; background: #111; color: #eee; box-sizing: border-box; }
|
||||
.form-group textarea { resize: vertical; }
|
||||
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
|
||||
.btn-cancel { background: #333; color: #ccc; border: none; border-radius: 4px; padding: 8px 16px; cursor: pointer; }
|
||||
.btn-primary { background: #409eff; color: #fff; border: none; border-radius: 4px; padding: 8px 16px; cursor: pointer; font-weight: 600; }
|
||||
.btn-danger-full { background: #f56c6c; color: #fff; border: none; border-radius: 4px; padding: 8px 16px; cursor: pointer; font-weight: 600; }
|
||||
|
||||
.preview-box { position: relative; max-width: 90vw; max-height: 90vh; }
|
||||
.preview-image { max-width: 90vw; max-height: 85vh; object-fit: contain; border-radius: 8px; }
|
||||
.close-preview { position: absolute; top: -12px; right: -12px; background: #333; color: #fff; border: none; border-radius: 50%; width: 28px; height: 28px; font-size: 14px; cursor: pointer; }
|
||||
</style>
|
||||
Reference in New Issue
Block a user