<template>
  <div>
    <div class="boxlist">
      <div class="box box1">
        <div class="boxtitle">
          预约参观
        </div>
        <div class="bline"></div>
        <div class="boxcontentsubtitle">总预约人数 / 总入场人数</div>
        <div class="boxcontent">
          <div class="boxcontentitem">
            <div class="boxcontentitem-big">
              <count-to separator="" :start-val="0" :end-val="totaldata.visit_list.total.appointment.total" :duration="3600" />
            </div>
            <div class="boxcontentitem-small">团队：{{totaldata.visit_list.total.appointment.team}}</div>
            <div class="boxcontentitem-small">个人：{{totaldata.visit_list.total.appointment.person}}</div>
          </div>
          <div class="boxline"></div>
          <div class="boxcontentitem">
            <div class="boxcontentitem-big">
              <count-to separator="" :start-val="0" :end-val="totaldata.visit_list.total.enter.total" :duration="3600" />
            </div>
            <div class="boxcontentitem-small">团队：{{totaldata.visit_list.total.enter.team}}</div>
            <div class="boxcontentitem-small">个人：{{totaldata.visit_list.total.enter.person}}</div>
          </div>
        </div>
        <div class="boxfooter">
          核销比：{{toCaculateper(totaldata.visit_list.total.enter.total,totaldata.visit_list.total.appointment.total)}}
        </div>


        <div class="boxcline"></div>

        <div class="boxcontentsubtitle">今日预约人数 / 今日入场人数</div>
        <div class="boxcontent">
          <div class="boxcontentitem">
            <div class="boxcontentitem-big">
              <count-to separator="" :start-val="0" :end-val="totaldata.visit_list.today.appointment.total" :duration="3600" />
            </div>
            <div class="boxcontentitem-small">团队：{{totaldata.visit_list.today.appointment.team}}</div>
            <div class="boxcontentitem-small">个人：{{totaldata.visit_list.today.appointment.person}}</div>
          </div>
          <div class="boxline"></div>
          <div class="boxcontentitem">
            <div class="boxcontentitem-big">
              <count-to separator="" :start-val="0" :end-val="totaldata.visit_list.today.enter.total" :duration="3600" />
            </div>
            <div class="boxcontentitem-small">团队：{{totaldata.visit_list.today.enter.team}}</div>
            <div class="boxcontentitem-small">个人：{{totaldata.visit_list.today.enter.person}}</div>
          </div>
        </div>
        <div class="boxfooter">
          核销比：{{toCaculateper(totaldata.visit_list.today.enter.total,totaldata.visit_list.today.appointment.total)}}
        </div>
        <img src="../../../assets/imgs/index_icon_1.png" class="index_icon" />
        <img src="../../../assets/imgs/index_icon_bg_1.png" class="index_bg" />
      </div>
      <div class="box box2">
        <div class="boxtitle">
          活动参加
        </div>
        <div class="bline"></div>

        <div class="boxcontentsubtitle">总报名人数 / 总核销人数</div>
        <div class="boxcontent">
          <div class="boxcontentitem">
            <div class="boxcontentitem-big">
              <count-to separator="" :start-val="0" :end-val="totaldata.activity_list.total.appointment.total" :duration="3600" />
            </div>
            <div class="boxcontentitem-small">团队：{{totaldata.activity_list.total.appointment.team}}</div>
            <div class="boxcontentitem-small">个人：{{totaldata.activity_list.total.appointment.person}}</div>
          </div>
          <div class="boxline"></div>
          <div class="boxcontentitem">
            <div class="boxcontentitem-big">
              <count-to separator="" :start-val="0" :end-val="totaldata.activity_list.total.enter.total" :duration="3600" />
            </div>
            <div class="boxcontentitem-small">团队：{{totaldata.activity_list.total.enter.team}}</div>
            <div class="boxcontentitem-small">个人：{{totaldata.activity_list.total.enter.person}}</div>
          </div>
        </div>
        <div class="boxfooter">
          核销比：{{toCaculateper(totaldata.activity_list.total.enter.total,totaldata.activity_list.total.appointment.total)}}
        </div>

        <div class="boxcline"></div>
        <div class="boxcontentsubtitle">今日报名人数 / 今日核销人数</div>
        <div class="boxcontent">
          <div class="boxcontentitem">
            <div class="boxcontentitem-big">
              <count-to separator="" :start-val="0" :end-val="totaldata.activity_list.today.appointment.total" :duration="3600" />
            </div>
            <div class="boxcontentitem-small">团队：{{totaldata.activity_list.today.appointment.team}}</div>
            <div class="boxcontentitem-small">个人：{{totaldata.activity_list.today.appointment.person}}</div>
          </div>
          <div class="boxline"></div>
          <div class="boxcontentitem">
            <div class="boxcontentitem-big">
              <count-to separator="" :start-val="0" :end-val="totaldata.activity_list.today.enter.total" :duration="3600" />
            </div>
            <div class="boxcontentitem-small">团队：{{totaldata.activity_list.today.enter.team}}</div>
            <div class="boxcontentitem-small">个人：{{totaldata.activity_list.today.enter.person}}</div>
          </div>
        </div>
        <div class="boxfooter"></div>
        <img src="../../../assets/imgs/index_icon_2.png" class="index_icon" />
        <img src="../../../assets/imgs/index_icon_bg_1-21.png" class="index_bg" />
      </div>
      <div class="box box4">
        <div class="boxtitle">
          停车预约
        </div>
        <div class="bline"></div>
        <div class="boxcontentsubtitle">总预约数 / 总核销数</div>
        <div class="boxcontent">
          <div class="boxcontentitem">
            <div class="boxcontentitem-big">
              <count-to separator="" :start-val="0" :end-val="totaldata.park_list.total.appointment" :duration="3600" />
            </div>
            <div class="boxcontentitem-small"><span style="visibility: hidden;">0</span></div>
            <div class="boxcontentitem-small"><span style="visibility: hidden;">0</span></div>
          </div>
          <div class="boxline"></div>
          <div class="boxcontentitem">
            <div class="boxcontentitem-big">
              <count-to separator="" :start-val="0" :end-val="totaldata.park_list.total.enter" :duration="3600" />
            </div>
            <div class="boxcontentitem-small"><span style="visibility: hidden;">0</span></div>
            <div class="boxcontentitem-small"><span style="visibility: hidden;">0</span></div>
          </div>
        </div>
        <div class="boxfooter">
          核销比：{{toCaculateper(totaldata.park_list.total.enter,totaldata.park_list.total.appointment)}}</div>
        <div class="boxcline"></div>
        <div class="boxcontentsubtitle">今日预约数 / 今日核销数</div>
        <div class="boxcontent">
          <div class="boxcontentitem">
            <div class="boxcontentitem-big">
              <count-to separator="" :start-val="0" :end-val="totaldata.park_list.today.appointment" :duration="3600" />
            </div>
            <div class="boxcontentitem-small"><span style="visibility: hidden;">0</span></div>
            <div class="boxcontentitem-small"><span style="visibility: hidden;">0</span></div>
          </div>
          <div class="boxline"></div>
          <div class="boxcontentitem">
            <div class="boxcontentitem-big">
              <count-to separator="" :start-val="0" :end-val="totaldata.park_list.today.enter" :duration="3600" />
            </div>
            <div class="boxcontentitem-small"><span style="visibility: hidden;">0</span></div>
            <div class="boxcontentitem-small"><span style="visibility: hidden;">0</span></div>
          </div>
        </div>
        <div class="boxfooter">
          核销比：{{toCaculateper(totaldata.park_list.today.enter,totaldata.park_list.today.appointment)}}</div>
        <img src="../../../assets/imgs/index_icon_4.png" class="index_icon" />
        <img src="../../../assets/imgs/index_icon_bg_4.png" class="index_bg" />
      </div>
    </div>
  </div>
