<template>
  <div v-if="isShow" class="bg">
    <div class="mainBody">
      <div class="bodyContent">
        
       
        <div v-if="datas.joinInfo.joinCodeInfo.joinCode == '1002'">
          <div class="p1">加入会员才能参与活动哦！</div>
          
        </div>
        <div class="condition" v-else-if="datas.joinInfo.joinCodeInfo.joinCode == '1003'">
            <div class="p1">{{ datas.joinInfo.requireLevel }}才能参与活动哦!</div>
            <div class="p2">感谢您的参与！</div>
        </div>

        <div v-if="isShowButton">
          <button class="button1" v-lz-click="'4'" @click="btClick(1)">进店逛逛</button>
          <button class="button2" @click="btClick(2)">会员中心</button>
        </div>

        <div v-if="!isShowButton" class="one-button">
          <button class="button3" @click="btClick(3)">立即入会</button>
        </div>

      </div>
    </div>
  </div>
</template>
<script>
import { goToOpenCard, goToShopPage } from "../../../../util/tools.js";
import store from "../../../../store/store";
export default {
  name: "joinVip",
  data() {
    return {
      isShow: true, //弹窗是否显示
      isShowButton: true, //显示不同按钮
    };
  },
  created() {
    console.log(this.datas);
    var joinData = this.datas.joinInfo.joinCodeInfo;
    // 1002,"不是会员无法参加"
    // 1003,"会员级别不足无法参加"

    if (joinData.joinCode == "1002") {
      this.isShowButton = false;
    } else if (joinData.joinCode == "1003") {
      this.isShowButton = true;
    }
    // this.datas.joinInfo.nickName = this.datas.joinInfo.nickName.substr(0, 1) + "****" + this.datas.joinInfo.nickName.substr(-1, 1);
  },
  methods: {
    initData() {},
    btClick(type) {
      // console.log(type, "点击");
      if (type == 1) {
        let shopId = sessionStorage.getItem("shopId"); //store.state.shopId
        goToShopPage(shopId);
      } else if (type == 2) {
        goToOpenCard(this.datas.joinInfo.openCardUrl);
      } else if (type == 3) {
        goToOpenCard(this.datas.joinInfo.openCardUrl);
      }
    },
  },
};
</script>
<style scope='scope' lang="scss">
.bg {
  position: fixed;
  top: 0;
  background: #404040;
  width: 100%;
  height: 100vh;
  .mainBody {
    background-image: url(//img10.360buyimg.com/imgzone/jfs/t1/221452/26/13714/21550/62399017Edf494fa6/db6fbb9028a0e0f7.png);
    background-size: 100% 100%;
    background-repeat: no-repeat;
    height: 6.3rem;
    width: 5.88rem;
    position: fixed;
    top: calc(50% - 6.3rem / 2);
    left: calc(50% - 5.88rem / 2);
    text-align: center;
  }
  .bodyContent {
    margin-top: 0.8rem;
  }
  .userId {
    color: black;
    font-size: 0.2rem;
    font-weight: bold;
    margin-top: 0.2rem;
  }
  .p1{
    width: 4.8rem;
    margin: 0 auto;
    margin-top: 3.4rem;
    color: black;
    font-size: 0.34rem;
    font-weight: bolder;
  }
  .p2{
       width: 4.8rem;
    margin: 0 auto;
    margin-top: 0.15rem;
    color: #8c8c8c;
    font-size: 0.2rem;
  }
  .condition {
    width: 4.8rem;
    margin: 0 auto;
    margin-top: 0.2rem;
    color: #e2231a;
    font-size: 0.34rem;
    font-weight: bolder;
  }
  .button1 {
    font-size: 0.4rem;
    width: 2.25rem;
    height: 0.9rem;
    background-color: #000000;
    border-radius: 5px;
    margin-right: 0.5rem;
    color: white;
  }
  .button2 {
    font-size: 0.4rem;
    width: 2.25rem;
    height: 0.9rem;
    background-color: #a90711;
    border-radius: 5px;
    color: #ffffff;
  }
  .one-button {
    margin-top: 0.3rem;
  }
  .button3 {
    font-size: 0.4rem;
    width: 4.9rem;
    height: 1rem;
    background-color: #cc001a;
    border-radius: .5rem;
    color: #ffffff;
  }
}

</style>
