transaction.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. <template>
  2. <view class="content">
  3. <scroll-view scroll-x="true" :scroll-with-animation="true" class="navbar">
  4. <view class="navbar-item" :class="{ current: tabCurrentIndex === index }" v-for="(item, index) in typelist" @click="tabClick(index)">{{ item.name }}</view>
  5. </scroll-view>
  6. <view class="list">
  7. <view class="list-title flex">
  8. <view class="title-left">交易對</view>
  9. <view class="title-center">最新價格</view>
  10. <view class="title-right">24h漲跌</view>
  11. </view>
  12. <scroll-view class="swiper-box" scroll-y="true" :style="{ height: maxheight }">
  13. <view class="list-main flex" v-for="(item, index) in list">
  14. <view class="main-left">{{ item.jyd }}</view>
  15. <view class="main-center" :class="{ down: item.zd < 0, ping: item.zd == 0 }">{{ item.price == 0 ? '--.--' : item.price }}</view>
  16. <view class="main-right">
  17. <view class="btn" :class="{ down: item.zd < 0, ping: item.zd == 0 }">{{ item.zd }}%</view>
  18. </view>
  19. </view>
  20. </scroll-view>
  21. </view>
  22. </view>
  23. </template>
  24. <script>
  25. export default {
  26. onReady(res) {
  27. var _this = this;
  28. uni.getSystemInfo({
  29. success: resu => {
  30. const query = uni.createSelectorQuery();
  31. query.select('.swiper-box').boundingClientRect();
  32. query.exec(function(res) {
  33. _this.maxheight = resu.windowHeight - res[0].top + 'px';
  34. console.log('打印页面的剩余高度', _this.maxheight);
  35. });
  36. },
  37. fail: res => {
  38. console.log('打印页面的剩余高度', res);
  39. }
  40. });
  41. },
  42. data() {
  43. return {
  44. typelist: [{ name: 'USDT市场' }, { name: 'LP市场' }, { name: 'BNB市场' }, { name: 'TP市场' }],
  45. tabCurrentIndex: 0,
  46. maxheight: '',
  47. list: [
  48. { jyd: 'BTC/USDT', price: '0.8431', zd: 1.2 },
  49. { jyd: 'ETH/USDT', price: '0.8431', zd: -1.2 },
  50. { jyd: 'EOS/USDT', price: '0.8431', zd: 1.2 },
  51. { jyd: 'DOGE/USDT', price: '0.8431', zd: 1.2 },
  52. { jyd: 'BCH/USDT', price: '0.8431', zd: 1.2 },
  53. { jyd: 'BTC/USDT', price: '0', zd: 0 },
  54. { jyd: 'BTC/USDT', price: '0.8431', zd: 1.2 },
  55. { jyd: 'BTC/USDT', price: '0.8431', zd: 1.2 },
  56. { jyd: 'BTC/USDT', price: '0.8431', zd: -1.2 },
  57. { jyd: 'BTC/USDT', price: '0.8431', zd: 1.2 },
  58. { jyd: 'BTC/USDT', price: '0.8431', zd: 1.2 },
  59. { jyd: 'BTC/USDT', price: '0.8431', zd: 1.2 },
  60. { jyd: 'BTC/USDT', price: '0.8431', zd: -1.2 },
  61. { jyd: 'BTC/USDT', price: '0.8431', zd: 1.2 },
  62. { jyd: 'BTC/USDT', price: '0.8431', zd: 1.2 },
  63. { jyd: 'BTC/USDT', price: '0.8431', zd: -1.2 },
  64. { jyd: 'BTC/USDT', price: '0.8431', zd: -1.2 },
  65. { jyd: 'BTC/USDT', price: '0.8431', zd: 1.2 }
  66. ]
  67. };
  68. },
  69. onLoad() {},
  70. onShow() {},
  71. methods: {
  72. tabClick(opt) {
  73. this.tabCurrentIndex = opt;
  74. }
  75. }
  76. };
  77. </script>
  78. <style lang="scss">
  79. page,
  80. .content {
  81. height: auto;
  82. min-height: 100%;
  83. background: #f6f6f6;
  84. }
  85. .navbar {
  86. padding-top: 34rpx;
  87. display: flex;
  88. align-items: center;
  89. white-space: nowrap;
  90. height: 100rpx;
  91. .navbar-item {
  92. text-align: center;
  93. display: inline-block;
  94. font-size: 32rpx;
  95. font-family: PingFang SC;
  96. font-weight: 800;
  97. color: #777988;
  98. margin-left: 115rpx;
  99. padding-bottom: 14rpx;
  100. line-height: 1;
  101. &.current {
  102. border-bottom: 3px solid #f7d359;
  103. }
  104. }
  105. }
  106. .list {
  107. background: #ffffff;
  108. border-top-left-radius: 26rpx;
  109. border-top-right-radius: 26rpx;
  110. padding: 40rpx 15rpx 0;
  111. .list-title {
  112. font-size: 28rpx;
  113. font-family: PingFang SC;
  114. font-weight: 500;
  115. color: #525c6e;
  116. padding-bottom: 32rpx;
  117. .title-left {
  118. text-align: left;
  119. width: 33%;
  120. }
  121. .title-center {
  122. text-align: center;
  123. width: 33%;
  124. }
  125. .title-right {
  126. text-align: right;
  127. width: 33%;
  128. }
  129. }
  130. .list-main {
  131. padding: 12rpx 0;
  132. .main-left {
  133. text-align: left;
  134. width: 33%;
  135. font-size: 28rpx;
  136. font-family: PingFang SC;
  137. font-weight: 500;
  138. color: #525c6e;
  139. }
  140. .main-center {
  141. text-align: center;
  142. width: 33%;
  143. font-size: 28rpx;
  144. font-family: PingFang SC;
  145. font-weight: 500;
  146. color: #e15560;
  147. &.down {
  148. color: #5ec886;
  149. }
  150. &.ping {
  151. color: #525c6e;
  152. }
  153. }
  154. .main-right {
  155. text-align: right;
  156. width: 33%;
  157. display: flex;
  158. justify-content: flex-end;
  159. .btn {
  160. width: 122rpx;
  161. height: 63rpx;
  162. background: #e15562;
  163. border-radius: 5rpx;
  164. text-align: center;
  165. line-height: 63rpx;
  166. font-size: 24rpx;
  167. font-family: PingFang SC;
  168. font-weight: 500;
  169. color: #ffffff;
  170. &.down {
  171. background: #5ec886;
  172. }
  173. &.ping {
  174. background: #f6f6f6;
  175. }
  176. }
  177. }
  178. }
  179. }
  180. </style>