|
@@ -18,13 +18,13 @@
|
|
|
<view class="content-item">
|
|
|
<text class="content-lable">开仓价格(USDT)</text>
|
|
|
<view class="content-val">
|
|
|
- {{ content.price }}
|
|
|
+ {{ content.origin_price }}
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="content-item">
|
|
|
<text class="content-lable">标记价格(USDT)</text>
|
|
|
<view class="content-val">
|
|
|
- {{ content.origin_price }}
|
|
|
+ {{ content.update_price }}
|
|
|
</view>
|
|
|
</view>
|
|
|
|
|
@@ -41,7 +41,8 @@
|
|
|
</view>
|
|
|
<view class="restrict-input-box input-type">
|
|
|
<text class="restrict-input" v-show="priceType === 1">市价</text>
|
|
|
- <input class="restrict-input" type="number" v-show="priceType === 2" placeholder-class="placeholder-class" placeholder="请输入委托价">
|
|
|
+ <input class="restrict-input" type="number" v-show="priceType === 2"
|
|
|
+ placeholder-class="placeholder-class" placeholder="请输入委托价">
|
|
|
<text class="restrict-tag">USDT</text>
|
|
|
<view class="restrict-switch" @click.stop="priceType === 1 ? priceType = 2 : priceType = 1">
|
|
|
<text class="restrict-btn">{{ priceType === 1 ? '市价' : '限价' }}</text>
|
|
@@ -52,7 +53,7 @@
|
|
|
<text class="restrict-lable">平仓数量(USDT)</text>
|
|
|
<view class="restrict-btn">
|
|
|
<text class="restrict-nums-text">可平仓位数量(张):</text>
|
|
|
- <text class="restrict-nums">{{ numss }}</text>
|
|
|
+ <text class="restrict-nums">{{ content.number }}</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="restrict-input-box">
|
|
@@ -63,22 +64,26 @@
|
|
|
<step :percent.sync="percent" />
|
|
|
</view>
|
|
|
<view class="content-btns">
|
|
|
- <view class="content-btn cancel-btn" @click.stop="close()">
|
|
|
+ <view class="content-btn cancel-btn" @click.stop="setCloseLeverAll()">
|
|
|
市价全平
|
|
|
</view>
|
|
|
- <view class="content-btn" @click.stop="setLeverStop()">
|
|
|
+ <view class="content-btn" @click.stop="setCloseLever()">
|
|
|
确定
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
+
|
|
|
+
|
|
|
</uni-popup>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import {
|
|
|
- Api_setLeverStop
|
|
|
+ Api_setCloseLever,
|
|
|
+
|
|
|
+ Api_setBatchClose
|
|
|
} from "@/api/index.js"
|
|
|
export default {
|
|
|
|
|
@@ -88,21 +93,23 @@
|
|
|
return {
|
|
|
content: {},
|
|
|
percent: 0,
|
|
|
- numss: 196,
|
|
|
numsk: '',
|
|
|
priceType: 1, // 1 : 市价 2: 限价
|
|
|
// target_profit_price: '',
|
|
|
// stop_loss_price: '',
|
|
|
-
|
|
|
+ unopenInfo: {
|
|
|
+ title: '平仓',
|
|
|
+ content: '如果存在平仓挂单(限价止盈止损),将会在全平前被撤单,确定平仓吗?'
|
|
|
+ }
|
|
|
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
|
|
percent: {
|
|
|
handler(newNum) {
|
|
|
- if (newNum) {
|
|
|
- let num = Math.ceil(this.numss * newNum / 100)
|
|
|
- this.numsk = num > this.numss ? this.numss : num
|
|
|
+ if (newNum && this.content.number) {
|
|
|
+ let num = Math.ceil(this.content.number * newNum / 100)
|
|
|
+ this.numsk = num > this.content.number ? this.content.number : num
|
|
|
} else {
|
|
|
this.numsk = ''
|
|
|
}
|
|
@@ -115,6 +122,9 @@
|
|
|
methods: {
|
|
|
open(item = {}) {
|
|
|
this.content = item;
|
|
|
+ this.percent = 0;
|
|
|
+ this.numsk ='';
|
|
|
+
|
|
|
this.$nextTick(() => {
|
|
|
this.$refs.popupRef.open();
|
|
|
})
|
|
@@ -131,43 +141,78 @@
|
|
|
}
|
|
|
|
|
|
},
|
|
|
+ // const obj = {
|
|
|
+ // title: '市价全平',
|
|
|
+ // closeLeverContent: '如果存在平仓挂单(限价止盈止损),将会在全平前被撤单,确定平仓吗?'
|
|
|
+ // }
|
|
|
|
|
|
|
|
|
+ // <view class="content-btn cancel-btn" @click.stop="setCloseLeverAll()">
|
|
|
+ // 市价全平
|
|
|
+ // </view>
|
|
|
+ // <view class="content-btn" @click.stop="setCloseLever()">
|
|
|
+ // 确定
|
|
|
+ // </view>
|
|
|
+ // 市价全平
|
|
|
+ setCloseLeverAll() {
|
|
|
+ this.unopenInfo = {
|
|
|
+ title: '平仓',
|
|
|
+ content: '如果存在平仓挂单(限价止盈止损),将会在全平前被撤单,确定平仓吗?'
|
|
|
+ };
|
|
|
+ this.$emit('setCloseLeverAll' , this.unopenInfo)
|
|
|
+ // this.$nextTick(() => {
|
|
|
+ // this.$refs.unopenRef.open();
|
|
|
+ // })
|
|
|
|
|
|
+ },
|
|
|
|
|
|
+ setCloseLever() {
|
|
|
+ // id 是 number 订单id
|
|
|
+ // share 否 number 【5-25】张数
|
|
|
+ if (this.numsk && this.numsk <= this.content.number) {
|
|
|
+ this.closeLever({
|
|
|
+ id: this.content.id,
|
|
|
+ share: this.numsk
|
|
|
+ })
|
|
|
|
|
|
+ }
|
|
|
|
|
|
+ },
|
|
|
|
|
|
|
|
|
+ confirm() {
|
|
|
|
|
|
- // confirm() {
|
|
|
- // this.close();
|
|
|
- // this.$emit('confirm')
|
|
|
- // },
|
|
|
- //
|
|
|
- setLeverStop() {
|
|
|
- if (this.content) {
|
|
|
- // 单个持仓修改
|
|
|
- Api_setLeverStop({
|
|
|
- id: this.content.id,
|
|
|
- target_profit_price: this.target_profit_price,
|
|
|
- stop_loss_price: this.stop_loss_price
|
|
|
- }).then(res => {
|
|
|
- this.close();
|
|
|
- this.$emit('setSuccess')
|
|
|
- })
|
|
|
- } else {
|
|
|
- // 全局下单设置
|
|
|
- this.close();
|
|
|
- this.$eventBus.$emit('placeOrder', {
|
|
|
- target_profit_price: this.target_profit_price,
|
|
|
- stop_loss_price: this.stop_loss_price
|
|
|
- });
|
|
|
+ // id 是 number 订单id
|
|
|
+ // share 否 number 【5-25】张数
|
|
|
+ this.closeLever({
|
|
|
+ id: this.content.id,
|
|
|
+ share: this.content.number
|
|
|
+ })
|
|
|
|
|
|
- }
|
|
|
+ },
|
|
|
+
|
|
|
+ closeLever(obj) {
|
|
|
+ uni.showLoading({
|
|
|
+ title: '',
|
|
|
+ mask: true
|
|
|
+ });
|
|
|
+ Api_setCloseLever(obj).then(res => {
|
|
|
+ setTimeout(() => {
|
|
|
+ uni.showToast({
|
|
|
+ icon: 'none',
|
|
|
+ title: '平仓成功'
|
|
|
+ })
|
|
|
+ this.$emit('refreshData')
|
|
|
+ }, 201)
|
|
|
+ }).catch(err => {}).finally(() => {
|
|
|
+ setTimeout(() => {
|
|
|
+ this.close()
|
|
|
+ }, 200)
|
|
|
+ })
|
|
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
@@ -320,6 +365,7 @@
|
|
|
|
|
|
.restrict-switch {
|
|
|
flex-shrink: 0;
|
|
|
+
|
|
|
.iconfont {
|
|
|
font-size: 22rpx;
|
|
|
color: #c29032;
|