From 25b2ba1cf86bc3439e7ad2acf2cd4a9ea7e4b0ed Mon Sep 17 00:00:00 2001
From: dcc <dcc@163.com>
Date: Fri, 28 Jun 2024 09:28:04 +0800
Subject: [PATCH] 123
---
src/components/perpetual-position-list/index.vue | 70 ++++++++++++++++++++++++++++++-----
1 files changed, 60 insertions(+), 10 deletions(-)
diff --git a/src/components/perpetual-position-list/index.vue b/src/components/perpetual-position-list/index.vue
index ae6d2e3..261c47b 100644
--- a/src/components/perpetual-position-list/index.vue
+++ b/src/components/perpetual-position-list/index.vue
@@ -9,8 +9,8 @@
<!-- </div>-->
<!-- <button class="border-none all-cancel-btn pl-34 pr-34 pt-10 pb-10 font-25" @click="onSellAll">{{ $t('一键平仓') }}</button>-->
<!-- </div>-->
- <div :class="[isStyle ? 'border-b-color' : '']" v-for="item in listData" :key="item.order_no">
- <div class="flex justify-between pt-44 pb-44">
+ <div :class="[isStyle ? 'border-b-color' : '']" style="margin:0 20px;" v-for="item in listData" :key="item.order_no">
+ <div class="flex justify-between pt-44 pb-44" >
<div class="flex flex-col">
<div class="flex items-center">
<div class="pl-29 pr-29 pt-11 pb-11 text-white open-btn"
@@ -35,8 +35,8 @@
<div class="mt-20" :class="item.profit > 0 ? 'text-green' : 'text-red'">
{{ item.profit > 0 ? '+' + item.profit : item.profit }}</div>
</div>
- <!-- <div class="flex-1 flex flex-col items-center justify-end">
- <button class="font-30 border-light-blue detail-btn colorMain " @click="goDetail(item)">{{
+ <!-- <div class="flex-1 flex flex-col items-center justify-end">
+ <button class="font-30 border-light-blue detail-btn colorMain " @click="clickzyzs(item)">{{
$t('设置') }}{{
$t('止盈') }}{{$t('止损') }}</button>
</div> -->
@@ -50,8 +50,7 @@
<div class="flex pt-44 pb-32">
<div class="flex-1">
<div class="text-grey">{{ $t('持仓数量') }}</div>
- <div class="mt-20" :class="[isStyle ? 'textColor1 ' : 'textColor']">{{ item.volume / (item.lever_rate ?
- item.lever_rate : 1) }}*{{ item.lever_rate ? item.lever_rate : 1 }}x</div>
+ <div class="mt-20" :class="[isStyle ? 'textColor1 ' : 'textColor']">{{ ((item.deposit * item.lever_rate )/item.trade_avg_price).toFixed(2)}}</div>
</div>
<div class="flex-1 text-center">
<div class="text-grey">{{ $t('保证金') }} (USDT)</div>
@@ -68,8 +67,7 @@
<div class="mt-20 " :class="[isStyle ? 'textColor1 ' : 'textColor']">{{ item.mark_price }}</div>
</div>
<div class="flex-1 flex flex-col items-center justify-end">
- <button class="font-30 border-light-blue detail-btn colorMain w-125 h-60" @click="goDetail(item)">{{
- $t('详情') }}</button>
+ <button class="font-30 border-light-blue detail-btn colorMain w-145 h-60" @click="clickzyzs(item)">{{$t('设置') }}{{$t('止盈') }}{{$t('止损') }}</button>
</div>
<div class="flex-1 flex flex-col items-end justify-end">
<button class=" greyBg border-none pl-34 pr-34 pt-10 pb-10 rounded" @click="onSell(item.order_no)">
@@ -77,12 +75,40 @@
</div>
</div>
</div>
+ <van-popup :closeable="true" v-if="iszyzs && selectIndex ==1 " v-model="iszyzs" style="width: 350px; height: 220px;display: flex;justify-content: center;flex-direction: column;
+ " class="rounded-2xl">
+ <div
+ class="h-76 lh-76 inputBackground mb-30 flex pr-20 justify-center rounded-lg textColor" style="margin-top:20px;width: 80%;margin-left: 10%;"
+ >
+ <input
+ :placeholder="selectIndex == 1 ? $t('请输入止盈金额') : ''"
+ class="inputBackground pl-20 h-76 border-none text-left rounded-lg"
+ v-model="stop_price_profit"
+ />
+ <span class="font-22 font-400 textColor">{{ $t("止盈") }}</span>
+ </div>
+ <div
+ class="h-76 lh-76 inputBackground mb-30 flex pr-20 justify-center rounded-lg textColor" style="margin-bottom:20px;width: 80%;margin-left: 10%;"
+ v-if="selectIndex == 1"
+ >
+ <input
+ :placeholder="selectIndex == 1 ? $t('请输入止损金额') : ''"
+ class="inputBackground pl-20 h-76 border-none text-left rounded-lg"
+ v-model="stop_price_loss"
+ />
+ <span class="font-22 font-400 textColor">{{ $t("止损") }}</span>
+ </div>
+ <div class="btn" style="width: 100%;display: flex;justify-content: center;align-items: center;">
+ <div class="btn_right" @click="iszyzs=false" style="width: 50%;text-align: center;height: 100%;display: flex;justify-content: center;align-items: center;">{{$t('取消')}}</div>
+ <div class="btn_left" @click="zyzsclick" style="width: 50%;text-align: center;height: 100%;display: flex;justify-content: center;align-items: center;">{{$t('确认')}}</div>
+ </div>
+ </van-popup>
<div class="text-grey text-center py-300" v-if="!listData.length">{{ $t('您目前没有持仓') }}</div>
</div>
</template>
<script>
-import { _orderSell, _orderSellBatch } from "@/API/trade.api";
+import { _orderSell, _orderSellBatch,_getzyzs } from "@/API/trade.api";
import { Dialog } from 'vant';
//import { i18n } from "@/i18n";
export default {
@@ -90,7 +116,12 @@
data() {
return {
iconShow: false,
- isStyle: true
+ isStyle: true,
+ selectIndex:1,
+ xzitem:{},
+ iszyzs:false,
+ stop_price_loss:'',
+ stop_price_profit:''
}
},
props: {
@@ -111,6 +142,10 @@
}
},
methods: {
+ clickzyzs(item){
+ this.iszyzs = true
+ this.xzitem = item
+ },
changeIcon() {
this.iconShow = !this.iconShow;
},
@@ -118,7 +153,22 @@
this.$router.push({
path: "/orderDetail?order_no=" + item.order_no
});
+ // this.iszyzs = !this.iszyzs
+ // this.$emit('iszyzs')
},
+ zyzsclick(){
+ console.log(this.xzitem.order_no);
+ var data = {
+ stop_price_loss:this.stop_price_loss,
+ order_no:this.xzitem.order_no,
+ stop_price_profit:this.stop_price_profit,
+ }
+ _getzyzs(data).then((res)=>{
+ this.$toast(this.$t('成功'))
+ this.iszyzs = false
+
+ })
+ },
onSell(order_no) { // 平仓单个
Dialog.confirm({
confirmButtonText: this.$t('确定'),
--
Gitblit v1.9.3