<template>
  <div class="page-card">
    <h3>运营概览</h3>
    <el-row :gutter="16" style="margin-top: 12px;">
      <el-col :span="6">
        <el-card>
          <div>在住长者</div>
          <h2>{{ stats.elders }}</h2>
        </el-card>
      </el-col>
      <el-col :span="6">
        <el-card>
          <div>护工数量</div>
          <h2>{{ stats.nurses }}</h2>
        </el-card>
      </el-col>
      <el-col :span="6">
        <el-card>
          <div>家属数量</div>
          <h2>{{ stats.families }}</h2>
        </el-card>
      </el-col>
      <el-col :span="6">
        <el-card>
          <div>累计收入</div>
          <h2>{{ stats.income }}</h2>
        </el-card>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import { adminStats } from "../../api";

export default {
  data() {
    return { stats: { elders: 0, nurses: 0, families: 0, income: 0 } };
  },
  async created() {
    try {
      const res = await adminStats();
      this.stats = res.data.data;
    } catch (e) {
      this.$message.error(e.message || "加载失败");
    }
  }
};
</script>

