zhengyiming
2025-04-02 0886e91fdfe3b5528f80d2b6742083aa11d16ebb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<template>
  <NutGrid :gutter="10" :column-num="3" square class="dashboard-view">
    <NutGridItem>
      <div class="pro-statistics-wrapper">
        <div class="pro-statistics-title">累计收款</div>
        <div class="pro-statistics-content">
          {{ toThousand(topStatistics?.accumulatedReceipts ?? 0) }}
        </div>
      </div>
    </NutGridItem>
    <NutGridItem>
      <div class="pro-statistics-wrapper">
        <div class="pro-statistics-title">昨日收款</div>
        <div class="pro-statistics-content">
          {{ toThousand(topStatistics?.receiptsYesterday ?? 0) }}
        </div>
      </div>
    </NutGridItem>
    <NutGridItem>
      <div class="pro-statistics-wrapper">
        <div class="pro-statistics-title">累计收益</div>
        <div class="pro-statistics-content">
          {{ toThousand(topStatistics?.accumulatedIncome ?? 0) }}
        </div>
      </div>
    </NutGridItem>
    <NutGridItem>
      <div class="pro-statistics-wrapper">
        <div class="pro-statistics-title">累计下单</div>
        <div class="pro-statistics-content">{{ topStatistics?.accumulatedOrders ?? 0 }}</div>
      </div>
    </NutGridItem>
    <NutGridItem>
      <div class="pro-statistics-wrapper">
        <div class="pro-statistics-title">昨日下单</div>
        <div class="pro-statistics-content">{{ topStatistics?.ordersNumYesterday ?? 0 }}</div>
      </div>
    </NutGridItem>
    <NutGridItem>
      <div class="pro-statistics-wrapper">
        <div class="pro-statistics-title">昨日成功</div>
        <div class="pro-statistics-content">{{ topStatistics?.yesterdaySuccess ?? 0 }}</div>
      </div>
    </NutGridItem>
    <NutGridItem>
      <div class="pro-statistics-wrapper">
        <div class="pro-statistics-title">累计用户</div>
        <div class="pro-statistics-content">{{ topStatistics?.accumulatedUsers ?? 0 }}</div>
      </div>
    </NutGridItem>
    <NutGridItem>
      <div class="pro-statistics-wrapper">
        <div class="pro-statistics-title">昨日活跃</div>
        <div class="pro-statistics-content">{{ topStatistics?.yesterdayActiveUsers ?? 0 }}</div>
      </div>
    </NutGridItem>
  </NutGrid>
</template>
 
<script setup lang="ts">
import { Grid as NutGrid, GridItem as NutGridItem } from '@nutui/nutui-taro';
import { toThousand } from '../../utils';
import { useQuery } from '@tanstack/vue-query';
import { useLifeRechargeContext, TopStatisticsOutput } from '@life-payment/core-vue';
import { computed } from 'vue';
 
defineOptions({
  name: 'Dashboard',
});
 
const { blLifeRecharge } = useLifeRechargeContext();
 
const { data: topStatistics } = useQuery({
  queryKey: ['lifePayServices/getTopStatistics', blLifeRecharge.accountModel.userChannles],
  queryFn: async () => {
    return await blLifeRecharge.services.getTopStatistics(
      {
        channleList: blLifeRecharge.accountModel.userChannles.map((x) => x.channlesNum),
      },
      {
        showLoading: false,
      }
    );
  },
  placeholderData: () => ({} as TopStatisticsOutput),
  enabled: computed(() => blLifeRecharge.accountModel.isBackClientUser),
});
</script>