From 349c48e168b9f2580334422228acde7d1b21bede Mon Sep 17 00:00:00 2001
From: 李凌 <344137771@qq.com>
Date: Fri, 05 Jun 2026 11:19:15 +0800
Subject: [PATCH] 1
---
src/components/Transform/perpetual-open/index.vue | 86 ++++++++++++++++++++++++++++++++++---------
1 files changed, 68 insertions(+), 18 deletions(-)
diff --git a/src/components/Transform/perpetual-open/index.vue b/src/components/Transform/perpetual-open/index.vue
index efe0591..bd02be2 100644
--- a/src/components/Transform/perpetual-open/index.vue
+++ b/src/components/Transform/perpetual-open/index.vue
@@ -62,8 +62,11 @@
</div>
</div>
</template>
- <contract-futrue v-if="selectIndex == 2 && JSON.stringify(initFutrue.para) != '[]'" class="mb-20"
+ <contract-futrue v-if="selectIndex == 2 && hasFutruePara" class="mb-20"
:initFutrue="initFutrue" @paraId="onParaId" />
+ <div v-else-if="selectIndex == 2" class="text-grey font-26 py-20 text-center mb-20">
+ {{ $t('暂无交割周期配置,请联系客服') }}
+ </div>
<div class="h-76 lh-76 greyBg mb-30 flex pr-20 justify-center rounded-lg textColor" v-if="selectIndex == 1">
<input placeholder="" class="greyBg w-full pl-20 h-76 border-none text-left rounded-lg"
:disabled="type / 1 === 1" @focus="focus = true" v-model="form.price" />
@@ -79,7 +82,7 @@
<input v-if="selectIndex == 1" placeholder="USDT" class="border-none greyBg text-center textColor"
style="width: 17rem;border-radius: 5rem;" v-model="form.amount" type="number" @input="onInput" />
- <input v-if="selectIndex == 2 && JSON.stringify(initFutrue.para) != '[]'"
+ <input v-if="selectIndex == 2 && hasFutruePara"
:placeholder="($t('最少') + initFutrue && initFutrue.para ? $t('最小金额') + initFutrue.para[paraIndex].buy_min : '')"
class="border-none greyBg text-center textColor" style="width: 17rem;border-radius: 5rem;"
v-model="form.amount" type="number" @input="onInput" />
@@ -121,8 +124,12 @@
<span class="flex-1 text-right">100%</span>
</div> -->
<!-- 张数输入 -->
- <amount-slider ref="sliderRef" :maxAmount="maxUSDT" @getAmount="getAmount"
- :propsAmount="form.amount"></amount-slider>
+ <!-- <amount-slider ref="sliderRef" :maxAmount="maxUSDT" @getAmount="getAmount"
+ :propsAmount="form.amount"></amount-slider> -->
+ <div class="btns_box">
+ <div :class="bfbindex == index ? 'btns_box_boxs' : 'btns_box_box'" @click="bfbclick(item, index)"
+ v-for="(item, index) in bfblist" :key="index">{{ item.name }}%</div>
+ </div>
</template>
<template v-if="selectIndex == 1 && userInfo.token">
<div class="flex justify-between mt-30">
@@ -134,13 +141,12 @@
<span>{{ 'USDT' }}</span>
</div>
</div>
- <div class="flex justify-between mt-30">
+ <!-- <div class="flex justify-between mt-30">
<div class="text-grey">{{ $t("保证金") }}</div>
<div class="textColor">
- <!-- {{ (initData.amount * (form.amount / 1)) }} {{ queryType === 'cryptos' ? 'USDT' : 'USD' }} -->
{{ form.lever_rate * form.amount }} {{ 'USDT' }}
</div>
- </div>
+ </div> -->
<div class="flex justify-between mt-30">
<div class="text-grey">{{ $t("建仓手续费") }}</div>
<div class="textColor">{{ reserve(userInfo.perpetual_contracts_status === '1' ?
@@ -150,20 +156,20 @@
</div>
</template>
- <div class="flex font-24 text-grey justify-between mt-32" v-if="selectIndex == 2">
+ <div class="flex font-24 text-grey justify-between mt-32">
<div>{{ $t("可用USDT") }}</div>
- <div class="textColor">{{ initFutrue.amount }} {{ queryType === 'cryptos' ? 'USDT' : 'USD' }}</div>
+ <div class="textColor">{{ initFutrue.amount }} USDT</div>
</div>
<div class="flex font-24 text-grey justify-between mt-20"
- v-if="selectIndex == 2 && JSON.stringify(initFutrue.para) != '[]'">
+ v-if="selectIndex == 2 && hasFutruePara">
<div>{{ $t("手续费") }}</div>
<div class="textColor">
{{
(
form.amount *
(initFutrue && initFutrue.para
- ? initData.para[paraIndex].unit_fee
- : "")
+ ? initFutrue.para[paraIndex].unit_fee
+ : 0)
).toFixed(2)
}}
{{ queryType === 'cryptos' ? 'USDT' : 'USD' }}
@@ -197,7 +203,7 @@
</div>
</div>
</template>
- <template v-if="selectIndex == 2">
+ <template v-if="selectIndex == 2 && hasFutruePara">
<div class="w-full h-80 lh-80 bg-green flex text-white rounded-ban mt-10 " @click="order('open')"
v-if="userInfo.token">
<div class="font-34 relative text-center" style="flex-grow: 1">
@@ -255,7 +261,7 @@
'%,rgba(246,70,93,.1) 100%)',
}"> -->
- <div v-if="showType == 0 || showType == 2" class="w-290 flex justify-between pt-1 font-26"
+ <div v-show="(showType == 0 || showType == 2)" class="w-290 flex justify-between pt-1 font-26"
v-for="(item, index) in redData" :key="item + index" @click="onQuickPrice(item.price)" :style="{
background:
`linear-gradient(to right,${THEME == 'dark' ? '#131A2E' : '#fff'
@@ -364,7 +370,6 @@
import ContractFutrue from '@/components/Transform/contract-futrue/index.vue'
import PopupDelivery from "@/components/Transform/popup-delivery/index.vue";
import { fixDate } from "@/utils/index.js";
-import { THEME } from '@/config/theme'
import AmountSlider from "./amountSlider.vue";
import "vue-slider-component/theme/default.css";
import { _getHomeList } from "@/service/home.api";
@@ -506,6 +511,9 @@
computed: {
...mapGetters('user', ['userInfo']),
...mapGetters('home', ['currency']),
+ hasFutruePara() {
+ return Array.isArray(this.initFutrue?.para) && this.initFutrue.para.length > 0
+ },
initData() {
let obj = null
if (this.selectIndex / 1 === 1) {
@@ -533,12 +541,21 @@
// console.log("dddddd", max, this.form.lever_rate, (1 / this.form.lever_rate + this.initData.fee));
return max
+ },
+ THEME() {
+ return this.$store.state.vant.theme
}
},
data() {
return {
- THEME,
fixDate,
+ bfbindex: null,
+ bfblist: [
+ { name: '25' },
+ { name: '50' },
+ { name: '75' },
+ { name: '100' }
+ ],
currentBuyType: '', // 交割合约当前下单的类型,用于弹窗倒计时结束以后,点击再下一单
timeout2: null,
timeout: null,
@@ -615,6 +632,14 @@
},
methods: {
reserve,
+ bfbclick(e, i) {
+ this.bfbindex = i
+ e = parseInt(e.name)
+ const rate = e / 100; //如0.25
+ this.form.amount = this.maxUSDT * rate
+ var a = this.form.amount
+ this.form.amount = Math.floor(a * 100) / 100
+ },
//获取张数
getAmount(val) {
if (!val) {
@@ -940,6 +965,28 @@
<style lang="scss">
@import "@/assets/init.scss";
+.btns_box_boxs {
+ width: 23%;
+ border: 1px solid #F7B600;
+ text-align: center;
+ border-radius: 10px;
+ color: #F7B600;
+}
+
+.btns_box_box {
+ width: 23%;
+ border: 1px solid #cbcbcb;
+ text-align: center;
+ border-radius: 10px;
+ color: #7f7f7f;
+}
+
+.btns_box {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+}
+
#cryptos {
.perpetual-open {
font-size: 26px;
@@ -1122,7 +1169,10 @@
.van-action-sheet__item {
background: transparent !important;
- color: $text_color;
+
+ @include themify() {
+ color: themed("text_color");
+ }
}
}
@@ -1143,7 +1193,7 @@
.select-box {
width: 220px;
border-radius: 2.5rem;
- background: #1E1E1E;
+ background: #aaa;
margin-right: 20px;
}
--
Gitblit v1.9.3