<template>
  <div
    class="big-dataservice-box"
    style="border-color:#b2dfdb!important"
    :class="{ 'hide-border': shouType == '4' }"
  >
    <div class="tag-title" style="background:#b2dfdb!important">课程动态</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.CourseCount }}
              <span class="unit">个</span>
            </div>
          </div>
          <div>
            <div class="label">在售课程</div>
            <div class="value">
              {{ d.SellCourseCount }}<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>
      </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.PlanCount.split(",")[0] }}
              <span class="unit">节</span>
            </div>
          </div>
          <div class="q-mr-lg">
            <div class="label big">当周</div>
            <div class="value samll">
              {{ d.PlanCount.split(",")[1] }}<span class="unit">节</span>
            </div>
          </div>
          <div>
            <div class="label big">当月</div>
            <div class="value samll">
              {{ d.PlanCount.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">
              {{ parseFloat(d.FullRate.split(",")[0]).toFixed(2) }}
              <span class="unit">%</span>
            </div>
          </div>
          <div class="q-mr-lg">
            <div class="label big">当周</div>
            <div class="value samll">
              {{ parseFloat(d.FullRate.split(",")[1]).toFixed(2)
              }}<span class="unit">%</span>
            </div>
          </div>
          <div class="q-mr-lg">
            <div class="label big">当月</div>
            <div class="value samll">
              {{ parseFloat(d.FullRate.split(",")[2]).toFixed(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">
              {{ parseFloat(d.AvgClassTime.split(",")[0]).toFixed(2) }}
              <span class="unit">分钟</span>
            </div>
          </div>
          <div class="q-mr-lg">
            <div class="label big">当周</div>
            <div class="value samll">
              {{ numberFormat(d.AvgClassTime.split(",")[1]).value
              }}<span class="unit">分钟</span>
            </div>
          </div>
          <div>
            <div class="label big">当月</div>
            <div class="value samll">
              {{ parseFloat(d.AvgClassTime.split(",")[2]).toFixed(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.NoneClassTeacher.split(",")[0] }}
              <span class="unit">人</span>
            </div>
          </div>
          <div class="q-mr-lg">
            <div class="label big">当周</div>
            <div class="value samll">
              {{ d.NoneClassTeacher.split(",")[1] }}<span class="unit">人</span>
            </div>
          </div>
          <div>
            <div class="label big">当月</div>
            <div class="value samll">
              {{ d.NoneClassTeacher.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.UnLessonClass.split(",")[0] }}
              <span class="unit">个</span>
            </div>
          </div>
          <div class="q-mr-lg">
            <div class="label big">当周</div>
            <div class="value samll">
              {{ d.UnLessonClass.split(",")[1] }}<span class="unit">个</span>
            </div>
          </div>
          <div class="q-mr-lg">
            <div class="label big">当月</div>
            <div class="value samll">
              {{ d.UnLessonClass.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.UnLessonTeacher.split(",")[0] }}
              <span class="unit">个</span>
            </div>
          </div>
          <div class="q-mr-lg">
            <div class="label big">当周</div>
            <div class="value samll">
              {{ d.UnLessonTeacher.split(",")[1] }}<span class="unit">个</span>
            </div>
          </div>
          <div class="q-mr-lg">
            <div class="label big">当月</div>
            <div class="value samll">
              {{ d.UnLessonTeacher.split(",")[2] }}<span class="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>
