Commit 7f90dec7 by 宋冰琦

修复结算返回跳转问题

parent bcfaaa09
<template> <template>
<div class="pages"> <div class="pages">
<view class="topBar" :style="{'padding-top':statusBarHeight+'px','height':navigationBarHeight+'px'}"> <view class="topBar" :style="{'padding-top':statusBarHeight+'px','height':navigationBarHeight+'px'}">
<u-icon @click="goBack" name="arrow-left" color="#000000" size="20"></u-icon> <u-icon @click="goBackOrder" name="arrow-left" color="#000000" size="20"></u-icon>
<view class="tabTitle" :style="{'line-height':navigationBarHeight+'px'}">订单详情</view> <view class="tabTitle" :style="{'line-height':navigationBarHeight+'px'}">订单详情</view>
</view> </view>
<div class="order_status" :style="{'margin-top':(statusBarHeight+navigationBarHeight+getPx(32))+'px'}"> <div class="order_status" :style="{'margin-top':(statusBarHeight+navigationBarHeight+getPx(32))+'px'}">
...@@ -116,7 +116,7 @@ export default { ...@@ -116,7 +116,7 @@ export default {
onLoad(option) { onLoad(option) {
this.initData(option) this.initData(option)
}, },
onHide(){ onUnload(){
this.goBack() this.goBack()
}, },
data() { data() {
...@@ -135,10 +135,14 @@ export default { ...@@ -135,10 +135,14 @@ export default {
// console.log(wx.getSystemInfoSync().windowWidth); // console.log(wx.getSystemInfoSync().windowWidth);
return rpx * (wx.getSystemInfoSync().windowWidth / 750); return rpx * (wx.getSystemInfoSync().windowWidth / 750);
}, },
goBackOrder(){
this.backFlag = true
this.goBack()
},
goBack(){ goBack(){
console.log('退出订单详情',this.backFlag) if(this.backFlag){
if(!this.backFlag){
uni.switchTab({ url: '/pages/order/order' }) uni.switchTab({ url: '/pages/order/order' })
this.backFlag = false
} }
}, },
async oneMoreOrder(item) { async oneMoreOrder(item) {
...@@ -170,7 +174,7 @@ export default { ...@@ -170,7 +174,7 @@ export default {
list.forEach(nextData => { list.forEach(nextData => {
Utils.getallNum(nextData); Utils.getallNum(nextData);
}) })
this.backFlag = true this.backFlag = false
uni.switchTab({ url: '/pages/menu/menu' }) uni.switchTab({ url: '/pages/menu/menu' })
}, },
async initData(option){ async initData(option){
...@@ -185,12 +189,16 @@ export default { ...@@ -185,12 +189,16 @@ export default {
if(orderId){ if(orderId){
console.log(!Authorization,Authorization) console.log(!Authorization,Authorization)
if(!Authorization){ if(!Authorization){
this.backFlag = true
this.goBack() this.goBack()
return return
}else{ }else{
this.backFlag = false
oId = orderId oId = orderId
} }
} }
}else{
this.backFlag = true
} }
// return // return
const {data = {}} = await Order.getOrderDetail({orderId:oId}) const {data = {}} = await Order.getOrderDetail({orderId:oId})
...@@ -198,7 +206,7 @@ export default { ...@@ -198,7 +206,7 @@ export default {
const getTime = ['2', '3'].indexOf(this.orderInfo.state) >= 0 const getTime = ['2', '3'].indexOf(this.orderInfo.state) >= 0
const isBuild = ['4', '5'].indexOf(this.orderInfo.state) >= 0; const isBuild = ['4', '5'].indexOf(this.orderInfo.state) >= 0;
if(getTime){ if(getTime){
const {data = {}} = await Order.getOrderWaiteTime({orderId:oId}) const {data = {}} = await Order.getOrderWaiteTime({orderId:oId})||{}
this.waitTime = data?.data this.waitTime = data?.data
} }
if (isBuild) { if (isBuild) {
...@@ -235,8 +243,6 @@ export default { ...@@ -235,8 +243,6 @@ export default {
success: (res) => { success: (res) => {
if (res.confirm) { if (res.confirm) {
Order.orderRefund({ orderId: this.orderInfo.id, refundAmount: this.orderInfo.amount }).then(res => { Order.orderRefund({ orderId: this.orderInfo.id, refundAmount: this.orderInfo.amount }).then(res => {
// this.backFlag = true
// uni.switchTab({ url: '/pages/order/order' })
this.initData() this.initData()
}) })
} else if (res.cancel) { } else if (res.cancel) {
...@@ -251,7 +257,7 @@ export default { ...@@ -251,7 +257,7 @@ export default {
}, },
cancelOrder() { cancelOrder() {
Order.cancelOrder({ orderId: this.orderInfo.id }).then(res => { Order.cancelOrder({ orderId: this.orderInfo.id }).then(res => {
this.backFlag = true this.backFlag = false
uni.switchTab({ url: '/pages/menu/menu' }) uni.switchTab({ url: '/pages/menu/menu' })
}) })
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment