<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 fcA8A8A8" @click="toHistory">
        <img src="../../../assets/icon/index/history.svg" alt="" />历史
      </div>
    </div>
  </div>
  <div class="change-coin">
    <div class="coin-area">
      <div
        class="coin-item pf400 fs18 fc1F2937"
        v-for="(item, index) in coinData"
        :key="index">
        <img :src="item.img" alt="" />{{ item.name }}
      </div>
    </div>
  </div>
</template>
<script setup>
  import { useRoute, useRouter } from "vue-router";

  const router = useRouter();

  const toHistory = () => {
    router.push("/rechargeHistory");
  };

  const coinData = [
    {
      img: require("@/assets/icon/coin/bnb.svg"),
      name: "Bitcoin",
    },
    {
      img: require("@/assets/icon/coin/EthereumClassicBadge.svg"),
      name: "Ethereum",
    },
    {
      img: require("@/assets/icon/coin/BinanceUsdBadge.svg"),
      name: "Binance",
    },
    {
      img: require("@/assets/icon/coin/SolanaBadge.svg"),
      name: "Solana",
    },
    {
      img: require("@/assets/icon/coin/xrp.svg"),
      name: "XRP",
    },
    {
      img: require("@/assets/icon/coin/CardanoBadge.svg"),
      name: "Cardano",
    },
    {
      img: require("@/assets/icon/coin/otc.svg"),
      name: "OTC交易",
    },
  ];

  const toPath = () => {
    router.back();
  };
</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 {
        display: flex;
        flex-direction: row;
        justify-content: flex-start;
        align-items: center;
        position: absolute;
        top: 12.3px;
        right: 16px;
        height: 24px;

        img {
          margin-right: 4px;
        }
      }
    }
  }

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

    .coin-area {
      display: flex;
      flex-direction: row;
      justify-content: flex-start;
      flex-wrap: wrap;
      width: 324px;

      .coin-item {
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        margin-left: 12px;
        margin-top: 12px;
        width: 100px;
        height: 90px;
        background: #f5f5f5;
        border-radius: 12px;

        &:nth-child(3n + 1) {
          margin-left: 0;
        }

        img {
          margin-top: 12px;
          margin-bottom: 8px;
          width: 30px;
          height: 30px;
        }
      }
    }
  }
</style>
