From 76a877f2c2c591c28d3184c2e9cbe33a8bcf1649 Mon Sep 17 00:00:00 2001 From: linxi <957440651@qq.com> Date: Tue, 14 Jul 2026 17:19:39 +0800 Subject: [PATCH] =?UTF-8?q?Fix=EF=BC=9A=E2=80=85=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=89=80=E6=9C=89=E6=8C=89=E9=92=AE=E7=82=B9?= =?UTF-8?q?=E5=87=BB=E9=83=BD=E6=B2=A1=E5=8F=8D=E5=BA=94=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/order/MyOrder/index.vue | 210 ++++++++++++++++++++++++++-------- 1 file changed, 160 insertions(+), 50 deletions(-) diff --git a/pages/order/MyOrder/index.vue b/pages/order/MyOrder/index.vue index 9993449..717ccf3 100644 --- a/pages/order/MyOrder/index.vue +++ b/pages/order/MyOrder/index.vue @@ -61,7 +61,7 @@ v-if="order.experienceOrderInfo" class="shop-info flex jc-between ai-center" style="padding-bottom: 0" - @click.stop="goStore(order)" + @click.stop="goStore(orderListIndex)" > {{ (order.isGiftCardSend || order.isGiftCardReceive) ? '礼包' : (getStatus(order) || (order._status && order._status._title) || '已完成') }} - + 联系商家 去使用 删除订单 更多 联系商家 申请退款 @@ -378,7 +378,7 @@ 联系客服 @@ -389,18 +389,18 @@ parseInt(order._status._type) !== 9 " class="bnt service" - @click="goRoom(order)" + @click="goRoom(orderListIndex)" >联系商家 查看详情 删除订单 @@ -411,61 +411,61 @@ @@ -505,7 +505,7 @@ 联系商家 @@ -519,14 +519,14 @@ " open-type="share" class="gift-btn service v12-primary-text v12-primary-border" - @click="shareGift(order)" + @click="shareGift(orderListIndex)" >送给朋友 - 查看详情 + 查看详情 @@ -930,12 +930,28 @@ export default { uni.hideLoading(); }) }, - editTime(order) { + editTime(orderOrIndex) { + const order = this.getOrderByIndex(orderOrIndex) + if (!order) { + uni.showToast({ + title: '订单信息异常', + icon: 'none' + }) + return + } this.showDatePicker = true this.travelGroupOrderInfo = order.travelGroupOrderInfo this.orderInfo = order }, - applyRefund(order) { + applyRefund(orderOrIndex) { + const order = this.getOrderByIndex(orderOrIndex) + if (!order) { + uni.showToast({ + title: '订单信息异常', + icon: 'none' + }) + return + } // 这里可以添加申请退款的逻辑,比如跳转到退款页面 uni.navigateTo({ url: '/pkg_product/views/sojoumOrderRefund?id=' + order.orderId @@ -951,8 +967,16 @@ export default { } return timeMap[type] }, - shareGift(item) { - this.giftItem = item + shareGift(orderOrIndex) { + const order = this.getOrderByIndex(orderOrIndex) + if (!order) { + uni.showToast({ + title: '订单信息异常', + icon: 'none' + }) + return + } + this.giftItem = order }, getGiftTips(giftCardInfo) { // giftCardStatus int 礼品卡状态 0-未领取 1-已领取 2-已失效 @@ -983,12 +1007,30 @@ export default { }) this.$forceUpdate() }, - delOrder(order) { + getOrderByIndex(orderOrIndex) { + if (typeof orderOrIndex === 'number') { + return this.orderList[orderOrIndex] + } + if (typeof orderOrIndex === 'string' && /^\d+$/.test(orderOrIndex)) { + return this.orderList[Number(orderOrIndex)] + } + return orderOrIndex + }, + delOrder(orderOrIndex) { + const order = this.getOrderByIndex(orderOrIndex) + if (!order) { + uni.showToast({ + title: '订单信息异常', + icon: 'none' + }) + return + } delOrderHandle(order.orderId).then(() => { this.changeType() }) }, - goStore(order) { + goStore(orderOrIndex) { + const order = this.getOrderByIndex(orderOrIndex) if (!order) { return } @@ -1070,14 +1112,30 @@ export default { this.toYuePay(payPwd) this.isShowPayPwdPop = false }, - subscribePay(order) { + subscribePay(orderOrIndex) { + const order = this.getOrderByIndex(orderOrIndex) + if (!order) { + uni.showToast({ + title: '订单信息异常', + icon: 'none' + }) + return + } this.orderInfo = order uni.requestSubscribeMessage({ tmplIds: settings.SubscribeMessageTmplIds, complete: () => this.pay = true }) }, - addressTap(order) { + addressTap(orderOrIndex) { + const order = this.getOrderByIndex(orderOrIndex) + if (!order) { + uni.showToast({ + title: '订单信息异常', + icon: 'none' + }) + return + } this._orderId = order.orderId uni.setStorageSync('updateOrderSourceAddress', { id: order.addressId || order.userAddressId || '', @@ -1095,7 +1153,8 @@ export default { force2Decimal(v) { return this.$force2Decimal(v) }, - callMerPhone(order) { + callMerPhone(orderOrIndex) { + const order = this.getOrderByIndex(orderOrIndex) const phone = String((order && order.merPhone) || '').trim() if (!phone) { uni.showToast({ @@ -1108,10 +1167,17 @@ export default { phoneNumber: phone }) }, - goRoom(order) { - console.log(order); + goRoom(orderOrIndex) { + const order = this.getOrderByIndex(orderOrIndex) + if (!order) { + uni.showToast({ + title: '订单信息异常', + icon: 'none' + }) + return + } if (order.experienceOrderInfo) { - const phone = order.merchantPhone || order.merPhone || order.experienceOrderInfo.phone || order.companyTel; + const phone = order.merchantPhone || order.merPhone || order.experienceOrderInfo.phone || order.companyTel if (phone) { uni.makePhoneCall({ phoneNumber: phone @@ -1142,7 +1208,15 @@ export default { url: `/pkg_common/views/room?id=${order.merId}&name=${order.merName}¶ms=${JSON.stringify(params)}` }) }, - goRefund(order) { + goRefund(orderOrIndex) { + const order = this.getOrderByIndex(orderOrIndex) + if (!order) { + uni.showToast({ + title: '订单信息异常', + icon: 'none' + }) + return + } // fix bug#1631 if (this.type === 4 || parseInt(order._status._type) === 3) { // 打开售后的目的就是开启已完成/待评价订单的退款功能,确认打开售后之后,小程序用户再点击申请退款,就可以进入退款申请填写页面,正常走退款流程,提交退款申请以后,订单状态变为退款中 @@ -1164,7 +1238,15 @@ export default { }) } }, - goLogistics(order) { + goLogistics(orderOrIndex) { + const order = this.getOrderByIndex(orderOrIndex) + if (!order) { + uni.showToast({ + title: '订单信息异常', + icon: 'none' + }) + return + } this.$yrouter.push({ path: "/pagesOrder/order/Logistics/index", query: { @@ -1172,7 +1254,15 @@ export default { } }); }, - goOrderDetails(order) { + goOrderDetails(orderOrIndex) { + const order = this.getOrderByIndex(orderOrIndex) + if (!order) { + uni.showToast({ + title: '订单信息异常', + icon: 'none' + }) + return + } if (order.experienceOrderInfo) { this.$yrouter.push({ path: "/pkg_product/views/experienceCouponOrderDetail", @@ -1238,7 +1328,15 @@ export default { this.orderData = res.data }) }, - takeOrder(order) { + takeOrder(orderOrIndex) { + const order = this.getOrderByIndex(orderOrIndex) + if (!order) { + uni.showToast({ + title: '订单信息异常', + icon: 'none' + }) + return + } const that = this uni.showModal({ title: '是否确认收货?', @@ -1369,7 +1467,11 @@ export default { uni.hideLoading() }); }, - tapShowMore(order, index) { + tapShowMore(index) { + const order = this.getOrderByIndex(index) + if (!order) { + return + } order.showMore = !order.showMore; this.$set(this.orderList, index, order); }, @@ -1409,7 +1511,15 @@ export default { } return status }, - cancelOrder(order) { + cancelOrder(orderOrIndex) { + const order = this.getOrderByIndex(orderOrIndex) + if (!order) { + uni.showToast({ + title: '订单信息异常', + icon: 'none' + }) + return + } cancelOrderHandle(order.orderId).then(() => { this.getOrderData(); this.orderList.splice(this.orderList.indexOf(order), 1)