first commit
Some checks failed
CI / Test (ubuntu-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Lint (ubuntu-latest) (push) Has been cancelled
CI / Lint (windows-latest) (push) Has been cancelled
CI / Check (ubuntu-latest) (push) Has been cancelled
CI / Check (windows-latest) (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
Deploy Website on push / Deploy Push Playground Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Docs Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Antd Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Element Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Naive Ftp (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
CI / CI OK (push) Has been cancelled
Deploy Website on push / Rerun on failure (push) Has been cancelled
Lock Threads / action (push) Has been cancelled
Issue Close Require / close-issues (push) Has been cancelled
Close stale issues / stale (push) Has been cancelled
Some checks failed
CI / Test (ubuntu-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Lint (ubuntu-latest) (push) Has been cancelled
CI / Lint (windows-latest) (push) Has been cancelled
CI / Check (ubuntu-latest) (push) Has been cancelled
CI / Check (windows-latest) (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
Deploy Website on push / Deploy Push Playground Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Docs Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Antd Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Element Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Naive Ftp (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
CI / CI OK (push) Has been cancelled
Deploy Website on push / Rerun on failure (push) Has been cancelled
Lock Threads / action (push) Has been cancelled
Issue Close Require / close-issues (push) Has been cancelled
Close stale issues / stale (push) Has been cancelled
This commit is contained in:
121
playground/src/views/dashboard/analytics/statistics-overview.vue
Normal file
121
playground/src/views/dashboard/analytics/statistics-overview.vue
Normal file
@@ -0,0 +1,121 @@
|
||||
<script lang="ts" setup>
|
||||
import { onMounted, ref } from 'vue';
|
||||
import {
|
||||
getStatisticsOverview,
|
||||
} from '#/api/agent';
|
||||
import type { AgentApi } from '#/api/agent';
|
||||
|
||||
interface OverviewItem {
|
||||
title: string;
|
||||
value: number;
|
||||
prefix?: string;
|
||||
suffix?: string;
|
||||
}
|
||||
|
||||
const loading = ref(false);
|
||||
const overviews = ref<OverviewItem[]>([]);
|
||||
|
||||
async function loadOverview() {
|
||||
loading.value = true;
|
||||
try {
|
||||
const data = await getStatisticsOverview();
|
||||
overviews.value = [
|
||||
{
|
||||
title: '代理总数',
|
||||
value: data.total_agents,
|
||||
},
|
||||
{
|
||||
title: '今日新增代理',
|
||||
value: data.today_new_agents,
|
||||
},
|
||||
{
|
||||
title: '总订单数',
|
||||
value: data.total_orders,
|
||||
},
|
||||
{
|
||||
title: '今日订单数',
|
||||
value: data.today_orders,
|
||||
},
|
||||
{
|
||||
title: '总订单金额',
|
||||
value: data.total_order_amount,
|
||||
prefix: '¥',
|
||||
},
|
||||
{
|
||||
title: '今日订单金额',
|
||||
value: data.today_order_amount,
|
||||
prefix: '¥',
|
||||
},
|
||||
{
|
||||
title: '总佣金支出',
|
||||
value: data.total_commission,
|
||||
prefix: '¥',
|
||||
},
|
||||
{
|
||||
title: '今日佣金支出',
|
||||
value: data.today_commission,
|
||||
prefix: '¥',
|
||||
},
|
||||
{
|
||||
title: '本月订单金额',
|
||||
value: data.month_order_amount,
|
||||
prefix: '¥',
|
||||
},
|
||||
{
|
||||
title: '本月佣金支出',
|
||||
value: data.month_commission,
|
||||
prefix: '¥',
|
||||
},
|
||||
{
|
||||
title: '待审核提现',
|
||||
value: data.pending_withdraw,
|
||||
prefix: '¥',
|
||||
},
|
||||
];
|
||||
} catch (error) {
|
||||
console.error('Failed to load statistics overview:', error);
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
loadOverview();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="statistics-overview">
|
||||
<a-spin :spinning="loading">
|
||||
<a-row :gutter="[16, 16]">
|
||||
<a-col
|
||||
v-for="(item, index) in overviews"
|
||||
:key="index"
|
||||
:xs="24"
|
||||
:sm="12"
|
||||
:md="8"
|
||||
:lg="6"
|
||||
>
|
||||
<a-card class="overview-card">
|
||||
<a-statistic
|
||||
:title="item.title"
|
||||
:value="item.value"
|
||||
:prefix="item.prefix"
|
||||
:precision="item.prefix ? 2 : 0"
|
||||
/>
|
||||
</a-card>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-spin>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.statistics-overview {
|
||||
.overview-card {
|
||||
:deep(.ant-card-body) {
|
||||
padding: 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user