history-freight-space.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  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" @click.stop="lookInfo(item)">
  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">{{ $numIntercepting(item.profits , 2) || '--'}}</text>
  30. <text class="color top-right-float"><text
  31. class="bdColor">平仓盈亏</text>{{ $getChange(item , 4) }}%</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.update_price }}</text>
  46. </view>
  47. <view class="info-item">
  48. <text class="info-item-lable">平仓数量(张)</text>
  49. <text class="info-item-val">{{ item.share }}</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">平仓时间 {{ item.handle_time }}</text>
  62. <view class="record-icon" @click.stop="$emit('shareContent' , item)">
  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="loadStatus" 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.list = []
  126. this.getRegister()
  127. }
  128. },
  129. immediate: true
  130. },
  131. },
  132. computed: {
  133. ...mapGetters([
  134. "stocksColor",
  135. ])
  136. },
  137. mounted() {
  138. // this.getRegister()
  139. },
  140. methods: {
  141. scrolltolower() {
  142. console.log('scrolltolower = ')
  143. if (this.loadStatus === 'loadmore') {
  144. // loadStatus: 'loading', // loading / nomore / loadmore
  145. this.page ++;
  146. this.getRegister()
  147. }
  148. },
  149. getRegister() {
  150. if (this.loadStatus === 'loading') {
  151. return false
  152. };
  153. this.loadStatus = 'loading'
  154. Api_getRegister({
  155. status: this.status,
  156. page: this.page,
  157. limit: this.limit
  158. }).then(res => {
  159. const data = res.message;
  160. this.list = this.list.concat(data.data)
  161. this.page = data.current_page;
  162. if (this.list.length >= data.total) {
  163. this.loadStatus = 'nomore'
  164. } else {
  165. this.loadStatus = 'loadmore'
  166. }
  167. }).catch(err => {
  168. if (this.page >= 2) {
  169. this.page -= 1;
  170. this.loadStatus = 'loadmore'
  171. } else {
  172. this.loadStatus = 'nomore'
  173. }
  174. })
  175. },
  176. lookInfo(item){
  177. this.$setStorageSync('historyInfo' , item)
  178. uni.navigateTo({
  179. url:'/pages/contract/order-info'
  180. });
  181. }
  182. }
  183. }
  184. </script>
  185. <style lang="scss" scoped>
  186. @import "~../sustainability/index.scss";
  187. @import "~./index.scss";
  188. .top-right-float{
  189. text{
  190. border: none;
  191. }
  192. }
  193. .top-left-b-tag{
  194. font-size: 20rpx;
  195. border-radius: 5rpx;
  196. }
  197. </style>