123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672 |
- <template>
- <view class="content">
- <view class="usdtTitle flex">
- <view class="left flex">
- <image class="img margin-r-10" src="../../static/icon/hy02.png" mode="widthFix"></image>
- <view class="margin-r-10">
- BTC/USDT
- </view>
- <view class="font-color-green">
- 10086
- </view>
- </view>
- <view class="right">
- <image class="img" src="../../static/icon/hy01.png" mode="widthFix"></image>
- </view>
- </view>
- <view class="box flex padding-t-20 padding-b-30">
- <view class="item">
- <view class="itemTitle margin-b-20">
- 交易方向
- </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}">
- 下跌
- </view>
- </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">
- </view>
- <view class="itemTitle margin-b-20">
- 交易個數
- </view>
- <view class="inputBox flex margin-b-20">
- <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>
- <view class="jg">
- </view>
- <image @click="payNum++" class="img" src="../../static/icon/hy03.png" mode="scaleToFill">
- </image>
- </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}"
- v-for="(ls,ind) in ggList">
- {{ls.num}}
- </view>
- </view>
- <view class="inputBox flex margin-b-20">
- <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">
- </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">
- </view>
- </view>
- <view class="flex margin-b-20">
- <view class="itemTitle">
- 保證金
- </view>
- <view class="itemTitle">
- 0
- </view>
- </view>
- <view class="flex margin-b-20">
- <view class="itemTitle">
- 可用合約餘額
- </view>
- <view class="itemTitle">
- 0
- </view>
- </view>
- <view class="flex margin-b-20">
- <view class="itemTitle">
- 手續費
- </view>
- <view class="itemTitle">
- 0
- </view>
- </view>
- <view class="buttomSubmit" :class="{'bg-success':typeIndex==1,'bg-danger':typeIndex==2}">
- {{typeIndex==1?'做多':'做空'}}
- </view>
- </view>
- <view class="item padding-l-20">
- <view class="itemName flex">
- <view class="itemMinName">
- 價格
- </view>
- <view class="itemMinName">
- 數量
- </view>
- </view>
- <view class="itemList">
- <view class="list flex font-color-green">
- <view class="li top">
- 166666
- </view>
- <view class="li top">
- 0000.00
- </view>
- </view>
- <view class="llMax font-color-green">
- 10086
- </view>
- <view class="list flex font-color-red">
- <view class="li bottom">
- 166666
- </view>
- <view class="li bottom">
- 0000.00
- </view>
- </view>
- </view>
- </view>
- </view>
- <view class="box margin-t-30 padding-t-30 padding-b-30">
- <view class="flex listTitleBox">
- <view class="leftBottom flex">
- <view @click="ddTypeChage(0)" class="titleType margin-r-30" :class="{action:ddType==0}">
- 限價委託
- </view>
- <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 v-for="(item,ind) in loadData[ddType].list" class="usdtList padding-t-30 padding-b-30">
- <view class="flex">
- <view class="name">
- <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 v-if="ddType==1"
- :class="{'font-color-green':item.direction==1,'font-color-red':item.direction==2}">
- 0.00
- </text>
- </view>
- <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 ">
- <text v-if="item.direction==1">
- 委託時間:{{item.wttime}}
- </text>
- <text v-if="item.direction==2">
- 開倉時間:{{item.addtime}}
- </text>
- </view>
- <view class="flex">
- <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">
- {{item.price}}
- </view>
- </view>
- <view class="tipList">
- <view class="nameTip">
- 保證金
- </view>
- <view class="text">
- {{item.bond}}
- </view>
- </view>
- <view class="tipList">
- <view class="nameTip">
- 交易個數
- </view>
- <view class="text">
- {{item.num}}
- </view>
- </view>
- <view class="tipList">
- <view class="nameTip">
- 槓桿倍數
- </view>
- <view class="text">
- {{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: [{
- num: 5
- }, {
- num: 10
- }, {
- num: 20
- }, {
- num: 50
- }, {
- num: 100
- }],
- //当前选中的交易类别
- typeIndex: 1,
- // 交易类型
- jyType: 1,
- //交易数量
- payNum: 0,
- // 杠杆倍数
- ggBs: 0,
- // 限价委托价格
- xzMoney: 0,
- // 止损价格
- zsMoney: 0,
- // 止盈价格
- zyMoney: 0,
- 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.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();
- }
- }
- }
- </script>
- <style lang="scss">
- .usdtTitle,
- .box {
- padding: 0 20rpx;
- width: 750rpx;
- background-color: #FFFFFF;
- }
- .usdtTitle {
- border-bottom: 1px solid $border-color-light;
- line-height: 1;
- .left {
- font-size: 32rpx;
- font-weight: bold;
- .img {
- width: 36rpx;
- }
- }
- .right {
- .img {
- width: 48rpx;
- }
- }
- }
- .box {
- line-height: 1;
- align-items: flex-start;
- .itemTitle {
- font-weight: bold;
- font-size: $font-sm;
- }
- .item {
- flex-grow: 1;
- flex-shrink: 0;
- }
- .buttomBox {
- font-size: $font-sm;
- .buttom {
- width: 200rpx;
- padding: 20rpx 0;
- text-align: center;
- border-radius: 10rpx;
- background-color: #F5F5F5;
- &.action {
- color: #FFFFFF;
- background-color: $color-green;
- }
- }
- }
- .tabType {
- justify-content: space-around;
- .tab {
- padding-top: 30rpx;
- padding-bottom: 20rpx;
- color: #545D6F;
- font-size: $font-sm;
- font-weight: bold;
- &.action {
- color: $uni-color-warning;
- }
- }
- }
- .inputBox {
- height: 60rpx;
- border-radius: 10rpx;
- padding: 0 20rpx;
- display: flex;
- align-items: center;
- border: 1px solid $border-color-light;
- .input {
- font-size: $font-sm;
- flex-grow: 1;
- }
- .rightInputBox {
- .jg {
- border: 1px solid $border-color-light;
- height: 50rpx;
- margin: 0 30rpx;
- }
- .img {
- width: 28rpx;
- height: 28rpx;
- }
- }
- }
- .itemLeftList {
- justify-content: space-around;
- .ll {
- border: 1px solid $border-color-light;
- width: 74rpx;
- height: 54rpx;
- line-height: 54rpx;
- text-align: center;
- font-size: $font-sm;
- font-weight: bold;
- &.action {
- background-color: #F5F5F5;
- }
- }
- }
- .buttomSubmit {
- color: #FFFFFF;
- height: 64rpx;
- line-height: 64rpx;
- text-align: center;
- font-size: $font-sm;
- border-radius: 10rpx;
- }
- .itemName {
- padding-bottom: 20rpx;
- .itemMinName {
- font-size: 22rpx;
- color: #5D6677;
- }
- }
- .itemList {
- .list {
- font-size: 20rpx;
- padding: 10rpx 0;
- }
- .llMax {
- padding: 30rpx 0;
- font-weight: bold;
- font-size: $font-lg;
- }
- }
- .listTitleBox {
- border-bottom: 1px solid $border-color-light;
- align-items: flex-start;
- .leftBottom {
- flex-shrink: 0;
- font-size: $font-lg;
- font-weight: bold;
- .action {
- border-bottom: 2px solid $uni-color-warning;
- }
- .titleType {
- padding-bottom: 20rpx;
- }
- }
- .rightBottom {
- font-size: $font-base;
- color: #707A8A;
- flex-shrink: 0;
- .img {
- width: 36rpx;
- }
- }
- }
- .usdtList {
- color: #707A8A;
- border-bottom: 1px solid $border-color-light;
- .name {
- font-size: $font-lg;
- font-weight: bold;
- }
- .usdtListButtom {
- font-size: $font-base;
- background-color: #F5F5F5;
- color: $uni-color-warning;
- border-radius: 10rpx;
- padding: 10rpx 20rpx;
- }
- .tip {
- padding-top: 10rpx;
- padding-bottom: 30rpx;
- font-size: $font-base;
- }
- .tipList {
- font-size: $font-sm;
- text-align: center;
- .nameTip {
- padding-bottom: 20rpx;
- }
- }
- }
- }
- </style>
|