201 lines
11 KiB
PHP
Executable File
201 lines
11 KiB
PHP
Executable File
<h1 class="text-2xl font-bold text-gray-800 mb-6 flex items-center">
|
|
<i class="fas fa-yen-sign text-primary mr-3"></i>
|
|
财务管理
|
|
</h1>
|
|
|
|
<!-- 统计卡片 -->
|
|
<div class="grid grid-cols-1 md:grid-cols-3 lg:grid-cols-6 gap-4 mb-6">
|
|
<div class="bg-white rounded-xl p-5 card-shadow hover-lift">
|
|
<div class="flex items-center justify-between">
|
|
<div>
|
|
<p class="text-gray-500 text-sm">总充值</p>
|
|
<h3 class="text-xl font-bold mt-1 text-success">
|
|
<?= number_format((float)($stats['total_deposit'] ?? 0), 2) ?>
|
|
</h3>
|
|
</div>
|
|
<div class="w-10 h-10 rounded-full bg-success/10 flex items-center justify-center">
|
|
<i class="fas fa-arrow-down text-success"></i>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="bg-white rounded-xl p-5 card-shadow hover-lift">
|
|
<div class="flex items-center justify-between">
|
|
<div>
|
|
<p class="text-gray-500 text-sm">总提现</p>
|
|
<h3 class="text-xl font-bold mt-1 text-danger">
|
|
<?= number_format((float)($stats['total_withdraw'] ?? 0), 2) ?>
|
|
</h3>
|
|
</div>
|
|
<div class="w-10 h-10 rounded-full bg-danger/10 flex items-center justify-center">
|
|
<i class="fas fa-arrow-up text-danger"></i>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="bg-white rounded-xl p-5 card-shadow hover-lift">
|
|
<div class="flex items-center justify-between">
|
|
<div>
|
|
<p class="text-gray-500 text-sm">总投注</p>
|
|
<h3 class="text-xl font-bold mt-1 text-warning">
|
|
<?= number_format((float)($stats['total_bet'] ?? 0), 2) ?>
|
|
</h3>
|
|
</div>
|
|
<div class="w-10 h-10 rounded-full bg-warning/10 flex items-center justify-center">
|
|
<i class="fas fa-coins text-warning"></i>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="bg-white rounded-xl p-5 card-shadow hover-lift">
|
|
<div class="flex items-center justify-between">
|
|
<div>
|
|
<p class="text-gray-500 text-sm">总中奖</p>
|
|
<h3 class="text-xl font-bold mt-1 text-primary">
|
|
<?= number_format((float)($stats['total_win'] ?? 0), 2) ?>
|
|
</h3>
|
|
</div>
|
|
<div class="w-10 h-10 rounded-full bg-primary/10 flex items-center justify-center">
|
|
<i class="fas fa-trophy text-primary"></i>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="bg-white rounded-xl p-5 card-shadow hover-lift">
|
|
<div class="flex items-center justify-between">
|
|
<div>
|
|
<p class="text-gray-500 text-sm">今日充值</p>
|
|
<h3 class="text-xl font-bold mt-1 text-success">
|
|
<?= number_format((float)($stats['today_deposit'] ?? 0), 2) ?>
|
|
</h3>
|
|
</div>
|
|
<div class="w-10 h-10 rounded-full bg-success/10 flex items-center justify-center">
|
|
<i class="fas fa-calendar-day text-success"></i>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="bg-white rounded-xl p-5 card-shadow hover-lift">
|
|
<div class="flex items-center justify-between">
|
|
<div>
|
|
<p class="text-gray-500 text-sm">今日提现</p>
|
|
<h3 class="text-xl font-bold mt-1 text-danger">
|
|
<?= number_format((float)($stats['today_withdraw'] ?? 0), 2) ?>
|
|
</h3>
|
|
</div>
|
|
<div class="w-10 h-10 rounded-full bg-danger/10 flex items-center justify-center">
|
|
<i class="fas fa-calendar-day text-danger"></i>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 资金流水列表 -->
|
|
<div class="bg-white rounded-xl shadow-md p-6 mb-8">
|
|
<div class="flex flex-col md:flex-row md:items-center md:justify-between gap-4 mb-6">
|
|
<div>
|
|
<h2 class="text-xl font-semibold text-gray-800">资金流水</h2>
|
|
<p class="text-sm text-gray-500 mt-1">查看所有资金变动记录</p>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="overflow-x-auto">
|
|
<table class="w-full bg-white rounded-xl overflow-hidden">
|
|
<thead class="bg-gray-50">
|
|
<tr>
|
|
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">流水ID</th>
|
|
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">用户</th>
|
|
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">类型</th>
|
|
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">金额</th>
|
|
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">余额变动</th>
|
|
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider hidden md:table-cell">描述</th>
|
|
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider hidden lg:table-cell">时间</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y divide-gray-200" id="transactionList">
|
|
<?php if (!empty($transactions) && is_array($transactions)): ?>
|
|
<?php foreach ($transactions as $tx): ?>
|
|
<tr class="hover:bg-gray-50 transition-colors">
|
|
<td class="px-4 py-4">
|
|
<span class="text-sm font-medium text-gray-900">#<?= htmlspecialchars((string)($tx['id'] ?? '')) ?></span>
|
|
</td>
|
|
<td class="px-4 py-4">
|
|
<div class="text-sm text-gray-900">
|
|
<?= htmlspecialchars((string)($tx['username'] ?? '未知')) ?>
|
|
</div>
|
|
<div class="text-xs text-gray-500">
|
|
ID: <?= htmlspecialchars((string)($tx['user_id'] ?? '')) ?>
|
|
</div>
|
|
</td>
|
|
<td class="px-4 py-4">
|
|
<?php
|
|
$type = $tx['type'] ?? '';
|
|
$typeMap = [
|
|
'deposit' => ['text' => '充值', 'class' => 'bg-success/10 text-success'],
|
|
'withdraw' => ['text' => '提现', 'class' => 'bg-danger/10 text-danger'],
|
|
'bet' => ['text' => '投注', 'class' => 'bg-warning/10 text-warning'],
|
|
'win' => ['text' => '中奖', 'class' => 'bg-primary/10 text-primary'],
|
|
'refund' => ['text' => '退款', 'class' => 'bg-gray-100 text-gray-700'],
|
|
'manual_deposit' => ['text' => '人工加款', 'class' => 'bg-purple-100 text-purple-700'],
|
|
'manual_withdraw' => ['text' => '人工扣款', 'class' => 'bg-orange-100 text-orange-700']
|
|
];
|
|
$typeInfo = $typeMap[$type] ?? ['text' => $type, 'class' => 'bg-gray-100 text-gray-700'];
|
|
?>
|
|
<span class="inline-flex items-center px-2 py-1 rounded-full text-xs <?= $typeInfo['class'] ?>">
|
|
<?= $typeInfo['text'] ?>
|
|
</span>
|
|
</td>
|
|
<td class="px-4 py-4">
|
|
<?php
|
|
$amount = floatval($tx['amount'] ?? 0);
|
|
$amountClass = $amount >= 0 ? 'text-success' : 'text-danger';
|
|
?>
|
|
<span class="text-sm font-semibold <?= $amountClass ?>">
|
|
<?= $amount >= 0 ? '+' : '' ?><?= number_format($amount, 2) ?>
|
|
</span>
|
|
</td>
|
|
<td class="px-4 py-4">
|
|
<div class="text-sm text-gray-900">
|
|
<span class="text-gray-500"><?= number_format(floatval($tx['balance_before'] ?? 0), 2) ?></span>
|
|
<i class="fas fa-arrow-right mx-1 text-gray-400"></i>
|
|
<span class="font-semibold"><?= number_format(floatval($tx['balance_after'] ?? 0), 2) ?></span>
|
|
</div>
|
|
</td>
|
|
<td class="px-4 py-4 hidden md:table-cell">
|
|
<span class="text-sm text-gray-600">
|
|
<?= htmlspecialchars((string)($tx['description'] ?? '-')) ?>
|
|
</span>
|
|
</td>
|
|
<td class="px-4 py-4 hidden lg:table-cell">
|
|
<?php if (!empty($tx['created_at'])): ?>
|
|
<div class="text-xs text-gray-500">
|
|
<?= date('Y-m-d H:i:s', strtotime((string)$tx['created_at'])) ?>
|
|
</div>
|
|
<?php else: ?>
|
|
<span class="text-xs text-gray-400">-</span>
|
|
<?php endif; ?>
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
<?php else: ?>
|
|
<tr>
|
|
<td colspan="7" class="px-6 py-12 text-center">
|
|
<div class="flex flex-col items-center">
|
|
<i class="fas fa-money-bill-wave text-gray-300 text-5xl mb-4"></i>
|
|
<h3 class="text-lg font-medium text-gray-900">暂无流水记录</h3>
|
|
<p class="mt-1 text-gray-500 text-sm">
|
|
还没有任何资金流水记录。
|
|
</p>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<?php endif; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
<script src="/Static/js/admin.js"></script>
|
|
<script>
|
|
layui.use(['layer'], function() {
|
|
var layer = layui.layer;
|
|
// 此处可以添加其他财务相关的JS逻辑
|
|
});
|
|
</script>
|
|
|