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

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

@@ -40,6 +40,8 @@
</view>
</view>
</view>
<!-- 分页 -->
<u-loadmore v-if="pagesShow" :status="status" />
</block>
<block v-else>
<view class="null">
@@ -58,8 +60,14 @@
export default {
data() {
return {
orders: [],
page : ''
orders : [],
// 分页
page : {
current : 1,
has_more: false,
},
pagesShow : false,
status : ''
}
},
created() {
@@ -87,10 +95,15 @@
},
// 获取订单列表
getList(){
ordersDiffs().then(res => {
ordersDiffs({
page : this.page.current
}).then(res => {
let { data, page } = res;
this.orders = data
this.page = page
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,
@@ -101,12 +114,22 @@
// 变更当前列表状态
removeListVal(id){
let ListArr = this.orders
let ListIndex = ListArr.findIndex(val => val.business_order_id == id)
let ListIndex = ListArr.findIndex(val => val.order_id == id)
if(ListIndex >= 0){
this.orders.splice(ListIndex, 1)
}
this.$store.commit('setOrderId', null)
},
},
onReachBottom() {
this.pagesShow = true;
if(this.page.has_more){
this.status = 'loading';
this.page.current++
this.getList()
return
}
this.status = 'nomore';
}
}
</script>