|
@@ -117,25 +117,13 @@
|
|
|
<body>
|
|
|
<div class="container">
|
|
|
<div class="row">
|
|
|
- <div class="col-md-3">
|
|
|
+ <div class="col-md-6">
|
|
|
<div class="stat-card">
|
|
|
<div class="title">今日收入</div>
|
|
|
<div class="value" id="todayIncome">¥0.00</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="col-md-3">
|
|
|
- <div class="stat-card">
|
|
|
- <div class="title">本月收入</div>
|
|
|
- <div class="value" id="monthlyIncome">¥0.00</div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="col-md-3">
|
|
|
- <div class="stat-card">
|
|
|
- <div class="title">总收入</div>
|
|
|
- <div class="value" id="totalIncome">¥0.00</div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="col-md-3">
|
|
|
+ <div class="col-md-6">
|
|
|
<div class="stat-card">
|
|
|
<div class="title">今日订单数</div>
|
|
|
<div class="value" id="todayOrders">0</div>
|
|
@@ -232,8 +220,8 @@
|
|
|
<td>-</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
- <td>应下发</td>
|
|
|
- <td id="shouldWithdraw">¥0.00</td>
|
|
|
+ <td>入款汇率</td>
|
|
|
+ <td id="depositExchangeRate">1.0000</td>
|
|
|
<td>-</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
@@ -247,13 +235,8 @@
|
|
|
<td>-</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
- <td>下发单笔附加费</td>
|
|
|
- <td id="singleWithdrawFee">¥0.00</td>
|
|
|
- <td>-</td>
|
|
|
- </tr>
|
|
|
- <tr>
|
|
|
- <td>单笔附费加总计</td>
|
|
|
- <td id="totalWithdrawFee">¥0.00</td>
|
|
|
+ <td>下发汇率</td>
|
|
|
+ <td id="withdrawExchangeRate">1.0000</td>
|
|
|
<td>-</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
@@ -289,8 +272,20 @@
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- console.log('正在加载数据,群组ID:', groupId);
|
|
|
- const response = await fetch(`/api/public/transactions?page=${page}&limit=${pageSize}&groupId=${groupId}`);
|
|
|
+ // 获取今天的日期(考虑时区)
|
|
|
+ const today = new Date();
|
|
|
+ const year = today.getFullYear();
|
|
|
+ const month = String(today.getMonth() + 1).padStart(2, '0');
|
|
|
+ const day = String(today.getDate()).padStart(2, '0');
|
|
|
+ const startDate = `${year}-${month}-${day}`;
|
|
|
+ const endDate = startDate;
|
|
|
+
|
|
|
+ console.log('日期范围:', { startDate, endDate });
|
|
|
+
|
|
|
+ const url = `/api/public/transactions?page=${page}&limit=${pageSize}&groupId=${groupId}&startDate=${startDate}&endDate=${endDate}`;
|
|
|
+ console.log('请求URL:', url);
|
|
|
+
|
|
|
+ const response = await fetch(url);
|
|
|
console.log('API响应:', response);
|
|
|
|
|
|
if (!response.ok) {
|
|
@@ -301,9 +296,29 @@
|
|
|
const data = await response.json();
|
|
|
console.log('获取到的数据:', data);
|
|
|
|
|
|
- updateTransactionsList(data.transactions);
|
|
|
- updatePagination(data.total, page);
|
|
|
- updateStatistics(data.statistics);
|
|
|
+ // 过滤掉非今天的记录
|
|
|
+ const todayTransactions = data.transactions.filter(transaction => {
|
|
|
+ const transactionDate = new Date(transaction.time).toISOString().split('T')[0];
|
|
|
+ return transactionDate === startDate;
|
|
|
+ });
|
|
|
+
|
|
|
+ // 计算今日收入
|
|
|
+ const todayIncome = todayTransactions.reduce((sum, transaction) => {
|
|
|
+ if (transaction.type === 'deposit') {
|
|
|
+ return sum + parseFloat(transaction.amount);
|
|
|
+ }
|
|
|
+ return sum;
|
|
|
+ }, 0);
|
|
|
+
|
|
|
+ // 更新统计数据
|
|
|
+ const statistics = {
|
|
|
+ todayIncome: todayIncome,
|
|
|
+ todayOrders: todayTransactions.length
|
|
|
+ };
|
|
|
+
|
|
|
+ updateTransactionsList(todayTransactions);
|
|
|
+ updatePagination(todayTransactions.length, page);
|
|
|
+ updateStatistics(statistics);
|
|
|
updateSummary(data.summary);
|
|
|
} catch (error) {
|
|
|
console.error('加载交易记录失败:', error);
|
|
@@ -361,7 +376,7 @@
|
|
|
// 上一页
|
|
|
html += `
|
|
|
<li class="page-item ${currentPage === 1 ? 'disabled' : ''}">
|
|
|
- <a class="page-link" href="#" onclick="loadTransactions(${currentPage - 1})">上一页</a>
|
|
|
+ <a class="page-link" href="#" onclick="event.preventDefault(); loadTransactions(${currentPage - 1})">上一页</a>
|
|
|
</li>
|
|
|
`;
|
|
|
|
|
@@ -369,7 +384,7 @@
|
|
|
for (let i = 1; i <= totalPages; i++) {
|
|
|
html += `
|
|
|
<li class="page-item ${i === currentPage ? 'active' : ''}">
|
|
|
- <a class="page-link" href="#" onclick="loadTransactions(${i})">${i}</a>
|
|
|
+ <a class="page-link" href="#" onclick="event.preventDefault(); loadTransactions(${i})">${i}</a>
|
|
|
</li>
|
|
|
`;
|
|
|
}
|
|
@@ -377,7 +392,7 @@
|
|
|
// 下一页
|
|
|
html += `
|
|
|
<li class="page-item ${currentPage === totalPages ? 'disabled' : ''}">
|
|
|
- <a class="page-link" href="#" onclick="loadTransactions(${currentPage + 1})">下一页</a>
|
|
|
+ <a class="page-link" href="#" onclick="event.preventDefault(); loadTransactions(${currentPage + 1})">下一页</a>
|
|
|
</li>
|
|
|
`;
|
|
|
|
|
@@ -394,8 +409,6 @@
|
|
|
};
|
|
|
|
|
|
document.getElementById('todayIncome').textContent = formatAmount(statistics.todayIncome);
|
|
|
- document.getElementById('monthlyIncome').textContent = formatAmount(statistics.monthlyIncome);
|
|
|
- document.getElementById('totalIncome').textContent = formatAmount(statistics.totalIncome);
|
|
|
document.getElementById('todayOrders').textContent = statistics.todayOrders || 0;
|
|
|
}
|
|
|
|
|
@@ -410,12 +423,11 @@
|
|
|
document.getElementById('totalDeposit').textContent = formatAmount(summary.totalDeposit);
|
|
|
document.getElementById('totalDepositCount').textContent = summary.depositCount || 0;
|
|
|
document.getElementById('depositFeeRate').textContent = `${summary.depositFeeRate || 0}%`;
|
|
|
- document.getElementById('shouldWithdraw').textContent = formatAmount(summary.shouldWithdraw);
|
|
|
+ document.getElementById('depositExchangeRate').textContent = `${summary.depositExchangeRate || 0}`;
|
|
|
document.getElementById('totalWithdraw').textContent = formatAmount(summary.totalWithdraw);
|
|
|
document.getElementById('totalWithdrawCount').textContent = summary.withdrawCount || 0;
|
|
|
document.getElementById('withdrawFeeRate').textContent = `${summary.withdrawFeeRate || 0}%`;
|
|
|
- document.getElementById('singleWithdrawFee').textContent = formatAmount(summary.singleWithdrawFee);
|
|
|
- document.getElementById('totalWithdrawFee').textContent = formatAmount(summary.totalWithdrawFee);
|
|
|
+ document.getElementById('withdrawExchangeRate').textContent = `${summary.withdrawExchangeRate || 0}`;
|
|
|
document.getElementById('balance').textContent = formatAmount(summary.balance);
|
|
|
}
|
|
|
|