<template>
  <!-- 申购和赎回 -->
  <div class="subscription">
    <div class="apply-mask" @click="emits('subscriptionClose')"></div>
    <div class="apply-content">
      <div class="slide-line"></div>
      <div class="notifi-classifi">
        <div
          class="classifi-item"
          :class="currentTab == 0 ? 'current-classifi' : 'pf600 fs14 fcA8A8A8'"
          @click="currentTab = 0">
          申购
          <div class="active-line" v-if="currentTab == 0"></div>
        </div>
        <div
          class="classifi-item"
          :class="currentTab == 1 ? 'current-classifi' : 'pf600 fs14 fcA8A8A8'"
          @click="currentTab = 1">
          赎回
          <div class="active-line" v-if="currentTab == 1"></div>
        </div>
      </div>
      <div class="subscription-area" v-if="currentTab == 0">
        <div class="from">
          <div class="text pf600 fs14 fc333333">从</div>
          <div class="number-input">
            <div class="text pf400 fs14 fc999999">合约账户申购</div>
            <div class="all pf500 fs14 fc333333">
              USDT <span class="fcDF384C">全部</span>
            </div>
          </div>
          <div class="use-number pf400 fs12 fc333333">
            可用余额&nbsp; 215.0508 USDT
            <img src="@/assets/icon/bitcoin/qianbao1.svg" alt="" class="qianbao" />
          </div>
          <div class="use-number pf400 fs12 fc333333">剩余可够&nbsp; 215.0508 HXUSDT</div>
        </div>
        <div class="to margin-top25">
          <div class="text pf600 fs14 fc333333">到</div>
          <div class="number-input">
            <div class="text pf400 fs14 fc999999">合约账户</div>
            <div class="all pf500 fs14 fc333333">HXUSDT</div>
          </div>
        </div>
        <div class="sure-btn pf600 fs14 fcFFFFFF">确认</div>
      </div>
      <div class="redemption-area" v-if="currentTab == 1">
        <div class="from">
          <div class="text pf600 fs14 fc333333">从</div>
          <div class="number-input">
            <div class="text pf400 fs14 fc999999">合约账户赎回</div>
            <div class="all pf500 fs14 fc333333">
              HXUSDT <span class="fcDF384C">全部</span>
            </div>
          </div>
          <div class="use-number pf400 fs12 fc333333">
            最大可赎回数量&nbsp; 215.0508 HXUSDT
          </div>
        </div>
        <div class="to margin-top25">
          <div class="text pf600 fs14 fc333333">到</div>
          <div class="number-input">
            <div class="text pf400 fs14 fc999999">合约账户</div>
            <div class="all pf500 fs14 fc333333">USDT</div>
          </div>
        </div>
        <div class="time pf600 fs14 fc333333">
          <div>赎回周期</div>
          <div>0天</div>
        </div>
        <div class="initiate-redemption">
          <div class="redemption-left">
            <div class="circle"></div>
            <div class="line"></div>
            <div class="circle"></div>
          </div>
          <div class="redemption-right">
            <div class="faqi1 pf500 fs12 fc333333">
              <div class="text1">发起赎回</div>
              <div class="time2">2025-11-04, 16:30</div>
            </div>
            <div class="faqi1 margin-top12 pf500 fs12 fc333333">
              <div class="text1">USDT到账日期</div>
              <div class="time2">2025-11-04, 16:30</div>
            </div>
          </div>
        </div>
        <div
          class="sure-btn margin-top22 pf600 fs14 fcFFFFFF"
          @click="redemptionNotFlag = true">
          确认
        </div>
      </div>
    </div>
    <RedemptionNot
      v-show="redemptionNotFlag"
      @redemptionNotClose="redemptionNotClose"></RedemptionNot>
  </div>
</template>
<script setup>
  import RedemptionNot from "../dialog/RedemptionNot.vue";
  import { ref } from "vue";

  const emits = defineEmits(["subscriptionClose"]);

  const currentTab = ref(0);

  const redemptionNotFlag = ref(false);
  const redemptionNotClose = () => {
    redemptionNotFlag.value = false;
  };
