Selaa lähdekoodia

单页面总金额显示调整

Taio_O 3 viikkoa sitten
vanhempi
commit
137b9cfb5b
1 muutettua tiedostoa jossa 63 lisäystä ja 35 poistoa
  1. 63 35
      admin/views/statistics_bill.html

+ 63 - 35
admin/views/statistics_bill.html

@@ -204,44 +204,28 @@
                     <thead>
                         <tr>
                             <th>项目</th>
-                            <th>金额</th>
+                            <th>人民币金额</th>
+                            <th>USDT金额</th>
                             <th>笔数</th>
                         </tr>
                     </thead>
                     <tbody id="summaryTable">
                         <tr>
-                            <td>总入款</td>
-                            <td id="totalDeposit">¥0.00</td>
+                            <td>应下发</td>
+                            <td id="totalDepositCNY">¥0.00</td>
+                            <td id="totalDeposit">0.00U</td>
                             <td id="totalDepositCount">0</td>
                         </tr>
                         <tr>
-                            <td>入款费率</td>
-                            <td id="depositFeeRate">0%</td>
-                            <td>-</td>
-                        </tr>
-                        <tr>
-                            <td>入款汇率</td>
-                            <td id="depositExchangeRate">1.0000</td>
-                            <td>-</td>
-                        </tr>
-                        <tr>
-                            <td>总下发</td>
-                            <td id="totalWithdraw">¥0.00</td>
+                            <td>已下发</td>
+                            <td id="totalWithdrawCNY">¥0.00</td>
+                            <td id="totalWithdraw">0.00U</td>
                             <td id="totalWithdrawCount">0</td>
                         </tr>
                         <tr>
-                            <td>下发费率</td>
-                            <td id="withdrawFeeRate">0%</td>
-                            <td>-</td>
-                        </tr>
-                        <tr>
-                            <td>下发汇率</td>
-                            <td id="withdrawExchangeRate">1.0000</td>
-                            <td>-</td>
-                        </tr>
-                        <tr>
-                            <td>余额</td>
-                            <td id="balance">¥0.00</td>
+                            <td>未下发</td>
+                            <td id="balanceCNY">¥0.00</td>
+                            <td id="balance">0.00U</td>
                             <td>-</td>
                         </tr>
                     </tbody>
@@ -302,6 +286,8 @@
                     return transactionDate === startDate;
                 });
                 
+                console.log('今日交易记录:', todayTransactions);
+                
                 // 计算今日收入
                 const todayIncome = todayTransactions.reduce((sum, transaction) => {
                     if (transaction.type === 'deposit') {
@@ -319,7 +305,34 @@
                 updateTransactionsList(todayTransactions);
                 updatePagination(todayTransactions.length, page);
                 updateStatistics(statistics);
-                updateSummary(data.summary);
+                
+                // 使用最新一条记录的数据更新账单总结
+                if (todayTransactions.length > 0) {
+                    const latestRecord = todayTransactions[0];
+                    console.log('最新记录:', latestRecord);
+                    
+                    const summary = {
+                        totalDeposit: latestRecord.totalDeposit,
+                        totalWithdraw: latestRecord.totalWithdrawal,
+                        totalUDeposit: latestRecord.totalUDeposit,
+                        totalUWithdrawal: latestRecord.totalUWithdrawal,
+                        depositCount: todayTransactions.filter(t => t.type === 'deposit').length,
+                        withdrawCount: todayTransactions.filter(t => t.type === 'withdrawal').length
+                    };
+                    
+                    console.log('账单总结数据:', summary);
+                    updateSummary(summary);
+                } else {
+                    console.log('没有今日交易记录');
+                    updateSummary({
+                        totalDeposit: 0,
+                        totalWithdraw: 0,
+                        totalUDeposit: 0,
+                        totalUWithdrawal: 0,
+                        depositCount: 0,
+                        withdrawCount: 0
+                    });
+                }
             } catch (error) {
                 console.error('加载交易记录失败:', error);
                 alert(error.message || '加载数据失败,请稍后重试');
@@ -417,18 +430,33 @@
             if (!summary) return;
             
             const formatAmount = (amount) => {
+                return amount ? `${parseFloat(amount).toFixed(2)}U` : '0.00U';
+            };
+
+            const formatCNY = (amount) => {
                 return amount ? `¥${parseFloat(amount).toFixed(2)}` : '¥0.00';
             };
             
-            document.getElementById('totalDeposit').textContent = formatAmount(summary.totalDeposit);
+            // 应下发 = totalUDeposit
+            const shouldWithdraw = parseFloat(summary.totalUDeposit) || 0;
+            const shouldWithdrawCNY = parseFloat(summary.totalDeposit) || 0;
+            
+            // 已下发 = totalUWithdrawal
+            const alreadyWithdraw = parseFloat(summary.totalUWithdrawal) || 0;
+            const alreadyWithdrawCNY = parseFloat(summary.totalWithdraw) || 0;
+            
+            // 未下发 = totalUDeposit - totalUWithdrawal
+            const remainingWithdraw = shouldWithdraw - alreadyWithdraw;
+            const remainingWithdrawCNY = shouldWithdrawCNY - alreadyWithdrawCNY;
+            
+            document.getElementById('totalDepositCNY').textContent = formatCNY(shouldWithdrawCNY);
+            document.getElementById('totalDeposit').textContent = formatAmount(shouldWithdraw);
             document.getElementById('totalDepositCount').textContent = summary.depositCount || 0;
-            document.getElementById('depositFeeRate').textContent = `${summary.depositFeeRate || 0}%`;
-            document.getElementById('depositExchangeRate').textContent = `${summary.depositExchangeRate || 0}`;
-            document.getElementById('totalWithdraw').textContent = formatAmount(summary.totalWithdraw);
+            document.getElementById('totalWithdrawCNY').textContent = formatCNY(alreadyWithdrawCNY);
+            document.getElementById('totalWithdraw').textContent = formatAmount(alreadyWithdraw);
             document.getElementById('totalWithdrawCount').textContent = summary.withdrawCount || 0;
-            document.getElementById('withdrawFeeRate').textContent = `${summary.withdrawFeeRate || 0}%`;
-            document.getElementById('withdrawExchangeRate').textContent = `${summary.withdrawExchangeRate || 0}`;
-            document.getElementById('balance').textContent = formatAmount(summary.balance);
+            document.getElementById('balanceCNY').textContent = formatCNY(remainingWithdrawCNY);
+            document.getElementById('balance').textContent = formatAmount(remainingWithdraw);
         }
 
         // 页面加载时加载数据