fix:修复bug;新增订单列表页面订单监控
This commit is contained in:
+25
-8
@@ -35,7 +35,8 @@
|
||||
import {
|
||||
ref,
|
||||
reactive,
|
||||
onMounted
|
||||
onMounted,
|
||||
onUnmounted
|
||||
} from 'vue';
|
||||
import OrderItemCard from '../../components/OrderItemCard.vue';
|
||||
import {
|
||||
@@ -60,13 +61,6 @@
|
||||
|
||||
const { t: $t } = useI18n()
|
||||
|
||||
// 设置页面标题
|
||||
onMounted(() => {
|
||||
uni.setNavigationBarTitle({
|
||||
title: $t('order.myOrders')
|
||||
})
|
||||
})
|
||||
|
||||
// 初始化状态
|
||||
const currentTab = ref(0);
|
||||
const orderList = ref([]);
|
||||
@@ -228,6 +222,29 @@
|
||||
}
|
||||
};
|
||||
|
||||
// 处理订单完成事件
|
||||
const handleOrderCompleted = (orderData) => {
|
||||
console.log('订单列表页收到订单完成事件:', orderData)
|
||||
// 刷新订单列表,根据当前选中的标签刷新对应状态的订单
|
||||
const statusList = orderStatusTabs[currentTab.value].status[0]
|
||||
loadOrderList(statusList)
|
||||
}
|
||||
|
||||
// 设置页面标题并监听订单完成事件
|
||||
onMounted(() => {
|
||||
uni.setNavigationBarTitle({
|
||||
title: $t('order.myOrders')
|
||||
})
|
||||
|
||||
// 监听订单完成事件
|
||||
uni.$on('orderCompleted', handleOrderCompleted)
|
||||
})
|
||||
|
||||
// 页面卸载时移除事件监听
|
||||
onUnmounted(() => {
|
||||
uni.$off('orderCompleted', handleOrderCompleted)
|
||||
})
|
||||
|
||||
// 同步订单状态
|
||||
const getOrderStatus = async (order) => {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user