修复订单状态刷新错误,修复订单数据展示错误

This commit is contained in:
唐明明
2023-05-09 17:02:18 +08:00
parent 88055e6052
commit 95452cea60
4 changed files with 63 additions and 14 deletions

View File

@@ -38,6 +38,8 @@
</view>
</view>
</view>
<!-- 分页 -->
<u-loadmore v-if="pagesShow" :status="status" />
</view>
<!-- 订单是空的 -->
<view class="order-null" v-else>
@@ -56,7 +58,14 @@
export default {
data() {
return {
orders: []
orders : [],
// 分页
page : {
current : 1,
has_more: false,
},
pagesShow : false,
status : ''
};
},
created() {
@@ -66,10 +75,15 @@
// 获取列表
getList(){
refunds({
status: ''
status: '',
page : this.page.current
}).then(res => {
let { data } = res;
this.orders = data
let { data, page } = res;
let atList = page.current == 1 ? [] : this.orders
this.orders = atList.concat(data)
this.page = page
this.pagesShow = false
}).catch(err => {
uni.showToast({
title: err.message,
@@ -77,6 +91,16 @@
})
})
}
},
onReachBottom() {
this.pagesShow = true;
if(this.page.has_more){
this.status = 'loading';
this.page.current++
this.getList()
return
}
this.status = 'nomore';
}
}
</script>