Bonusreceive.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. <template><page-meta :root-font-size="fontSize+'px'"></page-meta>
  2. <member-base :show="false"><view style="position: absolute;top:0;right:0;left:0;bottom:0" class="scroll-view-wrapper div container">
  3. <view class="div common-header-wrap">
  4. <view class="status-holder"></view>
  5. <view :style="'height:'+navHeight+'px'"></view>
  6. <view class="common-header-holder"></view>
  7. <view class="common-header-fixed">
  8. <title-header />
  9. <uni-nav-bar title="红包领取记录" class="common-header" left-icon="back" @clickLeft="goBack()">
  10. </uni-nav-bar>
  11. </view>
  12. </view>
  13. <view class="scroll-view div" style="position:relative">
  14. <scroll-view style="position: absolute;top:0;right:0;left:0;bottom:0" class="div" @scrolltolower="loadMore" scroll-y="true">
  15. <view
  16. class="div list-wrapper"
  17. v-if="log_list && log_list.length"
  18. >
  19. <view
  20. class="div point-list"
  21. v-for="(item, index) in log_list"
  22. :key="item.bonusreceive_id"
  23. >
  24. <view class="div info">
  25. <view class="div title"></view>
  26. <view class="div time">{{ $moment.unix(item.bonusreceive_time).format('YYYY年MM月DD日') }}</view>
  27. </view>
  28. <view class="div number">+{{ item.bonusreceive_price }}</view>
  29. </view>
  30. </view>
  31. <empty-record v-else-if="log_list && !log_list.length"></empty-record>
  32. </scroll-view>
  33. </view>
  34. </view></member-base>
  35. </template>
  36. <script>
  37. import {getFontSize} from '@/util/common'
  38. import TitleHeader from '../../TitleHeader'
  39. import MemberBase from '../MemberBase'
  40. import { getReceiveList } from '../../../api/homeBonus'
  41. import EmptyRecord from '../../EmptyRecord'
  42. export default {
  43. components:{
  44. TitleHeader,
  45. MemberBase,
  46. EmptyRecord
  47. },
  48. computed:{
  49. fontSize(){
  50. return getFontSize()
  51. },
  52. },
  53. data(){
  54. return {
  55. navHeight: 0,
  56. params: { 'page': 0, 'per_page': 10 },
  57. loading: false, // 是否加载更多
  58. isMore: true, // 是否有更多
  59. wrapperHeight: 0,
  60. log_list: false
  61. }
  62. },
  63. created () {
  64. this.loadMore()
  65. },
  66. mounted(){
  67. // #ifdef MP-WEIXIN
  68. this.navHeight = uni.getMenuButtonBoundingClientRect().top
  69. // #endif
  70. this.wrapperHeight = uni.getSystemInfoSync().windowHeight - 130
  71. },
  72. methods: {
  73. goBack () {
  74. uni.navigateBack({delta:1})
  75. },
  76. loadMore () {
  77. this.loading = true
  78. this.params.page = ++this.params.page
  79. if (this.isMore) {
  80. this.loading = false
  81. this.getReceiveList(true)
  82. }
  83. },
  84. getReceiveList () {
  85. uni.showLoading({ title: '加载中' })
  86. getReceiveList(this.params).then(res => {
  87. uni.hideLoading()
  88. if (res.result.hasmore) {
  89. this.isMore = true
  90. } else {
  91. this.isMore = false
  92. }
  93. let temp = res.result.log_list
  94. if (temp) {
  95. if (!this.log_list) {
  96. this.log_list = temp
  97. } else {
  98. this.log_list = this.log_list.concat(temp)
  99. }
  100. }
  101. }).catch(function (error) {
  102. uni.hideLoading()
  103. uni.showToast({icon:'none',title: error.message})
  104. })
  105. }
  106. }
  107. }
  108. </script>
  109. <style scoped lang="scss">
  110. .scroll-view-wrapper{display: flex;flex-direction: column;}
  111. .scroll-view{flex:1}
  112. .container {
  113. height: 100%;
  114. display: flex;
  115. position: relative;
  116. flex-direction: column;
  117. justify-content: flex-start;
  118. align-items: stretch;
  119. }
  120. .header {
  121. border-bottom: 1px solid #e8eaed;
  122. }
  123. .list-wrapper {
  124. flex: 1;
  125. display: flex;
  126. flex-direction: column;
  127. justify-content: flex-start;
  128. align-items: stretch;
  129. .point-list {
  130. background-color: #fff;
  131. border-bottom: 1px solid #e8eaed;
  132. display: flex;
  133. justify-content: space-between;
  134. align-items: center;
  135. padding: 0.55rem 0.75rem;
  136. .right{width:2.5rem;}
  137. .info {
  138. flex:1;
  139. .title {
  140. font-size:$subFontSize;
  141. color: #333;
  142. }
  143. .time {
  144. font-size:$fontSize;
  145. color: #999;
  146. margin-top:0.25rem;
  147. }
  148. }
  149. .number {
  150. font-size:$h1;
  151. color:$primaryColor;
  152. }
  153. .diture {
  154. font-size:$h1;
  155. color: rgba(102, 102, 102, 1);
  156. }
  157. }
  158. }
  159. </style>