<template>
  <mt-popup style="width: 90%;padding: 10px"
            v-model="popupFlag"
            popup-transition="popup-fade">
    <div style="height: 300px;background: #FFF;border-radius: 8px;" @click="togaodec">
      <div class="pop-title">
        停车诱导
        <p><span>{{num}}S</span> 后自动进入导航</p>
      </div>

      <div class="pop-main">
        <p style="text-align: center;padding: 10px 0">{{ parkName }}</p>
        <div style="display: flex;height: 90px;">
          <p class="main-left"></p>
          <p class="main-center">
            距您：{{ juli }}km
          </p>
          <p style="flex: 1;overflow: hidden;text-align: center;font-size: 18px;">
            <span style="display: block;padding: 20px 0;color: #0d72e2">{{ idleberths }} </span>
            空位
          </p>
        </div>
      </div>

      <div style="display: flex;text-align: center;font-size: 16px;margin-top: 15px;">
        <div style="flex: 1">
          <img src="../../assets/images/map/a4x.png" style="height: 30px;display: inline-block"/>
          <div>最优路线</div>
          <div>自动选最优</div>
        </div>

        <div style="flex: 1">
          <img src="../../assets/images/map/a5x.png" style="height: 30px;display: inline-block"/>
          <div>最优路线</div>
          <div>驾车更安全</div>
        </div>

        <div style="flex: 1">
          <img src="../../assets/images/map/a6.png" style="height: 30px;display: inline-block"/>
          <div>最优路线</div>
          <div>指引好停车</div>
        </div>

      </div>

    </div>
  </mt-popup>
</template>

<script>
export default {
  name: 'popComponents',
  props: [
    'popupFlag',
    'parkName',
    'idleberths',
    'juli',
    'num',
    'latitude',
    'longitude'
  ],
  data() {
      return{

      }
  },
  created(){
    // let me = this
    // this.n = 10
    // // this.popupVisible = true
    // this.setTimeoutTimer = setInterval(function () {
    //   if(me.n == 0){
    //     window.location.href = "http://api.map.baidu.com/marker?location="+this.$route.query.latitude+","+this.$route.query.longitude+"&title=目标地址&content="+this.$route.query.name+"&output=html&src=webapp.baidu.openAPIdemo"
    //     return
    //   }
    //    me.n --
    //   console.log(me.n)
    // },1000)
  },
  methods: {
    togaodec: function () {
      window.location.href = "http://api.map.baidu.com/marker?location="+this.latitude+","+this.longitude+"&title=目标地址&content="+this.parkName+"&output=html&src=webapp.baidu.openAPIdemo"

    },


  }
}
</script>

<style scoped lang="scss">
  .pop-title {
    height: 50px;
    line-height: 50px;
    text-align: center;
    font-size: 18px;
    position: relative;
    p {
      position: absolute;
      right: 0;
      bottom: 0;
      font-size: 12px;
      span {
        color: #f44336;
      }
    }
  }

  .pop-main {
    height: 150px;
    border: 2px solid #0d72e2;
  }

  .main-left {
    flex: 1;
    background: url('../../assets/images/map/a23.png') no-repeat center center;
    background-size: 50% 100%;
  }

  .main-center {
    flex: 1;
    padding-top: 70px;
    background: url('../../assets/images/map/a1x.png') no-repeat center center;
    background-size: 50% 60%;
  }

</style>
