PredepositList.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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 class="div list-wrapper" v-if="predeposit_list && predeposit_list.length">
  16. <view class="div item" v-for="(item, index) in predeposit_list" :key="item.lg_id">
  17. <label class="title" v-bind:class="item.lg_av_amount > 0 ? 'income' : 'expend'">{{ item.lg_av_amount }}</label>
  18. <label class="subtitle">{{ item.lg_desc }}</label>
  19. <label class="date">{{ item.lg_addtime_text }}</label>
  20. </view>
  21. </view>
  22. <empty-record v-else-if="predeposit_list && !predeposit_list.length"></empty-record>
  23. </scroll-view>
  24. </view>
  25. </view></member-base>
  26. </template>
  27. <script>
  28. import {getFontSize} from '@/util/common'
  29. import TitleHeader from '../../TitleHeader'
  30. import MemberBase from '../MemberBase'
  31. import { getPredepositList } from '../../../api/memberPredeposit'
  32. import EmptyRecord from '../../EmptyRecord'
  33. export default {
  34. name: 'BalanceHistory',
  35. components:{
  36. TitleHeader,
  37. MemberBase,
  38. EmptyRecord
  39. },
  40. computed:{
  41. fontSize(){
  42. return getFontSize()
  43. },
  44. },
  45. data(){
  46. return {
  47. navHeight: 0,
  48. wrapperHeight: 0,
  49. params: { 'page': 0, 'per_page': 10 },
  50. loading: false, // 是否加载更多
  51. isMore: true, // 是否有更多
  52. predeposit_list: false
  53. }
  54. },
  55. created () {
  56. this.loadMore()
  57. },
  58. mounted(){
  59. // #ifdef MP-WEIXIN
  60. this.navHeight = uni.getMenuButtonBoundingClientRect().top
  61. // #endif
  62. this.wrapperHeight = uni.getSystemInfoSync().windowHeight - 130
  63. },
  64. methods: {
  65. loadMore () {
  66. this.loading = true
  67. this.params.page = ++this.params.page
  68. if (this.isMore) {
  69. this.loading = false
  70. this.getPredepositList(true)
  71. }
  72. },
  73. goBack () {
  74. uni.navigateBack({delta:1})
  75. },
  76. getPredepositList () {
  77. uni.showLoading({ title: '加载中' })
  78. getPredepositList(this.params).then(res => {
  79. uni.hideLoading()
  80. if (res.result.hasmore) {
  81. this.isMore = true
  82. } else {
  83. this.isMore = false
  84. }
  85. let temp = res.result.list
  86. if (temp) {
  87. if (!this.predeposit_list) {
  88. this.predeposit_list = temp
  89. } else {
  90. this.predeposit_list = this.predeposit_list.concat(temp)
  91. }
  92. }
  93. }).catch(function (error) {
  94. uni.hideLoading()
  95. uni.showToast({icon:'none',title: error.message})
  96. })
  97. }
  98. }
  99. }
  100. </script>
  101. <style scoped lang="scss">
  102. .scroll-view-wrapper{display: flex;flex-direction: column;}
  103. .scroll-view{flex:1}
  104. .container {
  105. height: 100%;
  106. display: flex;
  107. position: relative;
  108. flex-direction: column;
  109. justify-content: flex-start;
  110. align-items: stretch;
  111. }
  112. .header {
  113. border-bottom: 1px solid #e8eaed;
  114. }
  115. .list-wrapper {
  116. .item {
  117. display: flex;
  118. position: relative;
  119. flex-direction: column;
  120. justify-content: flex-start;
  121. align-items: stretch;
  122. background-color: #fff;
  123. border-bottom: 1px solid #e8eaed;
  124. }
  125. .title {
  126. font-size:$h1;
  127. margin-left:0.7rem;
  128. margin-top:0.7rem;
  129. }
  130. .income {
  131. color: $primaryColor;
  132. }
  133. .expend {
  134. color: #333;
  135. }
  136. .subtitle {
  137. font-size:$fontSize;
  138. color: #666;
  139. margin-left:0.7rem;
  140. margin-top:0.4rem;
  141. margin-bottom:0.5rem;
  142. }
  143. .date {
  144. color: #666;
  145. font-size:$subFontSize;
  146. position: absolute;
  147. top:0.9rem;
  148. right: 0.7rem;
  149. }
  150. }
  151. </style>