<template>
  <van-overlay :show="value" :duration="0.1">
    <div class="repeat-modal modal" @click.stop>
      <img src="../assets/img/close.png" class="close" @click="$emit('change', false)" />
      <div class="text-box" v-if="text!==''">{{text}}</div>
      <div class="text-box" v-else>合约期外退订无需缴纳违约金，合约期内退订需一次性支付违约金话费<span style="color:red">{{Number(pageData.mainProduct.originalPrice)-0.01}}</span>元，是否确认退订</div>
      <div class="btn-box">
        <div class="btn left" @click="sure">确定</div>
        <div class="btn right" @click="$emit('change', false)">
          再想想
        </div>
      </div>
    </div>
  </van-overlay>
</template>
<script>
export default {
  data () {
    return {
      text: ""
    }
  },
  model: {
    prop: "value",
    event: "change"
  },
  props: {
    value: Boolean
  },
  computed: {
    pageData () {
      return this.$store.state.pageData;
    },
  },
  created () {
    if (this.pageData.remarks.treatyText && this.pageData.remarks.treatyText !== '') {
      this.text = this.pageData.remarks.treatyText
    }
  },
  methods: {
    sure () {
      this.$emit('change', false)
      this.$emit('opoutClick')
    }
  }
};
</script>
<style lang="scss" scoped>
.repeat-modal {
  top: 412px;
  padding: 60px 51px;
  font-size: 30px;
  font-family: Source Han Sans CN;
  font-weight: 400;
  color: #222222;

  .text-box {
    line-height: 48px;
    text-align: center;
  }

  .btn-box {
    display: flex;
    justify-content: space-between;

    .btn {
      width: 190px;
      margin-top: 60px;
      height: 80px;
      line-height: 80px;
      border-radius: 40px;
      font-size: 34px;
      font-weight: bold;
      text-align: center;
    }

    .left {
      border: 2px #fdc51b solid;
      color: #fdc51b;
      background-color: #ffffff;
    }

    .right {
      color: #0d0d0d;
      background: #fdc51b;
    }
  }

  // .btn {
  //     margin-top: 40px;
  //     height: 80px;
  //     line-height: 80px;
  //     background: #fdc51b;
  //     border-radius: 40px;
  //     font-size: 34px;
  //     font-weight: bold;
  //     color: #0d0d0d;
  //     text-align: center;
  // }
}

.modal {
  box-sizing: border-box;
  position: absolute;
  left: 50%;
  top: 333px;
  transform: translateX(-50%);
  width: 520px;
  background-color: #fff;
  border-radius: 8px;
  .close {
    width: 80px;
    height: 80px;
    position: absolute;
    bottom: -130px;
    left: 50%;
    transform: translateX(-50%);
  }
}
</style>