<template>
  <!-- 质押 -->
  <div class="loan-header">
    <div class="header-content pf600 fs16 fc1F2937">
      <img
        class="left-arrow-image"
        src="../../../assets/icon/index/left-arrow.svg"
        @click="toPath()" />
      质押
      <div class="save pf600 fs14 fc333333" @click="goRecord">质押记录</div>
    </div>
  </div>
  <div class="staking">
    <img src="@/assets/img/index/staking-banner.svg" class="staking-banner" alt="" />
    <div class="user-staking">
      <div class="user-staking-title pf500 fs14 fc2C3131">
        我要质押
        <img src="@/assets/icon/index/question.svg" @click="goRules" alt="" />
      </div>
      <div class="user-staking-number">
        <input
          type="text"
          class="user-staking-number-input pf400 fs26 fc333333"
          placeholder="0" />
        <div class="user-staking-number-coin pf500 fs18 fc1F2937">
          <img src="@/assets/icon/coin/bnb.svg" class="coin" alt="" />BTC
          <img src="@/assets/icon/index/bottom-arrow.svg" class="bottom-arrow" alt="" />
        </div>
      </div>
      <div class="user-staking-line"></div>
    </div>
    <div class="func-btn pf600 fs14 fcFFFFFF">
      <div class="reset" @click="subscriptionFlag = true">申购</div>
      <div class="calculator-btn" @click="subscriptionFlag = true">赎回</div>
    </div>
    <div class="estimate">
      <div class="estimate-left">
        <div class="pf500 fs14 fc1F2937">当前收益率</div>
        <div class="pf600 fs18 fcDF384C">2.50%</div>
      </div>
      <div class="estimate-right">
        <div class="pf500 fs14 fc1F2937">累计收益(USDT)</div>
        <div class="pf600 fs18 fc1F2937">15158.00</div>
      </div>
    </div>
    <div class="reward-record">
      <div class="reward-record-title pf600 fs18 fc333333">奖励记录</div>
      <div class="reward-record-item" v-for="(item, index) in 3" :key="index">
        <div class="item-first">
          <div class="pf500 fs16 fc2C3131">USDT</div>
          <div class="pf500 fs14 fc333333">2025-11-04, 16:30</div>
        </div>
        <div class="item-second">
          <div class="pf500 fs12 fc666666">质押收益</div>
          <div class="pf500 fs12 fcDF384C">15.12 USDT</div>
        </div>
      </div>
    </div>
  </div>
  <Subscription
    v-show="subscriptionFlag"
    @subscriptionClose="subscriptionClose"></Subscription>
</template>
<script setup>
  import Subscription from "../dialog/Subscription.vue";
  import { useRoute, useRouter } from "vue-router";
  import { ref } from "vue";

  const router = useRouter();

  const subscriptionFlag = ref(false);
  const subscriptionClose = () => {
    subscriptionFlag.value = false;
  };

  const toPath = () => {
    router.back();
  };

  const goRules = () => {
    router.push("/stakingRules");
  };

  const goRecord = () => {
    router.push("/stakingRecord");
  };
</script>
<style lang="less" scoped>
  .loan-header {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1;
    width: 100%;
    height: 48px;
    background: #ffffff;
    overflow: hidden;

    .header-content {
      display: flex;
      flex-direction: row;
      justify-content: center;
      align-items: center;
      position: relative;
      width: 100%;
      height: 48px;

      .left-arrow-image {
        position: absolute;
        left: 14px;
        top: 16px;
        width: 9px;
        height: 16px;
      }

      .save {
        position: absolute;
        top: 16px;
        right: 16px;
        height: 24px;
      }
    }
  }

  .staking {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    margin-top: 48px;
    width: 100%;

    .staking-banner {
      width: 345px;
      height: 100px;
    }

    .user-staking {
      display: flex;
      flex-direction: column;
      justify-content: flex-start;
      align-items: center;
      margin-top: 25px;
      width: 345px;

      .user-staking-title {
        display: flex;
        flex-direction: row;
        justify-content: flex-start;
        align-items: center;
        width: 345px;
        height: 24px;

        img {
          margin-left: 6px;
          width: 13px;
          height: 13px;
        }
      }

      .user-staking-number {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        width: 311px;
        height: 40px;

        .user-staking-number-input {
          width: 191px;
          height: 100%;
          box-sizing: border-box;
          border-radius: 6px;
          border: none;
          outline: none;
        }

        .user-staking-number-coin {
          display: flex;
          flex-direction: row;
          justify-content: flex-start;
          align-items: center;
          width: 105px;
          height: 40px;
          border-radius: 30px;
          border: 1px solid #ebebeb;
          box-sizing: border-box;

          .coin {
            margin-left: 8px;
            margin-right: 6px;
            width: 24px;
            height: 24px;
          }

          .bottom-arrow {
            margin-left: 6px;
            width: 12px;
            height: 12px;
          }
        }
      }

      .user-staking-line {
        margin-top: 22px;
        width: 311px;
        height: 1px;
        background: #e2e8f0;
      }
    }

    .func-btn {
      display: flex;
      flex-direction: row;
      justify-content: space-between;
      margin-top: 17px;
      width: 345px;
      height: 40px;

      .reset {
        width: 167px;
        height: 40px;
        line-height: 40px;
        text-align: center;
        border-radius: 10px;
        background: #45b26b;
      }

      .calculator-btn {
        width: 167px;
        height: 40px;
        line-height: 40px;
        text-align: center;
        border-radius: 10px;
        background: #df384c;
      }
    }

    .estimate {
      display: flex;
      flex-direction: row;
      justify-content: space-between;
      align-items: center;
      margin-top: 19px;
      width: 308px;
      height: 52px;

      .estimate-left {
        display: flex;
        flex-direction: column;
        justify-content: space-evenly;
        align-items: center;
        width: 130px;
        height: 100%;
      }

      .estimate-right {
        display: flex;
        flex-direction: column;
        justify-content: space-evenly;
        align-items: center;
        width: 130px;
        height: 100%;
      }
    }

    .reward-record {
      margin-top: 8px;
      width: 345px;

      .reward-record-title {
        width: 345px;
        height: 24px;
        line-height: 24px;
      }

      .reward-record-item {
        padding: 0 11px;
        margin-top: 10px;
        width: 345px;
        height: 60px;
        border-radius: 8px;
        border: 1px solid #ebebeb;
        box-sizing: border-box;

        .item-first {
          display: flex;
          flex-direction: row;
          justify-content: space-between;
          align-items: center;
          margin-top: 6px;
          width: 100%;
          height: 24px;
        }

        .item-second {
          display: flex;
          flex-direction: row;
          justify-content: space-between;
          align-items: center;
          margin-top: 5px;
          width: 100%;
          height: 18px;
        }
      }
    }
  }
</style>
