123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481 |
- <template>
- <view :rise-fall="stocksColor">
- <headContent borderBottom>
- <template #left>
- <reverse-back>
- <template #extend>
- <view class="details-nav">
- <view class="title-iocn">
- <text class="title-iocn-item"></text>
- <text class="title-iocn-item"></text>
- <text class="title-iocn-item"></text>
- </view>
- <text class="nav-name">
- {{ currencyVal.currency_name }}/ {{ currencyVal.legal_name }}
- </text>
- </view>
- </template>
- </reverse-back>
- </template>
- <template #right>
- <headCollect />
- </template>
- </headContent>
- <view class="top-index fixed-top-index" :style="{'top': navBarHeight + 'px'}">
- <view :class="['index-val' , $setColor(daymarket.open)]">
- <text class="index-val-num color">{{ daymarket.open }}</text>
- <text class="index-val-percent color">{{ daymarket.change }}%</text>
- </view>
- <view class="index-type">
- 标记价格 <text class="iconfont"></text>
- </view>
- </view>
- <view style="width:100%;height:90rpx;"></view>
- <view class="info-content">
- <view class="info-item">
- <text class="info-lable">标记价格</text>
- <text class="info-val">{{ daymarket.now_price }}</text>
- </view>
- <view class="info-item">
- <text class="info-lable">24H高</text>
- <text class="info-val">{{ daymarket.high }}</text>
- </view>
- <view class="info-item">
- <text class="info-lable">24H低</text>
- <text class="info-val">{{ daymarket.low }}</text>
- </view>
- <view class="info-item">
- <text class="info-lable">24H额(BTC)</text>
- <text class="info-val">{{ daymarket.volume }}</text>
- </view>
- <view class="info-item">
- <text class="info-lable">24H量(BTC)</text>
- <text class="info-val">{{ daymarket.volume * daymarket.open }}</text>
- </view>
- </view>
- <view class="iframe-content">
- <template v-if="currencyVal.legal_id">
- <k-line></k-line>
- </template>
- </view>
- <gap />
- <view class="val-content">
- <view class="val-content-lable">
- <text @click.stop="valLableIndex = 0"
- :class="['lable-text' , valLableIndex === 0 ? 'active-lable-text' : '']">交易深度</text>
- <text @click.stop="valLableIndex = 1"
- :class="['lable-text' , valLableIndex === 1 ? 'active-lable-text' : '']">实时成交</text>
- </view>
- <swiper class="swiper-content" :current="valLableIndex"
- :style="{'height': swiperHeight ? `${swiperHeight}px` : '' }" disable-touch>
- <swiper-item class="swiper-item-box">
- <view class="val-content-type">
- <text class="left-type">买</text>
- <text class="right-type">卖</text>
- </view>
- <view class="val-content-list">
- <text>数量(张)</text>
- <text>价格(USDT)</text>
- <text>数量(张)</text>
- </view>
- <u-list class="swiper-list" :style="{'height': scrollLeftHeight ? `${scrollLeftHeight}px` : '' }">
- <view class="depth-content">
- <view class="depth-val">
- <template v-for="(item , index) in asks">
- <market-depth :type="2" :val="item" height="80rpx"></market-depth>
- <!-- <view class="depth-item depth-item-left">
- <text class="depth-item-bg" :style="{'width': item[2] + '%' }"></text>
- <view class="depth-item-val">
- <text>{{ item[1] }}</text>
- <text class="item-val-price">{{ item[0] }}</text>
- </view>
- </view> -->
- </template>
- </view>
- <view class="depth-val">
- <template v-for="(item , index) in bids">
- <market-depth :type="1" :val="item" height="80rpx" leftbg></market-depth>
- </template>
- </view>
- </view>
- </u-list>
- </swiper-item>
- <swiper-item>
- <view class="val-content-list">
- <text>时间</text>
- <text>价格(USDT)</text>
- <text>数量(张)</text>
- </view>
- <u-list class="swiper-list" :style="{'height': scrollRightHeight ? `${scrollRightHeight}px` : '' }">
- <empty />
- </u-list>
- </swiper-item>
- </swiper>
- </view>
- <view class="details-footer">
- <view class="footer-btn" @click.stop="consumeBtn">买入/做多</view>
- <view class="footer-btn" @click.stop="consumeBtn">卖出/做空</view>
- </view>
- </view>
- </template>
- <script>
- import {
- mapGetters
- } from 'vuex'
- import {
- startSocket,
- closeSocket
- } from "@/utils/websocket.js"
- export default {
- data() {
- return {
- valLableIndex: 0,
- swiperHeight: 0,
- scrollLeftHeight: 0,
- scrollRightHeight: 0
- };
- },
- computed: {
- ...mapGetters([
- "currencyVal",
- "stocksColor",
- 'bids',
- 'asks',
- 'daymarket',
- 'tabBarHeight',
- 'PageContentHeight',
- 'navBarHeight',
- 'contractAccount'
- ])
- },
- watch: {
- PageContentHeight: {
- handler(newH) {
- this.swiperHeight = newH - uni.upx2px(90) - uni.upx2px(94)
- this.scrollLeftHeight = this.swiperHeight - uni.upx2px(66) - uni.upx2px(60) - uni.upx2px(96)
- this.scrollRightHeight = this.swiperHeight - uni.upx2px(60) - uni.upx2px(96)
- },
- immediate: true
- }
- },
- onShow() {
- this.setSocket();
- },
- onHide() {
- closeSocket()
- },
- mounted() {
- },
- methods: {
- setSocket() {
- startSocket();
- },
- consumeBtn() {
- const pages = getCurrentPages();
- console.log('pages = ', pages)
- if (pages.length >= 2 && pages[pages.length - 2].route === 'pages/contract/index') {
- uni.navigateBack({
- delta: 1
- });
- } else {
- uni.reLaunch({
- url: '/pages/contract/index'
- })
- }
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .details-nav {
- display: flex;
- align-items: center;
- border-left: 1rpx solid $border-color4;
- padding-left: 20rpx;
- .nav-name {
- padding-left: 10rpx;
- font-size: 38rpx;
- font-weight: bold;
- }
- }
- .title-iocn {
- width: 28rpx;
- height: 24rpx;
- display: flex;
- flex-direction: column;
- // align-items: center;
- justify-content: space-between;
- .title-iocn-item {
- width: 100%;
- height: 4rpx;
- border-radius: 2rpx;
- background: #111111;
- &:first-child {
- width: 50%;
- }
- }
- }
- // <view class="top-index fixed-top-index" :style="{'top': navBarHeight + 'px'}">
- // <view :class="['index-val' , $setColor(27)]">
- // <text class="index-val-num color">27</text>
- // <text class="index-val-percent color">0.29%</text>
- // </view>
- // <view class="index-type">
- // 标记价格 <text class="iconfont"></text>
- // </view>
- // </view>
- .top-index {
- width: 100%;
- height: 94rpx;
- padding: 16rpx $pages-padding;
- border-bottom: 1rpx solid $border-color;
- display: flex;
- justify-content: space-between;
- background-color: #fff;
- .index-val-num {
- font-size: 30rpx;
- font-weight: bold;
- }
- .index-val-percent {
- font-size: 24rpx;
- padding-left: 10rpx;
- }
- .index-type {
- width: 240rpx;
- height: 100%;
- border: 1rpx solid $border-color6;
- display: flex;
- justify-content: space-between;
- align-items: center;
- font-size: 24rpx;
- padding: 0 20rpx;
- border-radius: 10rpx;
- .iconfont {
- font-size: 20rpx;
- color: $Theme-Color;
- }
- }
- }
- .fixed-top-index {
- position: fixed;
- z-index: 1;
- left: 0;
- }
- .iframe-content {
- width: 100%;
- height: 660rpx;
- }
- .info-content {
- display: flex;
- align-items: stretch;
- flex-wrap: wrap;
- padding: 26rpx $pages-padding 0;
- border-bottom: 1rpx solid $border-color;
- .info-item {
- min-height: 70rpx;
- width: calc(100% / 3);
- flex-shrink: 0;
- display: flex;
- flex-direction: column;
- font-size: 20rpx;
- margin-bottom: 26rpx;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- &:nth-child(3n),
- &:nth-child(3n - 1) {
- text-align: right;
- }
- }
- }
- .val-content {
- width: 100%;
- .val-content-lable {
- width: 100%;
- display: flex;
- align-items: stretch;
- padding: 0 $pages-padding;
- height: 96rpx;
- border-bottom: 1rpx solid $border-color;
- .lable-text {
- height: 100%;
- font-size: 28rpx;
- line-height: 90rpx;
- margin-right: 50rpx;
- }
- .active-lable-text {
- position: relative;
- color: $Theme-Color;
- &::before {
- content: '';
- position: absolute;
- left: 50%;
- bottom: 0;
- transform: translateX(-50%);
- width: 40rpx;
- height: 7rpx;
- border-radius: 4rpx;
- background-color: $Theme-Color;
- }
- }
- }
- .val-content-type {
- width: 100%;
- height: 66rpx;
- border-bottom: 1rpx solid $border-color;
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 0 $pages-padding;
- font-size: 28rpx;
- font-weight: bold;
- .left-type {
- color: $mai_01;
- }
- .right-type {
- color: $mai_02;
- }
- }
- .val-content-list {
- width: 100%;
- padding: 0 $pages-padding;
- display: flex;
- justify-content: space-between;
- align-items: center;
- height: 60rpx;
- font-size: 26rpx;
- }
- .depth-content {
- padding: 0 $pages-padding;
- width: 100%;
- display: flex;
- .depth-val {
- width: 50%;
- flex-shrink: 0;
- .depth-item {
- height: 80rpx;
- position: relative;
- .depth-item-bg {
- height: 100%;
- position: absolute;
- top: 0;
- }
- .depth-item-val {
- position: absolute;
- width: 100%;
- height: 100%;
- font-size: 26rpx;
- display: flex;
- justify-content: space-between;
- align-items: center;
- font-weight: bold;
- }
- }
- .depth-item-left {
- .depth-item-val {
- padding-right: 10rpx;
- }
- .depth-item-bg {
- right: 0;
- background-color: $mai_03;
- }
- .item-val-price {
- color: $Theme-Color;
- }
- }
- .depth-item-right {
- .depth-item-val {
- padding-left: 10rpx;
- }
- .depth-item-bg {
- left: 0;
- background-color: $mai_04;
- }
- .item-val-price {
- color: $Theme-Color2;
- }
- }
- }
- }
- }
- .details-footer {
- position: fixed;
- left: 0;
- bottom: 0;
- height: 90rpx;
- width: 100%;
- padding: 5rpx 40rpx;
- display: flex;
- justify-content: space-between;
- align-items: stretch;
- background-color: #fff;
- .footer-btn {
- flex: 1;
- height: 80rpx;
- color: #fff;
- text-align: center;
- line-height: 80rpx;
- font-size: 30rpx;
- border-radius: 6rpx;
- &:first-child {
- background-color: $Theme-Color;
- }
- &:last-child {
- margin-left: 20rpx;
- background-color: $Theme-Color2;
- }
- }
- }
- </style>
|