hookehuyr

fix: 修复确认收货时使用错误订单ID的问题

在确认收货逻辑中,之前直接使用transactionId更新订单状态,现在改为先通过transactionId查找对应订单,再使用正确的订单ID进行更新
1 <!-- 1 <!--
2 * @Date: 2022-09-19 14:11:06 2 * @Date: 2022-09-19 14:11:06
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2025-08-09 18:33:54 4 + * @LastEditTime: 2025-08-09 18:43:38
5 * @FilePath: /jgdl/src/pages/myOrders/index.vue 5 * @FilePath: /jgdl/src/pages/myOrders/index.vue
6 * @Description: 订单管理页面 6 * @Description: 订单管理页面
7 --> 7 -->
...@@ -1481,11 +1481,15 @@ const performDeleteOrder = async (orderId) => { ...@@ -1481,11 +1481,15 @@ const performDeleteOrder = async (orderId) => {
1481 const handleConfirmReceiveSuccess = async ({ merchantId, transactionId, merchantTradeNo }) => { 1481 const handleConfirmReceiveSuccess = async ({ merchantId, transactionId, merchantTradeNo }) => {
1482 try { 1482 try {
1483 // 调用买家查询收货状态接口 1483 // 调用买家查询收货状态接口
1484 - const response = await receiptOrderStatusAPI({ order_id: transactionId }) 1484 + const response = await receiptOrderStatusAPI({ transaction_id: transactionId })
1485 1485
1486 if (response.code && response.data && response.data.status === 11) { 1486 if (response.code && response.data && response.data.status === 11) {
1487 // 接口返回状态为11,确认收货成功 1487 // 接口返回状态为11,确认收货成功
1488 - await updateOrderStatus(transactionId, 11, {}, 'buy') 1488 + // 通过transactionId找到对应的订单
1489 + const order = boughtOrders.value.find(o => o.transaction_id === transactionId)
1490 + if (order) {
1491 + await updateOrderStatus(order.id, 11, {}, 'buy')
1492 + }
1489 1493
1490 Taro.showToast({ 1494 Taro.showToast({
1491 title: '确认收货成功', 1495 title: '确认收货成功',
...@@ -1498,7 +1502,11 @@ const handleConfirmReceiveSuccess = async ({ merchantId, transactionId, merchant ...@@ -1498,7 +1502,11 @@ const handleConfirmReceiveSuccess = async ({ merchantId, transactionId, merchant
1498 } 1502 }
1499 } catch (error) { 1503 } catch (error) {
1500 // 查询收货状态失败,即使接口调用失败,也更新本地状态 1504 // 查询收货状态失败,即使接口调用失败,也更新本地状态
1501 - await updateOrderStatus(transactionId, 11, {}, 'buy') 1505 + // 通过transactionId找到对应的订单
1506 + const order = boughtOrders.value.find(o => o.transaction_id === transactionId)
1507 + if (order) {
1508 + await updateOrderStatus(order.id, 11, {}, 'buy')
1509 + }
1502 } 1510 }
1503 } 1511 }
1504 1512
......