guhongwei 2 роки тому
батько
коміт
610d5e2eef
1 змінених файлів з 41 додано та 8 видалено
  1. 41 8
      pagesMy/discount/index.vue

+ 41 - 8
pagesMy/discount/index.vue

@@ -2,9 +2,12 @@
 	<mobile-frame>
 	<mobile-frame>
 		<view class="main">
 		<view class="main">
 			<view class="one">
 			<view class="one">
-				<scroll-view scroll-y="true" class="scroll-view" @scrolltolower="toPage">
+				<scroll-view scroll-y="true" class="scroll-view" @scrolltolower="toPage" @scroll="toScroll">
 					<view class="list-scroll-view">
 					<view class="list-scroll-view">
 						<discount :Style="Style" :couponList="list"></discount>
 						<discount :Style="Style" :couponList="list"></discount>
+						<view class="is_bottom" v-if="is_bottom">
+							<text>我们也是有底线的!</text>
+						</view>
 					</view>
 					</view>
 				</scroll-view>
 				</scroll-view>
 			</view>
 			</view>
@@ -27,8 +30,11 @@
 				list: [],
 				list: [],
 				total: 0,
 				total: 0,
 				skip: 0,
 				skip: 0,
-				limit: 5,
-				page: 0
+				limit: 6,
+				page: 0,
+				// 数据是否触底
+				is_bottom: false,
+				scrollTop: 0,
 			};
 			};
 		},
 		},
 		onLoad: function(e) {
 		onLoad: function(e) {
@@ -59,8 +65,8 @@
 				const that = this;
 				const that = this;
 				let user = that.user;
 				let user = that.user;
 				let info = {
 				let info = {
-					// skip: that.skip,
-					// limit: that.limit,
+					skip: that.skip,
+					limit: that.limit,
 					customer: user._id
 					customer: user._id
 				}
 				}
 				const res = await that.$api(`/userCoupon`, 'GET', {
 				const res = await that.$api(`/userCoupon`, 'GET', {
@@ -92,9 +98,14 @@
 					that.$set(that, `skip`, skip)
 					that.$set(that, `skip`, skip)
 					that.search();
 					that.search();
 					uni.hideLoading();
 					uni.hideLoading();
-				} else uni.showToast({
-					title: '没有更多数据了'
-				});
+				} else that.$set(that, `is_bottom`, true)
+			},
+			toScroll(e) {
+				const that = this;
+				let up = that.scrollTop;
+				that.$set(that, `scrollTop`, e.detail.scrollTop);
+				let num = Math.sign(up - e.detail.scrollTop);
+				if (num == 1) that.$set(that, `is_bottom`, false);
 			},
 			},
 			// 清空列表
 			// 清空列表
 			clearPage() {
 			clearPage() {
@@ -112,4 +123,26 @@
 	.main {
 	.main {
 		background-color: var(--f5Color);
 		background-color: var(--f5Color);
 	}
 	}
+
+	.scroll-view {
+		position: absolute;
+		top: 0;
+		left: 0;
+		right: 0;
+		bottom: 0;
+
+		.list-scroll-view {
+			display: flex;
+			flex-direction: column;
+		}
+	}
+
+	.is_bottom {
+		text-align: center;
+
+		text {
+			padding: 2vw 0;
+			display: inline-block;
+		}
+	}
 </style>
 </style>