<template>
  <van-popup class="win-popup" v-model="visible" closeable close-icon="close" :style="{ background: 'transparent' }">
    <div class="win-popup__container">
      <div class="win-popup__container__wrap">
        <div class="win-popup__container__wrap__title">
          <template v-if="info.id !== 0">恭喜获得</template>
        </div>
        <div class="win-popup__container__wrap__content">
          <div class="win-popup__container__wrap__content__box">
            <!-- :class="{'win-popup__container__wrap__content__box--no': info.id === 0}" -->
            <div class="win-popup__container__wrap__content__box__title">
              <template v-if="info.id !== 0">{{ info.name }}</template>
              <template v-if="info.id === 0">谢谢参与</template>
            </div>
            <div
              class="win-popup__container__wrap__content__box__win-msg"
              :class="{ 'win-popup__container__wrap__content__box__win-msg--no': info.id === 0 }"
            >
              <template v-if="info.id !== 0">
                已成功获取{{ info.name }}
                <p>根据活动说明进行领取</p>
              </template>
              <template v-if="info.id === 0">谢谢参与，再接再厉</template>
            </div>
          </div>
          <van-button class="win-popup__container__wrap__content__sure" color="#F5E952" round @click="know"
            >我知道了</van-button
          >
        </div>
      </div>
    </div>
  </van-popup>
</template>

<script>
export default {
  name: 'WinPopup',
  data() {
    return {}
  },
  props: {
    isShow: {
      type: Boolean,
      default: false
    },
    info: {
      type: Object,
      default: () => ({})
    }
  },
  computed: {
    visible: {
      get: function() {
        return this.isShow
      },
      set: function(val) {
        this.$emit('changeVisible', val)
      }
    }
  },
  components: {},
  methods: {
    know() {
      this.$emit('winCallback')
    }
  }
}
</script>

<style lang="less" scoped>
@containerWidth: 326px;
@wrapWidth: 275px;
@wrapHeight: 292px;
@bulinbulinWidth: @containerWidth;
@bulinbulinHeight: 136px;

.win-popup {
  overflow: visible;
  /deep/ .van-popup__close-icon {
    right: 52px;
    top: -8px;
    font-size: 38px;
    color: #fff;
  }
  &__container {
    width: 100%;
    height: 100%;
    position: relative;
    width: @containerWidth;

    &::after {
      content: '';
      position: absolute;
      width: @bulinbulinWidth;
      height: @bulinbulinHeight;
      top: 40px;
      left: 0;
      background-image: url('~@/assets/images/lottery/bulinbulin.png');
      background-size: cover;
      background-repeat: no-repeat;
    }
    &__wrap {
      margin: 0 auto;
      width: 275px;
      height: 292px;
      padding: 10px;
      border-radius: 10px;
      overflow: hidden;
      background-image: url('~@/assets/images/lottery/winning_bg.png');
      background-size: cover;
      background-repeat: no-repeat;
      &__title {
        padding: 0 42px;
        width: 100%;
        text-align: center;
        color: #fc5147;
        font-weight: 700;
        font-size: 16px;
        height: 18px;
        text-indent: 12px;
        margin: 45px 0 0;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
      }
      &__content {
        color: #fc575a;
        font-size: 16px;
        &__box {
          margin-top: 5px;
          text-align: center;
          color: #fc575a;
          font-size: 28px;
          text-indent: 12px;
          font-weight: 700;

          &__title {
            height: 52px;
            line-height: 28px;
            width: 60%;
            margin: 0 auto;
            // 两行隐藏
            word-break: break-all;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            overflow: hidden;
            /*! autoprefixer: off */
            -webkit-box-orient: vertical;
          }
          &__win-msg {
            padding: 0 20px;
            margin-top: 48px;
            font-size: 20px;
            color: #fff;
            text-indent: 10px;
            white-space: nowrap;
            text-overflow: ellipsis;
            overflow: hidden;
            &--no {
              margin-top: 70px;
            }
            > p {
              color: #fe9746;
              font-size: 12px;
              height: 26px;
              line-height: 26px;
            }
          }
        }
        &__sure {
          width: 45%;
          height: 38px;
          line-height: 38px;
          border: 0;
          outline: none;
          position: absolute;
          bottom: 28px;
          left: 50%;
          transform: translateX(-50%);
          /deep/ .van-button__text {
            font-size: 16px;
            color: #fc5147;
            font-weight: 700;
          }
        }
      }
    }
  }
}
</style>
