Fix:5693 【商城小程序】【我的订单-订单列表】删除已完成订单后,页面跳转至“购物”Tab
This commit is contained in:
@@ -864,14 +864,7 @@ export default {
|
||||
} else if (needRefreshOrderList) {
|
||||
uni.removeStorageSync('needRefreshMyOrderList')
|
||||
this.getOrderData()
|
||||
if (this.savedScrollTop > 0) {
|
||||
this.$nextTick(() => {
|
||||
uni.pageScrollTo({
|
||||
scrollTop: this.savedScrollTop,
|
||||
duration: 0
|
||||
})
|
||||
})
|
||||
}
|
||||
this.refreshOrderListKeepPosition()
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
@@ -1866,7 +1859,7 @@ export default {
|
||||
keyword,
|
||||
orderType
|
||||
} = this
|
||||
getOrderList({
|
||||
return getOrderList({
|
||||
page,
|
||||
limit,
|
||||
type,
|
||||
@@ -1889,6 +1882,24 @@ export default {
|
||||
uni.hideLoading()
|
||||
});
|
||||
},
|
||||
// 保持当前主/子tab及滚动位置刷新列表(从订单详情页返回后同步删除等状态变更)
|
||||
refreshOrderListKeepPosition() {
|
||||
this.orderListRequestId += 1
|
||||
this.page = 1
|
||||
this.loaded = false
|
||||
this.loading = false
|
||||
const restoreScrollTop = this.savedScrollTop
|
||||
this.getOrderListReq().then(() => {
|
||||
if (restoreScrollTop > 0) {
|
||||
this.$nextTick(() => {
|
||||
uni.pageScrollTo({
|
||||
scrollTop: restoreScrollTop,
|
||||
duration: 0
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
tapShowMore(index) {
|
||||
const order = this.getOrderByIndex(index)
|
||||
if (!order) {
|
||||
|
||||
@@ -1251,16 +1251,17 @@ export default {
|
||||
});
|
||||
},
|
||||
goBack() {
|
||||
if (this.name === "MyOrder") {
|
||||
// 从订单列表进入时直接返回原页面,保留列表页主/子tab及滚动位置
|
||||
const pages = getCurrentPages()
|
||||
const prevPage = pages && pages[pages.length - 2]
|
||||
const prevRoute = prevPage && prevPage.route
|
||||
if (prevRoute && prevRoute.indexOf('order/MyOrder') > -1) {
|
||||
this.$yrouter.back();
|
||||
return;
|
||||
} else {
|
||||
console.log(this);
|
||||
this.$yrouter.replace({
|
||||
path: "/pages/order/MyOrder/index"
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.$yrouter.replace({
|
||||
path: "/pages/order/MyOrder/index"
|
||||
});
|
||||
},
|
||||
cancelOrder() {
|
||||
cancelOrderHandle(this.orderInfo.orderId)
|
||||
|
||||
Reference in New Issue
Block a user