<template>
  <div
    class="buttomBtnNewC"
    ref="doubleBottomBtn"
    :style="styleData.buttomBtnNewC"
    @click="styleClick('click', 'doubleBottomBtn')"
    @mousemove="styleClick('mousemove', 'doubleBottomBtn')"
    @mouseout="styleClick('mouseout')"
  >
    <div :style="styleData.btnGoShopImg" v-lz-click="'4'" @click="enterstore"></div>
    <div :style="styleData.btnShareImg" v-lz-click="'2'" @click="share"></div>
  </div>
</template>

<script>
import { allShare } from '../../../js/share.js';
import store from '../../../store/store';
import { goToShopPage } from '../../../util/tools.js';
import apis1 from '../../../util/apis1.js';
// import sharebg from '../assets/images/share.png'
let { initPage, storeGoodsPoint } = apis1;
export default {
  props: ['isTemplate', 'styleData', 'isWebClick', 'modifyContent'],
  name: 'buttomBtn',
  components: {},
  data() {
    return {
      activityType: '',
      styleDataOld: {},
      isCustomSwitching: '' //有tab切换时
    };
  },
  computed: {},
  created() {
    //深拷贝重置需要
    this.styleDataOld = JSON.parse(JSON.stringify(this.styleData));
    this.activityType = sessionStorage.getItem('activityType');
  },

  mounted() {},
  methods: {
    //点击可修改位置的方法
    styleClick(type, refName) {
      if (this.isWebClick) {
        //传值给B端
        let byValue = {
          modifyContent: this.modifyContent,
          refName: refName,
          styleData: this.styleData,
          isCustomSwitching: this.isCustomSwitching, //有tab切换时
          c_this: this,
          styleDataOld: this.styleDataOld
        };
        this.$emit('opertaionCom', type, byValue);
      }
    },
    enterstore() {
      if (this.isTemplate) {
        // this.$toast('活动预览，仅供查看');
        return;
      }
      document.querySelector('body').removeAttribute('style');
      console.log('进入商店');
      let shopId = store.state.shopId;
      storeGoodsPoint(4);
      goToShopPage(shopId);
    },

    share() {
      let actStatus = sessionStorage.getItem('actStatus');
      if (this.isTemplate) {
        // this.$toast('活动预览，仅供查看');
        return;
      }

      if (actStatus == 2) {
        // Toast
        this.$toast('活动已结束');
        return;
      }
      if (actStatus == 1) {
        this.$toast('活动尚未开始');
        // Toast('活动尚未开始');
        return;
      }

      // Toast('活动正在惊醒中');
      // this.share = 1
      allShare(false, this, callBackData => {
        console.log(callBackData, 'callBackData');
      });
    }
  }
};
</script>

<style lang="scss" scoped="scoped">
.buttomBtnNewC {
  display: flex;
  justify-content: space-between;
  bottom: 0;
  width: 100%;
  z-index: 100;
}
</style>
