<template>
  <div class="summary-dashboard">
    <topBar
      v-if="topList.length > 0 && userInfo.userType != 9"
      :top-list="topList"
      :moren="defaultTabItem"
      :wait-approval-num="waitApprovalNum"
      :receive-approval-num="receiveApprovalNum"
    />
  </div>
</template>

<script>
import topBarMixin from './mixins/top-bar-mixin'
import topBar from '@/components/topBar'
import { getMemberSummary, getDailyPerformance, getMonthlyPerformance } from '@/api/dashboard'
export default {
  name: 'SummaryDashboard',
  components: {
    topBar
  },
  mixins: [topBarMixin],
  data() {
    return {
      memberSummary: {},
      dailyPerformance: {},
      monthlyPerformance: {},
      defaultTabItem: 'summary'
    }
  },
  mounted() {
    this.getMemberSummary()
    this.getDailyPerformance()
    this.getMonthlyPerformance()
    this.getApprovalStatus()
  },
  methods: {
    getMemberSummary() {
      getMemberSummary().then(res => {
        this.memberSummary = res.data
      })
    },
    getDailyPerformance() {
      getDailyPerformance().then(res => {
        this.dailyPerformance = res.data
      })
    },
    getMonthlyPerformance() {
      getMonthlyPerformance().then(res => {
        this.monthlyPerformance = res.data
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.summary-dashboard {
  padding: 20px;
  background: #f9f9f9;
  font-size: 14px;
}
</style>
