<script setup>
import { reactive, toRefs, onMounted, ref, unref } from "vue";
import { Button, Toast } from "vant";
import "vant/es/toast/style";
import { useRouter, useRoute } from "vue-router";
import { getUser } from "@/api/api";

let infoData = ref({});
const getUserInfoData = async () => {
  const res = await getUser();
  if (res.Ret === 200) {
    infoData.value = res.Data;
  }
};
getUserInfoData();
onMounted(async () => {});
</script>

<template>
  <div class="container-box">
    <div class="content">
      <img :src="infoData.Headimgurl" />
      <div class="info-box">
        <p class="tip-name" v-if="infoData.HasPermission == 2">暂无您的客户信息</p>
        <template v-else>
          <p class="tip-name">{{ infoData.RealName }}</p>
          <p class="mobile">{{ infoData.Mobile }}</p>
          <p>{{ infoData.CompanyName }}</p>
        </template>
      </div>
      <div class="auth-info">
        <template v-if="infoData.HasPermission == 0">
          <div class="info-status-date">
            <div class="status">{{ infoData.PermissionStatus }}</div>
            <div>{{ infoData.StartDate }} ~ {{ infoData.EndDate }}</div>
          </div>
          <div class="points-num" v-if="infoData.PermissionStatus !== '试用'">剩余研选点数：{{ infoData.CompanyPointsNum }}</div>
        </template>
        <template v-else-if="infoData.HasPermission == 2">
          <div>请先前往【买方研选】小程序绑定您的联系方式<br />并申请开通试用权限</div>
        </template>
        <template v-else>
          <div class="info-no-permission">
            <div class="global_title">暂无权限</div>
            <div>可在【买方研选】小程序申请试用权限</div>
          </div>
        </template>
      </div>

      <p class="tip-login">登录成功,可及时获取【买方研选】消息推送</p>
    </div>
  </div>
</template>

<style lang="scss" scoped>
* {
  box-sizing: border-box;
}
.container-box {
  width: 100%;
  height: 100vh;
  padding: 258px 25px 25px;
  background: url("@/assets/mfyx/bg.png") no-repeat;
  background-size: 100% 100%;
  .content {
    position: relative;
    width: 100%;
    height: 840px;
    border-radius: 16px;
    background-color: rgba(255, 255, 255, 89%);
    padding-top: 95px;
    font-size: 28px;
    line-height: 39.2px;
    color: #333;
    img {
      display: block;
      width: 178px;
      height: 178px;
      border-radius: 50%;
      overflow: hidden;
      margin: 0 auto 35px;
    }
    .info-box {
      width: 100%;
      height: 148px;
      text-align: center;
      .tip-name {
        font-size: 34px;
        font-weight: 500;
        line-height: 48px;
      }
      .mobile {
        padding: 10px;
      }
    }
    .tip-login {
      position: absolute;
      width: 90%;
      text-align: center;
      left: 50%;
      bottom: 95px;
      transform: translateX(-50%);
    }
    .auth-info {
      margin-top: 27px;
      width: 100%;
      text-align: center;
      .info-status-date {
        display: flex;
        align-items: center;
        justify-content: center;
        .status {
          width: 88px;
          height: 50px;
          text-align: center;
          line-height: 50px;
          font-size: 24px;
          color: #e5cfb1;
          background-color: #403f3e;
          margin-right: 20px;
        }
      }
      .points-num {
        padding-left: 20px;
      }
    }
  }
}
</style>
