address.vue 1.78 KB
<template>
  <div class="address-wrapper" @click="onClick">
    <div v-if="data" class="address-info">
      <div class="index">
        <i class="iconfont iconaddress icon-size2"></i>
      </div>
      <div class="user-info">
        <div class="name">{{data.consignee}}</div>
        <div class="area">{{data.area}}</div>
        <div class="area">{{data.address}}</div>
        <div class="mobile">{{data.mobile}}</div>
      </div>
    </div>
    <template v-else>
      <div class="title"><i class="iconfont iconaddress icon-size"></i>添加地址</div>
      <div class="tip" v-if="showTip">商品不符合平检查验标准时,将到付寄还给您</div>
    </template>
  </div>
</template>

<script>
export default {
  name: 'OrderAddress',
  props: {
    data: {
      type: Object,
      default() {
        return null;
      }
    },
    showTip: {
      type: Boolean,
      default: true
    }
  },
  methods: {
    async onClick() {
      const user = await this.$yoho.auth();

      if (user) {
        this.$router.push({
          name: 'address',
          query: {
            address_id: this.data?.address_id
          }
        });
      }
    }
  }
};
</script>

<style lang="scss" scoped>
.address-wrapper {
}

.title {
  font-size: 40px;
  font-weight: bold;
  text-align: center;
  margin-bottom: 12px;
}

.index {
  display: flex;
  align-items: center;
}

.icon-size {
  font-size: 34px;
  margin-right: 10px;
}

.icon-size2 {
  font-size: 48px;
}

.index {
  margin-right: 40px;
}

.tip {
  font-size: 24px;
  color: #999;
  text-align: center;
}

.address-info {
  display: flex;
}

.name {
  font-size: 32px;
  font-weight: bold;
  margin-bottom: 12px;
}

.area {
  font-size: 24px;
  color: #999;
}

.mobile {
  font-size: 28px;
  margin-top: 12px;
  font-weight: bold;
}
</style>