Parcourir la source

feat: 日统计汇总卡片增加充值笔数和退款笔数,改为三列布局

- DailyStatSummaryVo 新增 rechargeCount / refundCount 字段
- aggregateDailyStat 补充充值笔数和退款笔数聚合
- 汇总卡片从 2×2 改为 3×2 布局

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
skyline il y a 1 semaine
Parent
commit
e84f56fb35

+ 22 - 5
admin-h5/src/pages/statistics/index.vue

@@ -56,6 +56,14 @@
         <text class="summary-label">活跃用户</text>
         <text class="summary-value">{{ summary.totalActiveUsers }}</text>
       </view>
+      <view class="summary-card">
+        <text class="summary-label">充值笔数</text>
+        <text class="summary-value">{{ summary.totalRechargeCount }}</text>
+      </view>
+      <view class="summary-card">
+        <text class="summary-label">退款笔数</text>
+        <text class="summary-value">{{ summary.totalRefundCount }}</text>
+      </view>
     </view>
 
     <!-- 数据列表 -->
@@ -217,14 +225,21 @@ const summary = ref({
   totalConsumption: 0,
   totalOrders: 0,
   totalRegistrations: 0,
-  totalActiveUsers: 0
+  totalActiveUsers: 0,
+  totalRechargeCount: 0,
+  totalRefundCount: 0
 })
 const summaryLoading = ref(false)
 
+const emptySummary = () => ({
+  totalIncome: 0, totalConsumption: 0, totalOrders: 0,
+  totalRegistrations: 0, totalActiveUsers: 0,
+  totalRechargeCount: 0, totalRefundCount: 0
+})
+
 const loadSummary = async () => {
   if (activeTab.value !== 0) {
-    // 月统计暂不走聚合接口
-    summary.value = { totalIncome: 0, totalConsumption: 0, totalOrders: 0, totalRegistrations: 0, totalActiveUsers: 0 }
+    summary.value = emptySummary()
     return
   }
   summaryLoading.value = true
@@ -242,7 +257,9 @@ const loadSummary = async () => {
         totalConsumption: res.data.totalConsumption || 0,
         totalOrders: res.data.ordersCount || 0,
         totalRegistrations: res.data.registrations || 0,
-        totalActiveUsers: res.data.activeUserCount || 0
+        totalActiveUsers: res.data.activeUserCount || 0,
+        totalRechargeCount: res.data.rechargeCount || 0,
+        totalRefundCount: res.data.refundCount || 0
       }
     }
   } catch (e) {
@@ -460,7 +477,7 @@ onMounted(async () => {
 
 .summary-section {
   display: grid;
-  grid-template-columns: repeat(2, 1fr);
+  grid-template-columns: repeat(3, 1fr);
   gap: 16rpx;
   padding: 0 20rpx 16rpx;
 }

+ 10 - 0
car-wash-entity/src/main/java/com/kym/entity/vo/DailyStatSummaryVo.java

@@ -37,4 +37,14 @@ public class DailyStatSummaryVo {
      * 活跃用户数
      */
     private Integer activeUserCount;
+
+    /**
+     * 充值笔数
+     */
+    private Integer rechargeCount;
+
+    /**
+     * 退款笔数
+     */
+    private Integer refundCount;
 }

+ 8 - 2
car-wash-service/src/main/java/com/kym/service/impl/DailyStatServiceImpl.java

@@ -206,7 +206,9 @@ public class DailyStatServiceImpl extends MyBaseServiceImpl<DailyStatMapper, Dai
                     .setTotalConsumption(0)
                     .setOrdersCount(0)
                     .setRegistrations(0)
-                    .setActiveUserCount(0);
+                    .setActiveUserCount(0)
+                    .setRechargeCount(0)
+                    .setRefundCount(0);
         }
 
         var totalIncome = list.stream().filter(s -> s.getTotalIncome() != null).mapToInt(DailyStat::getTotalIncome).sum();
@@ -214,12 +216,16 @@ public class DailyStatServiceImpl extends MyBaseServiceImpl<DailyStatMapper, Dai
         var ordersCount = list.stream().filter(s -> s.getOrdersCount() != null).mapToInt(DailyStat::getOrdersCount).sum();
         var registrations = list.stream().filter(s -> s.getRegistrations() != null).mapToInt(DailyStat::getRegistrations).sum();
         var activeUserCount = list.stream().filter(s -> s.getActiveUserCount() != null).mapToInt(DailyStat::getActiveUserCount).sum();
+        var rechargeCount = list.stream().filter(s -> s.getRechargeCount() != null).mapToInt(DailyStat::getRechargeCount).sum();
+        var refundCount = list.stream().filter(s -> s.getRefundCount() != null).mapToInt(DailyStat::getRefundCount).sum();
 
         return new DailyStatSummaryVo()
                 .setTotalIncome(totalIncome)
                 .setTotalConsumption(totalConsumption)
                 .setOrdersCount(ordersCount)
                 .setRegistrations(registrations)
-                .setActiveUserCount(activeUserCount);
+                .setActiveUserCount(activeUserCount)
+                .setRechargeCount(rechargeCount)
+                .setRefundCount(refundCount);
     }
 }