// 改版全本订阅弹窗
<template>
  <x-prompt class="order-confirm" :visible="visible">
    <div class="head">全本订阅提醒</div>
    <div class="body">
      <p
        class="tips-text"
        v-if="is_first_book_order && !book_order_custom_price"
      >
        <template>
          <p style="line-height:200%; font-size:.3rem;">
            首次订阅仅需<i
              style="color: #fd555d;padding: 0 5px;font-weight: bold;text-decoration:none;font-size: .34rem"
              >{{ fee }}</i
            >书币<span style="color:#aaa;font-size:.26rem;text-decoration:line-through">(1399书币)</span>
          </p>
          <p style="line-height:200%; font-size:.3rem;">即可解锁所有章节</p>
        </template>
      </p>
      <p class="tips-text not-first" v-else>
        <!--  <template v-if="!book_order_custom_price">
          整本仅需<i>{{ fee }}</i
          >书币即可解锁所有章节
        </template> -->
        <template>
          <p style="line-height:200%">
            全本订阅仅需<i
              style="color: #fd555d;padding: 0 5px;font-weight: bold;"
              >{{ fee }}</i
            >书币
          </p>
          <p style="line-height:200%">即可解锁所有章节</p>
        </template>
      </p>
    </div>
    <div class="confirm-wrap">
      <p class="btn grey" @click="close">取消</p>
      <p class="btn btn-confirm" @click="orderBook">确定</p>
    </div>
  </x-prompt>
</template>

<script>
import prompt from "../prompt.vue";

export default {
  components: { "x-prompt": prompt },
  methods: {
    orderBook() {
      let isEnough = this.user_balance >= this.fee;
      // 余额足够 订阅 不够 跳充值
      if (isEnough) this.confirm();
      else {
        this.visible = false;
        this.reject();
      }
    },
    close() {
      this.visible = false;
    }
  }
};
</script>

<style lang="scss">
.order-confirm {
  .wrap {
    margin: auto;
    background-color: #fff;
    width: 6.6rem;
    text-align: center;
    padding-bottom: 0.3rem;
    border-radius: 0.08rem;
    overflow: visible !important;
    position: relative !important;
    padding-bottom: 0 !important;
    .head {
      height: 0.6rem;
      line-height: 0.6rem;
      font-size: 0.32rem;
      padding-top: 0.8rem;
      border-bottom: 0;
      font-weight: bold;
    }
    .body {
      padding: 0.1rem 0 0.4rem;
    }
    &::after {
      position: absolute;
      width: 1.34rem;
      height: 1.34rem;
      content: "";
      display: block;
      background-image: url("https://cdn-novel.bookkks.com/h5/2022-10-14-reader-tips.png");
      background-size: cover;
      top: -0.68rem;
      left: 50%;
      margin-left: -0.68rem;
    }
  }

  .tips-text {
    font-size: 0.28rem;
    color: #666;
    padding: 0.1rem 0;
    line-height: 100%;
    .round {
      background: #0094ff;
      border-radius: 100%;
      width: 0.1rem;
      height: 0.1rem;
      display: inline-block;
      vertical-align: middle;
    }
    i {
      font-style: normal;
      color: #999;
      text-decoration: line-through;
    }

    &.not-first {
      i {
        text-decoration: none;
        color: #000;
      }
    }
  }

  .confirm-wrap {
    display: flex;
    padding:0 0.1rem 0.4rem;
    justify-content: space-around;
    .btn {
      flex: 1;
      padding:.22rem;
      text-align: center;
      width: 3rem;
      min-width: 3rem;
      max-width: 3rem;
      box-sizing: border-box;
      border-radius: 0.6rem;
      font-size: .3rem;
      &.grey {
        background: #f2f2f2;
        color: #aaa;
      }
      &.btn-confirm {
        background: rgba($color: #32a1ff, $alpha: 0.8);
        color: #fff;
      }
    }
  }
}
</style>
