|
@@ -21,7 +21,7 @@
|
|
|
</view>
|
|
|
<view class="buttomBox flex">
|
|
|
<view @click="typeIndex=1" class="buttom " :class="{action:typeIndex==1}">
|
|
|
- 上涨
|
|
|
+ 上漲
|
|
|
</view>
|
|
|
<view @click="typeIndex=2" class="buttom " :class="{action:typeIndex==2,'bg-danger':typeIndex==2}">
|
|
|
下跌
|
|
@@ -29,20 +29,20 @@
|
|
|
</view>
|
|
|
<view class="tabType flex ">
|
|
|
<view class="tab" @click="jyType=1" :class="{action:jyType==1}">
|
|
|
- 限价委托
|
|
|
+ 限價委託
|
|
|
</view>
|
|
|
<view class="tab" @click="jyType=2" :class="{action:jyType==2}">
|
|
|
- 市价委托
|
|
|
+ 市價委託
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="inputBox margin-b-20" v-if="jyType==1">
|
|
|
- <input v-model="xzMoney" class="input" placeholder="请输入价格" type="number">
|
|
|
+ <input v-model="xzMoney" class="input" placeholder="請輸入價格" type="number">
|
|
|
</view>
|
|
|
<view class="itemTitle margin-b-20">
|
|
|
- 交易个数
|
|
|
+ 交易個數
|
|
|
</view>
|
|
|
<view class="inputBox flex margin-b-20">
|
|
|
- <input v-model="payNum" class="input" placeholder="请输入交易数量" type="number">
|
|
|
+ <input v-model="payNum" class="input" placeholder="請輸入交易數量" type="number">
|
|
|
<view class="rightInputBox flex">
|
|
|
<image @click="payNum>0?payNum--:false" class="img" src="../../static/icon/hy04.png"
|
|
|
mode="scaleToFill"></image>
|
|
@@ -53,7 +53,7 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="itemTitle margin-b-20">
|
|
|
- 杠杆倍数
|
|
|
+ 槓桿倍數
|
|
|
</view>
|
|
|
<view class="itemLeftList flex margin-b-20">
|
|
|
<view class="ll" @click="changeGG(ind,ls)" :class="{action:ind==ggIndex}"
|
|
@@ -62,27 +62,27 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="inputBox flex margin-b-20">
|
|
|
- <input v-model="ggBs" class="input" placeholder="请输入杠杆倍数" type="number">
|
|
|
+ <input v-model="ggBs" class="input" placeholder="請輸入槓桿倍率" type="number">
|
|
|
</view>
|
|
|
<view class="flex margin-b-20">
|
|
|
<view class="itemTitle">
|
|
|
- 止损价
|
|
|
+ 止損價
|
|
|
</view>
|
|
|
<view class="inputBox flex">
|
|
|
- <input v-model="zsMoney" placeholder="请输入止损价格" class="input" type="number">
|
|
|
+ <input v-model="zsMoney" placeholder="請輸入止損價格" class="input" type="number">
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="flex margin-b-20">
|
|
|
<view class="itemTitle">
|
|
|
- 止盈价
|
|
|
+ 止盈價
|
|
|
</view>
|
|
|
<view class="inputBox flex">
|
|
|
- <input v-model="zyMoney" placeholder="请输入止盈价格" class="input" type="number">
|
|
|
+ <input v-model="zyMoney" placeholder="請輸入止盈價格" class="input" type="number">
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="flex margin-b-20">
|
|
|
<view class="itemTitle">
|
|
|
- 保证金
|
|
|
+ 保證金
|
|
|
</view>
|
|
|
<view class="itemTitle">
|
|
|
0
|
|
@@ -90,7 +90,7 @@
|
|
|
</view>
|
|
|
<view class="flex margin-b-20">
|
|
|
<view class="itemTitle">
|
|
|
- 可用合约余额
|
|
|
+ 可用合約餘額
|
|
|
</view>
|
|
|
<view class="itemTitle">
|
|
|
0
|
|
@@ -98,7 +98,7 @@
|
|
|
</view>
|
|
|
<view class="flex margin-b-20">
|
|
|
<view class="itemTitle">
|
|
|
- 手续费
|
|
|
+ 手續費
|
|
|
</view>
|
|
|
<view class="itemTitle">
|
|
|
0
|
|
@@ -111,10 +111,10 @@
|
|
|
<view class="item padding-l-20">
|
|
|
<view class="itemName flex">
|
|
|
<view class="itemMinName">
|
|
|
- 价格
|
|
|
+ 價格
|
|
|
</view>
|
|
|
<view class="itemMinName">
|
|
|
- 数量
|
|
|
+ 數量
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="itemList">
|
|
@@ -143,84 +143,111 @@
|
|
|
<view class="box margin-t-30 padding-t-30 padding-b-30">
|
|
|
<view class="flex listTitleBox">
|
|
|
<view class="leftBottom flex">
|
|
|
- <view @click="ddTypeChage(1)" class="titleType margin-r-30" :class="{action:ddType==1}">
|
|
|
- 限价委托
|
|
|
+ <view @click="ddTypeChage(0)" class="titleType margin-r-30" :class="{action:ddType==0}">
|
|
|
+ 限價委託
|
|
|
</view>
|
|
|
- <view @click="ddTypeChage(2)" class="titleType" :class="{action:ddType==2}">
|
|
|
- 持仓
|
|
|
+ <view @click="ddTypeChage(1)" class="titleType" :class="{action:ddType==1}">
|
|
|
+ 持倉
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="rightBottom flex">
|
|
|
<image class="img" src="../../static/icon/hy02.png" mode="widthFix"></image>
|
|
|
<view class="more">
|
|
|
- 全部订单
|
|
|
+ 全部訂單
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="usdtList padding-t-30 padding-b-30">
|
|
|
+ <view v-for="(item,ind) in loadData[ddType].list" class="usdtList padding-t-30 padding-b-30">
|
|
|
<view class="flex">
|
|
|
<view class="name">
|
|
|
- <text class="font-color-green">
|
|
|
+ <text v-if="item.direction==1" class="font-color-green">
|
|
|
做多
|
|
|
</text>
|
|
|
+ <text v-if="item.direction==2" class="font-color-red">
|
|
|
+ 做空
|
|
|
+ </text>
|
|
|
<text>
|
|
|
BTC/USDT
|
|
|
</text>
|
|
|
- <text class="font-color-green">
|
|
|
+ <text v-if="ddType==1"
|
|
|
+ :class="{'font-color-green':item.direction==1,'font-color-red':item.direction==2}">
|
|
|
0.00
|
|
|
</text>
|
|
|
</view>
|
|
|
- <view class="usdtListButtom">
|
|
|
- 一键平仓
|
|
|
+ <view @click="clearorder(item)" v-if="ddType==0" class="usdtListButtom">
|
|
|
+ 撤銷
|
|
|
+ </view>
|
|
|
+ <view @click="closeorder(item)" v-if="ddType==1" class="usdtListButtom">
|
|
|
+ 一鍵平倉
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="tip ">
|
|
|
- 开仓时间:2022-11-23 19:10:11
|
|
|
+ <text v-if="item.direction==1">
|
|
|
+ 委託時間:{{item.wttime}}
|
|
|
+ </text>
|
|
|
+ <text v-if="item.direction==2">
|
|
|
+ 開倉時間:{{item.addtime}}
|
|
|
+ </text>
|
|
|
</view>
|
|
|
<view class="flex">
|
|
|
- <view class="tipList">
|
|
|
+ <view v-if="item.direction==1" class="tipList">
|
|
|
+ <view class="nameTip">
|
|
|
+ 限價
|
|
|
+ </view>
|
|
|
+ <view class="text">
|
|
|
+ {{item.wt_price}}
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view v-if="item.direction==2" class="tipList">
|
|
|
<view class="nameTip">
|
|
|
- 开仓单价
|
|
|
+ 開倉單價
|
|
|
</view>
|
|
|
<view class="text">
|
|
|
- 1600000
|
|
|
+ {{item.price}}
|
|
|
</view>
|
|
|
</view>
|
|
|
+
|
|
|
<view class="tipList">
|
|
|
<view class="nameTip">
|
|
|
- 保证金
|
|
|
+ 保證金
|
|
|
</view>
|
|
|
<view class="text">
|
|
|
- 1600000
|
|
|
+ {{item.bond}}
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="tipList">
|
|
|
<view class="nameTip">
|
|
|
- 交易个数
|
|
|
+ 交易個數
|
|
|
</view>
|
|
|
<view class="text">
|
|
|
- 1600000
|
|
|
+ {{item.num}}
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="tipList">
|
|
|
<view class="nameTip">
|
|
|
- 杠杆倍数
|
|
|
+ 槓桿倍數
|
|
|
</view>
|
|
|
<view class="text">
|
|
|
- 1600000
|
|
|
+ {{item.ggan}}
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
-
|
|
|
</view>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+ import {
|
|
|
+ levertadeLaverorder,
|
|
|
+ closeorder,
|
|
|
+ clearorder
|
|
|
+ } from '@/api/heyue.js';
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
+ //保存幣種類型
|
|
|
+ moneytypeList:[],
|
|
|
// 当前选中的杠杆倍数
|
|
|
ggIndex: 0,
|
|
|
ggList: [{
|
|
@@ -248,31 +275,179 @@
|
|
|
zsMoney: 0,
|
|
|
// 止盈价格
|
|
|
zyMoney: 0,
|
|
|
- // 当前查看列表类型
|
|
|
- ddType: 1
|
|
|
+ ddType: 1, //1委托订单2持仓订单3成交订单
|
|
|
+ loadData: [{
|
|
|
+ state: 1,
|
|
|
+ text: '限价委托',
|
|
|
+ loadingType: 'more',
|
|
|
+ list: [],
|
|
|
+ page: 1, //当前页数
|
|
|
+ limit: 10 //每次信息条数
|
|
|
+ },
|
|
|
+ {
|
|
|
+ state: 2,
|
|
|
+ text: '持仓',
|
|
|
+ loadingType: 'more',
|
|
|
+ list: [],
|
|
|
+ page: 1, //当前页数
|
|
|
+ limit: 10 //每次信息条数
|
|
|
+ }
|
|
|
+ ]
|
|
|
}
|
|
|
},
|
|
|
onLoad() {
|
|
|
-
|
|
|
+ this.levertadeLaverorder();
|
|
|
},
|
|
|
onShow() {
|
|
|
|
|
|
},
|
|
|
onReachBottom() {
|
|
|
-
|
|
|
+ this.levertadeLaverorder();
|
|
|
},
|
|
|
onReady() {
|
|
|
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 平倉
|
|
|
+ closeorder(item) {
|
|
|
+ const that = this;
|
|
|
+ uni.showModal({
|
|
|
+ title: '平倉',
|
|
|
+ content: '是否立即平倉,確認後不可修改',
|
|
|
+ success: res => {
|
|
|
+ if (res.confirm) {
|
|
|
+ uni.showLoading({
|
|
|
+ title: '請求中...',
|
|
|
+ mask: true
|
|
|
+ });
|
|
|
+ closeorder({
|
|
|
+ id: item.id
|
|
|
+ }).then((e) => {
|
|
|
+ uni.hideLoading()
|
|
|
+ uni.showToast({
|
|
|
+ title: '平倉成功',
|
|
|
+ icon: 'success'
|
|
|
+ });
|
|
|
+ that.ddTypeInit()
|
|
|
+ }).catch(() => {
|
|
|
+ uni.hideLoading()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fail: () => {},
|
|
|
+ complete: () => {}
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 撤銷
|
|
|
+ clearorder(item) {
|
|
|
+ const that = this;
|
|
|
+ uni.showModal({
|
|
|
+ title: '撤銷',
|
|
|
+ content: '是否立即撤銷,確認後不可修改',
|
|
|
+ success: res => {
|
|
|
+ if (res.confirm) {
|
|
|
+ uni.showLoading({
|
|
|
+ title: '請求中...',
|
|
|
+ mask: true
|
|
|
+ });
|
|
|
+ clearorder({
|
|
|
+ id: item.id
|
|
|
+ }).then((e) => {
|
|
|
+ uni.hideLoading()
|
|
|
+ uni.showToast({
|
|
|
+ title: '撤銷成功',
|
|
|
+ icon: 'success'
|
|
|
+ });
|
|
|
+ that.ddTypeInit()
|
|
|
+ }).catch(() => {
|
|
|
+ uni.hideLoading()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fail: () => {},
|
|
|
+ complete: () => {}
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 获取订单商品
|
|
|
+ levertadeLaverorder(source) {
|
|
|
+ //这里是将订单挂载到tab列表下
|
|
|
+ let index = this.ddType;
|
|
|
+ let navItem = this.loadData[index];
|
|
|
+ let state = navItem.state;
|
|
|
+ if (source === 'tabChange' && navItem.loaded === true) {
|
|
|
+ //tab切换只有第一次需要加载数据
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (navItem.loadingType === 'loading') {
|
|
|
+ //防止重复加载
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (navItem.loadingType === 'noMore') {
|
|
|
+ //防止重复加载
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 修改当前对象状态为加载中
|
|
|
+ navItem.loadingType = 'loading';
|
|
|
+ uni.showLoading({
|
|
|
+ title: '數據加載中',
|
|
|
+ mask: true
|
|
|
+ });
|
|
|
+ levertadeLaverorder({
|
|
|
+ type: state,
|
|
|
+ page: navItem.page,
|
|
|
+ limit: navItem.limit
|
|
|
+ })
|
|
|
+ .then(({
|
|
|
+ list
|
|
|
+ }) => {
|
|
|
+ uni.hideLoading()
|
|
|
+ let arr = list.map(e => {
|
|
|
+ e.direction = +e.direction;
|
|
|
+ e.bond = +e.bond
|
|
|
+ e.price = +e.price
|
|
|
+ e.wt_price = +e.wt_price
|
|
|
+ return e;
|
|
|
+ });
|
|
|
+ navItem.list = navItem.list.concat(arr);
|
|
|
+ navItem.page++;
|
|
|
+ if (navItem.limit == list.length) {
|
|
|
+ //判断是否还有数据, 有改为 more, 没有改为noMore
|
|
|
+ navItem.loadingType = 'more';
|
|
|
+ return;
|
|
|
+ } else {
|
|
|
+ //判断是否还有数据, 有改为 more, 没有改为noMore
|
|
|
+ navItem.loadingType = 'noMore';
|
|
|
+ }
|
|
|
+ this.$set(navItem, 'loaded', true);
|
|
|
+ })
|
|
|
+ .catch(e => {
|
|
|
+ uni.hideLoading()
|
|
|
+ console.log(e);
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ },
|
|
|
// 修改杠杆倍数
|
|
|
changeGG(ind, item) {
|
|
|
this.ggBs = item.num
|
|
|
this.ggIndex = ind
|
|
|
},
|
|
|
- // 查看列表切换类型
|
|
|
+ // 列表切换
|
|
|
ddTypeChage(ind) {
|
|
|
- this.ddType = ind
|
|
|
+ this.ddType = ind;
|
|
|
+ this.levertadeLaverorder('tabChange');
|
|
|
+ },
|
|
|
+ // 初始化重新加載
|
|
|
+ ddTypeInit() {
|
|
|
+ // 初始化數據
|
|
|
+ let item = this.loadData[this.ddType];
|
|
|
+ item.loadingType = 'more';
|
|
|
+ item.list = [];
|
|
|
+ item.page = 1;
|
|
|
+ item.limit = 10;
|
|
|
+ item.loaded = false;
|
|
|
+ this.levertadeLaverorder();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -435,6 +610,7 @@
|
|
|
.listTitleBox {
|
|
|
border-bottom: 1px solid $border-color-light;
|
|
|
align-items: flex-start;
|
|
|
+
|
|
|
.leftBottom {
|
|
|
flex-shrink: 0;
|
|
|
font-size: $font-lg;
|
|
@@ -459,28 +635,35 @@
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- .usdtList{
|
|
|
+
|
|
|
+ .usdtList {
|
|
|
color: #707A8A;
|
|
|
border-bottom: 1px solid $border-color-light;
|
|
|
- .name{
|
|
|
+
|
|
|
+ .name {
|
|
|
font-size: $font-lg;
|
|
|
font-weight: bold;
|
|
|
}
|
|
|
- .usdtListButtom{
|
|
|
+
|
|
|
+ .usdtListButtom {
|
|
|
font-size: $font-base;
|
|
|
- background-color:#F5F5F5 ;
|
|
|
+ background-color: #F5F5F5;
|
|
|
color: $uni-color-warning;
|
|
|
border-radius: 10rpx;
|
|
|
padding: 10rpx 20rpx;
|
|
|
}
|
|
|
- .tip{
|
|
|
+
|
|
|
+ .tip {
|
|
|
padding-top: 10rpx;
|
|
|
padding-bottom: 30rpx;
|
|
|
font-size: $font-base;
|
|
|
}
|
|
|
- .tipList{
|
|
|
+
|
|
|
+ .tipList {
|
|
|
font-size: $font-sm;
|
|
|
- .nameTip{
|
|
|
+ text-align: center;
|
|
|
+
|
|
|
+ .nameTip {
|
|
|
padding-bottom: 20rpx;
|
|
|
}
|
|
|
}
|