From 890dfab6b29867f60ef6aac5c02be7e4170fe29b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E6=98=8A=E5=A4=A9?= <442384644@qq.com> Date: Tue, 20 Oct 2026 16:45:26 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E7=A7=BB=E5=8A=A8=E7=AB=AF):=20=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E8=AF=A6=E6=83=85=E7=A1=AE=E8=AE=A4=E6=94=B6=E8=B4=A7?= =?UTF-8?q?=E7=9B=B4=E6=8E=A5=E8=B0=83=E7=94=A8=E6=8E=A5=E5=8F=A3=E5=B9=B6?= =?UTF-8?q?=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 详情页原仅广播 order:confirm 事件(只有列表引擎监听),点击确认收货无响应;action 增加 context 回调,详情页直接调 takeOrder 并重载 --- .../src/dynamic-pages/api/action-map.js | 6 ++++- .../engines/OrderDetailEngine.vue | 24 +++++++++++++++++-- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/frontend/uni-app/src/dynamic-pages/api/action-map.js b/frontend/uni-app/src/dynamic-pages/api/action-map.js index c51d93e70..6c8d674a2 100644 --- a/frontend/uni-app/src/dynamic-pages/api/action-map.js +++ b/frontend/uni-app/src/dynamic-pages/api/action-map.js @@ -60,13 +60,17 @@ export default { }); }, /** 确认收货 */ - confirmReceive(order, params) { + confirmReceive(order, params, context) { const orderNo = params.order_no || order.order_no || ''; uni.showModal({ title: i18n.t(`提示`), content: i18n.t(`确定已收到商品吗?`), success: (res) => { if (res.confirm) { + if (context && typeof context.onConfirm === 'function') { + context.onConfirm({ order_no: orderNo }); + return; + } uni.$emit('order:confirm', { order_no: orderNo }); } }, diff --git a/frontend/uni-app/src/dynamic-pages/engines/OrderDetailEngine.vue b/frontend/uni-app/src/dynamic-pages/engines/OrderDetailEngine.vue index ac8c0c86e..feb642da4 100644 --- a/frontend/uni-app/src/dynamic-pages/engines/OrderDetailEngine.vue +++ b/frontend/uni-app/src/dynamic-pages/engines/OrderDetailEngine.vue @@ -53,7 +53,7 @@ import { resolveSectionComponent, InfoListComponent } from '../components/order/ import SectionDispatcher from '../components/order/detail/SectionDispatcher.vue'; // #endif import actionMap from '../api/action-map.js'; -import { getCenterOrderDetail } from '@/api/order-center.js'; +import { getCenterOrderDetail, takeOrder } from '@/api/order-center.js'; import routes from '../api/routes.js'; import { useColorTheme } from '@/composables/useColorTheme'; import i18n from '@/utils/lang.js'; @@ -71,6 +71,7 @@ const { colorStyle } = useColorTheme(); // 声明式渲染配置(res.data.page_config),v8.1 只返回 page_config const pageConfig = ref({ sections: [], extensions: {} }); const loading = ref(true); +const confirmingReceive = ref(false); // ---------- computed ---------- /** @@ -203,7 +204,26 @@ function onButtonAction(payload) { var orderNo = ((sectionPropsMap.value['order_info'] && sectionPropsMap.value['order_info'].fields) && sectionPropsMap.value['order_info'].fields.order_no) || (payload.params && payload.params.order_no) || ''; - handler(Object.assign({}, sectionPropsMap.value, { order_no: orderNo }), payload.params || {}); + var context = payload.action === 'confirmReceive' ? { onConfirm: confirmReceive } : undefined; + handler(Object.assign({}, sectionPropsMap.value, { order_no: orderNo }), payload.params || {}, context); + } +} + +/** + * 详情页确认收货 + * @param {object} payload {order_no} + */ +async function confirmReceive(payload) { + if (confirmingReceive.value) return; + confirmingReceive.value = true; + try { + await takeOrder(payload.order_no); + uni.showToast({ title: i18n.t('收货成功'), icon: 'success' }); + await loadDetail(); + } catch (e) { + uni.showToast({ title: e?.msg || i18n.t('收货失败'), icon: 'none' }); + } finally { + confirmingReceive.value = false; } } /**