<template>
  <div v-if="isShow" class="bg">
    <div class="mainBody">
      <div class="bodyContent">
        <!-- <img :src="datas.joinInfo.userImg" /> -->
        <!-- <div class="userId">用户<span style="margin-left: 6px;">{{ datas.joinInfo.nickName }}</span></div> -->
        <div class="condition" v-if="datas.joinInfo.joinCodeInfo.joinCode == '1002'">
          本活动只针对于店铺会员，请您加入会员， 参与活动赢好礼！
        </div>
        <div class="condition" v-else-if="datas.joinInfo.joinCodeInfo.joinCode == '1003'">
          本活动只针对于店铺{{ datas.joinInfo.requireLevel }}，请先提升会员等级哦~
        </div>
        <div class="one-button" v-if="isShowButton" v-lz-click="'4'" @click="btClick(1)">
          知道了
        </div>
        <div v-if="!isShowButton" class="one-button" @click="btClick(3)">
          立即入会
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import api1 from '../../../util/apis1.js'
let { storeGoodsPoint } = api1
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
        storeGoodsPoint(4)
        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/168561/27/38706/33444/6513ee41F29abec96/cbd682c35950eeb9.png);
    background-size: 100% 100%;
    background-repeat: no-repeat;
    height: 7.22rem;
    width: 6.4rem;
    position: fixed;
    top: 20%;
    left: calc(50% - 6rem / 2);
    text-align: center;
  }
  .bodyContent {
    margin-top: 5rem;
  }
  .bodyContent img {
    width: 1.8rem;
    height: 1.8rem;
    border: 3px solid #fcb83b;
    border-radius: 50%;
  }
  .userId {
    color: black;
    font-size: 0.2rem;
    font-weight: bold;
    margin-top: 0.2rem;
  }
  .condition {
    width: 4.8rem;
    margin: 0 auto;
    margin-top: 0.2rem;
    color: #999999;
    font-size: 0.24rem;
  }
  .two-button {
    margin-top: 0.6rem;
  }
  .button1 {
    font-size: 0.4rem;
    width: 2.25rem;
    height: 0.9rem;
    background-color: #e2231a;
    border-radius: 5px;
    margin-right: 0.5rem;
    color: white;
  }
  .button2 {
    font-size: 0.4rem;
    width: 2.25rem;
    height: 0.9rem;
    background-color: #ff5b02;
    border-radius: 5px;
    color: #ffffff;
  }
  .one-button {
    margin-top: 0.6rem;
    background-image: url(//img10.360buyimg.com/imgzone/jfs/t1/107873/22/44259/13057/6513efbaF6dbffbf4/dc13cb1f0a277778.png);
    background-size: 100% 100%;
    background-repeat: no-repeat;
    height: 0.94rem;
    width: 3.66rem;
    line-height: 0.94rem;
    text-align: center;
    font-size: 0.3rem;
    font-weight: 700;
    color: #fff;
    margin: 1rem auto 0 auto;
  }
}
</style>
