marketplace.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. <template>
  2. <uni-table class="table-box" emptyText="暂无更多数据">
  3. <!-- 表头行 -->
  4. <uni-tr>
  5. <uni-th>
  6. <view class="table-th">
  7. 交易对
  8. </view>
  9. </uni-th>
  10. <uni-th >
  11. <view class="table-th table-th-title" @click.stop="alterRankRule(`rankRule`)">
  12. <text>最新价</text>
  13. <view class="title-arrows">
  14. <image class="arrows-icon" :src="rankRule === 1 ? activeRankRuleIcon : rankRuleIcon"
  15. mode="aspectFit"></image>
  16. <image class="arrows-icon" :src="rankRule === 2 ? activeRankRuleIcon : rankRuleIcon"
  17. mode="aspectFit"></image>
  18. </view>
  19. </view>
  20. </uni-th>
  21. <uni-th >
  22. <view class="table-th table-th-title" @click.stop="alterRankRule(`rankRule`)">
  23. <text>日涨跌</text>
  24. <view class="title-arrows">
  25. <image class="arrows-icon" :src="rankRule === 1 ? activeRankRuleIcon : rankRuleIcon"
  26. mode="aspectFit"></image>
  27. <image class="arrows-icon" :src="rankRule === 2 ? activeRankRuleIcon : rankRuleIcon"
  28. mode="aspectFit"></image>
  29. </view>
  30. </view>
  31. </uni-th>
  32. </uni-tr>
  33. <!-- 表格数据行 -->
  34. <uni-tr v-for="item in 30" :rise-fall="stocksColor">
  35. <uni-td>
  36. <view class="table-title">
  37. <view class="title">
  38. <text>BTC</text>
  39. <text class="title-sub">/USDT</text>
  40. </view>
  41. <view class="title-num">
  42. 24H额:476.62m
  43. </view>
  44. </view>
  45. </uni-td>
  46. <uni-td>
  47. <view class="title">
  48. <view class="">
  49. 30188.2
  50. </view>
  51. <view class="title-num">
  52. ¥207695.01
  53. </view>
  54. </view>
  55. </uni-td>
  56. <uni-td class="table-right">
  57. <view :class="['table-btn' , item % 2 ? 'fall-btn' : 'rise-btn']">
  58. +0.03%
  59. </view>
  60. </uni-td>
  61. </uni-tr>
  62. </uni-table>
  63. </template>
  64. <script>
  65. import {
  66. mapGetters
  67. } from 'vuex'
  68. export default {
  69. name: "marketplace",
  70. data() {
  71. return {
  72. rankRule: 0,
  73. rankRuleIcon: require("@/static/images/jiantou.png"),
  74. activeRankRuleIcon: require("@/static/images/jiantou_01.png")
  75. };
  76. },
  77. computed: {
  78. ...mapGetters([
  79. 'stocksColor'
  80. ]),
  81. },
  82. methods: {
  83. alterRankRule(rankRule) {
  84. console.log('alterRankRule' , rankRule)
  85. switch (this['rankRule']) {
  86. case 0:
  87. this['rankRule'] = 1;
  88. break;
  89. case 1:
  90. this['rankRule'] = 2;
  91. break;
  92. default:
  93. this['rankRule'] = 0
  94. }
  95. }
  96. }
  97. }
  98. </script>
  99. <style lang="scss" scoped>
  100. .table-box {
  101. ::v-deep .uni-table-tr {
  102. display: flex;
  103. .uni-table-th,
  104. .uni-table-td {
  105. padding: 0;
  106. flex-shrink: 0;
  107. display: flex;
  108. flex-direction: column;
  109. justify-content: center;
  110. &:nth-child(3n - 2) {
  111. padding-left: $pages-padding;
  112. flex: 4;
  113. }
  114. &:nth-child(3n - 1) {
  115. text-align: right !important;
  116. flex: 3;
  117. }
  118. &:nth-child(3n) {
  119. flex: 3;
  120. padding-right: $pages-padding;
  121. }
  122. // &:nth-child()
  123. }
  124. .table-th{
  125. padding-top: 20rpx;
  126. padding-bottom: 10rpx;
  127. }
  128. .uni-table-th {
  129. font-size: 22rpx;
  130. border-bottom: none;
  131. .table-th-title {
  132. width: 100%;
  133. display: flex;
  134. justify-content: flex-end;
  135. .title-arrows {
  136. display: flex;
  137. flex-direction: column;
  138. align-items: center;
  139. justify-content: flex-end;
  140. padding-left: 3px;
  141. .arrows-icon {
  142. width: 18rpx;
  143. height: 18rpx;
  144. &:first-child {
  145. transform: rotate(180deg);
  146. margin-bottom: -4rpx;
  147. }
  148. &:last-child {
  149. margin-top: -4rpx;
  150. }
  151. }
  152. }
  153. }
  154. }
  155. .uni-table-td {
  156. padding-top: 20rpx;
  157. padding-bottom: 20rpx;
  158. .table-title {
  159. width: 100%;
  160. line-height: 1.2;
  161. }
  162. .title {
  163. line-height: 1.2;
  164. font-size: 28rpx;
  165. font-family: PingFang SC, PingFang SC-Bold;
  166. font-weight: 700;
  167. .title-sub {
  168. font-size: 24rpx;
  169. font-weight: 400;
  170. }
  171. }
  172. .title-num {
  173. padding-top: 18rpx;
  174. font-size: 24rpx;
  175. }
  176. // <view class="table-title">
  177. // <view class="title">
  178. // <text>BTC</text>
  179. // <text class="title-sub">/USDT</text>
  180. // </view>
  181. // <view class="title-num">
  182. // 24H额:476.62m
  183. // </view>
  184. // </view>
  185. // &:nth-child(3n - 2) {
  186. // padding-left: $pages-padding;
  187. // }
  188. // &:nth-child(3n) {
  189. // padding-right: $pages-padding;
  190. // background-color: yellow;
  191. // text-align: right;
  192. // }
  193. // &:nth-child()
  194. }
  195. .table-btn {
  196. // 138
  197. width: 138rpx;
  198. height: 60rpx;
  199. border-radius: 6rpx;
  200. color: #fff;
  201. font-family: PingFang SC, PingFang SC-Bold;
  202. font-weight: 700;
  203. text-align: center;
  204. line-height: 60rpx;
  205. font-size: 26rpx;
  206. // margin-left: calc(100% - 138rpx);
  207. }
  208. }
  209. .table-right {
  210. display: flex;
  211. justify-content: flex-end;
  212. flex-direction: row;
  213. align-items: flex-end;
  214. }
  215. }
  216. </style>