<template>
  <div class="container">
    <div class="row1">
      <span @click="emits('itemClick',props.listData)" :class="{'highlight': props.isHighlight}">{{props.listData.name}}</span>
      <div v-if="props.listData.onTime">
        <span>准点率：</span>
        <span>{{formatZdl(props.listData.onTime)}}</span>
      </div>
    </div>
    <div class="row2">
      <div>
        <i class="icon icon-total"></i>
        <span>{{props.listData.count}}</span>
      </div>
      <div>
        <i class="icon icon-xr"></i>
        <span>{{props.listData.walkingCount}}</span>
      </div>
      <div>
        <i class="icon icon-llc"></i>
        <span>{{props.listData.bicycleCount}}</span>
      </div>
      <div>
        <i class="icon icon-slc"></i>
        <span>{{props.listData.motorCount}}</span>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'ListBoxLdkll',
}
</script>

<script setup>
  const props = defineProps(['list-data', 'is-highlight'])

  const emits = defineEmits(['itemClick'])

  function formatZdl(data) {
    return Number(data.slice(0,-1)).toFixed(1) + '%'
  }


</script>

<style lang="scss" scoped>
.container {
  box-sizing: border-box;
  padding-right: 16px;
  width: 321px;
  height: 6.85vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin-bottom: 0.926vh;
  margin-left: 5px;

  .row1 {
    margin-bottom: 1.2vh;
    height: 24px;
    background: url('@/assets/imgs/page_ssky/bg-lundu-line.png') no-repeat;
    background-size: 100% 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    &>span {
      display: block;
      margin-left: 2px;
      padding-right: 5px;
      font-size: 18px;
      font-weight: bold;
      font-style: italic;
      color: transparent;
      line-height: 24px;
      background: linear-gradient(0deg, #ACDDFF 0%, #FFFFFF 100%);
      -webkit-background-clip: text;
      cursor: pointer;
      &.highlight {
        background: linear-gradient(0deg, #f0d60d 0%, #FFFFFF 100%);
        -webkit-background-clip: text;
      }
    }
    &>div {
      span:first-child {
        display: inline-block;
        font-size: 14px;
        color: #ddd;
      }
      span:last-child {
        display: inline-block;
        width: 48px;
        font-size: 14px;
        color: #07afd4;
        font-weight: bold;
        text-align: right;
      }
    }
  }

  .row2 {
    display: flex;
    justify-content: space-between;
    align-items: center;

    &>div {
      display: flex;
      align-items: center;
    }

    span {
      font-size: 16px;
      font-family: BarlowBold;
      color: rgba(255, 234, 0, 1);
    }

    .icon {
      display: inline-block;
      width: 24px;
      height: 24px;
      margin-right: 6px;
    }

    .icon-total {
      background: url('@/assets/imgs/page_ssky/kl-total-s.png') no-repeat;
      background-size: contain;
    }
    .icon-xr {
      background: url('@/assets/imgs/page_ssky/kl-xr-s.png') no-repeat;
      background-size: contain;
    }
    .icon-llc {
      background: url('@/assets/imgs/page_ssky/kl-llc-s.png') no-repeat;
      background-size: contain;
    }
    .icon-slc {
      background: url('@/assets/imgs/page_ssky/kl-slc-s.png') no-repeat;
      background-size: contain;
    }
  }
}
</style>
