history-freight-space.vue 5.1 KB

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