definite.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <template>
  2. <view>
  3. <scroll-view class="floor-list" style="height: 95vh;"
  4. :scroll-top="scrollTop" scroll-y="true" @scroll="scroll" @scrolltoupper="upper" @scrolltolower="lower"
  5. :refresher-enabled="false">
  6. <view class="money">
  7. <view class="moneysize">{{userinfo.member_points}}</view>
  8. <view>我的圈币</view>
  9. </view>
  10. <van-cell v-for="(item,index) in point_list" :key="index" use-label-slot :title="'圈币来源:'+item.pl_desc" >
  11. <template>
  12. {{item.pl_stage == "payment" ? "-" : "+"}}{{item.pl_points}}
  13. </template>
  14. <template slot="label">
  15. {{item.pl_addtime}}
  16. </template>
  17. </van-cell>
  18. </scroll-view>
  19. <Gobacktop @getop="getop" v-if="isTop" />
  20. </view>
  21. </template>
  22. <script>
  23. import Gobacktop from '@/component/Gobacktop.vue'
  24. export default {
  25. components: {
  26. Gobacktop
  27. },
  28. onReady: function() {
  29. uni.setNavigationBarColor({
  30. frontColor: '#ffffff',
  31. backgroundColor: '#D9332E',
  32. animation: {
  33. duration: 400,
  34. timingFunc: 'easeIn'
  35. }
  36. })
  37. },
  38. data() {
  39. return{
  40. page: 1,
  41. ispull: true,
  42. point_list:[],
  43. userinfo:{},
  44. scrollTop: 0,
  45. isTop: false,
  46. old: {
  47. scrollTop: 0
  48. },
  49. }
  50. },
  51. onLoad() {
  52. this.getuserinfo();
  53. this.getlist();
  54. },
  55. methods:{
  56. // 滚动到顶部
  57. upper(e) {
  58. },
  59. getop() {
  60.    this.scrollTop = this.old.scrollTop
  61.                 this.$nextTick(function(){
  62.                     this.scrollTop=0;
  63.                 });
  64. this.isTop = false;
  65. },
  66. // 滚到底部
  67. lower(e) {
  68. this.page = this.page + 1;
  69. if(this.ispull) {
  70. this.getlist();
  71. }
  72. },
  73. // 滚动时触发
  74. scroll(e) {
  75. if(e.detail.scrollTop > 400) {
  76. this.isTop = true;
  77. }else{ //当距离小于500时显示回到顶部按钮
  78. this.isTop = false;
  79. }
  80. this.old.scrollTop = e.detail.scrollTop
  81. },
  82. getuserinfo() {
  83. this.request({
  84. url:'/v2/member/info',
  85. method:'GET',
  86. success:(res)=>{
  87. let { data } = res.data;
  88. this.userinfo = data;
  89. }
  90. })
  91. },
  92. // 获取圈币明细
  93. getlist() {
  94. this.request({
  95. url: '/v2/member/points',
  96. method: 'post',
  97. data: {
  98. page: this.page,
  99. page_size: 10
  100. },
  101. success: (res) => {
  102. // ispull
  103. let { data } = res.data;
  104. if(data.point_list.length < 10) {
  105. this.ispull = false;
  106. }
  107. this.point_list = this.point_list.concat(data.point_list);
  108. }
  109. })
  110. }
  111. }
  112. }
  113. </script>
  114. <style lang="scss">
  115. .money {
  116. height: 140upx;
  117. color: #fff;
  118. text-align: center;
  119. background-color: #D9332E;
  120. font-size: 28upx;
  121. padding: 20upx 0 40upx 0;
  122. .moneysize {
  123. font-size: 42upx;
  124. padding-top: 25upx;
  125. }
  126. }
  127. </style>