wangfukang 1 week ago
parent
commit
17c6b7f7e7
  1. 56
      components/tab-bar/delivery.vue

56
components/tab-bar/delivery.vue

@ -69,7 +69,7 @@
</view> </view>
</view> </view>
<view class="content"> <view class="content">
<scroll-view @scrolltolower="onReachPage" @scroll="handleScroll" :scroll-top="scrollTop" scroll-y style="width:100%;height: 620px;overflow: scroll;"> <scroll-view id="orderScroll" class="order-scroll" @scrolltolower="onReachPage" @scroll="handleScroll" :scroll-top="scrollTop" lower-threshold="160" scroll-y>
<view class="box1" v-for="(item,index) in pageData" :key="index"> <view class="box1" v-for="(item,index) in pageData" :key="index">
<view class="maotou" v-if="item.deliveryType == 1"> <view class="maotou" v-if="item.deliveryType == 1">
<text>{{item.numberCode.length>14 ?'多订单':item.numberCode | delPlus}}</text> <text>{{item.numberCode.length>14 ?'多订单':item.numberCode | delPlus}}</text>
@ -355,7 +355,7 @@
</view> </view>
</uni-popup> </uni-popup>
<view style="width: 100%;height: 160rpx;"></view> <view class="list-bottom-space"></view>
<uni-load-more :status="loadStatus" @change="onChange" /> <uni-load-more :status="loadStatus" @change="onChange" />
</view> </view>
</view> </view>
@ -372,6 +372,8 @@
menuButtonInfo: {}, menuButtonInfo: {},
scrollTop: 0, scrollTop: 0,
oldScrollTop: 0, oldScrollTop: 0,
isLoadingPage: false,
scrollViewHeight: 0,
isArea: false, isArea: false,
latitude: 39.909, // latitude: 39.909, //
longitude: 116.39742, // longitude: 116.39742, //
@ -411,10 +413,7 @@
}, },
onReachBottom() { onReachBottom() {
if (this.searchForm.pageNum >= this.totalPages) return; this.onReachPage();
// this.status = 'loading';
this.searchForm.pageNum++;
this.getDelivery();
}, },
filters: { filters: {
formatHourMinute(value) { formatHourMinute(value) {
@ -474,6 +473,9 @@
} }
this.$forceUpdate() this.$forceUpdate()
this.getDelivery() this.getDelivery()
this.$nextTick(() => {
this.measureScrollView()
})
}, },
// //
@ -496,12 +498,28 @@
}); });
}, },
onReachPage() { onReachPage() {
if (this.searchForm.pageNum >= this.totalPages) return; if (this.isLoadingPage || this.searchForm.pageNum >= this.totalPages) return;
this.isLoadingPage = true;
this.searchForm.pageNum++; this.searchForm.pageNum++;
this.getDelivery(); this.getDelivery();
}, },
handleScroll(e) { handleScroll(e) {
this.oldScrollTop = e.detail.scrollTop this.oldScrollTop = e.detail.scrollTop
const detail = e.detail || {};
const viewHeight = this.scrollViewHeight || 0;
const reachBottom = viewHeight > 0 && detail.scrollTop + viewHeight >= detail.scrollHeight - 180;
if (reachBottom) {
this.onReachPage();
}
},
measureScrollView() {
const query = uni.createSelectorQuery().in(this);
query.select('#orderScroll').boundingClientRect();
query.exec((res) => {
if (res && res[0] && res[0].height) {
this.scrollViewHeight = res[0].height;
}
});
}, },
scrollToTop() { scrollToTop() {
this.scrollTop = this.oldScrollTop this.scrollTop = this.oldScrollTop
@ -544,7 +562,9 @@
}, },
getDelivery() { getDelivery() {
let that = this let that = this
that.isLoadingPage = true;
this.tui.request("/mall/delivery/pagebyworker", "POST", this.searchForm, false, false).then((res) => { this.tui.request("/mall/delivery/pagebyworker", "POST", this.searchForm, false, false).then((res) => {
that.isLoadingPage = false;
that.loadStatus = 'nomore'; that.loadStatus = 'nomore';
if (res.code == 200) { if (res.code == 200) {
if (this.searchForm.status == 1) { if (this.searchForm.status == 1) {
@ -570,7 +590,9 @@
return; return;
} }
uni.hideLoading(); uni.hideLoading();
}).catch((res) => {}); }).catch((res) => {
that.isLoadingPage = false;
});
}, },
// //
largeImg(img) { largeImg(img) {
@ -902,11 +924,25 @@
.content { .content {
flex: 1; flex: 1;
width: 95%; width: 95%;
overflow-y: auto; min-height: 0;
-webkit-overflow-scrolling: touch; overflow: hidden;
margin: 20rpx auto 0; margin: 20rpx auto 0;
} }
.order-scroll {
width: 100%;
height: 100%;
overflow: scroll;
-webkit-overflow-scrolling: touch;
box-sizing: border-box;
}
.list-bottom-space {
width: 100%;
height: calc(160rpx + constant(safe-area-inset-bottom));
height: calc(160rpx + env(safe-area-inset-bottom));
}
.box1 { .box1 {
width: 100%; width: 100%;
margin: 20rpx auto 20rpx; margin: 20rpx auto 20rpx;

Loading…
Cancel
Save