Files

51 lines
1.1 KiB
Vue
Raw Normal View History

2023-07-20 17:26:43 +08:00
<script setup>
import StatisticsPanel from "@/views/components/StatisticsPanel.vue";
import { getBrokerStatistic } from "@/api/admin/agent/home";
import { ref } from "vue";
2023-07-27 17:31:39 +08:00
import { useI18n } from "vue-i18n";
2023-07-20 17:26:43 +08:00
2023-07-27 17:31:39 +08:00
const { t } = useI18n();
2023-07-20 17:26:43 +08:00
const statisticsList = ref([
{
2023-07-27 17:31:39 +08:00
key: "enterpriseCount",
label: computed(() => t("admin.statistics.enterpriseCount")),
2023-07-20 17:26:43 +08:00
value: 0,
unit: "家",
},
{
2023-07-27 17:31:39 +08:00
key: "runDemandCount",
label: computed(() => t("admin.statistics.serviceDemandCount")),
2023-07-20 17:26:43 +08:00
value: 0,
unit: "个",
},
{
2023-07-27 17:31:39 +08:00
key: "orderTotal",
label: computed(() => t("admin.statistics.orderCount")),
2023-07-20 17:26:43 +08:00
value: 0,
unit: "元",
},
{
2023-07-27 17:31:39 +08:00
key: "demandCount",
label: computed(() => t("admin.statistics.demandCount")),
2023-07-20 17:26:43 +08:00
value: 0,
unit: "个",
},
]);
const loadStatistics = async () => {
const { data } = await getBrokerStatistic();
2023-07-27 17:31:39 +08:00
statisticsList.value.forEach((item) => {
item.value = data[item.key] ?? 0;
});
2023-07-20 17:26:43 +08:00
};
loadStatistics();
</script>
<template>
<div class="app-container">
<statistics-panel :list="statisticsList" />
</div>
</template>
<style lang="scss" scoped></style>