<template>
  <div v-if="show">
    <div v-if="snapdragon" class="snapdragonDiv">
      <div class="basicPopDiv">
        <div class="titleDiv">
          <div class="titleDiv1">
            <div class="leftLineDiv"></div>
            <span>很遗憾</span>
            <div class="RightLineDiv"></div>
          </div>
          <div class="closeDiv" @click="closeClick()"></div>
        </div>
        <div class="content-body">
          <img
            alt="图标"
            class="icon"
            src="//img10.360buyimg.com/imgzone/jfs/t1/195219/30/2852/6030/609d0959Ef55dcf31/cc2dde0a0b8a0d50.png"
          />
          <div class="text">奖品被领光啦</div>
          <button class="button" @click="closeClick">关 闭</button>
        </div>
      </div>
    </div>
    <template v-else>
      <div id="noPrizeDiv">
        <div id="prizeFinished">
          <div id="close" @click="closeClick()"></div>
          <div id="top-img"></div>
          <div id="bottom-content">
            <img :src="noImg" />
            <p>{{ pcontent }}</p>
            <button v-lz-click="'4'" @click="enterstore">
              {{ buttoncontent }}
            </button>
          </div>
        </div>
      </div>
    </template>
  </div>
</template>
<script>
import api1 from "../../../util/apis1.js";
let { storeGoodsPoint } = api1;
import store from "../../../store/store";
import { goToShopPage } from "../../../util/tools.js";

export default {
  data() {
    return {
      // pcontent: '非常遗憾，您与大奖擦肩而过~',
      buttoncontent: "进店逛逛"
    };
  },
  computed: {
    snapdragon() {
      const at = sessionStorage.getItem("activityType");
      const snapdragon = ["10011", "10012", "10013", "10014", "10015", "10016"];
      return snapdragon.some(o => at === o);
    }
  },
  methods: {
    closeClick() {
      // document.querySelector('body').removeAttribute('style')
      this.submit();
      // this.$emit('closeClick');
    },
    enterstore() {
      document.querySelector("body").removeAttribute("style");
      console.log("进入商店");
      let shopId = store.state.shopId;
      storeGoodsPoint(4);
      goToShopPage(shopId);
    }
  }
};
</script>
<style lang="scss" scoped>
#noPrizeDiv {
  position: fixed;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  top: 0;
  z-index: 20;
}

#prizeFinished {
  height: 6.6rem;
  width: 6rem;
  position: absolute;
  z-index: 2;
  margin: auto;
  top: 1rem;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 0.2rem;
  background-image: url("//img10.360buyimg.com/imgzone/jfs/t1/165321/39/14389/3705/605960ecE9c9498f9/a359e13c90a17a1c.png");
  background-repeat: no-repeat;
  background-size: 100%;
}

#close {
  height: 0.3rem;
  width: 0.3rem;
  position: absolute;
  right: 0.2rem;
  top: 0.2rem;
  background: url("//img10.360buyimg.com/imgzone/jfs/t1/143521/26/18654/387/5fd9e706E8f1594e3/ae5cc06440559585.png")
    no-repeat;
  background-size: 100% 100%;
}

#top-img {
  height: 0.35rem;
  width: 2.39rem;
  margin: auto;
  margin-top: 0.4rem;
  background-image: url("//img10.360buyimg.com/imgzone/jfs/t1/138090/24/18694/2054/5fd996ffE21debdd7/9495c2233cce85e2.png");
  background-repeat: no-repeat;
  background-size: 100%;
}

#bottom-content {
  height: 5.28rem;
  width: 6rem;
  background-color: white;
  margin: auto;
  border-radius: 0.2rem;
  margin-top: 0.3rem;
  padding-top: 0.48rem;
}

#bottom-content img {
  display: block;
  height: 1.83rem;
  // width: 2.77rem;
  margin: auto;
}

#bottom-content p {
  /* padding-top: 0.2rem; */
  font-size: 0.28rem;
  font-weight: bold;
  color: #333333;
  display: block;
  margin-top: 0.38rem;
  text-align: center;
  /* margin-top: 0.3rem; */
}

#bottom-content button {
  display: block;
  margin: 0 auto;
  margin-top: 1.06rem;
  width: 5rem;
  background-color: #e2231a;
  color: white;
  font-size: 0.28rem;
  border-radius: 0.1rem;
  border: 1px solid #e2231a;
  padding: 0.26rem 0;
}

.snapdragonDiv {
  position: fixed;
  width: 100%;
  height: 100%;
  background: rgba($color: #000000, $alpha: 0.7);
  top: 0;
  bottom: 0;
  z-index: 200;

  .basicPopDiv {
    position: fixed;
    width: 6.48rem;
    min-height: 7rem;
    max-height: 100vh;
    background-color: #eaebf0;
    border-radius: 0.2rem;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: stretch;

    .titleDiv {
      width: 100%;
      height: 1.14rem;
      position: relative;
      flex-grow: 0;
      flex-shrink: 0;

      .titleDiv1 {
        height: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        color: #333333;
        font-size: 0.46rem;
      }

      .leftLineDiv {
        width: 34px;
        height: 4px;
        background: linear-gradient(to right, #4f5f7a, #e9eaef);
        border-radius: 4px;
        margin-right: 0.1rem;
      }

      .RightLineDiv {
        width: 34px;
        height: 4px;
        background: linear-gradient(to left, #4f5f7a, #e9eaef);
        border-radius: 4px;
        margin-left: 0.1rem;
      }

      .closeDiv {
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        width: 48px;
        height: 48px;

        img {
          display: none;
        }

        &:before,
        &:after {
          position: absolute;
          left: 50%;
          top: 50%;
          display: block;
          content: "";
          width: 0.4rem;
          height: 0.04rem;
          border-radius: 1px;
          background-color: #8293ab;
        }

        &:before {
          transform: translate(-50%, -50%) rotate(45deg);
        }

        &:after {
          transform: translate(-50%, -50%) rotate(-45deg);
        }
      }
    }

    .content-body {
      flex-grow: 1;
      flex-shrink: 1;
      margin: 0.25rem;
      background-color: white;
      padding: 0.34rem;
      overflow: auto;
      -webkit-overflow-scrolling: touch;
      box-shadow: 0rem 0.05rem 0.16rem 0rem rgba(177, 177, 177, 0.18);
      border-radius: 0.1rem;
      font-weight: normal;
      font-stretch: normal;
      line-height: 0.47rem;
      letter-spacing: 0rem;
      color: #495975;
      display: flex;
      flex-direction: column;
      font-size: 0.44rem;
      align-items: center;
      justify-content: space-evenly;

      .icon {
        width: 1.53rem;
        height: 1.53rem;
      }

      .text {
        color: #495975;
      }

      .button {
        width: 100%;
        height: 0.94rem;
        background-color: #495975;
        border-radius: 0.1rem;
        color: #ffffff;
        font-size: 0.46rem;
      }
    }
  }
}
</style>
