mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-10-28 21:40:50 +00:00
fix(移动端): 订单详情确认收货直接调用接口并刷新
详情页原仅广播 order:confirm 事件(只有列表引擎监听),点击确认收货无响应;action 增加 context 回调,详情页直接调 takeOrder 并重载
This commit is contained in:
parent
e4289f4a5a
commit
890dfab6b2
@ -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 });
|
||||
}
|
||||
},
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user