</template>

<script>
  import CountTo from 'vue-count-to'

  export default {
    props: {
      countsData: {
        type: Object
      },
      totaldata: {
        type: Object,
        default: {
          "visit_list": {
            "total": {
              "appointment": {
                "team": 0,
                "person": 0,
                "total": 0
              },
              "enter": {
                "team": 0,
                "person": 0,
                "total": 0
              }
            },
            "today": {
              "appointment": {
                "team": 0,
                "person": 0,
                "total": 0
              },
              "enter": {
                "team": 0,
                "person": 0,
                "total": 0
              }
            }
          },
          "activity_list": {
            "total": {
              "appointment": {
                "team": 0,
                "person": 126,
                "total": 126
              },
              "enter": {
                "team": 0,
                "person": 44,
                "total": 44
              }
            },
            "today": {
              "appointment": {
                "team": 0,
                "person": 0,
                "total": 0
              },
              "enter": {
                "team": 0,
                "person": 0,
                "total": 0
              }
            }
          },
          "park_list": {
            "total": {
              "appointment": 0,
              "enter": 0
            },
            "today": {
              "appointment": 0,
              "enter": 0
            }
          }
        }
      }
    },
    components: {
      CountTo
    },
    methods: {
      handleRoute(type) {
        this.$emit('handleRoute', type)
      },
      toCaculateper(f1, f2) {
        return ((f1 / (f2 == 0 ? 1 : f2)) * 100).toFixed(2) + "%"
      }
    }
  }
</script>

