<template>
  <div
    class="card"
    :style="{ backgroundImage: `url(${imgUrl})`, backgroundSize: '100% 100%' }"
  >
    <div class="logo">
      <van-image
        src="https://static.caimei365.com/app/img/icon/logo-fanbai.png"
        mode=""
        class="titleImgUrl"
      ></van-image>
    </div>
    <div class="card-contain">
      <div style="display: flex">
        <div class="card-head">
          <van-image
            :src="
              (userInfo.image && userInfo.image?.length > 12)
                ? userInfo.image
                : 'https://static.caimei365.com/app/img/icon/default-head-new.png'
            "
            mode=""
            class="head"
          ></van-image>
        </div>
        <div class="card-info">
          <div class="card-info-head">
            <div class="card-name">
              {{ userInfo.linkMan }}
            </div>
            <div class="card-info-tab">客户经理</div>
          </div>
          <div class="card-info-iphone">
            {{
              userInfo.mobile
                ? userInfo.mobile.replace(/(?=(\d{4})+$)/g, "-")
                : ""
            }}
          </div>
        </div>
      </div>
      <div class="card-qrcode">
        <div class="qrcode-message">
          <van-image :src="userInfo.qrCode || ''" class="qrcode" mode=""></van-image>
        </div>
        <div class="tips">长按或扫二维码—-联系我-—</div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data () {
    return {
      userInfo: null,
      imgUrl: 'https://static.caimei365.com/app/img/icon/bg-card.png'
    }
  },
  mounted () {
    this.userInfo = this.$store.getters.userInfo
  },
  methods: {}
}
</script>

<style lang="scss" scoped>
.card {
  width: 93.6vw;
  height: 45.3vw;
  background: #ff5b00;
  border-radius: 2.1vw;
  opacity: 1;
  margin: 0 auto;
  box-sizing: border-box;
  padding: 6.5vw 3.2vw;
  .titleImgUrl {
    width: 32.8vw;
    height: 8.8vw;
  }
  .card-contain {
    display: flex;
    align-items: center;
    justify-content: space-between;
    .head {
      width: 17.1vw;
      height: 17.1vw;
      border-radius: 50%;
      object-fit: contain;
    }
    .card-info {
      margin-left: 4vw;
    }
    .card-info-head {
      display: flex;
      align-items: center;
      margin-bottom: 1.7vw;
      .card-name {
        color: #ffffff;
        font-size: 5.3vw;
        font-weight: bold;
      }
      .card-info-tab {
        width: 13.9vw;
        height: 4.3vw;
        background-color: #ffbb00;
        color: #fff;
        font-size: 2.9vw;
        padding: 0 1vw;
        margin-left: 1.3vw;
      }
    }
    .card-info-iphone {
      color: #ffffff;
      font-size: 3.7vw;
    }
    .card-qrcode {
      display: flex;
      flex-direction: column;
      align-items: center;
      .qrcode {
        width: 16vw;
        height: 16vw;
        object-fit: contain;
        margin-bottom: 0.8vw;
      }
      .tips {
        font-size: 1vw;
        color: #fff;
        text-align: center;
        width: 22.8vw;
        line-height: 3.2vw;
      }
    }
  }
}
</style>
