| | |
| | | <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> |
| | | <span @click="fillAllBalance" class="cursor-pointer text-blue-500 " style="padding: 0 10px;">{{ $t('全部') }}</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" |
| | |
| | | this.form.total = '' |
| | | this.form.volume = '' |
| | | }, |
| | | fillAllBalance() { |
| | | if (!this.userInfo.token) { |
| | | this.$router.push('/login'); |
| | | return; |
| | | } |
| | | if (this.currentType === 'open') { |
| | | // 买入模式:可用USDT / 当前价格 |
| | | const availableUsdt = parseFloat(this.initOpen.volume) || 0; |
| | | const price = parseFloat(this.form.price) || 0; |
| | | if (price > 0) { |
| | | this.form.volume = (availableUsdt / price).toFixed(6); |
| | | } |
| | | } else { |
| | | // 卖出模式:直接使用可用币种数量 |
| | | this.form.volume = parseFloat(this.initClose.volume) || 0; |
| | | } |
| | | this.onInput(); |
| | | }, |
| | | exchangeVal(val) { |
| | | if (!this.userInfo.token) { |
| | | this.$router.push('/login') |
| | |
| | | if (!this.isTotal) { |
| | | if (this.currentType == 'open') { |
| | | let sum = (parseFloat(this.initOpen.volume) * (val / 100) / parseFloat(this.form.price)) |
| | | this.form.volume = Math.floor(sum * 100000) / 100000 |
| | | this.form.volume = Math.floor(sum * 100000) / 100000; |
| | | this.onInput(); |
| | | } else { |
| | | let sum = parseFloat(this.initClose.volume) |
| | | this.form.volume = (Math.floor(sum * (val / 100) * 100000)) / 100000 |