<template>
  <img src="@/assets/icon/asset/c2c.svg" class="c2c" alt="" />
  <div class="buy-sell">
    <div class="buy-left">
      <div class="buy-btn pf500 fs14 fcFFFFFF">购买</div>
      <div class="sell-btn pf500 fs14 fc999999">出售</div>
    </div>
    <div class="buy-right">
      <div class="text pf400 fs14 fc333333">CNY</div>
      <img src="@/assets/icon/asset/bottom-arrow-black.svg" alt="" />
    </div>
  </div>
  <div class="filter-area">
    <div class="filter-left">
      <div class="left-coin">
        <img src="@/assets/icon/coin/bnb.svg" class="coin" alt="" />
        <div class="text pf400 fs14 fc333333">BTC</div>
        <img src="@/assets/icon/asset/bottom-arrow-black.svg" class="bottom-arrow" />
      </div>
      <div class="left-money" @click="amountFlag = true">
        <div class="text pf400 fs14 fc333333">金额</div>
        <img src="@/assets/icon/asset/bottom-arrow-black.svg" class="bottom-arrow" />
      </div>
      <div class="left-pay-way" @click="paymentWayFlag = true">
        <div class="text pf400 fs14 fc333333">支付方式</div>
        <img src="@/assets/icon/asset/bottom-arrow-black.svg" class="bottom-arrow" />
      </div>
    </div>
    <div class="filter-right" @click="filterFlag = true">
      <img src="@/assets/icon/asset/filter.svg" alt="" />
    </div>
  </div>
  <div class="goods-area">
    <div class="goods-item" v-for="(item, index) in 2" :key="index">
      <div class="item-merchant">
        <div class="merchant-left" @click="goMerchantDetails">
          <img src="@/assets/img/index/user/default-head.png" alt="" />
          <div class="left-name pf500 fs14 fc2C3131">商家昵称</div>
          <div class="vip-flag pf500 fs10 fcDF384C">V2</div>
        </div>
        <div class="merchant-right pf400 fs10 fc999999">
          入驻时间: 2025-11-07 12:25:10
        </div>
      </div>
      <div class="item-chengjiao-number pf400 fs10 fc999999">
        成交量 12550 · 98.95% 成交率
      </div>
      <div class="item-price">
        <div class="price-area">
          <div class="text pf400 fs10 fc999999">单价</div>
          <div class="price-number pf400 fs10 fc999999">
            ￥
            <span class="pf500 fs16 fc333333">6.58</span>
            /USDT
          </div>
          <div class="number pf400 fs10 fc999999">
            数量 <span class="pf400 fs12 fc666666">1000.05 USDT</span>
          </div>
          <div class="number pf400 fs10 fc999999">
            限额 <span class="pf400 fs12 fc666666">20000 - 1000.05 CNY</span>
          </div>
        </div>
        <div class="price-func">
          <div class="func-time pf400 fs10 fc999999">
            <img src="@/assets/icon/asset/clock-gray.svg" alt="" />0m 45s
          </div>
          <div class="func-pay-way pf400 fs10 fc999999">
            <div class="color"></div>
            银行卡
          </div>
          <div class="func-main">
            <div class="func-chat pf500 fs12 fcDF384C">聊天</div>
            <div class="func-buy pf500 fs12 fcFFFFFF" @click="sellAndBuyFlag = true">
              购买
            </div>
          </div>
        </div>
      </div>
    </div>
    <PaymentWay v-show="paymentWayFlag" @paymentWayClose="paymentWayClose"></PaymentWay>
    <Amount v-show="amountFlag" @amountClose="amountClose"></Amount>
    <Filter v-show="filterFlag" @filterClose="filterClose"></Filter>
    <SellAndBuy v-show="sellAndBuyFlag" @sellAndBuyClose="sellAndBuyClose"></SellAndBuy>
    <!-- 暂无收款方式，还没点击的地方 -->
    <NotPaymentWay
      v-show="notPaymnetWayFlag"
      @notPaymentWayClose="notPaymentWayClose"></NotPaymentWay>
    <!-- 添加收款方式，还没点击的地方 -->
    <PaymentAccount
      v-show="paymentAccountFlag"
      @paymentAccountClose="paymentAccountClose"></PaymentAccount>
    <!-- 取消订单，还没点击的地方 -->
    <CancelOrder
      v-show="cancelOrderFlag"
      @cancelOrderClose="cancelOrderClose"></CancelOrder>
    <!-- 是否完成付款，还没点击的地方 -->
    <CompletePayment
      v-show="completePaymentFlag"
      @completePaymentClose="completePaymentClose"></CompletePayment>
  </div>
