From 9d02e0b5b17e4d53ec99c5d71410fd17230dced2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E6=98=8A=E5=A4=A9?= <442384644@qq.com> Date: Sat, 10 Oct 2026 16:18:32 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E7=94=A8=E6=88=B7=E6=8E=A5=E5=8F=A3):=20?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E8=AE=A2=E5=8D=95=E8=A7=92=E6=A0=87=E5=90=84?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E7=BB=9F=E8=AE=A1=E5=8F=A3=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 对齐订单列表 tab 口径:状态常量化;待发货/待收货按实物 delivery_time=0 判定 (int 默认 0,旧 null 比较永不命中);待评价用 pending_review;售后角标改为 退款中+已退款;移除未使用的客服订单管理查询。 --- .../api/controller/v1/PublicController.php | 41 ++++++++++--------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/backend/app/api/controller/v1/PublicController.php b/backend/app/api/controller/v1/PublicController.php index 0c69e1e94..06fcd4992 100644 --- a/backend/app/api/controller/v1/PublicController.php +++ b/backend/app/api/controller/v1/PublicController.php @@ -154,8 +154,6 @@ class PublicController if ($uid && $userInfo) { //是否客服 $userService = (bool)(event('KefuConfigQuery', ['uid' => $uid, 'customer' => 0])[0] ?? false); - //是否订单管理 - $userOrder = (bool)(event('KefuConfigQuery', ['uid' => $uid, 'customer' => 1])[0] ?? false); //是否核销员 $userVerifyStatus = app()->make(SystemStoreStaffServices::class)->verifyStatus($uid); //是否配送员 @@ -937,26 +935,31 @@ class PublicController //是否分销员 $userIsPromoter = (bool)app()->make(UserServices::class)->checkUserPromoter($uid, $userInfo); - // 统计各状态订单数量,用于菜单角标显示(基于 eb_order_center 表) + // 统计各状态订单数量,用于菜单角标显示(基于 eb_order_center 表,口径与订单列表 tab 一致) $orderAuth = []; $countWhere = ['is_del' => 0, 'uid' => $uid]; - // 全部订单(不含退款中和已退款) - $orderAuth['/pages/goods/order_list/index'] = (int)$orderCenterDao->count($countWhere + ['status_code' => ['pending_payment', 'processing', 'completed']]); + // 全部订单(不含取消和退款) + $orderAuth['/pages/goods/order_list/index'] = (int)$orderCenterDao->count($countWhere + ['status_code' => [ + \app\model\order\OrderCenter::STATUS_PENDING_PAYMENT, + \app\model\order\OrderCenter::STATUS_PROCESSING, + \app\model\order\OrderCenter::STATUS_PENDING_REVIEW, + \app\model\order\OrderCenter::STATUS_COMPLETED, + ]]); // 待付款 - $orderAuth['/pages/goods/order_list/index?status=0'] = (int)$orderCenterDao->count($countWhere + ['status_code' => 'pending_payment']); - // 待发货:processing + delivery_time 为空 - $orderAuth['/pages/goods/order_list/index?status=1'] = (int)$orderCenterDao->count($countWhere + ['status_code' => 'processing', ['delivery_time', 'null', '']]); - // 待收货:processing + delivery_time 不为空 + take_time 为空 - $orderAuth['/pages/goods/order_list/index?status=2'] = (int)$orderCenterDao->count($countWhere + ['status_code' => 'processing', ['delivery_time', 'not null', ''], ['take_time', 'null', '']]); - // 待评价:completed(需 JOIN 扩展表精确区分,此处近似取值) - $orderAuth['/pages/goods/order_list/index?status=3'] = (int)$orderCenterDao->count($countWhere + ['status_code' => 'completed']); - // 已完成:completed - $orderAuth['/pages/goods/order_list/index?status=4'] = (int)$orderCenterDao->count($countWhere + ['status_code' => 'completed']); - $orderAuth['/pages/users/user_return_list/index'] = (int)$orderCenterDao->getDb()->where([ - 'uid' => $uid, - 'is_del' => 0, - 'refund_status' => \app\model\order\OrderCenter::REFUND_APPLYING, - ])->count(); + $orderAuth['/pages/goods/order_list/index?status=0'] = (int)$orderCenterDao->count($countWhere + ['status_code' => \app\model\order\OrderCenter::STATUS_PENDING_PAYMENT]); + // 待发货:进行中的实物、未发货(delivery_time NOT NULL DEFAULT 0,0=未发货) + $orderAuth['/pages/goods/order_list/index?status=1'] = (int)$orderCenterDao->count($countWhere + ['status_code' => \app\model\order\OrderCenter::STATUS_PROCESSING, 'product_type' => 'normal', ['delivery_time', '=', 0]]); + // 待收货:进行中的实物、已发货未收货 + $orderAuth['/pages/goods/order_list/index?status=2'] = (int)$orderCenterDao->count($countWhere + ['status_code' => \app\model\order\OrderCenter::STATUS_PROCESSING, 'product_type' => 'normal', ['delivery_time', '<>', 0], ['take_time', '=', 0]]); + // 待评价:收货后未评价的订单,评价完成才流转 completed + $orderAuth['/pages/goods/order_list/index?status=3'] = (int)$orderCenterDao->count($countWhere + ['status_code' => \app\model\order\OrderCenter::STATUS_PENDING_REVIEW]); + // 已完成 + $orderAuth['/pages/goods/order_list/index?status=4'] = (int)$orderCenterDao->count($countWhere + ['status_code' => \app\model\order\OrderCenter::STATUS_COMPLETED]); + // 售后:与订单列表售后 tab 同口径(退款中 + 已退款) + $orderAuth['/pages/users/user_return_list/index'] = (int)$orderCenterDao->count($countWhere + ['status_code' => [ + \app\model\order\OrderCenter::STATUS_REFUNDING, + \app\model\order\OrderCenter::STATUS_REFUNDED, + ]]); } // 配置各页面的访问权限