Commit 4de1a348 by 宋冰琦

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

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