1
李凌
2025-09-20 6b754cd28c45741a24e7f7193b894e3e386e4af8
src/components/Transform/trade-order-area/index.vue
@@ -31,51 +31,54 @@
      <div class="flex justify-center items-center h-66 buy-item">{{ $t('停牌中,禁止交易') }}</div>
    </template> -->
    <!-- <template v-else> -->
      <div class="flex total-list">
        <div class="total-div" :class="[!isTotal ? 'active-bg' : '']" @click="checkIsTotal(false)">
          {{ $t('数量') }}
        </div>
        <div class="total-div" :class="[isTotal ? 'active-bg' : '']" @click="checkIsTotal(true)">
          {{ $t('总额') }}
        </div>
    <div class="flex total-list">
      <div class="total-div" :class="[!isTotal ? 'active-bg' : '']" @click="checkIsTotal(false)">
        {{ $t('数量') }}
      </div>
      <div v-if="!isTotal" class="h-70 lh-70 inputBackground mb-36 flex justify-center px-16">
        <input :placeholder="$t('数量')" class=" w-full h-70 border-none textColor font-28" v-model="form.volume"
          @input="onInput" />
        <span class="textColor font-28">{{ symbol.toLocaleUpperCase() }}</span>
      <div class="total-div" :class="[isTotal ? 'active-bg' : '']" @click="checkIsTotal(true)">
        {{ $t('总额') }}
      </div>
      <div v-if="isTotal" class="h-70 lh-70 inputBackground  mb-36 flex justify-center px-16">
        <input :placeholder="$t('总额')" class=" w-full h-70 border-none textColor font-28" v-model="form.total"
          @input="onInputTotal" />
        <span class="textColor font-28">{{ 'USDT' }}</span>
    </div>
    <div v-if="!isTotal" class="h-70 lh-70 inputBackground mb-36 flex justify-center px-16">
      <input :placeholder="$t('数量')" class=" w-full h-70 border-none textColor font-28" v-model="form.volume"
        @input="onInput" />
      <span class="textColor font-28">{{ strToArr(symbolName.toLocaleUpperCase(), '/')[0] }}</span>
    </div>
    <div v-if="isTotal" class="h-70 lh-70 inputBackground  mb-36 flex justify-center px-16">
      <input :placeholder="$t('总额')" class=" w-full h-70 border-none textColor font-28" v-model="form.total"
        @input="onInputTotal" />
      <span class="textColor font-28">{{ 'USDT' }}</span>
    </div>
    <div class="font-24 w-full flex justify-between items-center textColor1">
      <!-- <span class="flex-1 text-left">0%</span> -->
      <span class="flex-1 tab-item" :class="[percentageVal == 25 ? 'select-active' : '']"
        @click="exchangeVal(25)">25%</span>
      <span class="flex-1 tab-item" :class="[percentageVal == 50 ? 'select-active' : '']"
        @click="exchangeVal(50)">50%</span>
      <span class="flex-1 tab-item" :class="[percentageVal == 75 ? 'select-active' : '']"
        @click="exchangeVal(75)">75%</span>
      <span class="flex-1 tab-item" :class="[percentageVal == 100 ? 'select-active' : '']"
        @click="exchangeVal(100)">100%</span>
    </div>
    <div class="flex justify-between items-center mt-40">
      <div class="flex flex-col font-24">
        <p class="text-grey" v-if="this.currentType === 'open'">{{ $t('可用') }}<span class="textColor ml-8">
            {{ initOpen.volume }}&nbsp;USDT</span>
        </p>
        <p class="text-grey" v-else>{{ $t('可卖') }}
          <span class="textColor ml-8">
            {{ initClose.volume }}&nbsp;{{ strToArr(symbolName.toLocaleUpperCase(), '/')[0] }}
          </span>
        </p>
      </div>
      <div class="font-24 w-full flex justify-between items-center textColor1">
        <!-- <span class="flex-1 text-left">0%</span> -->
        <span class="flex-1 tab-item" :class="[percentageVal == 25 ? 'select-active' : '']"
          @click="exchangeVal(25)">25%</span>
        <span class="flex-1 tab-item" :class="[percentageVal == 50 ? 'select-active' : '']"
          @click="exchangeVal(50)">50%</span>
        <span class="flex-1 tab-item" :class="[percentageVal == 75 ? 'select-active' : '']"
          @click="exchangeVal(75)">75%</span>
        <span class="flex-1 tab-item" :class="[percentageVal == 100 ? 'select-active' : '']"
          @click="exchangeVal(100)">100%</span>
      </div>
      <div class="flex justify-between items-center mt-40">
        <div class="flex flex-col font-24">
          <p class="text-grey" v-if="this.currentType === 'open'">{{ $t('可用') }}<span class="textColor ml-8">
              {{ initOpen.volume }}&nbsp;USDT</span>
          </p>
          <p class="text-grey" v-else>{{ $t('可卖') }}<span class="textColor ml-8">{{ initClose.volume }}&nbsp;{{
            symbol.toLocaleUpperCase() }}</span></p>
        </div>
        <van-icon name="add-o" @click="$router.push('/cryptos/exchangePage')" class="font-30 add-icon" />
        <!-- <img @click="$router.push('/exchange/exchangePage')" src="@/assets/image/public/switch.png" class="w-24 h-24" /> -->
      </div>
      <div style="border-radius: 3.5rem;"
        class="w-full h-90 lh-90 flex justify-center text-white text-center rounded buyandSell mt-70"
        :class="currentType === 'open' ? 'bg-green' : 'bg-red'" @click="order()">
        {{ currentType == 'open' ? $t('买入') : $t('卖出') }}
      </div>
      <van-icon name="add-o" @click="$router.push('/cryptos/exchangePage')" class="font-30 add-icon" />
      <!-- <img @click="$router.push('/exchange/exchangePage')" src="@/assets/image/public/switch.png" class="w-24 h-24" /> -->
    </div>
    <div style="border-radius: 3.5rem;"
      class="w-full h-90 lh-90 flex justify-center text-white text-center rounded buyandSell mt-70"
      :class="currentType === 'open' ? 'bg-green' : 'bg-red'" @click="order()">
      {{ currentType == 'open' ? $t('买入') : $t('卖出') }}
    </div>
    <!-- </template> -->
  </div>
</template>
@@ -86,6 +89,7 @@
import 'vue-slider-component/theme/default.css'
import { _getBalance } from "@/service/user.api.js";
import TradeApi from "@/service/trading.js";
import { strToArr } from '@/utils/utis'
import { mapGetters } from "vuex";
// import PopupConfirmOrder from '@/components/popup-confirm-order'
export default {
@@ -100,7 +104,7 @@
      type: String,
      default: ''
    },
    symbol: {
    symbolName: {
      type: String,
      default: ''
    },
@@ -189,6 +193,7 @@
    this.form.order_price_type = 'opponent'
  },
  methods: {
    strToArr,
    checkIsTotal(val) {
      this.isTotal = val
      this.percentageVal = 0