refactor(user/order): 重构订单页面

- 移除了 OrderSearch 组件
- 简化了 OrderList 组件的接口- 优化了订单页面的逻辑结构
- 删除了未使用的 CSS 样式文件
This commit is contained in:
2025-08-11 22:08:53 +08:00
parent f7825b84b1
commit 8c10b4a66b
5 changed files with 42 additions and 367 deletions

View File

@@ -72,7 +72,6 @@ interface OrderWithGoods extends ShopOrder {
}
interface OrderListProps {
data: ShopOrder[];
onReload?: () => void;
searchParams?: ShopOrderParam;
showSearch?: boolean;
@@ -87,7 +86,6 @@ function OrderList(props: OrderListProps) {
// 获取订单状态文本
const getOrderStatusText = (order: ShopOrder) => {
console.log(order,'order')
// 优先检查订单状态
if (order.orderStatus === 2) return '已取消';
@@ -239,7 +237,7 @@ function OrderList(props: OrderListProps) {
Taro.showToast({
title: '订单已删除',
});
reload(true); // 重新加载列表
reload(true).then(); // 重新加载列表
props.onReload?.(); // 通知父组件刷新
} catch (error) {
console.error('取消订单失败:', error);
@@ -250,11 +248,11 @@ function OrderList(props: OrderListProps) {
};
useEffect(() => {
reload(true); // 首次加载或tab切换时重置页码
reload(true).then(); // 首次加载或tab切换时重置页码
}, [tapIndex]); // 监听tapIndex变化
useEffect(() => {
reload(true); // 搜索参数变化时重置页码
reload(true).then(); // 搜索参数变化时重置页码
}, [props.searchParams]); // 监听搜索参数变化
return (