Commit 4de1a348 by 宋冰琦

修复订单详情再来一单跳转问题

parent 3c70c978
......@@ -160,7 +160,8 @@ export default {
ewmImg: '',
Utils,
isBuild:true,
waitTime:0
waitTime:0,
backFlag:false
}
},
methods: {
......@@ -170,15 +171,18 @@ export default {
return rpx * (wx.getSystemInfoSync().windowWidth / 750);
},
goBack(){
if(!this.backFlag){
uni.switchTab({ url: '/pages/order/order' })
}
},
async oneMoreOrder(item) {
uni.removeStorageSync('shopCarInfo');
$EventBus.$emit('updateCar');
const numObj = {}
const { id, shopId, orderDetails } = item;
orderDetails.forEach(item => {
orderDetails[item.skuId] = Number(item.num)
const newOrderDetail = [...orderDetails]
newOrderDetail.forEach(item => {
newOrderDetail[item.skuId] = Number(item.num)
})
const { data } = await Order.moreOrder({ orderId: id, shopId });
if(!data || !data.data){
......@@ -188,7 +192,7 @@ export default {
let list = new Array();
data.data.forEach(item => {
const skuId = item.skus[0].skuId
const nextData = { ...item, skuId, num: orderDetails[skuId], flag: true, sku: item.skus[0] }
const nextData = { ...item, skuId, num: newOrderDetail[skuId], flag: true, sku: item.skus[0] }
if (nextData.sku.state == 1) {
list.push(nextData);
}
......@@ -200,6 +204,7 @@ export default {
list.forEach(nextData => {
Utils.getallNum(nextData);
})
this.backFlag = true
uni.switchTab({ url: '/pages/menu/menu' })
},
async PayNow() {
......@@ -220,6 +225,7 @@ export default {
success: (res) => {
if (res.confirm) {
Order.orderRefund({ orderId: this.orderInfo.id, refundAmount: this.orderInfo.amount }).then(res => {
this.backFlag = true
uni.switchTab({ url: '/pages/menu/menu' })
})
} else if (res.cancel) {
......@@ -234,6 +240,7 @@ export default {
},
cancelOrder() {
Order.cancelOrder({ orderId: this.orderInfo.id }).then(res => {
this.backFlag = true
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