<template>
  <div class="stat">
    <!-- 标题区域 -->
    <div class="stat_title">
      <div class="title_text">住宿统计</div>
      <img src="@/assets/images/33.png" />
    </div>

    <!-- 时间选择框区域 -->
    <div class="stat_search">
      <!-- <div class="search_box">
        <el-date-picker
          v-model="dateValue"
          type="date"
          style="width: 100%; height: 100%"
          placeholder="请选择日期"
        />
      </div> -->
    </div>

    <!-- 统计数量区域 -->
    <div class="stat_content">
      <!-- 昨日订房量统计区域 -->
      <div class="content_box">
        <div class="box_img">
          <img src="@/assets/images/8.png" />
        </div>
        <div class="box_info">
          <div class="info_top">昨日订房量统计</div>
          <div class="info_bottom">
            <div ref="yesterdayDom">{{ yesterdayValue }}</div>
            <span>间</span>
          </div>
        </div>
      </div>

      <!-- 昨日销售额统计区域 -->
      <div class="content_box">
        <div class="box_img">
          <img src="@/assets/images/8.png" />
        </div>
        <div class="box_info">
          <div class="info_top">昨日销售额统计</div>
          <div class="info_bottom">
            <div ref="yesdayMoneyDom">{{ yesdayMoneyValue }}</div>
            <span>元</span>
          </div>
        </div>
      </div>

      <!-- 累计订房量统计区域 -->
      <div class="content_box">
        <div class="box_img">
          <img src="@/assets/images/8.png" />
        </div>
        <div class="box_info">
          <div class="info_top">累计订房量统计</div>
          <div class="info_bottom">
            <div ref="addDom">{{ addValue }}</div>
            <span>间</span>
          </div>
        </div>
      </div>

      <!-- 累计销售额统计区域 -->
      <div class="content_box">
        <div class="box_img">
          <img src="@/assets/images/8.png" />
        </div>
        <div class="box_info">
          <div class="info_top">累计销售额统计</div>
          <div class="info_bottom">
            <div ref="addMoneyDom">{{ addMoneyValue }}</div>
            <span>元</span>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref, onMounted } from "vue";
import { countUpNum } from "@/utils/countUpNum.ts";

// 昨日订房量数据
const yesterdayDom = ref();
const yesterdayValue = ref<number>(156);

// 昨日销售额数据
const yesdayMoneyDom = ref();
const yesdayMoneyValue = ref<number>(31520);

// 累计订房量数据
const addDom = ref();
const addValue = ref<number>(455);

// 累计销售额数据
const addMoneyDom = ref();
const addMoneyValue = ref<number>(91860);

onMounted(() => {
  getCountUpNum();
});

// 让数字跳动
const getCountUpNum = () => {
  countUpNum(yesterdayDom.value, yesterdayValue.value);
  countUpNum(yesdayMoneyDom.value, yesdayMoneyValue.value);
  countUpNum(addDom.value, addValue.value);
  countUpNum(addMoneyDom.value, addMoneyValue.value);
};

// 时间选择框绑定数据
// const dateValue = ref("");
</script>

<style lang="scss" scoped>
.stat {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;

  .stat_title {
    position: relative;
    margin-top: 31px;
    width: 548px;
    height: 41px;
    line-height: 41px;

    .title_text {
      position: absolute;
      left: 15px;
      z-index: 1;
      font-size: 23.5px;
      font-weight: bold;
      color: #e0efff;
    }

    img {
      position: absolute;
      left: 0;
      bottom: 0;
      width: 548px;
      height: 16px;
    }
  }

  .stat_search {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    width: 548px;
    height: 104px;

    .search_box {
      width: 185px;
      height: 38px;
    }
  }

  .stat_content {
    display: grid;
    gap: 20px 60px;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    width: 548px;
    height: 200px;

    .content_box {
      display: flex;
      height: 70px;

      .box_img {
        display: flex;
        justify-content: center;
        align-items: center;
        width: 70px;
        height: 70px;
        border-radius: 12px;
        border: 2px solid rgba(120, 183, 255, 0.4);
        background: linear-gradient(
          180deg,
          rgba(120, 183, 255, 0.4) 0%,
          rgba(255, 255, 255, 0) 100%
        );

        img {
          width: 41px;
          height: 41px;
        }
      }

      .box_info {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        margin-left: 17.5px;
        height: 70px;

        .info_top {
          font-size: 20.5px;
        }

        .info_bottom {
          display: flex;
          font-size: 35px;
          font-weight: bold;
          color: #78b7ff;

          span {
            align-self: center;
            margin-left: 10px;
            font-size: 20.5px;
            color: #fff;
            font-weight: 400;
          }
        }
      }
    }
  }
}

::v-deep(.el-input__wrapper) {
  font-size: 18px;
  background-color: transparent;
}

::v-deep(.el-input__inner) {
  color: #fff;
}
</style>
