1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee

取消订单完成,小程序订单详情页完善

This commit is contained in:
2023-03-21 19:18:06 +08:00
parent b71d4381d7
commit 23dfc8288c
8 changed files with 208 additions and 28 deletions

View File

@@ -26,6 +26,16 @@ Page({
orderPrice: '',
},
clearPageData() {
this.setData({
order: {},
orderGoodList: [],
orderStatusCode: '',
orderTime: '',
orderPrice: '',
})
},
/**
* 生命周期函数--监听页面加载
*/
@@ -43,6 +53,7 @@ Page({
}
this.setData({
_options: options,
orderId: options.orderId,
})
this.loadPageData()
@@ -97,6 +108,13 @@ Page({
},
refreshMyOrderPage() {
// 刷新
console.log("刷新上级订单列表页")
let myOrderPage = getCurrentPages().find(p => p.route == "pages/shop/myOrder")
myOrderPage && myOrderPage.onPullDownRefresh()
},
// 订单状态:等待确认
confirmPayment() {
// 点击确认支付按钮
@@ -113,19 +131,55 @@ Page({
if (res.confirm) {
(async () => {
this.clearPageData()
let payResult = await orderService.payOrder(this.data.orderId)
console.log("payResult", payResult)
this.onLoad(this.data._options)
this.refreshMyOrderPage()
wx.showModal({
title: '支付结果',
content: payResult,
showCancel: false,
complete: (res) => {
wx.navigateBack({
delta: getCurrentPages().length - 1
})
wx.navigateTo({
url: "/pages/shop/orderDetail?orderId=" + this.data.orderId,
})
// wx.navigateBack({
// delta: getCurrentPages().length - 1
// })
// wx.navigateTo({
// url: "/pages/shop/orderDetail?orderId=" + this.data.orderId,
// })
}
})
})();
}
}
})
},
// 订单状态:等待确认
cancelPayment() {
// 点击取消订单按钮
wx.showModal({
title: '是否取消订单?',
content: '点击确认取消订单,点击取消关闭弹窗(未发货前可取消订单)',
complete: (res) => {
if (res.confirm) {
(async () => {
this.clearPageData()
let cancelResult = await orderService.cancelOrder(this.data.orderId)
console.log("cancelResult", cancelResult)
this.onLoad(this.data._options)
this.refreshMyOrderPage()
wx.showModal({
title: '操作结果',
content: cancelResult || "操作失败,请重试",
showCancel: false,
complete: (res) => {
// wx.navigateBack({
// delta: getCurrentPages().length - 1
// })
// wx.navigateTo({
// url: "/pages/shop/orderDetail?orderId=" + this.data.orderId,
// })
}
})
})();