<template>
  <div v-if="show">
    <div id="noPrizeDiv">
      <div id="thanksjion">
        <div id="close" @click="closeClick()"></div>
        <div id="top-img" :style="{'background-image':'url('+titleImg+')'}"></div>
        <div id="bottom-content">
          <img :src="noImg"/>
          <p>{{ pcontent }}</p>
          <button class="bottom-content-button" v-if="type == 1" v-lz-click="'4'" @click="closeClick">{{ buttoncontent }}</button>
          <div class="btn-box" v-if="type == 2">
            <button v-lz-click="'23'" @click="submitAddress">确认</button>
            <button @click="closeClick">取消</button>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import apis1 from "../../../util/apis1.js";
import { ReminderPopComService } from '../../../util/comCreate.js';
let { memberTrial } = apis1;
export default {
  data() {
    return {
      buttoncontent: '确认'
    };
  },
  computed: {
    snapdragon() {
      const at = sessionStorage.getItem("activityType");
      const snapdragon = ['10011', '10012', '10013', '10014','10015'];
      return snapdragon.some(o => at === o)
    }
  },
  methods: {
    closeClick() {
      this.submit();
      // this.publicData.$emit("applied", false,this.type,this.index);
      // this.$emit('closeClick');
    },
    submitAddress() {
      memberTrial(this.values).then(res => {
        this.$toast('提交成功');
        this.submit();
        // this.publicData.$emit("applied", false,1,this.index);
      }).catch(res =>{
        if(res.resp_code == 50031){
          this.submit();
          ReminderPopComService.create(
            res.resp_msg,
            "//img10.360buyimg.com/imgzone/jfs/t1/198092/1/400/2429/61022268E1e0f0ba0/2a0485a12eb3cbbf.png",
            "//img10.360buyimg.com/imgzone/jfs/t1/136745/32/20121/48059/5fd996feE56314a28/b952f0e6f3fe811f.png",
            1,
            this.index,
            {},
            (submit) => {
              ReminderPopComService.close();
            }
          );
        }else{
          this.$toast(res.resp_msg);
          this.submit();
        }
        // this.publicData.$emit("applied", false,1,this.index);
      })
      // memberTrial(this.values, (addressdatas) => {
      //   if (addressdatas.data == "1") {
      //     this.$toast("已发货,无法修改地址");
      //     return;
      //   }
      //   this.$toast("保存地址成功");
      //   setTimeout(() => {
      //     this.submit(this.values);
      //     this.publicData.$emit("isNotyFiceWinnerReorrd", true, false);
      //   }, 1000);
      // });
    }
  }
};
</script>
<style lang="scss" scoped>
#noPrizeDiv {
  position: fixed;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  top: 0;
  z-index: 20;
}

#thanksjion {
  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.34rem;
  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% 100%;
}

#bottom-content {
  height: 5.3rem;
  width: 5.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;
}

.btn-box{
  display: flex;
  button{
    display: block;
    margin: 0 auto;
    margin-top: 1.06rem;
    width: 2.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: .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: .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>
