<template>
    <div class="gotoShopNewDivAll" ref="goToShopNew" @click="styleClick('click', 'goToShopNew')" @mousemove="styleClick('mousemove', 'goToShopNew')" @mouseout="styleClick('mouseout')">
      <div :class="isWebClick ? 'collect-fd2' : 'collect-fd'">
        <div :style="styleData.unpackBagBtnAll" v-if="isShowTwoButton">
          <div :style="styleData.unpackBagBtn" v-lz-click="'4'" @click="buttonClick(null)"></div>
          <div :style="styleData.unpackBagBtn2" v-lz-click="'2'" @click="shareClick(null)"></div>
        </div>
        <div v-else :style="styleData.unpackBagBtn1" v-lz-click="'4'" @click="buttonClick(null)"></div>
      </div>
    </div>
</template>

<script>
import { goToShopPage } from '../../../util/tools.js';
import store from '../../../store/store.js';
import { prizeShare } from '../../../js/share.js';
export default {
  props: ['datas', 'styleData', 'keyData', 'isTemplate', 'templateData', 'isWebClick', 'modifyContent'],
  data() {
    return {
      isShowTwoButton: false, //是否显示两个按钮的展示
      styleDataOld: {}
    };
  },
  created() {
    //深拷贝重置需要
    this.styleDataOld = JSON.parse(JSON.stringify(this.styleData));
    //让福袋飞的传值
    this.publicData.$on('unpackingStatus', unpackingStatusCallBackData => {
      this.unpackingStatus = unpackingStatusCallBackData;
      if (this.unpackingStatus == 2 || this.unpackingStatus == 3 || this.unpackingStatus == 4) {
        this.isShowTwoButton = true;
      } else {
        this.isShowTwoButton = false;
      }
    });
  },
  methods: {
    styleClick(type, refName) {
      if (this.isWebClick) {
        //传值给B端
        let byValue = {
          modifyContent: this.modifyContent,
          refName: refName,
          styleData: this.styleData,
          c_this: this,
          styleDataOld: this.styleDataOld
        };
        this.$emit('opertaionCom', type, byValue);
      }
    },
    buttonClick() {
      if(this.isWebClick){
        return
      }
      if (this.isTemplate == true) {
        // this.$toast('活动预览，仅供查看');
      } else {
        goToShopPage(store.state.shopId);
      }
    },
    //立即分享
    shareClick() {
      prizeShare(false, this, callBackData => {
        console.log(callBackData, 'callBackData');
      });
    },
  }
};
</script>

<style lang="scss" scoped="scoped">
.gotoShopNewDivAll {
  // position: sticky;
  // bottom: 0;
  width: 100%;
  z-index:2
}
.collect-fd {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
}
.collect-fd2 {
  height: 0.9rem;
}
</style>
