details.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472
  1. <template>
  2. <view :rise-fall="stocksColor">
  3. <headContent borderBottom>
  4. <template #left>
  5. <reverse-back>
  6. <template #extend>
  7. <view class="details-nav">
  8. <view class="title-iocn">
  9. <text class="title-iocn-item"></text>
  10. <text class="title-iocn-item"></text>
  11. <text class="title-iocn-item"></text>
  12. </view>
  13. <text class="nav-name">
  14. {{ currencyVal.currency_name }}/ {{ currencyVal.legal_name }}
  15. </text>
  16. </view>
  17. </template>
  18. </reverse-back>
  19. </template>
  20. <template #right>
  21. <headCollect />
  22. </template>
  23. </headContent>
  24. <view class="top-index fixed-top-index" :style="{'top': navBarHeight + 'px'}">
  25. <view :class="['index-val' , $setColor(daymarket.open)]">
  26. <text class="index-val-num color">{{ daymarket.open }}</text>
  27. <text class="index-val-percent color">{{ daymarket.change }}%</text>
  28. </view>
  29. <view class="index-type">
  30. 标记价格 <text class="iconfont">&#xeb6d;</text>
  31. </view>
  32. </view>
  33. <view style="width:100%;height:90rpx;"></view>
  34. <view class="info-content">
  35. <view class="info-item">
  36. <text class="info-lable">标记价格</text>
  37. <text class="info-val">{{ daymarket.now_price }}</text>
  38. </view>
  39. <view class="info-item">
  40. <text class="info-lable">24H高</text>
  41. <text class="info-val">{{ daymarket.high }}</text>
  42. </view>
  43. <view class="info-item">
  44. <text class="info-lable">24H低</text>
  45. <text class="info-val">{{ daymarket.low }}</text>
  46. </view>
  47. <view class="info-item">
  48. <text class="info-lable">24H额(BTC)</text>
  49. <text class="info-val">{{ daymarket.volume }}</text>
  50. </view>
  51. <view class="info-item">
  52. <text class="info-lable">24H量(BTC)</text>
  53. <text class="info-val">{{ daymarket.volume * daymarket.open }}</text>
  54. </view>
  55. </view>
  56. <view class="iframe-content">
  57. <!-- <iframe
  58. :src="`https://doc.okenx.com/biking/kline.html?legal_id=${currencyVal.legal_id}&currency_id=${currencyVal.currency_id}&symbol=${currencyVal.currency_name}/${currencyVal.legal_name}`"
  59. frameborder="0"></iframe> -->
  60. </view>
  61. <gap />
  62. <view class="val-content">
  63. <view class="val-content-lable">
  64. <text @click.stop="valLableIndex = 0" :class="['lable-text' , valLableIndex === 0 ? 'active-lable-text' : '']">交易深度</text>
  65. <text @click.stop="valLableIndex = 1" :class="['lable-text' , valLableIndex === 1 ? 'active-lable-text' : '']">实时成交</text>
  66. </view>
  67. <swiper class="swiper-content" :current="valLableIndex"
  68. :style="{'height': swiperHeight ? `${swiperHeight}px` : '' }" disable-touch>
  69. <swiper-item class="swiper-item-box">
  70. <view class="val-content-type">
  71. <text class="left-type">买</text>
  72. <text class="right-type">卖</text>
  73. </view>
  74. <view class="val-content-list">
  75. <text>数量(张)</text>
  76. <text>价格(USDT)</text>
  77. <text>数量(张)</text>
  78. </view>
  79. <u-list class="swiper-list" :style="{'height': scrollLeftHeight ? `${scrollLeftHeight}px` : '' }">
  80. <view class="depth-content">
  81. <view class="depth-val">
  82. <template v-for="(item , index) in asks">
  83. <view class="depth-item depth-item-left">
  84. <text class="depth-item-bg" :style="{'width': item[2] + '%' }"></text>
  85. <view class="depth-item-val">
  86. <text>{{ item[1] }}</text>
  87. <text class="item-val-price">{{ item[0] }}</text>
  88. </view>
  89. </view>
  90. </template>
  91. </view>
  92. <view class="depth-val">
  93. <template v-for="(item , index) in bids">
  94. <view class="depth-item depth-item-right">
  95. <text class="depth-item-bg" :style="{'width': item[2] + '%' }"></text>
  96. <view class="depth-item-val">
  97. <text class="item-val-price">{{ item[0] }}</text>
  98. <text>{{ item[1] }}</text>
  99. </view>
  100. </view>
  101. </template>
  102. </view>
  103. </view>
  104. </u-list>
  105. </swiper-item>
  106. <swiper-item>
  107. <view class="val-content-list">
  108. <text>时间</text>
  109. <text>价格(USDT)</text>
  110. <text>数量(张)</text>
  111. </view>
  112. <u-list class="swiper-list" :style="{'height': scrollRightHeight ? `${scrollRightHeight}px` : '' }">
  113. <empty />
  114. </u-list>
  115. </swiper-item>
  116. </swiper>
  117. </view>
  118. <view class="details-footer">
  119. <view class="footer-btn" @click.stop="consumeBtn">买入/做多</view>
  120. <view class="footer-btn" @click.stop="consumeBtn">卖出/做空</view>
  121. </view>
  122. </view>
  123. </template>
  124. <script>
  125. import {
  126. mapGetters
  127. } from 'vuex'
  128. export default {
  129. data() {
  130. return {
  131. valLableIndex: 0,
  132. swiperHeight: 0,
  133. scrollLeftHeight: 0,
  134. scrollRightHeight:0
  135. };
  136. },
  137. computed: {
  138. ...mapGetters([
  139. "currencyVal",
  140. "stocksColor",
  141. 'bids',
  142. 'asks',
  143. 'daymarket',
  144. 'tabBarHeight',
  145. 'PageContentHeight',
  146. 'navBarHeight',
  147. 'contractAccount'
  148. ])
  149. },
  150. watch: {
  151. PageContentHeight: {
  152. handler(newH) {
  153. this.swiperHeight = newH - uni.upx2px(90) - uni.upx2px(94)
  154. this.scrollLeftHeight = this.swiperHeight - uni.upx2px(66) - uni.upx2px(60) - uni.upx2px(96)
  155. this.scrollRightHeight = this.swiperHeight - uni.upx2px(60) - uni.upx2px(96)
  156. },
  157. immediate: true
  158. }
  159. },
  160. mounted() {
  161. },
  162. methods:{
  163. consumeBtn(){
  164. const pages = getCurrentPages();
  165. console.log('pages = ' , pages)
  166. if (pages.length >= 2 && pages[pages.length - 2].route === 'pages/contract/index') {
  167. uni.navigateBack({
  168. delta:1
  169. });
  170. } else {
  171. uni.reLaunch({
  172. url:'/pages/contract/index'
  173. })
  174. }
  175. }
  176. }
  177. }
  178. </script>
  179. <style lang="scss" scoped>
  180. .details-nav {
  181. display: flex;
  182. align-items: center;
  183. border-left: 1rpx solid $border-color4;
  184. padding-left: 20rpx;
  185. .nav-name {
  186. padding-left: 10rpx;
  187. font-size: 38rpx;
  188. font-weight: bold;
  189. }
  190. }
  191. .title-iocn {
  192. width: 28rpx;
  193. height: 24rpx;
  194. display: flex;
  195. flex-direction: column;
  196. // align-items: center;
  197. justify-content: space-between;
  198. .title-iocn-item {
  199. width: 100%;
  200. height: 4rpx;
  201. border-radius: 2rpx;
  202. background: #111111;
  203. &:first-child {
  204. width: 50%;
  205. }
  206. }
  207. }
  208. // <view class="top-index fixed-top-index" :style="{'top': navBarHeight + 'px'}">
  209. // <view :class="['index-val' , $setColor(27)]">
  210. // <text class="index-val-num color">27</text>
  211. // <text class="index-val-percent color">0.29%</text>
  212. // </view>
  213. // <view class="index-type">
  214. // 标记价格 <text class="iconfont">&#xeb6d;</text>
  215. // </view>
  216. // </view>
  217. .top-index {
  218. width: 100%;
  219. height: 94rpx;
  220. padding: 16rpx $pages-padding;
  221. border-bottom: 1rpx solid $border-color;
  222. display: flex;
  223. justify-content: space-between;
  224. background-color: #fff;
  225. .index-val-num {
  226. font-size: 30rpx;
  227. font-weight: bold;
  228. }
  229. .index-val-percent{
  230. font-size: 24rpx;
  231. padding-left: 10rpx;
  232. }
  233. .index-type{
  234. width: 240rpx;
  235. height: 100%;
  236. border: 1rpx solid $border-color6;
  237. display: flex;
  238. justify-content: space-between;
  239. align-items: center;
  240. font-size: 24rpx;
  241. padding: 0 20rpx;
  242. border-radius: 10rpx;
  243. .iconfont{
  244. font-size: 20rpx;
  245. color: $Theme-Color;
  246. }
  247. }
  248. }
  249. .fixed-top-index {
  250. position: fixed;
  251. z-index: 1;
  252. left: 0;
  253. }
  254. .iframe-content {
  255. width: 100%;
  256. height: 660rpx;
  257. iframe {
  258. width: 100%;
  259. height: 100%;
  260. }
  261. }
  262. .info-content {
  263. display: flex;
  264. align-items: stretch;
  265. flex-wrap: wrap;
  266. padding: 26rpx $pages-padding 0;
  267. border-bottom: 1rpx solid $border-color;
  268. .info-item {
  269. min-height: 70rpx;
  270. width: calc(100% / 3);
  271. flex-shrink: 0;
  272. display: flex;
  273. flex-direction: column;
  274. font-size: 20rpx;
  275. margin-bottom: 26rpx;
  276. display: flex;
  277. flex-direction: column;
  278. justify-content: space-between;
  279. &:nth-child(3n),
  280. &:nth-child(3n - 1) {
  281. text-align: right;
  282. }
  283. }
  284. }
  285. .val-content {
  286. width: 100%;
  287. .val-content-lable {
  288. width: 100%;
  289. display: flex;
  290. align-items: stretch;
  291. padding: 0 $pages-padding;
  292. height: 96rpx;
  293. border-bottom: 1rpx solid $border-color;
  294. .lable-text {
  295. height: 100%;
  296. font-size: 28rpx;
  297. line-height: 90rpx;
  298. margin-right: 50rpx;
  299. }
  300. .active-lable-text {
  301. position: relative;
  302. color: $Theme-Color;
  303. &::before {
  304. content: '';
  305. position: absolute;
  306. left: 50%;
  307. bottom: 0;
  308. transform: translateX(-50%);
  309. width: 40rpx;
  310. height: 7rpx;
  311. border-radius: 4rpx;
  312. background-color: $Theme-Color;
  313. }
  314. }
  315. }
  316. .val-content-type {
  317. width: 100%;
  318. height: 66rpx;
  319. border-bottom: 1rpx solid $border-color;
  320. display: flex;
  321. align-items: center;
  322. justify-content: space-between;
  323. padding: 0 $pages-padding;
  324. font-size: 28rpx;
  325. font-weight: bold;
  326. .left-type {
  327. color: $mai_01;
  328. }
  329. .right-type {
  330. color: $mai_02;
  331. }
  332. }
  333. .val-content-list {
  334. width: 100%;
  335. padding: 0 $pages-padding;
  336. display: flex;
  337. justify-content: space-between;
  338. align-items: center;
  339. height: 60rpx;
  340. font-size: 26rpx;
  341. }
  342. .depth-content {
  343. padding: 0 $pages-padding;
  344. width: 100%;
  345. display: flex;
  346. .depth-val {
  347. width: 50%;
  348. flex-shrink: 0;
  349. .depth-item {
  350. height: 80rpx;
  351. position: relative;
  352. .depth-item-bg {
  353. height: 100%;
  354. position: absolute;
  355. top: 0;
  356. }
  357. .depth-item-val {
  358. position: absolute;
  359. width: 100%;
  360. height: 100%;
  361. font-size: 26rpx;
  362. display: flex;
  363. justify-content: space-between;
  364. align-items: center;
  365. font-weight: bold;
  366. }
  367. }
  368. .depth-item-left {
  369. .depth-item-val {
  370. padding-right: 10rpx;
  371. }
  372. .depth-item-bg {
  373. right: 0;
  374. background-color: $mai_03;
  375. }
  376. .item-val-price {
  377. color: $Theme-Color;
  378. }
  379. }
  380. .depth-item-right {
  381. .depth-item-val {
  382. padding-left: 10rpx;
  383. }
  384. .depth-item-bg {
  385. left: 0;
  386. background-color: $mai_04;
  387. }
  388. .item-val-price {
  389. color: $Theme-Color2;
  390. }
  391. }
  392. }
  393. }
  394. }
  395. .details-footer {
  396. position: fixed;
  397. left: 0;
  398. bottom: 0;
  399. height: 90rpx;
  400. width: 100%;
  401. padding: 5rpx 40rpx;
  402. display: flex;
  403. justify-content: space-between;
  404. align-items: stretch;
  405. background-color: #fff;
  406. .footer-btn {
  407. flex: 1;
  408. height: 80rpx;
  409. color: #fff;
  410. text-align: center;
  411. line-height: 80rpx;
  412. font-size: 30rpx;
  413. border-radius: 6rpx;
  414. &:first-child {
  415. background-color: $Theme-Color;
  416. }
  417. &:last-child {
  418. margin-left: 20rpx;
  419. background-color: $Theme-Color2;
  420. }
  421. }
  422. }
  423. </style>