<template>
  <div class="big-dataservice-box" :class="{ 'hide-border': shouType == '3' }">
    <div class="tag-title">学员动态</div>
    <div class="row q-gutter-md">
      <q-card flat>
        <div class="data-title">现有学员</div>
        <div class="data-time">{{ formatDate.date }} {{ formatDate.week }}</div>
        <div class="wrapper">
          <div class="col">
            <div class="label">在学</div>
            <div class="value">
              {{ d.TradeStu }}
              <span class="unit">人</span>
            </div>
          </div>
          <div class="q-mr-lg">
            <div class="label big">即将欠费</div>
            <div class="value samll red">
              {{ d.ImArrearsStu }}<span class="unit">人</span>
            </div>
          </div>
          <div>
            <div class="label big">即将结课</div>
            <div class="value samll green">
              {{ d.ImFinishStu }}<span class="unit">人</span>
            </div>
          </div>
        </div>
      </q-card>
      <q-card flat>
        <div class="data-title">停课学员</div>
        <div class="data-time">{{ formatDate.date }} {{ formatDate.week }}</div>
        <div class="wrapper">
          <div class="col">
            <div class="label">总数</div>
            <div class="value">
              {{ d.StopStu.split(",")[3] }}
              <span class="unit">人</span>
            </div>
          </div>
          <div class="q-mr-lg">
            <div class="label big">当日停课</div>
            <div class="value samll">
              {{ d.StopStu.split(",")[0] }}
              <span class="unit">人</span>
            </div>
          </div>
          <div class="q-mr-lg">
            <div class="label big">当周停课</div>
            <div class="value samll">
              {{ d.StopStu.split(",")[1] }}<span class="unit">人</span>
            </div>
          </div>
          <div>
            <div class="label big">当月结课</div>
            <div class="value samll">
              {{ d.StopStu.split(",")[2] }}<span class="unit">人</span>
            </div>
          </div>
        </div>
      </q-card>
      <q-card flat>
        <div class="data-title">毕业学员</div>
        <div class="data-time">{{ formatDate.date }} {{ formatDate.week }}</div>
        <div class="wrapper">
          <div class="col">
            <div class="label">总数</div>
            <div class="value">
              {{ d.FinishStu.split(",")[3] }}
              <span class="unit">人</span>
            </div>
          </div>
          <div class="q-mr-lg">
            <div class="label big">当日毕业</div>
            <div class="value samll">
              {{ d.FinishStu.split(",")[0] }}
              <span class="unit">人</span>
            </div>
          </div>
          <div class="q-mr-lg">
            <div class="label big">当周毕业</div>
            <div class="value samll">
              {{ d.FinishStu.split(",")[1] }}<span class="unit">人</span>
            </div>
          </div>
          <div>
            <div class="label big">当月毕业</div>
            <div class="value samll">
              {{ d.FinishStu.split(",")[2] }}<span class="unit">人</span>
            </div>
          </div>
        </div>
      </q-card>
      <q-card flat>
        <div class="data-title">欠费学员</div>
        <div class="data-time">{{ formatDate.date }} {{ formatDate.week }}</div>
        <div class="wrapper">
          <div class="col">
            <div class="label">总数</div>
            <div class="value red">
              {{ d.ArrearsStu.split(",")[3] }}
              <span class="unit">人</span>
            </div>
          </div>
          <div class="q-mr-lg">
            <div class="label big">当日欠费</div>
            <div class="value samll">
              {{ d.ArrearsStu.split(",")[0] }}
              <span class="unit">人</span>
            </div>
          </div>
          <div class="q-mr-lg">
            <div class="label big">当周欠费</div>
            <div class="value samll">
              {{ d.ArrearsStu.split(",")[1] }}<span class="unit">人</span>
            </div>
          </div>
          <div>
            <div class="label big">当月欠费</div>
            <div class="value samll">
              {{ d.ArrearsStu.split(",")[2] }}<span class="unit">人</span>
            </div>
          </div>
        </div>
      </q-card>
      <q-card flat>
        <div class="data-title">续费学员</div>
        <div class="data-time">{{ formatDate.date }} {{ formatDate.week }}</div>
        <div class="wrapper">
          <div class="col">
            <div class="label">总数</div>
            <div class="value green">
              {{ d.RenewStu.split(",")[3] }}
              <span class="unit">人</span>
            </div>
          </div>
          <div class="q-mr-lg">
            <div class="label big">当日续费</div>
            <div class="value samll">
              {{ d.RenewStu.split(",")[0] }}
              <span class="unit">人</span>
            </div>
          </div>
          <div class="q-mr-lg">
            <div class="label big">当周续费</div>
            <div class="value samll">
              {{ d.RenewStu.split(",")[1] }}<span class="unit">人</span>
            </div>
          </div>
          <div>
            <div class="label big">当月续费</div>
            <div class="value samll">
              {{ d.RenewStu.split(",")[2] }}<span class="unit">人</span>
            </div>
          </div>
        </div>
      </q-card>
      <q-card flat>
        <div class="data-title">学员转介绍</div>
        <div class="data-time">{{ formatDate.date }} {{ formatDate.week }}</div>
        <div class="wrapper">
          <div class="col">
            <div class="label">总数</div>
            <div class="value green">
              {{ d.RecommendStu.split(",")[3] }}
              <span class="unit">人</span>
            </div>
          </div>
          <div class="q-mr-lg">
            <div class="label big">当日转介</div>
            <div class="value samll">
              {{ d.RecommendStu.split(",")[0] }}
              <span class="unit">人</span>
            </div>
          </div>
          <div class="q-mr-lg">
            <div class="label big">当周转介</div>
            <div class="value samll">
              {{ d.RecommendStu.split(",")[1] }}<span class="unit">人</span>
            </div>
          </div>
          <div>
            <div class="label big">当月转介</div>
            <div class="value samll">
              {{ d.RecommendStu.split(",")[2] }}<span class="unit">人</span>
            </div>
          </div>
        </div>
      </q-card>
      <q-card flat>
        <div class="data-title">学员跟进记录</div>
        <div class="data-time">{{ formatDate.date }} {{ formatDate.week }}</div>
        <div class="wrapper">
          <div class="col">
            <div class="label">当日跟进</div>
            <div class="value">
              {{ d.FollowStu.split(",")[0] }}
              <span class="unit">人</span>
            </div>
          </div>
          <div class="q-mr-lg">
            <div class="label big">当周跟进</div>
            <div class="value samll">
              {{ d.FollowStu.split(",")[1] }}<span class="unit">人</span>
            </div>
          </div>
          <div class="q-mr-lg">
            <div class="label big">当月跟进</div>
            <div class="value samll">
              {{ d.FollowStu.split(",")[2] }}<span class="unit">人</span>
            </div>
          </div>
          <div>
            <div class="label big">总数</div>
            <div class="value samll">
              {{ d.FollowStu.split(",")[3] }}
              <span class="unit">人</span>
            </div>
          </div>
        </div>
      </q-card>
      <q-card flat>
        <div class="data-title">上课人次</div>
        <div class="data-time">{{ formatDate.date }} {{ formatDate.week }}</div>
        <div class="wrapper">
          <div class="col">
            <div class="label">当日</div>
            <div class="value">
              {{ d.StudyStu.split(",")[0] }}
              <span class="unit">人次</span>
            </div>
          </div>
          <div class="q-mr-lg">
            <div class="label big">当周</div>
            <div class="value samll">
              {{ d.StudyStu.split(",")[1] }}<span class="unit">人次</span>
            </div>
          </div>
          <div>
            <div class="label big">当月</div>
            <div class="value samll">
              {{ d.StudyStu.split(",")[2] }}<span class="unit">人次</span>
            </div>
          </div>
        </div>
      </q-card>
      <q-card flat>
        <div class="data-title">缺勤人次</div>
        <div class="data-time">{{ formatDate.date }} {{ formatDate.week }}</div>
        <div class="wrapper">
          <div class="col">
            <div class="label">当日</div>
            <div class="value">
              {{ d.AbsenceStu.split(",")[0] }}
              <span class="unit">人次</span>
            </div>
          </div>
          <div class="q-mr-lg">
            <div class="label big">当周</div>
            <div class="value samll">
              {{ d.AbsenceStu.split(",")[1] }}<span class="unit">人次</span>
            </div>
          </div>
          <div>
            <div class="label big">当月</div>
            <div class="value samll">
              {{ d.AbsenceStu.split(",")[2] }}<span class="unit">人次</span>
            </div>
          </div>
        </div>
      </q-card>
      <q-card flat>
        <div class="data-title">消耗课时</div>
        <div class="data-time">{{ formatDate.date }} {{ formatDate.week }}</div>
        <div class="wrapper">
          <div class="col">
            <div class="label">当日</div>
            <div class="value">
              {{ d.ConsumeHour.split(",")[0] }}
              <span class="unit">课时</span>
            </div>
          </div>
          <div class="q-mr-lg">
            <div class="label big">当周</div>
            <div class="value samll">
              {{ d.ConsumeHour.split(",")[1] }}<span class="unit">课时</span>
            </div>
          </div>
          <div>
            <div class="label big">当月</div>
            <div class="value samll">
              {{ d.ConsumeHour.split(",")[2] }}<span class="unit">课时</span>
            </div>
          </div>
        </div>
      </q-card>
      <q-card flat>
        <div class="data-title">消耗金额</div>
        <div class="data-time">{{ formatDate.date }} {{ formatDate.week }}</div>
        <div class="wrapper">
          <div class="col">
            <div class="label">当日</div>
            <div class="value">
              {{ numberFormat(d.ConsumeMoney.split(",")[0]).value }}
              <span class="unit">{{
                numberFormat(d.ConsumeMoney.split(",")[0]).unit
              }}</span>
            </div>
          </div>
          <div class="q-mr-lg">
            <div class="label big">当周</div>
            <div class="value samll">
              {{ numberFormat(d.ConsumeMoney.split(",")[1]).value
              }}<span class="unit">{{
                numberFormat(d.ConsumeMoney.split(",")[1]).unit
              }}</span>
            </div>
          </div>
          <div>
            <div class="label big">当月</div>
            <div class="value samll">
              {{ numberFormat(d.ConsumeMoney.split(",")[2]).value
              }}<span class="unit">{{
                numberFormat(d.ConsumeMoney.split(",")[2]).unit
              }}</span>
            </div>
          </div>
        </div>
      </q-card>
      <q-card flat>
        <div class="data-title">产生课时费</div>
        <div class="data-time">{{ formatDate.date }} {{ formatDate.week }}</div>
        <div class="wrapper">
          <div class="col">
            <div class="label">当日</div>
            <div class="value">
              {{ numberFormat(d.TimeHourFee.split(",")[0]).value }}
              <span class="unit">{{
                numberFormat(d.TimeHourFee.split(",")[0]).unit
              }}</span>
            </div>
          </div>
          <div class="q-mr-lg">
            <div class="label big">当周</div>
            <div class="value samll">
              {{ numberFormat(d.TimeHourFee.split(",")[1]).value
              }}<span class="unit">{{
                numberFormat(d.TimeHourFee.split(",")[1]).unit
              }}</span>
            </div>
          </div>
          <div>
            <div class="label big">当月</div>
            <div class="value samll">
              {{ numberFormat(d.TimeHourFee.split(",")[2]).value
              }}<span class="unit">{{
                numberFormat(d.TimeHourFee.split(",")[2]).unit
              }}</span>
            </div>
          </div>
        </div>
      </q-card>
    </div>
  </div>
</template>

<script>
export default {
  props: ["d", "formatDate", "shouType"],
  data() {
    return {};
  },
  methods: {
    numberFormat(value) {
      let param = {};
      let k = 10000;
      let sizes = ["元", "万", "亿", "万亿"];
      let i;
      if (value < k) {
        param.value = parseFloat(value).toFixed(2);
        param.unit = "元";
      } else {
        i = Math.floor(Math.log(value) / Math.log(k));
        param.value = (value / Math.pow(k, i)).toFixed(2);
        param.unit = sizes[i];
      }
      return param;
    }
  }
};
</script>

<style></style>