</script>
<style lang="less" scoped>
  .subscription {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    width: 100%;
    min-height: 100vh;

    .apply-mask {
      position: fixed;
      left: 0;
      top: 0;
      z-index: -1;
      width: 100%;
      min-height: 100vh;
      background: rgba(0, 0, 0, 0.5);
    }

    .apply-content {
      display: flex;
      flex-direction: column;
      justify-content: flex-start;
      align-items: center;
      width: 375px;
      height: 528px;
      background: #ffffff;
      border-radius: 24px 24px 0px 0px;

      .slide-line {
        margin-top: 12px;
        width: 32px;
        height: 4px;
        border-radius: 2px;
        opacity: 0.4;
        background: rgba(0, 0, 0, 0.5);
      }

      .notifi-classifi {
        display: flex;
        flex-direction: row;
        justify-content: flex-start;
        align-items: flex-end;
        margin-top: 14px;
        width: 345px;
        height: 24px;

        .classifi-item {
          position: relative;
          margin-left: 43px;

          .active-line {
            position: absolute;
            bottom: -6px;
            left: 50%;
            transform: translateX(-50%);
            width: 20px;
            height: 3px;
            background-color: #323233;
            border-radius: 2px;
          }

          &:first-child {
            margin-left: 0;
          }
        }

        .current-classifi {
          font-family: "PingFang SC";
          font-style: normal;
          font-weight: 600;
          font-size: 18px;
          color: #121212;
          transition: color 0.3s, font-size 0.3s;
        }
      }

      .sure-btn {
        margin: 0 auto;
        margin-top: 69px;
        width: 311px;
        height: 40px;
        line-height: 40px;
        text-align: center;
        border-radius: 100px;
        background: #df384c;
      }

      .subscription-area {
        margin-top: 14px;
        width: 345px;

        .margin-top25 {
          margin-top: 25px;
        }

        .from,
        .to {
          width: 100%;

          .text {
            height: 24px;
            line-height: 24px;
          }

          .number-input {
            display: flex;
            flex-direction: row;
            justify-content: space-between;
            align-items: center;
            padding: 0 11px;
            margin-top: 5px;
            width: 345px;
            height: 45px;
            border-radius: 6px;
            background: #f5f5f5;
            box-sizing: border-box;
          }

          .use-number {
            display: flex;
            flex-direction: row;
            justify-content: flex-start;
            align-items: center;
            margin-top: 7px;
            width: 345px;
            height: 18px;

            .qianbao {
              margin-left: 8px;
              width: 14px;
              height: 14px;
            }
          }
        }
      }

      .redemption-area {
        margin-top: 14px;
        width: 345px;

        .margin-top25 {
          margin-top: 25px;
        }

        .from,
        .to {
          width: 100%;

          .text {
            height: 24px;
            line-height: 24px;
          }

          .number-input {
            display: flex;
            flex-direction: row;
            justify-content: space-between;
            align-items: center;
            padding: 0 11px;
            margin-top: 5px;
            width: 345px;
            height: 45px;
            border-radius: 6px;
            background: #f5f5f5;
            box-sizing: border-box;
          }

          .use-number {
            display: flex;
            flex-direction: row;
            justify-content: flex-start;
            align-items: center;
            margin-top: 7px;
            width: 345px;
            height: 18px;

            .qianbao {
              margin-left: 8px;
              width: 14px;
              height: 14px;
            }
          }
        }

        .time {
          display: flex;
          flex-direction: row;
          justify-content: space-between;
          align-items: center;
          margin-top: 9px;
          width: 345px;
          height: 24px;
        }

        .initiate-redemption {
          display: flex;
          flex-direction: row;
          justify-content: flex-start;
          align-items: center;
          margin-top: 16px;
          width: 345px;
          height: 112px;
          border-radius: 8px;
          border: 1px solid #ebebeb;

          .redemption-left {
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            margin-left: 17px;
            width: 10px;
            height: 65px;

            .circle {
              width: 10px;
              height: 10px;
              border-radius: 50%;
              background: #df384c;
            }

            .line {
              width: 1px;
              height: 54px;
              background: repeating-linear-gradient(
                to bottom,
                #df384c,
                #df384c 1px,
                transparent 2px,
                transparent 3px
              );
            }
          }

          .redemption-right {
            margin-left: 13px;

            .margin-top12 {
              margin-top: 12px;
            }

            .faqi1 {
              .text1 {
                height: 24px;
                line-height: 24px;
              }

              .time2 {
                height: 18px;
                line-height: 18px;
              }
            }
          }
        }

        .sure-btn {
          margin: 0 auto;
          margin-top: 22px;
          width: 311px;
          height: 40px;
          line-height: 40px;
          text-align: center;
          border-radius: 100px;
          background: #df384c;
        }
      }
    }
  }
</style>
