mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-10-28 21:40:50 +00:00
feat(移动端): 订单列表与详情返回时刷新最新状态
引擎暴露 refresh,包装页跳过首次 onShow、此后返回本页(评价完成/收货/售后进度变化)自动刷新
This commit is contained in:
parent
76c4b9f840
commit
45d3304606
@ -140,6 +140,9 @@ async function loadDetail() {
|
||||
}
|
||||
}
|
||||
|
||||
// 包装页 onShow 返回时调用(评价完成/售后进度变化等场景,返回详情需看到最新状态)
|
||||
defineExpose({ refresh: loadDetail });
|
||||
|
||||
// ========== 全局状态注入 ==========
|
||||
|
||||
/**
|
||||
|
||||
@ -327,6 +327,9 @@ onBeforeUnmount(() => {
|
||||
uni.$off('order:confirm', onConfirmOrder);
|
||||
uni.$off('order:delete', onDeleteOrder);
|
||||
});
|
||||
|
||||
// 包装页 onShow 返回时调用(详情页评价/收货等操作后返回列表需看到最新状态)
|
||||
defineExpose({ refresh: refreshList });
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<view>
|
||||
<OrderDetailEngine :order-no="orderNo" />
|
||||
<OrderDetailEngine ref="engine" :order-no="orderNo" />
|
||||
<!-- 系统悬浮菜单(小程序端不显示) -->
|
||||
<!-- #ifndef MP -->
|
||||
<home></home>
|
||||
@ -10,13 +10,24 @@
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import OrderDetailEngine from '@/dynamic-pages/engines/OrderDetailEngine.vue';
|
||||
import home from '@/components/home';
|
||||
|
||||
const orderNo = ref('');
|
||||
const engine = ref(null);
|
||||
|
||||
onLoad((options) => {
|
||||
orderNo.value = options.order_no || '';
|
||||
});
|
||||
|
||||
// 首次 onShow 与 onLoad 引擎的首次加载重复,跳过;此后每次返回本页(评价完成 navigateBack 等)刷新详情数据
|
||||
let showed = false;
|
||||
onShow(() => {
|
||||
if (!showed) {
|
||||
showed = true;
|
||||
return;
|
||||
}
|
||||
engine.value?.refresh();
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
<template>
|
||||
<OrderListEngine :status-filter="statusFilter" />
|
||||
<OrderListEngine ref="engine" :status-filter="statusFilter" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import OrderListEngine from '@/dynamic-pages/engines/OrderListEngine.vue';
|
||||
|
||||
// 旧版数字 status → 新版语义化 status 映射表
|
||||
@ -23,11 +23,22 @@ const STATUS_MAP = {
|
||||
const SEMANTIC_STATUS = ['all', 'pending_payment', 'pending_delivery', 'pending_use', 'pending_comment', 'after_sale'];
|
||||
|
||||
const statusFilter = ref('all');
|
||||
const engine = ref(null);
|
||||
|
||||
onLoad((options) => {
|
||||
statusFilter.value = normalizeStatus(options.status);
|
||||
});
|
||||
|
||||
// 首次 onShow 与引擎首次加载重复,跳过;此后每次返回本页(详情页评价/收货后返回)刷新列表数据
|
||||
let showed = false;
|
||||
onShow(() => {
|
||||
if (!showed) {
|
||||
showed = true;
|
||||
return;
|
||||
}
|
||||
engine.value?.refresh();
|
||||
});
|
||||
|
||||
/**
|
||||
* 归一化 status 参数
|
||||
* 兼容旧版数字 status(0/1/2/3/9)与新版语义化字符串
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user