diff --git a/pages/goods/coupon-details/coupon-details.vue b/pages/goods/coupon-details/coupon-details.vue index 161d8b2..01f8b28 100644 --- a/pages/goods/coupon-details/coupon-details.vue +++ b/pages/goods/coupon-details/coupon-details.vue @@ -90,7 +90,10 @@ oneTime: '', twoTime: '', threeTime: '', - menddesId: '' + menddesId: '', + pageNum: 1, + pageSize: 10, + isNoMoreData: false } }, onLoad(option) { @@ -164,16 +167,27 @@ uni.showLoading({ title: '加载中...' }) - + if (this.isNoMoreData) { + uni.hideLoading() + return false; + } + let pagenum = this.pageNum; let params = { couponId: this.menddesId, longitude: app.globalData.longitude, - latitude: app.globalData.latitude + latitude: app.globalData.latitude, + pageNum: pagenum, + pageSize: this.pageSize } getStoreListByCoupon(params).then(res => { if (res.return_code == '000000' && res.return_data.list != '') { uni.hideLoading(); - this.storeList = res.return_data; + this.isNoMoreData = res.return_data.list.length == this.pageSize ? false : true; + this.storeList = this.storeList.concat(res.return_data.list); + if (res.return_data.total == (this.pageNum * this.pageSize)) { + this.isNoMoreData = true; + } + this.pageNum = res.return_data.list.length == this.pageSize ? ++pagenum : pagenum; } else { this.storeList = []; uni.hideLoading() diff --git a/pages/pay/success/success.vue b/pages/pay/success/success.vue index f17a43a..abceaba 100644 --- a/pages/pay/success/success.vue +++ b/pages/pay/success/success.vue @@ -96,7 +96,10 @@ storeList: [], oneTime: '', twoTime: '', - threeTime: '' + threeTime: '', + pageNum: 1, + pageSize: 10, + isNoMoreData: false } }, onLoad(option) { @@ -169,16 +172,27 @@ uni.showLoading({ title: '加载中...' }) - + if (this.isNoMoreData) { + uni.hideLoading() + return false; + } + let pagenum = this.pageNum; let params = { couponId: this.couDesId, longitude: app.globalData.longitude, - latitude: app.globalData.latitude + latitude: app.globalData.latitude, + pageNum: pagenum, + pageSize: this.pageSize } getStoreListByCoupon(params).then(res => { if (res.return_code == '000000' && res.return_data.list != '') { uni.hideLoading(); - this.storeList = res.return_data; + this.isNoMoreData = res.return_data.list.length == this.pageSize ? false : true; + this.storeList = this.storeList.concat(res.return_data.list); + if (res.return_data.total == (this.pageNum * this.pageSize)) { + this.isNoMoreData = true; + } + this.pageNum = res.return_data.list.length == this.pageSize ? ++pagenum : pagenum; } else { this.storeList = []; uni.hideLoading() diff --git a/pages/tabBar/category/category.vue b/pages/tabBar/category/category.vue index 804f17f..69629c1 100644 --- a/pages/tabBar/category/category.vue +++ b/pages/tabBar/category/category.vue @@ -61,33 +61,6 @@ - - - - - 筛选门店 @@ -114,6 +87,7 @@ data() { return { showCategoryIndex: '', + showCategoryIndexId: '', headerPosition: "fixed", imagewxUrl: app.globalData.imageWxImg, imgadres: 'jt.png', @@ -152,6 +126,10 @@ } }, + //上拉加载,需要自己在page.json文件中配置"onReachBottomDistance" + onReachBottom() { + this.getStoreListByMerchant(); + }, methods: { //显示弹出 showPopup() { @@ -213,7 +191,8 @@ if (res.return_code == '000000' && res.return_data != '') { this.MerchantList = res.return_data; this.showCategoryIndex = res.return_data[0].merchantName; - this.getStoreListByMerchant(res.return_data[0].id); + this.showCategoryIndexId = res.return_data[0].id; + this.getStoreListByMerchant(); } else { this.MerchantList = []; @@ -251,20 +230,33 @@ }) }, //门店列表 - getStoreListByMerchant(item) { + getStoreListByMerchant() { uni.showLoading({ title: '加载中...' }) - + if (this.isNoMoreData) { + uni.hideLoading() + return false; + } + let pagenum = this.pageNum; let params = { - merchantId: item, + merchantId: this.showCategoryIndexId, longitude: app.globalData.longitude, - latitude: app.globalData.latitude + latitude: app.globalData.latitude, + pageNum: pagenum, + pageSize: this.pageSize + } getStoreListByMerchant(params).then(res => { uni.hideLoading(); if (res.return_code == '000000') { - this.categoryList = res.return_data + uni.hideLoading(); + this.isNoMoreData = res.return_data.list.length == this.pageSize ? false : true; + this.categoryList = this.categoryList.concat(res.return_data.list); + if (res.return_data.total == (this.pageNum * this.pageSize)) { + this.isNoMoreData = true; + } + this.pageNum = res.return_data.list.length == this.pageSize ? ++pagenum : pagenum; } else { this.categoryList = []; } @@ -275,7 +267,12 @@ showCategory(index, item) { this.showCategoryIndex = index; this.$refs.popup.hide(); - this.getStoreListByMerchant(item); + this.showCategoryIndexId = item; + this.pageNum = 1; + this.pageSize = 10; + this.isNoMoreData = false; + this.categoryList = []; + this.getStoreListByMerchant(); }, toCategory(e) { uni.navigateTo({