Jelajahi Sumber

新订单列表详情 -- 初步改完

shizhongqi 4 tahun lalu
induk
melakukan
1bac694472
1 mengubah file dengan 24 tambahan dan 10 penghapusan
  1. 24 10
      app-ghs/controllers/OrderController.php

+ 24 - 10
app-ghs/controllers/OrderController.php

@@ -629,26 +629,39 @@ class OrderController extends BaseController
     public function actionNewOrderList()
     {
         $get = Yii::$app->request->get();
+
+
         $status = $get['status'] ?? 0;
         if (!empty($status)) {
             $where['status'] = $status;
         }
-        $where['sjId'] = $this->sjId;
-        if (isset($get['shopId'])) {
-            $shopId = $get['shopId'] ?? 0;
-            if (!empty($shopId)) {
-                $where['shopId'] = $this->shopId;
+        if (isset($get['type'])) {
+            $type = $get['type'];
+            if ($type == 1) { // 今日实收
+                $get['searchTime'] = 'today';
+                $where['debt'] = 0;
+                $where['payStatus'] = 2;
+            } elseif ($type == 2) { // 今日欠款
+                $get['searchTime'] = 'today';
+                $where['debt'] = 1;
+            } elseif ($type == 3) { // 总欠款
+                $where['debt'] = 1;
+            } else {
+                util::fail('查询的订单类别不存在');
             }
-        } else {
-            $where['shopId'] = $this->shopId;
         }
+
+        //$where['sjId'] = $this->sjId;
+        $where['shopId'] = $this->shopId;
+
         $searchTime = $get['searchTime'] ?? '';
         if (!empty($searchTime)) {
-            $startTime = $get['startTime'] ?? '';
-            $endTime = $get['endTime'] ?? '';
+            $startTime = '';
+            $endTime = '';
             $period = dateUtil::formatTime($searchTime, $startTime, $endTime);
             $where['addTime'] = ['between', [$period['startTime'], $period['endTime']]];
         }
+
         $name = $get['name'] ?? '';
         if (!empty($name)) {
             $searchType = $get['searchType'] ?? 0;
@@ -664,9 +677,10 @@ class OrderController extends BaseController
             } elseif ($searchType == 1) {
                 $where['sendNum'] = $name;
             } else {
-
+                util::fail('搜索的订单类别不存在');
             }
         }
+
         $respond = OrderClass::getOrderList($where);
         $respond['shop'] = $this->shop;
         $respond['shopExt'] = $this->shopExt;