<template>
  <div class="address-item">
    <div class="info">
      <span class="name">{{ info.name }}</span>
      <span class="phone">{{ info.mobile }}</span>
      <span class="icon" v-if="info.isDefault">默认</span>
    </div>
    <div class="text">{{ address }} {{ info.detail }}</div>
  </div>
</template>

<script>
export default {
  name: 'shop-address-item',
  props: {
    info: {}
  },
  computed: {
    address() {
      let str = '';
      if (this.info.province) {
        str += this.info.province + '-';
      }
      if (this.info.city) {
        str += this.info.city + '-';
      }
      if (this.info.area) {
        str += this.info.area;
      }
      return str;
    }
  }
};
</script>

<style lang="less" scoped>
.address-item {
  padding: 0.05rem 0;
  height: 100%;
  .info {
    margin-bottom: 0.05rem;
    line-height: 0.2rem;
    .name {
      vertical-align: middle;
      margin-right: 0.1rem;
      font-size: 0.13rem;
      color: #333333;
    }
    .phone {
      vertical-align: middle;
      margin-right: 0.05rem;
      font-size: 0.12rem;
      color: #999999;
    }
    .icon {
      vertical-align: middle;
      padding: 0.02rem 0.03rem;
      font-size: 0.1rem;
      color: #f14936;
      border: 0.01rem solid #f14936;
      border-radius: 0.04rem;
    }
  }
  .text {
    line-height: 0.2rem;
    font-size: 0.12rem;
    color: #333;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
}
</style>
