<template>
  <cr-overlay :show="value">
    <div class="rate-box">
      <div class="rate-box--body">
        <div class="rate-box--body__title">分期费率说明</div>
        <table class="rate-box--body__table" cellspacing="0" cellpadding="0">
          <thead>
            <tr>
              <td>分期期数</td>
              <td>近似年化折合费率</td>
            </tr>
          </thead>
          <tbody>
            <tr v-for="(item, i) in info.detailList" :key="i">
              <td>{{ item.term }}期</td>
              <td>{{ item.rate }}</td>
            </tr>
          </tbody>
        </table>
        <div class="rate-box--body__content">
          {{ info.rateExplain }}
        </div>
      </div>
      <div class="rate-box--btns" @click="onClose">我知道了</div>
    </div>
  </cr-overlay>
</template>
<script>
export default {
  props: {
    value: {
      type: Boolean,
      default: false
    },
    info: {
      type: Object,
      default: () => ({})
    }
  },
  methods: {
    onClose() {
      this.$emit('input', false);
    }
  }
};
</script>
<style lang="less" scoped>
.rate-box {
  width: 311px;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background-color: #fff;
  border-radius: 16px;
  overflow: hidden;
  user-select: none;
  &--body {
    padding: @padding-xl @padding-xl @padding-md @padding-xl;
    box-sizing: border-box;
    text-align: center;
    &__title {
      .text-size(16);
      font-weight: bold;
      color: #323232;
      line-height: 1.375;
    }
    &__table {
      width: 100%;
      text-align: center;
      color: @gray-5;
      margin-top: 5px;
      .text-size(14);
      thead {
        td {
          background-color: #f7f8f9;
        }
      }
      td {
        width: 50%;
        height: 30px;
        line-height: 30px;
        background-color: #fff;
        box-sizing: border-box;
        border: 1px solid #e8e8e8;
      }
    }
    &__content {
      margin-top: @padding-xs;
      .text-size(12);
      color: @gray-4;
      line-height: 18px;
      text-align: left;
    }
  }
  &--btns {
    border-top: 0.5px solid #ebedf0;
    height: 48px;
    .text-size(16);
    line-height: 3;
    color: @red;
    text-align: center;
    &:active {
      background-color: rgba(0, 0, 0, 0.05);
    }
  }
}
</style>
