Browse Source

选择开单人

shish 1 year ago
parent
commit
2167589fb9
1 changed files with 24 additions and 18 deletions
  1. 24 18
      app-ghs/controllers/OrderController.php

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

@@ -137,10 +137,10 @@ class OrderController extends BaseController
         $transaction = $connection->beginTransaction();
         $transaction = $connection->beginTransaction();
         try {
         try {
             $staff = $this->shopAdmin;
             $staff = $this->shopAdmin;
-            $staffId = $staff->id??0;
-            $staffName= $staff->name??'';
-            $params = ['staffId'=>$staffId,'staffName'=>$staffName];
-            OrderClass::confirmReach($order,$params);
+            $staffId = $staff->id ?? 0;
+            $staffName = $staff->name ?? '';
+            $params = ['staffId' => $staffId, 'staffName' => $staffName];
+            OrderClass::confirmReach($order, $params);
             $transaction->commit();
             $transaction->commit();
             util::complete('操作成功');
             util::complete('操作成功');
         } catch (\Exception $e) {
         } catch (\Exception $e) {
@@ -199,8 +199,8 @@ class OrderController extends BaseController
         $order = OrderClass::getById($id, true);
         $order = OrderClass::getById($id, true);
         OrderClass::valid($order, $this->shopId);
         OrderClass::valid($order, $this->shopId);
         $staff = $this->shopAdmin;
         $staff = $this->shopAdmin;
-        $staffId = $staff->id??0;
-        $staffName = $staff->name??'';
+        $staffId = $staff->id ?? 0;
+        $staffName = $staff->name ?? '';
         $fhWl = $post['fhWl'] ?? '';
         $fhWl = $post['fhWl'] ?? '';
         $fhWlNo = $post['fhWlNo'] ?? '';
         $fhWlNo = $post['fhWlNo'] ?? '';
         $fhType = $post['fhType'] ?? '';
         $fhType = $post['fhType'] ?? '';
@@ -208,8 +208,8 @@ class OrderController extends BaseController
             'fhType' => $fhType,
             'fhType' => $fhType,
             'fhWl' => $fhWl,
             'fhWl' => $fhWl,
             'fhWlNo' => $fhWlNo,
             'fhWlNo' => $fhWlNo,
-            'staffId'=>$staffId,
-            'staffName'=>$staffName,
+            'staffId' => $staffId,
+            'staffName' => $staffName,
         ];
         ];
 
 
         if ($order->book == 1) {
         if ($order->book == 1) {
@@ -738,7 +738,7 @@ class OrderController extends BaseController
         $staff = $this->shopAdmin;
         $staff = $this->shopAdmin;
         if (isset($staff->identity) && $staff->identity == 2) {
         if (isset($staff->identity) && $staff->identity == 2) {
             //如果用于确认发货时要显出订单
             //如果用于确认发货时要显出订单
-            if($onlySend == 0){
+            if ($onlySend == 0) {
                 util::success(['list' => []]);
                 util::success(['list' => []]);
             }
             }
         }
         }
@@ -807,6 +807,12 @@ class OrderController extends BaseController
             $newIds = explode(',', $stringIds);
             $newIds = explode(',', $stringIds);
             $where['id'] = ['in', $newIds];
             $where['id'] = ['in', $newIds];
         }
         }
+        //选择开单人
+        $shopAdminId = $get['shopAdminId'] ?? 0;
+        if (!empty($shopAdminId)) {
+            $where['shopAdminId'] = $shopAdminId;
+        }
+
         $respond = OrderClass::getOrderList($where);
         $respond = OrderClass::getOrderList($where);
         if ($export == 1) {
         if ($export == 1) {
             OrderClass::exportOrderData($respond, $this->mainId);
             OrderClass::exportOrderData($respond, $this->mainId);
@@ -2430,23 +2436,23 @@ class OrderController extends BaseController
         }
         }
 
 
         $get = Yii::$app->request->get();
         $get = Yii::$app->request->get();
-        $staffId = $get['staffId']??0;
-        $orderId = $get['orderId']??0;
-        $order = OrderClass::getById($orderId,true);
-        if(empty($order)){
+        $staffId = $get['staffId'] ?? 0;
+        $orderId = $get['orderId'] ?? 0;
+        $order = OrderClass::getById($orderId, true);
+        if (empty($order)) {
             util::fail('没有找到订单');
             util::fail('没有找到订单');
         }
         }
-        if($order->mainId != $this->mainId){
+        if ($order->mainId != $this->mainId) {
             util::fail('不是你的');
             util::fail('不是你的');
         }
         }
-        $staff = ShopAdminClass::getById($staffId,true);
-        if(empty($staff)){
+        $staff = ShopAdminClass::getById($staffId, true);
+        if (empty($staff)) {
             util::fail('没有找到员工');
             util::fail('没有找到员工');
         }
         }
-        if($staff->mainId!=$this->mainId){
+        if ($staff->mainId != $this->mainId) {
             util::fail('不是你的员工');
             util::fail('不是你的员工');
         }
         }
-        $staffName = $staff->name??'';
+        $staffName = $staff->name ?? '';
         $order->sendStaffId = $staffId;
         $order->sendStaffId = $staffId;
         $order->sendStaffName = $staffName;
         $order->sendStaffName = $staffName;
         $order->save();
         $order->save();