history.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. <template>
  2. <view class="">
  3. <view class="lable-title" v-if="list.length > 0">
  4. <view class=""></view>
  5. <text class="lable-title-icon iconfont">&#xe611;</text>
  6. </view>
  7. <u-list class="swiper-list" :style="{'height': scrollHeight ? `${scrollHeight}px` : '' }"
  8. @scrolltolower="scrolltolower">
  9. <template v-for="item in list">
  10. <view class="content-box" :rise-fall="stocksColor">
  11. <view class="content-top">
  12. <view class="top-left">
  13. <view class="top-left-title">
  14. <text>{{ item.symbol }}</text>
  15. <text v-if="item.settled == 0">永续</text>
  16. <text v-else-if="item.settled == 9">快捷</text>
  17. </view>
  18. <view class="top-left-b">
  19. <text>{{ item.multiple }}倍杠杆</text>
  20. <text class="top-left-b-tag">{{ item.type_name }}</text>
  21. <text class="top-left-b-tag">{{ item.status_name }}</text>
  22. </view>
  23. </view>
  24. <view :class="['top-right' , $setColor(item.profits)]">
  25. <text class="color">{{ item.profits || '--'}}</text>
  26. <text class="color top-right-float"><text
  27. class="bdColor">平仓盈亏</text>{{ item.fact_profits }}%</text>
  28. </view>
  29. </view>
  30. <view class="content-info">
  31. <view class="info-item">
  32. <text class="info-item-lable">保证金(USDT)</text>
  33. <text class="info-item-val">{{ item.caution_money }}</text>
  34. </view>
  35. <view class="info-item">
  36. <text class="info-item-lable">开仓价格(USDT)</text>
  37. <text class="info-item-val">{{ item.price }}</text>
  38. </view>
  39. <view class="info-item">
  40. <text class="info-item-lable">平仓价格(USDT)</text>
  41. <text class="info-item-val">{{ item.origin_price }}</text>
  42. </view>
  43. <view class="info-item">
  44. <text class="info-item-lable">平仓数量(张)</text>
  45. <text class="info-item-val">{{ item.number }}</text>
  46. </view>
  47. <view class="info-item">
  48. <text class="info-item-lable">手续费(USDT)</text>
  49. <text class="info-item-val">{{ item.trade_fee || '--' }}</text>
  50. </view>
  51. <view class="info-item">
  52. <text class="info-item-lable">平仓类型(USDT)</text>
  53. <text class="info-item-val">{{ item.status === 3 ? '强制平仓' : '' }}</text>
  54. </view>
  55. </view>
  56. <view class="record-hint">
  57. <text class="record-lable">平仓时间 {{ $getData_(item.create_time ) }}</text>
  58. <view class="record-icon">
  59. <text class="icon-size iconfont">&#xe8b0;</text>
  60. <text class="icon-size">分享</text>
  61. </view>
  62. </view>
  63. </view>
  64. <gap />
  65. </template>
  66. <view class="loadmore-box" v-show="loadStatus">
  67. <u-loadmore :status="loadStatus" nomoreText="没有更多数据" :fontSize='28' :iconSize='30'/>
  68. </view>
  69. </u-list>
  70. </view>
  71. </template>
  72. <script>
  73. import {
  74. mapGetters
  75. } from 'vuex'
  76. import {
  77. Api_getRegister
  78. } from "@/api/index.js"
  79. export default {
  80. name: 'login',
  81. props: {
  82. listHeight: {
  83. type: Number,
  84. default: 0
  85. },
  86. status: {
  87. type: Number,
  88. default: ''
  89. },
  90. },
  91. data() {
  92. return {
  93. loadStatus: '', // loading / nomore / loadmore
  94. limit: 10,
  95. page: 1,
  96. scrollHeight: 0,
  97. list: [],
  98. };
  99. },
  100. // 80rpx
  101. watch: {
  102. listHeight: {
  103. handler(newH) {
  104. if (newH) {
  105. this.scrollHeight = newH - uni.upx2px(80);
  106. }
  107. },
  108. immediate: true
  109. },
  110. status: {
  111. handler(newSatus, oldStatus) {
  112. if (newSatus === -1 && newSatus !== oldStatus) {
  113. this.limit = 10;
  114. this.page = 1;
  115. this.getRegister()
  116. }
  117. },
  118. immediate: true
  119. },
  120. },
  121. computed: {
  122. ...mapGetters([
  123. "stocksColor",
  124. ])
  125. },
  126. mounted() {
  127. // this.getRegister()
  128. },
  129. methods: {
  130. scrolltolower() {
  131. console.log('scrolltolower = ')
  132. if (this.loadStatus === 'loadmore') {
  133. // loadStatus: 'loading', // loading / nomore / loadmore
  134. this.page ++;
  135. this.getRegister()
  136. }
  137. },
  138. getRegister() {
  139. if (this.loadStatus === 'loading') {
  140. return false
  141. };
  142. this.loadStatus = 'loading'
  143. Api_getRegister({
  144. status: this.status,
  145. page: this.page,
  146. limit: this.limit
  147. }).then(res => {
  148. const data = res.message;
  149. this.list = this.list.concat(data.data)
  150. this.page = data.current_page
  151. if (this.list.length >= data.total) {
  152. this.loadStatus = 'nomore'
  153. } else {
  154. this.loadStatus = 'loadmore'
  155. }
  156. }).catch(err => {
  157. if (this.page >= 2) {
  158. this.page -= 1;
  159. this.loadStatus = 'loadmore'
  160. } else {
  161. this.loadStatus = 'nomore'
  162. }
  163. })
  164. }
  165. }
  166. }
  167. </script>
  168. <style lang="scss" scoped>
  169. @import "~../sustainability/index.scss";
  170. .top-right-float{
  171. text{
  172. border: none;
  173. }
  174. }
  175. .top-left-b-tag{
  176. font-size: 20rpx;
  177. border-radius: 5rpx;
  178. }
  179. </style>