<template>
  <div class="shopMessageDiv" :style="styleData.shopMessageDivStyle">
    <div class="leftDiv" :style="styleData.leftDiv">
      <div class="shopLogoImageDiv" :style="styleData.shopLogoImageDiv">
        <img :src="shopLogo" alt="" :style="styleData.shopLogoImage">
      </div>
      <div class="shopNameDiv" :style="styleData.shopNameDivStyle">{{shopName}}</div>
    </div>
    <div class="gonToShopDiv" @click="goToshop()" :style="styleData.gonToShopDivStyle"></div>
  </div>
</template>
<script>
import bus from '../../../util/bus.js';
import { goToShopPage } from "../../../util/tools.js";
import store from "../../../store/store";

export default {
  props:['isTemplate','isWebClick','styleData'],
  data(){
    return{
      shopName:'',
      shopLogo:'',
    }
  },
  mounted() {
    if (this.isTemplate === true) {
      this.shopName = 'xxx京东自营旗舰店',
      this.shopLogo = 'https://img10.360buyimg.com/imgzone/jfs/t1/167895/16/13400/5028/6051c652E2d5e72a8/703cbabdbea7c4d1.jpg'
    }
    bus.$on("shopName", (content) => {
      this.shopName = content;
    });
    bus.$on("shopLogo", (content) => {
      this.shopLogo = content ? content : 'https://img10.360buyimg.com/imgzone/jfs/t1/167895/16/13400/5028/6051c652E2d5e72a8/703cbabdbea7c4d1.jpg';
    });
  },
  methods:{
    goToshop(){
      if (this.isTemplate === true) {
        if (this.isWebClick) {
          return;
        }
        this.$toast("活动预览，仅供查看");
        return;
      }
      goToShopPage(store.state.shopId);
    }

  }
}

</script>
<style scoped lang="scss">
.shopMessageDiv{
  background-image: url("//img10.360buyimg.com/imgzone/jfs/t1/106511/15/46221/19459/6614b4a2Faa73bda3/4b6571f85ad27cd6.png");
  background-size: 100% 100%;
  background-repeat: no-repeat;
  width: 6.90rem;
  height: 1.20rem;
  margin-left: calc(50% - 6.90rem / 2);
  margin-top: 0.32rem;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  padding: 0 0.48rem;
  .leftDiv{
    display: flex;
    img{
      height: 0.64rem;
    }
    .shopNameDiv{
      margin-left: 0.18rem;
      color: #06050a;
      font-size: 0.23rem;
      display:flex;
      align-items:center;
    }
  }

  .gonToShopDiv{
    background-image: url("//img10.360buyimg.com/imgzone/jfs/t1/234686/13/16525/5447/6614b4a2F4b6d7b92/a9103416f709635d.png");
    background-size: 100% 100%;
    background-repeat: no-repeat;
    width: 1.80rem;
    height: 0.64rem;
  }
}
</style>
