<template>
  <div
    ref="goToShop1"
    @click="styleClick('click', 'goToShop1')"
    @mousemove="styleClick('mousemove', 'goToShop1')"
    @mouseout="styleClick('mouseout')"
  >
    <div
      class="enterprise"
      :style="styleData.goToShopStyle"
      @click="goShop"
      v-lz-click="'4'"
    >
      <div class="shop-logo-box" :style="styleData.logoStyle">
        <img
          :src="goToShopList.shopLogoUrl"
          alt=""
          class="shop-logo"
          :style="styleData.shopLogoStyle"
        />
      </div>
      <p class="shop-name" :style="styleData.shopNameStyle">
        {{ goToShopList.shopName }}
      </p>
      <div :style="styleData.shopGtStyle">&gt;</div>
    </div>
  </div>
</template>
<script>
import apis1 from "../../../util/apis1.js";
import { goToShopPage } from "../../../util/tools.js";
let {storeGoodsPoint} = apis1
export default {
  props: [
    "isTemplate",
    "datas",
    "keyData",
    "styleData",
    "templateData",
    "isWebClick",
    "modifyContent",
  ],
  data() {
    return {
      goToShopList: [],
      styleDataOld: {},
      acRulePopComData: {
        styleData: {},
        datas: {},
        keyData: {},
      },
    };
  },

  created() {
    //深拷贝重置需要
    this.styleDataOld = JSON.parse(JSON.stringify(this.styleData));
    this.initData();
  },
  mounted() {},
  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);
      }
    },
    initData() {
      var datasAll = this.templateData;

      if (this.isTemplate == true) {
        this.$toast("活动预览，仅供查看");
        if (datasAll) {
          this.goToShopList.shopLogoUrl = datasAll.activity.shopLogo;
          this.goToShopList.shopName = datasAll.activity.shopName;
        } else {
          //没有模板的数据
          this.goToShopList = {
            shopLogoUrl: "",
            shopName: "XXX京东自营官方旗舰店",
          };
        }
      } else {
        let shopList = apis1[this.datas.shopList];
        shopList((data) => {
          this.goToShopList = data.data;
        });
      }
    },

    goShop() {
      if (this.isTemplate == true) {
        this.$toast("活动预览，仅供查看");
        return;
      }
      let shopId = this.goToShopList.shopId;
      storeGoodsPoint(4)
      goToShopPage(shopId);
    },
  },
};
</script>
<style lang="scss" scoped>
</style>
