分页加载

This commit is contained in:
THK3121 2023-09-08 10:53:37 +08:00
parent a800fea2b5
commit 5898169ef4
2 changed files with 39 additions and 12 deletions

View File

@ -12,10 +12,11 @@
<p class="tit" v-if="goodsInfo.status==2" style="background-color: #47BE62;">
收货人姓名:&nbsp;&nbsp;{{fuzzyName(goodsInfo.receiver_name)}}</p>
<p class="tit" v-if="goodsInfo.status==3" style="background-color: red;display: flex;justify-content: space-between;">
<p class="tit" v-if="goodsInfo.status==3"
style="background-color: red;display: flex;justify-content: space-between;">
<text>收货人姓名:&nbsp;&nbsp;{{fuzzyName(goodsInfo.receiver_name)}}</text>
<text>已取消</text>
</p>
</p>
<view class="contents">
<!-- 已取货 -->
<view class="left" v-if='goodsInfo.status==0'>

View File

@ -11,10 +11,11 @@
<view v-if="!orderlist.length">
<u-empty mode="data" icon="../../static/img/empty/data.png"> </u-empty>
</view>
<view v-else>
<view v-else @scroll='scrolling'>
<logistiCard ref="logistiCards" v-for="(item, index) in orderlist" @getlist="getOrderList"
@showTost="showToast" @showToast2="showToast2" :goodsInfo="item" :key="index">
</logistiCard>
<u-loadmore :status="status" />
</view>
<!-- -->
<u-toast ref="uToast"></u-toast>
@ -52,15 +53,15 @@
name: '已送达'
}],
curNow: 0,
orderlist: []
orderlist: [],
id: "",
status: "loadmore",
page_num: 1,
flag: false
}
},
methods: {
go() {
uni.navigateTo({
url: "/pages/logistics/te"
})
},
sectionChange(index) {
this.curNow = index.index;
@ -85,10 +86,10 @@
},
getOrderList() {
console.log("列表更新")
let id = JSON.parse(uni.getStorageSync('USER_INFO')).id
this.id = JSON.parse(uni.getStorageSync('USER_INFO')).id
getList({
status: this.curNow,
user_id: id,
user_id: this.id,
keywords: this.keywords,
user_type: this.is_captain
}).then(res => {
@ -98,7 +99,9 @@
}
},
onLoad() {
this.is_captain = JSON.parse(uni.getStorageSync('USER_INFO')).is_captain
let that = this
//#ifdef APP-PLUS
@ -111,11 +114,34 @@
that.notArr.push(result.messageID)
})
// #endif
// window.addEventListener("scroll", this.scrolling);
},
onShow() {
this.getOrderList()
}
},
onReachBottom() {
if (this.flag) return
this.status = "loading"
this.page_num += 1
this.flag = true
getList({
status: this.curNow,
user_id: this.id,
keywords: this.keywords,
user_type: this.is_captain,
page_num: this.page_num
}).then(res => {
this.orderlist = this.orderlist.concat(res.data.data)
this.flag = false
if (!res.data.data.length) {
this.status = "nomore"
this.flag = true
}
})
},
}
</script>