<style lang="scss" scoped>
  .boxlist {
    display: flex;
  }

  .index_icon {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    width: 3.5625rem;
  }

  .index_bg {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
  }



  .box {
    position: relative;
    width: 33%;
    margin-left: 0.5%;
    margin-right: 0.5%;
    margin-bottom: 2.375rem;
    box-shadow: 0px 8px 15px 0px rgba(212, 84, 32, 0.3100);
    border-radius: 8px;
    box-sizing: border-box;
    opacity: 0.8;
    padding: 1.25rem 0;

    .boxcontentsubtitle {
      color: #FFFFFF;
      text-align: center;
      display: flex;
      justify-content: center;
      font-size: 1.0625rem;
      margin-top: 1.25rem;
    }

    .boxfooter {
      font-size: 1.0625rem;
      font-family: Source Han Sans CN;
      font-weight: 400;
      color: #FFFFFF;
      display: flex;
      justify-content: center;
    }

    .boxtitle {
      font-size: 20px;
      font-family: Source Han Sans CN;
      font-weight: 400;
      color: #FFFFFF;
      padding: 0 1.25rem;
    }

    .boxcontent {
      display: flex;
      //justify-content: space-around;
      align-items: center;

      .boxline {
        width: 1px;
        height: 4.0625rem;
        background: #FFFFFF00;
        opacity: 0.3;
        margin-left: 2.0625rem;
        margin-right: 2.0625rem;
      }



      .boxcontentitem {
        display: flex;
        flex-direction: column;
        font-size: 19px;
        font-family: Source Han Sans CN;
        font-weight: 400;
        color: #FFFFFF;
        text-align: center;
        min-width: 40%;

        .boxcontentitem-big {
          font-size: 2.625rem;
          font-family: Arial;
          font-weight: 400;
          color: #FFFFFF;
        }
      }


    }
  }

  .box1 {
    background: linear-gradient(134deg, #D1AC7B, #DFC69C);

    .boxcline {
      width: 100%;
      background: #DFC69C;
      height: 0.125rem;
      margin-top: 1.25rem;
      margin-bottom: 1.25rem;
    }
  }

  .bline {
    background: linear-gradient(to right, rgba(255,255,255,0.3), rgba(255,255,255,0)  60%);
    height: 0.25rem;
    width: 100%;
    margin-top: 1.25rem;
  }

  .box2 {
    background: linear-gradient(134deg, #9193BC, #B7B9D4);

    .boxcline {
      width: 100%;
      background: #B7B9D4;
      height: 0.125rem;
      margin-top: 1.25rem;
      margin-bottom: 1.25rem;
    }
  }

  .box3 {

    background: linear-gradient(-55deg, #F6A868, #F4C59E);

    .boxcline {
      width: 100%;
      background: #F4C59E;
      height: 0.125rem;
      margin-top: 1.25rem;
      margin-bottom: 1.25rem;
    }
  }

  .box4 {

    background: linear-gradient(-55deg, #64A48E, #9ECABB);

    .boxcline {
      width: 100%;
      background: #9ECABB;
      height: 0.125rem;
      margin-top: 1.25rem;
      margin-bottom: 1.25rem;
    }
  }

  .panel-group {
    // margin-top: 18px;
    margin-left: -2% !important;
    margin-right: -3% !important;

    .card-panel-col {
      margin: 0 2%;

      margin-bottom: 32px;
    }

    .card-panel {
      height: 130px;
      cursor: pointer;
      font-size: 12px;
      position: relative;
      overflow: hidden;
      color: #666;
      text-align: center;
      // background: #fff;
      // box-shadow: 4px 4px 40px rgba(0, 0, 0, .05);
      // border-color: rgba(0, 0, 0, .05);

      &:hover {
        .card-panel-icon-wrapper {
          color: #fff;
        }

        // .icon-people {
        //   background: #40c9c6;
        // }

        // .icon-message {
        //   background: #36a3f7;
        // }

        // .icon-money {
        //   background: #f4516c;
        // }

        // .icon-shopping {
        //   background: #34bfa3
        // }
      }

      .icon-people {
        color: #fff;
      }

      .icon-message {
        color: #fff;
      }

      .icon-money {
        color: #fff;
      }

      .icon-shopping {
        color: #fff
      }

      .card-panel-icon-wrapper {
        float: right;
        margin: 22px 0 0 14px;
        padding: 16px;
        transition: all 0.38s ease-out;
        border-radius: 6px;
      }

      .card-panel-icon {
        float: left;
        font-size: 42px;
      }

      .card-panel-description {
        // float: right;
        font-weight: bold;
        margin: 16px 12px;

        .card-panel-text {
          line-height: 25px;
          color: rgb(255, 255, 255);
          font-size: 26px;
          margin-bottom: 20px;
          width: 70%;
          text-align: left;
        }

        p {
          text-align: left;
          font-size: 19px;
        }

        .card-panel-num {
          font-size: 20px;
        }
      }
    }
  }

  @media (max-width:550px) {
    .card-panel-description {
      display: none;
    }

    .card-panel-icon-wrapper {
      float: none !important;
      width: 100%;
      height: 100%;
      margin: 0 !important;

      .svg-icon {
        display: block;
        margin: 14px auto !important;
        float: none !important;
      }
    }
  }
</style>
