<template>
  <div
    ref="organizePrizeNumber"
    @click="styleClick('click', 'organizePrizeNumber')"
    @mousemove="styleClick('mousemove', 'organizePrizeNumber')"
    @mouseout="styleClick('mouseout')"
    :style="styleData.organizeAll">
    <div v-if="captainPrize != 0" style="margin-top:.25rem">
      组队成功队长可额外获得{{ captainPrize }}<span v-if="prizeType==4">积分</span><span v-if="prizeType==1">京豆</span>
    </div>
  </div>
</template>

<script>
import {goToSkuPage } from '../../../util/tools.js';
import apis1 from '../../../util/apis1.js';
import store from '../../../store/store.js'

export default {
  components: {
    store,
  },
  props:['datas','keyData','styleData','isTemplate',"templateData","isWebClick",
    "modifyContent"],
  data() {
    return {
      exposureList:[],
      captainList: [],
      prizeType: 0,
      nickName:'',
      captainPrize:0,
      shareUserId:'',//用户id取得
    };
  },
  mounted() {},
created() {
  this.initData();
   //深拷贝重置需要
    this.styleDataOld = JSON.parse(JSON.stringify(this.styleData));
},
  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);
      }
    },
    initData() {
      var datasAll = this.templateData;
      if (this.isTemplate == true) {
        this.$toast("活动预览，仅供查看");
        if (datasAll) {
          this.captainPrize = datasAll.draw.prizeList[0].captainPrize;
          this.prizeType = datasAll.draw.prizeList[0].prizeType;
          
        } else {
          this.captainPrize = "1";
          this.prizeType = 1;
        }
      }else {
        this.getGoodsList();
      }
    },
    getGoodsList(){
       this.publicData.$emit('isKe', false);
      this.shareUserId = store.state.shareUserId;
      let goodsList  = apis1[this.datas.goodsList];
      var shareUserId = this.shareUserId;
      goodsList(shareUserId,data => {

        this.exposureList = data.data;
        this.captainPrize = data.data.captainPrize;
        this.prizeType = data.data.prizeType;

      });
    },
    goToBuy(sku) {
      goToSkuPage(sku);
    }
  }
};
</script>
