shish vor 1 Tag
Ursprung
Commit
716a57d2c4

+ 3 - 1
app-mall/controllers/RefundController.php

@@ -145,6 +145,7 @@ class RefundController extends BaseController
     /**
      * 顾客售后申请列表(mallApp 退款售后 Tab)
      * status:all 全部;0/pending 处理中;1/refunded 已退款;closed 已关闭(驳回+取消)
+     * orderId:可选,订单详情「申请记录」只看本单申请
      */
     public function actionList()
     {
@@ -152,7 +153,8 @@ class RefundController extends BaseController
         if ($tab === '' || $tab === null) {
             $tab = 'all';
         }
-        $list = HdRefundMallClass::getCustomApplyList((int)$this->userId, (string)$tab);
+        $orderId = (int)Yii::$app->request->get('orderId', 0);
+        $list = HdRefundMallClass::getCustomApplyList((int)$this->userId, (string)$tab, $orderId);
         util::success($list);
     }
 

+ 14 - 4
biz-hd/refund/classes/HdRefundMallClass.php

@@ -570,15 +570,21 @@ class HdRefundMallClass
     }
 
     /**
-     * 顾客端售后列表(mallApp 退款售后页,跨店)
+     * 顾客端售后列表(mallApp 退款售后页,跨店;可按订单收窄
      * @param int $userId 当前登录商城用户
      * @param string $tab all|pending|0|refunded|1|closed|2|3
+     * @param int $orderId 可选,>0 时只返回该订单的顾客申请(订单详情「申请记录」)
      * @return array 分页 list + pendingCount
      */
-    public static function getCustomApplyList($userId, $tab = 'all')
+    public static function getCustomApplyList($userId, $tab = 'all', $orderId = 0)
     {
         $userId = (int)$userId;
+        $orderId = (int)$orderId;
         $where = ['userId' => $userId];
+        // 订单详情进入时只看本单,避免混入其它订单售后
+        if ($orderId > 0) {
+            $where['orderId'] = $orderId;
+        }
         $tab = (string)$tab;
         if ($tab === 'pending' || $tab === '0') {
             $where['status'] = HdRefundClass::STATUS_PENDING;
@@ -591,10 +597,14 @@ class HdRefundMallClass
         }
 
         $data = HdRefundClass::getList('*', $where, 'addTime DESC');
-        $data['pendingCount'] = (int)HdRefundClass::getCount([
+        $pendingWhere = [
             'userId' => $userId,
             'status' => HdRefundClass::STATUS_PENDING,
-        ]);
+        ];
+        if ($orderId > 0) {
+            $pendingWhere['orderId'] = $orderId;
+        }
+        $data['pendingCount'] = (int)HdRefundClass::getCount($pendingWhere);
         if (!empty($data['list'])) {
             $data['list'] = self::formatCustomList($data['list']);
         } else {