<template>
  <div
    class="UserInfo-Box"
    v-if="customerId || customerPhone"
  >
    <div class="UserInfo-Title">
      <div class="UserInfo-IdTag">ID:{{customerBaseInfo.id}}</div>
      <header-img-box
        class="UserInfo-HeaderImg"
        :imgUrl="customerBaseInfo.customerHead"
      />
      <div class="UserInfo-Name-Box">
        <div class="UserInfo-Name-Col">
          <span>{{customerBaseInfo.customerName}}</span>
          <span>{{getTypeLabel(customerBaseInfo.customerType)}}</span>
        </div>
        <div class="UserInfo-Name-Col">
          <span>{{$formatePhone(customerBaseInfo.customerPhone)}}</span>
          <span>{{getSexLabel(customerBaseInfo.customerSex)}}</span>
        </div>
      </div>
    </div>
    <div class="UserInfo-Content">
      <div class="UserInfo-Content-Col UserInfo-State-Box">
        <div
          v-if="customerBaseInfo.state === '1'"
          class="UserInfo-State"
        >
          <div class="UserInfo-State-Icon">
            <img src="@/assets/images/user/normal_icon.png" />
          </div>
          正常使用
        </div>
        <div
          v-else
          class="UserInfo-State"
        >
          <div class="UserInfo-State-Icon">
            <img src="@/assets/images/user/locked_icon.png" />
          </div>
          已锁定
        </div>
        <div
          v-if="customerBaseInfo.isFirstRecharge"
          class="UserInfo-State"
        >
          <div class="UserInfo-State-Icon">
            <img src="@/assets/images/user/normal_icon.png" />
          </div>
          已充值
        </div>
        <div
          v-else
          class="UserInfo-State"
        >
          <div class="UserInfo-State-Icon">
            <img src="@/assets/images/user/locked_icon.png" />
          </div>
          未充值
        </div>
      </div>
      <div class="UserInfo-Content-Col">注册时间：{{$formatDate(customerBaseInfo.createAt,'yyyy-MM-dd')}}</div>
      <div class="UserInfo-Content-Col UserInfo-CampusName">{{customerBaseInfo.areaName}}</div>
    </div>
  </div>
</template>

<script>
import headImg from '@/assets/images/demo/head_icon.png';
import UserBaseInfoMixin from '../../mixins/user/userBaseInfo.js';
import getUserInfoLabelMixin from '@/mixins/user/getUserInfoLabel.js';

export default {
  props: {
    customerId: Number,
    customerPhone: String,
  },
  mixins: [UserBaseInfoMixin, getUserInfoLabelMixin],
};
</script>

<style lang="scss">
@import '../../assets/styles/variables.scss';

.UserInfo-Box {
  width: 170px;
  min-width: 170px;
  height: 157px;
  font-family: 'Microsoft YaHei';
  font-size: 12px;
  border-radius: 8px;
  .UserInfo-Title {
    height: 68px;
    background-color: #4e82fb;
    position: relative;
    padding: 10px;
    box-sizing: border-box;
    display: flex;
    .UserInfo-Name-Box {
      align-self: center;
      flex: 1;
      color: #fff;
      font-size: 12px;
      line-height: 24px;
      .UserInfo-Name-Col {
        display: flex;
        justify-content: space-between;
      }
    }
    .UserInfo-HeaderImg {
      width: 46px;
      height: 46px;
      border: 3px solid #a7c0fd;
      border-radius: 50%;
      margin-right: 8px;
      overflow: hidden;
    }
    .UserInfo-IdTag {
      border-radius: 0 8px 8px 0;
      box-shadow: 0 0 10px #666;
      position: absolute;
      width: 70px;
      height: 18px;
      line-height: 18px;
      text-indent: 5px;
      left: 0;
      bottom: -9px;
      background-color: #ffd737;
      font-size: 12px;
      font-weight: bold;
      color: #084e8a;
    }
  }
  .UserInfo-Content {
    height: 90px;
    background-color: #fff;
    padding: 10px;
    .UserInfo-Content-Col {
      line-height: 25px;
    }
    .UserInfo-State-Box {
      margin-top: 2px;
      display: flex;
      .UserInfo-State {
        display: flex;
        margin-right: 10px;
        align-items: center;
        .UserInfo-State-Icon {
          width: 12px;
          height: 12px;
          margin-right: 4px;
        }
      }
    }
    .UserInfo-CampusName {
      line-height: 1;
      margin-top: 0px;
    }
  }
}
@media screen and (min-width: $bigScreenWidth) {
  .UserInfo-Box {
    width: 300px;
    min-width: 300px;
    height: 300px;
    font-size: 16px;
    .UserInfo-Title {
      height: 120px;
      padding: 20px;
      .UserInfo-Name-Box {
        font-size: 18px;
        line-height: 38px;
      }
      .UserInfo-HeaderImg {
        width: 80px;
        height: 80px;
        border-width: 5px;
        margin-right: 10px;
      }
      .UserInfo-IdTag {
        width: 128px;
        height: 30px;
        line-height: 30px;
        text-indent: 5px;
        bottom: -20px;
        font-size: 16px;
      }
    }
    .UserInfo-Content {
      height: 180px;
      padding: 20px;
      .UserInfo-Content-Col {
        line-height: 38px;
      }
      .UserInfo-State-Box {
        margin-top: 6px;
        .UserInfo-State {
          margin-right: 20px;
          .UserInfo-State-Icon {
            width: 20px;
            height: 20px;
            margin-right: 10px;
          }
        }
      }
      .UserInfo-CampusName {
        line-height: 1;
        margin-top: 10px;
      }
    }
  }
}
</style>

