zhengyiming
3 天以前 9453bef1fc4a3121b28ffa6617f0fbfc81d9f634
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<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> -->
  <div class="dashboard-view">
    <Chunk title="核心数据">
      <DashboardLargeCell class="dashboard-large-cell1">
        <DashboardItem
          title="累计收款"
          :icon="IconDashboard1"
          :value="toThousand(topStatistics?.accumulatedReceipts ?? 0)"
          need-symbol
        />
        <DashboardItem
          title="昨日收款"
          :icon="IconDashboard2"
          :value="toThousand(topStatistics?.receiptsYesterday ?? 0)"
          need-symbol
        />
      </DashboardLargeCell>
      <div class="dashboard-item-grad">
        <DashboardItem
          title="累计下单"
          :icon="IconDashboard3"
          :value="toThousand(topStatistics?.accumulatedOrders ?? 0)"
        />
        <DashboardItem
          title="昨日下单"
          :icon="IconDashboard4"
          :value="toThousand(topStatistics?.ordersNumYesterday ?? 0)"
        />
        <DashboardItem
          title="累计收益"
          :icon="IconDashboard5"
          :value="toThousand(topStatistics?.accumulatedIncome ?? 0)"
          need-symbol
        />
        <DashboardItem
          title="昨日成功"
          :icon="IconDashboard6"
          :value="toThousand(topStatistics?.yesterdaySuccess ?? 0)"
        />
      </div>
    </Chunk>
    <Chunk title="用户统计">
      <DashboardLargeCell>
        <DashboardItem
          title="累计用户"
          :icon="IconDashboard7"
          :value="toThousand(topStatistics?.accumulatedUsers ?? 0)"
        />
        <DashboardItem
          title="昨日活跃"
          :icon="IconDashboard8"
          :value="toThousand(topStatistics?.yesterdayActiveUsers ?? 0)"
        />
      </DashboardLargeCell>
    </Chunk>
  </div>
</template>
 
<script setup lang="ts">
import { toThousand } from '../../utils';
import { useQuery } from '@tanstack/vue-query';
import { useLifeRechargeContext, TopStatisticsOutput } from '@life-payment/core-vue';
import { computed } from 'vue';
import Chunk from '../../components/Layout/Chunk.vue';
import DashboardLargeCell from './components/DashboardLargeCell.vue';
import DashboardItem from './components/DashboardItem.vue';
import IconDashboard1 from '../../assets/dashboard/icon-dashboard1.png';
import IconDashboard2 from '../../assets/dashboard/icon-dashboard2.png';
import IconDashboard3 from '../../assets/dashboard/icon-dashboard3.png';
import IconDashboard4 from '../../assets/dashboard/icon-dashboard4.png';
import IconDashboard5 from '../../assets/dashboard/icon-dashboard5.png';
import IconDashboard6 from '../../assets/dashboard/icon-dashboard6.png';
import IconDashboard7 from '../../assets/dashboard/icon-dashboard7.png';
import IconDashboard8 from '../../assets/dashboard/icon-dashboard8.png';
 
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>