<template>
  <div class="buyGoodDivC">
    <div class="ui-modal-body" :style="{ backgroundImage: 'url(' + templatData.templateBg + ')' }">
      <div class="goodUl">
        <div class="goodItemDiv" v-for="(item, index) in giftBagData.exposedGoods" :style="{ backgroundImage: 'url(' + templatData.basicJson + ')' }">
          <div class="goodImg">
            <img :src="item.skuImg" alt="">
          </div>
          <div class="infoBox">
            <div class="nameMsg">{{ item.skuName }}</div>
            <div class="priceMsg" v-if="giftBagData.isShowPrice == 1">
              <span style="font-size:.2rem">¥</span>
              {{ item.skuPrice }}
            </div>
          </div>
        </div>
      </div>
      <div class="prizeBox">
        <div class="prizeItemDiv" v-for="(item, index) in giftBagData.prizeData" :key="index">
          {{item.prizeName}}
        </div>
      </div>
      <div class="btnDiv" :style="{ backgroundImage: 'url(' + templatData.topicImage + ')' }" @click="btnClick()"></div>
    </div>
  </div>
</template>

<script>
  export default {
    props: ['styleData', 'giftBagData'],
    data() {
      return {
        templatData: {}
      };
    },
    created() {
      console.log(this.giftBagData, '加购礼包模板数据');
      console.log(this.styleData, 'styleData1111');
      console.log(JSON.parse(sessionStorage.getItem('templatData1')), "00000000000")
      this.templatData = JSON.parse(sessionStorage.getItem('templatData1'))
    },
    methods: {
      //收下礼包
      btnClick() {
        this.$emit('btnClickEmit', {});
      }
    }
  };
</script>

<style lang="scss" scoped="scoped">
  .buyGoodDivC {
    .ui-modal-body {
      width: 5.36rem;
      height: 7.53rem;
      position: absolute;
      top: calc(50% - 7.35rem / 2);
      left: calc(50% - 5.36rem / 2);
      background-size: 100%;
      .goodUl {
        width: 100%;
        height: 4.65rem;
        margin-top: 1.35rem;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        align-content: flex-start;
        overflow-y: scroll;
        .goodItemDiv {
          width: 4.74rem;
          height: 1.38rem;
          margin-bottom: 0.2rem;
          background-size: 100%;
          padding: 0.1rem 0.15rem;
          display: flex;
          .goodImg {
            background: #fff;
            width: 1.05rem;
            height: 1.05rem;
            border-radius: 0.15rem;
            overflow: hidden;
            img {
              width: 100%;
            }
          }
          .infoBox {
            width: 3rem;
            height: 1.05rem;
            margin-left: 0.25rem;
            display: flex;
            flex-wrap: wrap;
            .nameMsg {
              width: 100%;
              font-size: 0.24rem;
              overflow: hidden;
              text-overflow: ellipsis;
              white-space: nowrap;
              color: #fff;
            }
            .priceMsg {
              color: #fff;
              font-size: 0.3rem;
            }
          }
        }
      }
      .prizeBox {
        width: 4.94rem;
        height: 0.55rem;
        background-size: 100%;
        background-image: url('//img10.360buyimg.com/imgzone/jfs/t1/135024/36/45413/4428/66c6f91bFcca39439/336836ef5998c9e7.png');
        margin: 0 auto;
        display: flex;
        .prizeItemDiv {
          width: 33%;
          height: 100%;
          font-size: 0.28rem;
          display: flex;
          justify-content: center;
          align-items: center;
        }
      }
      .btnDiv {
        background-size: 100% 100%;
        width: 3.32rem;
        height: 0.84rem;
        position: absolute;
        left: calc(50% - 3.32rem / 2);
        bottom: -0.4rem;
      }
    }
  }
</style>
