123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369 |
- <template>
- <view class="content">
- <view class="flex navbar">
- <view class="" v-for="(item,index) in navList" :class="{'action':current == index}" @click="changetab(index)">
- {{item.name}}
- </view>
- </view>
- <swiper class="swiper" :style="{'height': height}" :current="current">
- <swiper-item v-for="navitem in navList">
- <scroll-view scroll-y="true" class="scroll" :style="{'height': height}">
- <view v-for="(item,ind) in navitem.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>
- {{item.symbol}}
- </text>
- <text v-if="current==0"
- :class="{'font-color-green':+item.profit>=0,'font-color-red':+item.profit<0}">
- {{+item.profit}}
- </text>
- </view>
- <view @click="clearorder(item)" v-if="current==0" class="usdtListButtom">
- 撤銷
- </view>
- <view @click="closeorder(item)" v-if="current==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" style="flex-wrap: wrap;justify-content: flex-start;">
- <view v-if="current == 0" class="tipList">
- <view class="nameTip">
- 限價
- </view>
- <view class="text">
- {{item.wt_price}}
- </view>
- </view>
- <view v-if="current != 0" class="tipList">
- <view class="nameTip">
- 開倉單價
- </view>
- <view class="text">
- {{item.price}}
- </view>
- </view>
- <view class="tipList" v-if="current == 2">
- <view class="nameTip">
- 平倉單價
- </view>
- <view class="text">
- {{item.pc_price}}
- </view>
- </view>
- <view class="tipList">
- <view class="nameTip">
- {{current == 0?'委托手數': '交易個數'}}
- </view>
- <view class="text">
- {{item.num}}
- </view>
- </view>
- <view class="tipList">
- <view class="nameTip">
- 槓桿倍數
- </view>
- <view class="text">
- {{item.ggan}}
- </view>
- </view>
- <template v-if="current == 1">
- <view class="tipList">
- <view class="nameTip">
- 止盈單價
- </view>
- <view class="text">
- {{item.zyprice}}
- </view>
- </view>
- <view class="tipList">
- <view class="nameTip">
- 止損單價
- </view>
- <view class="text">
- {{item.zsprice}}
- </view>
- </view>
- </template>
- <view class="tipList" v-if="current != 0">
- <view class="nameTip">
- 手續費
- </view>
- <view class="text">
- {{item.fee}}
- </view>
- </view>
- <template v-if="current == 2">
- <view class="tipList" >
- <view class="nameTip">
- 盈虧狀態
- </view>
- <view class="text" :style="{'color': item.yk_status == 1?'#5DC887':'#dd524d'}">
- {{item.yk_status == 1?'盈利':'虧損'}}
- </view>
- </view>
- <view class="tipList">
- <view class="nameTip">
- 盈虧金額
- </view>
- <view class="text" :style="{'color': item.yk_status == 1?'#5DC887':'#dd524d'}">
- {{item.yk_status == 1?'+':'-'}}{{item.ylmoney}}
- </view>
- </view>
- </template>
-
- </view>
- </view>
- </scroll-view>
- </swiper-item>
- </swiper>
- </view>
- </template>
- <script>
- import {
- levertadeLaverorder,
- closeorder,
- clearorder,
- UpOrderHandle,
- bond
- } from '@/api/heyue.js';
- export default {
- data() {
- return {
- height: '',
- current: 0,
- navList: [{
- status: 1,
- name: '全部委托',
- page: 1,
- limit: 10,
- loadingType: 'more',
- loded: false,
- list: []
- },
- {
- status: 2,
- name: '全部持倉',
- page: 1,
- limit: 10,
- loadingType: 'more',
- loded: false,
- list: []
- },
- {
- status: 3,
- name: '成交明細',
- page: 1,
- limit: 10,
- loadingType: 'more',
- loded: false,
- list: []
- }
- ]
- }
- },
- onLoad() {
- },
- onShow() {
- this.loadData()
- },
- onReachBottom() {
- },
- onReady(res) {
- var obj = this;
- uni.getSystemInfo({
- success: resu => {
- const query = uni.createSelectorQuery();
- query.select('.swiper').boundingClientRect();
- query.exec(function(res) {
- obj.height = resu.windowHeight - res[0].top + 'px';
- });
- },
- fail: res => {}
- });
- },
- methods: {
- changetab(index) {
- this.current = index
- this.loadData('tab')
- },
- loadData(tab) {
- let obj = this
- let index = obj.current
- let item = obj.navList[index]
- if (tab == 'tab' && item.loaded) {
- return
- }
- if (item.loadingType == 'loading' || item.loadingType == 'noMore') {
- return
- }
- levertadeLaverorder({
- type: item.status,
- page: item.page,
- limit: item.limit
- })
- .then(({
- list
- }) => {
- // uni.hideLoading()
- console.log(list,'list+++++++')
- 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;
- });
- item.list = arr;
- this.$set(item, 'loaded', true);
- })
- .catch(e => {
- // uni.hideLoading()
- console.log(e);
- });
- },
- // 平倉
- closeorder(item) {
- const that = this;
- uni.showModal({
- title: '平倉',
- content: '是否立即平倉,確認後不可修改',
- confirmText: '確認',
- cancelText: '取消',
- 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: '是否立即撤銷,確認後不可修改',
- confirmText: '確認',
- 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: () => {}
- });
- },
- }
- }
- </script>
- <style lang="scss">
- .swiper {
- background-color: #fff;
- }
- .scroll {
- padding: 0 20rpx;
- }
- .navbar {
- justify-content: flex-start;
- font-size: 40rpx;
- padding: 30rpx;
- view {
- width: 184rpx;
- height: 100rpx;
- line-height: 100rpx;
- }
- }
- .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;
- width: 25%;
- max-width: 33%;
- padding-top: 20rpx;
- flex-grow: 1;
- .nameTip {
- padding-bottom: 20rpx;
- }
- }
- }
- .action {
- font-weight: bold;
- font-size: 44rpx;
- }
- </style>
|