优化订单列表页面显示

master
wayn 3 years ago
parent 8a6c9c9b8e
commit c1fced1a3f

@ -12,7 +12,6 @@
swipeable swipeable
offset-top="46" offset-top="46"
type="line" type="line"
animated
@click="handleTabClick" @click="handleTabClick"
> >
<van-tab <van-tab
@ -29,9 +28,12 @@
v-model="loading" v-model="loading"
:finished="finished" :finished="finished"
:immediate-check="false" :immediate-check="false"
finished-text="没有更多了"
@load="getOrderList" @load="getOrderList"
> >
<van-empty
v-if="orderListEmptyShow"
description="您还没有相关订单"
/>
<van-panel <van-panel
v-for="(el, i) in orderList" v-for="(el, i) in orderList"
:key="i" :key="i"
@ -134,7 +136,8 @@ export default {
refreshing: false, refreshing: false,
page: 0, page: 0,
limit: 10, limit: 10,
loading: false, loading: true,
orderListEmptyShow: false,
finished: false finished: false
} }
}, },
@ -146,15 +149,17 @@ export default {
init() { init() {
this.page = 0 this.page = 0
this.orderList = [] this.orderList = []
this.getOrderList() this.getOrderList(true)
}, },
// //
onRefresh() { onRefresh() {
this.refreshing = true this.refreshing = true
this.pageNum = 1 this.pageNum = 1
this.getOrderList() this.getOrderList(true)
}, },
getOrderList() { getOrderList(init) {
this.loading = true
this.orderListEmptyShow = false
this.page++ this.page++
orderList({ orderList({
showType: this.activeIndex, showType: this.activeIndex,
@ -166,6 +171,9 @@ export default {
this.loading = false this.loading = false
this.refreshing = false this.refreshing = false
this.finished = res.map.page >= res.map.pages this.finished = res.map.page >= res.map.pages
if (init && res.map.data.length <= 0) {
this.orderListEmptyShow = true
}
}) })
}, },
delOrder(id) { delOrder(id) {
@ -225,7 +233,7 @@ export default {
handleTabClick() { handleTabClick() {
this.page = 0 this.page = 0
this.orderList = [] this.orderList = []
this.getOrderList() this.getOrderList(true)
}, },
toOrderDetail(id) { toOrderDetail(id) {
this.$router.push({ this.$router.push({

Loading…
Cancel
Save