Marketmanagelog.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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.marketmanagelog_id"
  23. >
  24. <view class="div info">
  25. <view class="div title">{{ item.marketmanagelog_remark }}</view>
  26. <view class="div time">{{ $moment.unix(item.marketmanagelog_time).format('YYYY.MM.DD') }}</view>
  27. </view>
  28. <view class="div right" :class="item.marketmanagelog_win>0?'number':'diture'">{{ item.marketmanagelog_win>0?'已中奖':'未中奖' }}</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 { getMarketmanagelog } from '../../../api/homeMarketmanage'
  41. import EmptyRecord from '../../EmptyRecord'
  42. export default {
  43. name: 'BalanceHistory',
  44. components:{
  45. TitleHeader,
  46. MemberBase,
  47. EmptyRecord
  48. },
  49. computed:{
  50. fontSize(){
  51. return getFontSize()
  52. },
  53. },
  54. data(){
  55. return {
  56. navHeight: 0,
  57. params: { 'page': 0, 'per_page': 20 },
  58. loading: false, // 是否加载更多
  59. isMore: true, // 是否有更多
  60. wrapperHeight: 0,
  61. log_list: false
  62. }
  63. },
  64. created () {
  65. this.loadMore()
  66. },
  67. mounted(){
  68. // #ifdef MP-WEIXIN
  69. this.navHeight = uni.getMenuButtonBoundingClientRect().top
  70. // #endif
  71. this.wrapperHeight = uni.getSystemInfoSync().windowHeight - 130
  72. },
  73. methods: {
  74. goBack () {
  75. uni.navigateBack({delta:1})
  76. },
  77. loadMore () {
  78. this.loading = true
  79. this.params.page = ++this.params.page
  80. if (this.isMore) {
  81. this.loading = false
  82. this.getMarketmanagelog(true)
  83. }
  84. },
  85. getMarketmanagelog () {
  86. uni.showLoading({ title: '加载中' })
  87. getMarketmanagelog(this.params).then(res => {
  88. uni.hideLoading()
  89. if (res.result.hasmore) {
  90. this.isMore = true
  91. } else {
  92. this.isMore = false
  93. }
  94. let temp = res.result.log_list
  95. if (temp) {
  96. if (!this.log_list) {
  97. this.log_list = temp
  98. } else {
  99. this.log_list = this.log_list.concat(temp)
  100. }
  101. }
  102. }).catch(function (error) {
  103. uni.hideLoading()
  104. uni.showToast({icon:'none',title: error.message})
  105. })
  106. }
  107. }
  108. }
  109. </script>
  110. <style scoped lang="scss">
  111. .scroll-view-wrapper{display: flex;flex-direction: column;}
  112. .scroll-view{flex:1}
  113. .container {
  114. height: 100%;
  115. display: flex;
  116. position: relative;
  117. flex-direction: column;
  118. justify-content: flex-start;
  119. align-items: stretch;
  120. }
  121. .header {
  122. border-bottom: 1px solid #e8eaed;
  123. }
  124. .list-wrapper {
  125. flex: 1;
  126. display: flex;
  127. flex-direction: column;
  128. justify-content: flex-start;
  129. align-items: stretch;
  130. .point-list {
  131. background-color: #fff;
  132. border-bottom: 1px solid #e8eaed;
  133. display: flex;
  134. justify-content: space-between;
  135. align-items: center;
  136. padding: 0.55rem 0.75rem;
  137. .right{width:2.5rem;}
  138. .info {
  139. flex:1;
  140. .title {
  141. font-size:$subFontSize;
  142. color: #333;
  143. }
  144. .time {
  145. font-size:$fontSize;
  146. color: #999;
  147. margin-top:0.25rem;
  148. }
  149. }
  150. .number {
  151. font-size:$h2;
  152. color:$primaryColor;
  153. }
  154. .diture {
  155. font-size:$h2;
  156. color: rgba(102, 102, 102, 1);
  157. }
  158. }
  159. }
  160. </style>