<script setup>
import StatisticsPanel from "@/views/components/StatisticsPanel.vue";
import { getBrokerStatistic } from "@/api/admin/agent/home";
import { ref } from "vue";

const statisticsList = ref([
  {
    label: "企业数量",
    value: 0,
    unit: "家",
  },
  {
    label: "正在服务需求数",
    value: 0,
    unit: "个",
  },
  {
    label: "订单总数",
    value: 0,
    unit: "元",
  },
  {
    // demandCount
    label: "需求总数",
    value: 0,
    unit: "个",
  },
]);

const loadStatistics = async () => {
  const { data } = await getBrokerStatistic();

  statisticsList.value = [
    {
      label: "企业数量",
      value: data?.enterpriseCount ?? 0,
      unit: "家",
    },
    {
      label: "正在服务需求数",
      value: data?.runDemandCount ?? 0,
      unit: "个",
    },
    {
      label: "订单总数",
      value: data?.orderTotal ?? 0,
      unit: "元",
    },
    {
      // demandCount
      label: "需求总数",
      value: data?.demandCount ?? 0,
      unit: "个",
    },
  ];
};
loadStatistics();
</script>

<template>
  <div class="app-container">
    <statistics-panel :list="statisticsList" />
  </div>
</template>

<style lang="scss" scoped></style>
