diff --git a/pages/order/MyOrder/index.vue b/pages/order/MyOrder/index.vue index 717ccf3..79a070d 100644 --- a/pages/order/MyOrder/index.vue +++ b/pages/order/MyOrder/index.vue @@ -254,22 +254,22 @@ @@ -1299,9 +1299,39 @@ export default { } } }, - gotoGoodDetail(cart, type, query){ + gotoGoodDetail(orderOrIndex, cartOrIndex) { + const order = this.getOrderByIndex(orderOrIndex) + const cartList = Array.isArray(order && order.cartInfo) ? order.cartInfo : [] + const cart = typeof cartOrIndex === 'number' ? cartList[cartOrIndex] : cartOrIndex + if (!cart) { + uni.showToast({ + title: '未获取到商品信息', + icon: 'none' + }) + return + } + const productInfo = cart.productInfo || {} + let type = 1 + let id = productInfo.id || cart.productId || '' + if (Number(cart.combinationId) > 0) { + type = 2 + id = cart.combinationId + } else if (Number(cart.bargainId) > 0) { + type = 3 + id = cart.bargainId + } else if (Number(cart.seckillId) > 0) { + type = 4 + id = cart.seckillId + } + if (!id) { + uni.showToast({ + title: '未获取到商品详情参数', + icon: 'none' + }) + return + } // isProductStillExist:0-不存在,1-存在 - const isProductStillExist = cart.isProductStillExist || 0 + const isProductStillExist = Number(cart.isProductStillExist || 0) if (isProductStillExist === 0) { this.$dialog.toast({ mes: '商品已下架' }) return @@ -1321,7 +1351,17 @@ export default { path = '/pages/activity/SeckillDetails/index' break } - this.$yrouter.push({ path, query }) + if (!path) { + uni.showToast({ + title: '未找到商品详情页', + icon: 'none' + }) + return + } + this.$yrouter.push({ + path, + query: { id } + }) }, getOrderData() { getOrderData().then(res => {