wcni 5 роки тому
батько
коміт
b691d13afe
1 змінених файлів з 59 додано та 2 видалено
  1. 59 2
      pages/myCenter/definite.vue

+ 59 - 2
pages/myCenter/definite.vue

@@ -1,9 +1,13 @@
 <template>
 	<view>
+		<scroll-view  class="floor-list" style="height: 95vh;"
+		 :scroll-top="scrollTop" scroll-y="true"  @scroll="scroll"  @scrolltoupper="upper" @scrolltolower="lower"
+		 :refresher-enabled="false">
 		<view class="money">
 			<view class="moneysize">{{userinfo.member_points}}</view>
 			<view>我的圈币</view>
 		</view>
+		
 		<van-cell v-for="(item,index) in point_list" :key="index" use-label-slot :title="'圈币来源:'+item.pl_desc" >
 			<template>
 				{{item.pl_stage == "payment" ? "-" : "+"}}{{item.pl_points}}
@@ -12,11 +16,17 @@
 				{{item.pl_addtime}}
 			</template>
 		</van-cell>
+		</scroll-view>
+		 <Gobacktop @getop="getop" v-if="isTop" />
 	</view>
 </template>
 
 <script>
+	    import Gobacktop from '@/component/Gobacktop.vue'
 	    export default {
+			components: {
+				Gobacktop
+			},
 	        onReady: function() {
 				   uni.setNavigationBarColor({
 					   frontColor: '#ffffff',
@@ -30,8 +40,14 @@
 			data() {
 				return{
 					page: 1,
+					ispull: true,
 					point_list:[],
-					userinfo:{}
+					userinfo:{},
+					scrollTop: 0,
+					isTop: false,
+					old: {
+						scrollTop: 0
+					},
 				}
 			},
 			onLoad() {
@@ -39,6 +55,42 @@
 				this.getlist();
 			},
 			methods:{
+				// 滚动到顶部
+				upper(e) {
+				
+				},
+				
+				getop() {
+					//  setTimeout( () => {  
+					// 		uni.pageScrollTo({  
+					// 		   duration:0,			//过渡时间必须为0,uniapp bug,否则运行到手机会报错
+					// 		   scrollTop: 0,  
+					// 		})  
+					// },300)  
+					   this.scrollTop = this.old.scrollTop
+		                this.$nextTick(function(){
+		                    this.scrollTop=0;
+		                });
+						this.isTop = false;
+				},
+				
+				// 滚到底部
+				lower(e) {
+					this.page = this.page + 1;
+					if(this.ispull) {
+						this.getlist();
+					}
+				},
+				
+				// 滚动时触发
+				scroll(e) {
+					if(e.detail.scrollTop > 400) {
+						this.isTop = true;
+					}else{ //当距离小于500时显示回到顶部按钮
+						this.isTop = false;
+					}
+					this.old.scrollTop = e.detail.scrollTop
+				},
 				getuserinfo() {
 					this.request({
 						url:'/v2/member/info',
@@ -59,7 +111,12 @@
 							page_size: 10
 						},
 						success: (res) => {
-							this.point_list = res.data.data.point_list;
+							// ispull
+							let { data } = res.data;
+							if(data.point_list.length < 10) {
+								this.ispull = false;
+							}
+							this.point_list = this.point_list.concat(data.point_list);
 						}
 					})
 				}