<template>
  <div class="m-container">
    <h2>首页 <div class="squrt"></div>
    </h2>
    <div class="m-core">
      <div class="itemWrap">
        <div class="item" v-if="dataInfo.musicDatas">
          <h4> <p>分部乐团数</p> <img src="" alt=""> </h4>
          <div class="infos">
            <div class="info">
              <p class="sub">全部</p>
              <p class='msg'>{{ dataInfo.musicDatas.total }}</p>
            </div>
            <div class="info">
              <p class="sub">进行中</p>
              <p class='msg'>{{ dataInfo.musicDatas.progress_num_ }}</p>
            </div>
            <div class="info">
              <p class="sub">已完成</p>
              <p class='msg'>{{ dataInfo.musicDatas.pause_num_ }}</p>
            </div>
          </div>
        </div>
        <!--  -->
        <div class="item" v-if="dataInfo.incomeExpendMap">
          <h4>
            <p>本月收入</p>
            <img src=""
                 alt="">
          </h4>
          <div class="infos">
            <div class="info">
              <p class="sub">收入笔数</p>
              <p class='msg'>{{ dataInfo.incomeExpendMap.income_num_ }}</p>
            </div>
            <div class="info">
              <p class="sub">收入金额</p>
              <p class='msg'>{{ dataInfo.incomeExpendMap.income_total_ }}</p>
            </div>
          </div>
        </div>

        <div class="item" v-if="dataInfo.incomeExpendMap">
          <h4>
            <p>本月支出</p>
            <img src=""
                 alt="">
          </h4>
          <div class="infos">
            <div class="info">
              <p class="sub">支出笔数</p>
              <p class='msg'>{{ dataInfo.incomeExpendMap.expend_num_ }}</p>
            </div>
            <div class="info">
              <p class="sub">支出金额</p>
              <p class='msg'>{{ dataInfo.incomeExpendMap.expend_total_ }}</p>
            </div>
          </div>
        </div>

        <div class="item" v-if="dataInfo.teacherDatas">
          <h4>
            <p>本月支出</p>
            <img src=""
                 alt="">
          </h4>
          <div class="infos">
            <div class="info">
              <p class="sub">总计</p>
              <p class='msg'>{{ dataInfo.teacherDatas.total }}</p>
            </div>
            <div class="info">
              <p class="sub">全职人数</p>
              <p class='msg'>{{ dataInfo.teacherDatas.full_time_num_ }}</p>
            </div>
            <div class="info">
              <p class="sub">兼职人数</p>
              <p class='msg'>{{ dataInfo.teacherDatas.part_time_num_ }}</p>
            </div>
          </div>
        </div>

        <div class="item" v-if="dataInfo.vipDatas">
          <h4>
            <p>VIP课数</p>
            <img src=""
                 alt="">
          </h4>
          <div class="infos">
            <div class="info">
              <p class="sub">总计</p>
              <p class='msg'>{{ dataInfo.vipDatas.total }}</p>
            </div>
            <div class="info">
              <p class="sub">进行中</p>
              <p class='msg'>{{ dataInfo.vipDatas.applying_num_ }}</p>
            </div>
            <div class="info">
              <p class="sub">已完成</p>
              <p class='msg'>{{ dataInfo.vipDatas.finished_num_ }}</p>
            </div>
          </div>
        </div>

        <div class="item" v-if="dataInfo.demoDatas">
          <h4>
            <p>试听课</p>
            <img src=""
                 alt="">
          </h4>
          <div class="infos">
            <div class="info">
              <p class="sub">总计</p>
              <p class='msg'>{{ dataInfo.demoDatas.booked_num_ + dataInfo.demoDatas.unbooked_num_ }}</p>
            </div>
            <div class="info">
              <p class="sub">已预约</p>
              <p class='msg'>{{ dataInfo.demoDatas.booked_num_ }}</p>
            </div>
            <div class="info">
              <p class="sub">未完成</p>
              <p class='msg'>{{ dataInfo.demoDatas.unbooked_num_ }}</p>
            </div>
          </div>
        </div>

        <div class="item" v-if="dataInfo.studentDatas">
          <h4>
            <p>分部学生数</p>
            <img src=""
                 alt="">
          </h4>
          <div class="infos">
            <div class="info">
              <p class="sub">总计</p>
              <p class='msg'>{{ dataInfo.studentDatas.total_num_ }}</p>
            </div>
            <div class="info">
              <p class="sub">本月新增</p>
              <p class='msg'>{{ dataInfo.studentDatas.new_num_ }}</p>
            </div>
            <div class="info">
              <p class="sub">本月退团</p>
              <p class='msg'>{{ dataInfo.studentDatas.quit_num_ }}</p>
            </div>
          </div>
        </div>

        <div class="item">
          <h4>
            <p>本月预计上课</p>
            <img src=""
                 alt="">
          </h4>
          <div class="infos">
            <div class="info">
              <p class="sub">乐团课</p>
              <p class='msg'>{{ dataInfo.musicGroupNum }}</p>
            </div>
            <div class="info">
              <p class="sub">VIP课</p>
              <p class='msg'>{{ dataInfo.vipGroupNum }}</p>
            </div>
            <div class="info">
              <p class="sub">试听课</p>
              <p class='msg'>{{ dataInfo.demoGroupNum }}</p>
            </div>
          </div>
        </div>

      </div>
    </div>
  </div>
</template>
<script>
import { getIndex } from '@/api/user'
export default {
  // name: 'main',
  data() {
    return {
      dataInfo: {}
    }
  },
  mounted() {
    this.__init()
  },
  methods: {
    __init() {
      getIndex().then(res => {
        if(res.code == 200) {
          this.dataInfo = res.data
        }
      })
    }
  }
}
</script>
<style lang="scss" scope>
.itemWrap {
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
  flex-wrap: wrap;
  .item {
    width: 333px;
    height: 137px;
    padding: 22px 28px 20px;
    box-shadow: 0px 8px 20px 0px rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    margin: 0 15px 3rem;
    h4 {
      display: flex;
      flex-direction: row;
      justify-content: space-between;
      margin-bottom: 20px;
      color: #323c47;
      font-size: 14px;
    }
    .infos {
      display: flex;
      flex-direction: row;
      justify-content: space-between;
      .sub {
        font-size: 14px;
        line-height: 20px;
        color: #aaa;
        margin-bottom: 8px;
      }
      .msg {
        font-size: 24px;
        font-weight: 500;
        color: rgba(68, 68, 68, 1);
        line-height: 28px;
      }
    }
  }
}
</style>