zs hace 2 años
padre
commit
ef8da4b9ce
Se han modificado 2 ficheros con 112 adiciones y 7 borrados
  1. 13 0
      pagesMy/dough/index.vue
  2. 99 7
      pagesMy/integral/index.vue

+ 13 - 0
pagesMy/dough/index.vue

@@ -324,4 +324,17 @@
 			}
 		}
 	}
+	.scroll-view {
+		position: absolute;
+		top: 0;
+		left: 0;
+		right: 0;
+		bottom: 0;
+	
+		.list-scroll-view {
+			display: flex;
+			flex-direction: column;
+		}
+	}
+	
 </style>

+ 99 - 7
pagesMy/integral/index.vue

@@ -11,7 +11,13 @@
 			</view>
 			<view class="two">
 				<view class="two_1" v-if="list&&list.length>0">
-					数据列表
+					scroll-view scroll-y="true" class="scroll-view" @scrolltolower="toPage">
+					<view class="list-scroll-view">
+						<view class="list" v-for="(item, index) in list" :key="index">
+
+						</view>
+					</view>
+					</scroll-view>
 				</view>
 				<view class="two_2" v-else>
 					已加载完全部
@@ -26,15 +32,21 @@
 		data() {
 			return {
 				user: {},
-				list: []
+				list: [],
+				total: 0,
+				skip: 0,
+				limit: 6,
+				page: 0,
+				// 状态
+				statusList: [],
+				// 来源
+				sourceList: [],
 			};
 		},
-		onLoad: function(e) {
-
-		},
-		onShow: function() {
+		onShow: async function() {
 			const that = this;
-			that.watchLogin()
+			await that.searchOther();
+			await that.watchLogin();
 		},
 		methods: {
 			watchLogin() {
@@ -44,8 +56,75 @@
 					success: function(res) {
 						let user = that.$jwt(res.data);
 						that.$set(that, `user`, user)
+						that.search()
 					}
 				})
+			},
+			// 查询列表
+			async search() {
+				const that = this;
+				let user = that.user;
+				if (user._id) {
+					let info = {
+						skip: that.skip,
+						limit: that.limit,
+						customer: user._id,
+					}
+					let res = await that.$api(`/point`, 'GET', {
+						...info,
+					})
+					if (res.errcode == '0') {
+						let list = [...that.list, ...res.data];
+						that.$set(that, `list`, list);
+						that.$set(that, `total`, res.total)
+					}
+				}
+			},
+			// 查询其他信息
+			async searchOther() {
+				const that = this;
+				let res;
+				res = await that.$api(`/dictData`, 'GET', {
+					code: "point_status"
+				});
+				if (res.errcode == '0') {
+					that.$set(that, `statusList`, res.data)
+				}
+				res = await that.$api(`/dictData`, 'GET', {
+					code: "point_source"
+				});
+				if (res.errcode == '0') {
+					that.$set(that, `sourceList`, res.data)
+				}
+			},
+			// 分页
+			toPage(e) {
+				const that = this;
+				let list = that.list;
+				let limit = that.limit;
+				if (that.total > list.length) {
+					uni.showLoading({
+						title: '加载中',
+						mask: true
+					})
+					let page = that.page + 1;
+					that.$set(that, `page`, page)
+					let skip = page * limit;
+					that.$set(that, `skip`, skip)
+					that.search();
+					uni.hideLoading();
+				} else uni.showToast({
+					title: '没有更多数据了',
+					icon: 'none'
+				});
+			},
+			// 清空列表
+			clearPage() {
+				const that = this;
+				that.$set(that, `list`, [])
+				that.$set(that, `skip`, 0)
+				that.$set(that, `limit`, 6)
+				that.$set(that, `page`, 0)
 			}
 		}
 	}
@@ -96,4 +175,17 @@
 
 		}
 	}
+
+	.scroll-view {
+		position: absolute;
+		top: 0;
+		left: 0;
+		right: 0;
+		bottom: 0;
+
+		.list-scroll-view {
+			display: flex;
+			flex-direction: column;
+		}
+	}
 </style>