<template>
  <div v-if="!isMeetCondition">
    <div class="bargainmainDiv" :style="styleData.bargainmainDiv" v-if="show">
      <div :style="styleData.tou"><img :src="userImg" alt="" style="width:100%;height:100%;borderRadius:50%" /></div>
      <div :style="styleData.nickName">{{ nickName }}</div>
      <div :style="styleData.level">当前会员等级：{{ currentStarLevel }}级</div>
      <div :style="styleData.picture">会员等级{{ requireMinLevel }}才能参与活动哦</div>
      <div :style="styleData.picture1">感谢你的参与</div>
      <div v-if="isWebClick" :style="styleData.button"></div>
      <div v-else :style="styleData.button" v-lz-click="'4'" @click="goToShop(shopId)"></div>
    </div>
    <div class="bargain"></div>
  </div>
</template>

<script>
import { Toast } from 'vant';
import apis1 from '../../../util/apis1.js';
import { goToShopPage } from '../../../util/tools';
import Vue from 'vue';
let { bargain, guest, toJoin,storeGoodsPoint } = apis1;
export default {
  components: {
    // goToShopPage,
  },
  props: ['datas', 'styleData', 'keyData', 'isTemplate', "modifyContent", "isWebClick"],
  data() {
    return {
      isMeetCondition:true,//是否满足参与活动条件
      show: true,
      a: [{ a: 1 }, { a: 2 }, { a: 3 }],
      dataAll: {},
      userImg: '',
      currentStarLevel: '',
      requireMinLevel: '',
      shopId: '',
      nickName: ''
    };
  },
  created() {
    this.publicData.$on('isMeetCondition',data=>{
      console.log(data,'isMeetCondition')
      if(data == 2){
        this.isMeetCondition = false
      }else{
        this.isMeetCondition = true
      }
    })
  },
  mounted() {
    if(!this.isWebClick && !this.isTemplate) {
      toJoin(data => {
        this.userImg = data.data.userImg;
        this.currentStarLevel = data.data.currentStarLevel;
        this.requireMinLevel = data.data.requireLevel;
        this.shopId = data.data.shopId;
        this.nickName = data.data.nickName;
      });
    }
  },

  methods: {
    initData(data) {
      console.log(data);
      let activityType = sessionStorage.getItem('activityType');
      this.dataAll = data;
    },
    goToShop(shopid) {
      console.log('11111', shopid);
      storeGoodsPoint(4)
      goToShopPage(shopid);
    }
  }
};
</script>

<style lang="scss">
.bargain {
  position: absolute;
  width: 100%;
  height: 1rem;
  margin-top: 4rem;
  background: #d81e35;
}

</style>