</template>
<script setup>
  import { ref } from "vue";
  import { useRoute, useRouter } from "vue-router";
  import PaymentWay from "../../dialog/NotPaymentWay.vue";
  import Amount from "../../dialog/Amount.vue";
  import Filter from "../../dialog/Filter.vue";
  import SellAndBuy from "../../dialog/SellAndBuy.vue";
  import NotPaymentWay from "../../dialog/NotPaymentWay.vue";
  import PaymentAccount from "../../dialog/PaymentAccount.vue";
  import CancelOrder from "../../dialog/CancelOrder.vue";
  import CompletePayment from "../../dialog/CompletePayment.vue";

  const router = useRouter();

  const goMerchantDetails = () => {
    router.push("/OTCMerchantDetails");
  };

  const completePaymentFlag = ref(false);
  const completePaymentClose = () => {
    completePaymentFlag.value = false;
  };

  const cancelOrderFlag = ref(false);
  const cancelOrderClose = () => {
    cancelOrderFlag.value = false;
  };

  const paymentAccountFlag = ref(false);
  const paymentAccountClose = () => {
    paymentAccountFlag.value = false;
  };

  const notPaymnetWayFlag = ref(false);
  const notPaymentWayClose = () => {
    notPaymnetWayFlag.value = false;
  };

  const sellAndBuyFlag = ref(false);
  const sellAndBuyClose = () => {
    sellAndBuyFlag.value = false;
  };

  const filterFlag = ref(false);
  const filterClose = () => {
    filterFlag.value = false;
  };

  const amountFlag = ref(false);
  const amountClose = () => {
    amountFlag.value = false;
  };

  const paymentWayFlag = ref(false);
  const paymentWayClose = () => {
    paymentWayFlag.value = false;
  };
</script>
<style lang="less" scoped>
  .c2c {
    margin-top: 13px;
    width: 345px;
    height: 100px;
  }

  .buy-sell {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    margin-top: 13px;
    width: 345px;
    height: 35px;

    .buy-left {
      display: flex;
      flex-direction: row;
      justify-content: flex-start;
      height: 100%;

      .buy-btn {
        width: 85px;
        height: 35px;
        line-height: 35px;
        text-align: center;
        border-radius: 6px;
        background: #45b26b;
      }

      .sell-btn {
        margin-left: 14px;
        width: 85px;
        height: 35px;
        line-height: 35px;
        text-align: center;
        border-radius: 6px;
        background: #f5f5f5;
      }
    }

    .buy-right {
      display: flex;
      flex-direction: row;
      justify-content: flex-start;
      align-items: center;
      width: 75px;
      height: 35px;
      line-height: 35px;
      text-align: center;
      border-radius: 6px;
      background: #f5f5f5;

      .text {
        margin-left: 15px;
      }

      img {
        margin-left: 12px;
      }
    }
  }

  .filter-area {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    padding-left: 6px;
    margin-top: 13px;
    width: 345px;
    height: 18px;
    box-sizing: border-box;

    .filter-left {
      display: flex;
      flex-direction: row;
      justify-content: flex-start;
      align-items: center;
      height: 18px;

      .left-coin {
        display: flex;
        flex-direction: row;
        justify-content: flex-start;
        align-items: center;
        height: 18px;

        .coin {
          width: 18px;
          height: 18px;
        }

        .text {
          margin-left: 3px;
        }

        .bottom-arrow {
          margin-left: 5px;
        }
      }

      .left-money {
        display: flex;
        flex-direction: row;
        justify-content: flex-start;
        align-items: center;
        margin-left: 34px;
        height: 18px;

        .text {
          margin-left: 3px;
        }

        .bottom-arrow {
          margin-left: 5px;
        }
      }

      .left-pay-way {
        display: flex;
        flex-direction: row;
        justify-content: flex-start;
        align-items: center;
        margin-left: 34px;
        height: 18px;

        .text {
          margin-left: 3px;
        }

        .bottom-arrow {
          margin-left: 5px;
        }
      }
    }

    .filter-right {
      display: flex;
      flex-direction: row;
      justify-content: center;
      align-items: center;
      height: 18px;
    }
  }

  .goods-area {
    width: 345px;

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

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

        .merchant-left {
          display: flex;
          flex-direction: row;
          justify-content: flex-start;
          align-items: center;
          height: 24px;

          img {
            width: 24px;
            height: 24px;
          }

          .left-name {
            margin-left: 4px;
          }

          .vip-flag {
            margin-left: 4px;
            width: 18px;
            height: 15px;
            line-height: 15px;
            text-align: center;
            border-radius: 3px;
            background: #df384c1a;
          }
        }
      }

      .item-chengjiao-number {
        margin-top: 6px;
      }

      .item-price {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        margin-top: 10px;

        .price-area {
          .price-number {
            margin-top: 3px;
          }

          .number {
            margin-top: 5px;
            height: 13px;
            line-height: 13px;

            span {
              margin-left: 1px;
            }
          }
        }

        .price-func {
          display: flex;
          flex-direction: column;
          justify-content: flex-start;
          align-items: flex-end;

          .func-time {
            display: flex;
            flex-direction: row;
            justify-content: flex-start;
            align-items: center;
            height: 12px;

            img {
              margin-right: 3px;
              width: 9px;
              height: 9px;
            }
          }

          .func-pay-way {
            display: flex;
            flex-direction: row;
            justify-content: flex-start;
            align-items: center;
            margin-top: 5px;
            height: 12px;

            .color {
              margin-right: 3px;
              width: 3px;
              height: 10px;
              border-radius: 2px;
              background: #df384c;
            }
          }

          .func-main {
            display: flex;
            flex-direction: row;
            justify-content: flex-start;
            margin-top: 15px;
            height: 24px;

            .func-chat {
              width: 58px;
              height: 24px;
              line-height: 24px;
              text-align: center;
              border-radius: 5px;
              background: #df384c1a;
            }

            .func-buy {
              margin-left: 8px;
              width: 58px;
              height: 24px;
              line-height: 24px;
              text-align: center;
              border-radius: 5px;
              background: #45b26b;
            }
          }
        }
      }
    }
  }
</style>
