Explorar o código

订单按钮 显示 与 控制

shish %!s(int64=4) %!d(string=hai) anos
pai
achega
4f71c460c3

+ 1 - 0
app-ghs/controllers/OrderController.php

@@ -4,6 +4,7 @@ namespace ghs\controllers;
 
 use biz\stat\classes\StatOrderCountClass;
 use bizGhs\express\services\DadaExpressServices;
+use bizGhs\order\classes\OrderItemClass;
 use bizGhs\order\classes\StockWastageOrderClass;
 use bizHd\purchase\classes\PurchaseClass;
 use bizHd\purchase\services\PurchaseService;

+ 12 - 0
app-ghs/controllers/OrderItemController.php

@@ -70,4 +70,16 @@ class OrderItemController extends BaseController
         util::success(['productList' => array_values($productList)]);
     }
 
+    //根据花材id取订单列表 shish 20211011
+    public function actionGetOrderInfoList()
+    {
+        $get = Yii::$app->request->get();
+        $productId = $get['productId'] ?? 0;
+        $product = ProductClass::getById($productId, true);
+        ProductClass::check($product, $this->shopId);
+        $where = ['shopId' => $this->shopId, 'productId' => $productId];
+        $respond = OrderItemClass::getOrderInfoList($where);
+        util::success($respond);
+    }
+
 }

+ 6 - 6
biz-ghs/order/classes/OrderClass.php

@@ -313,8 +313,8 @@ class OrderClass extends BaseClass
 
         if ($isList) {
             //订单列表页显示的按钮
-            $send = ['type' => 'send', 'show' => 1, 'disable' => 0, 'name' => '发货'];
-            $selfGet = ['type' => 'selfGet', 'show' => 1, 'disable' => 1, 'name' => '自取'];
+            $send = ['type' => 'send', 'show' => 0, 'disable' => 0, 'name' => '发货'];
+            $selfGet = ['type' => 'selfGet', 'show' => 0, 'disable' => 1, 'name' => '自取'];
             if ($order['status'] == self::ORDER_STATUS_UN_PAY) {
                 //待确认订单,打印和修改花材按钮可以使用
                 $send['disable'] = 1;
@@ -355,8 +355,8 @@ class OrderClass extends BaseClass
 
             //待配送订单显示打印、发货和自取
             if ($order['status'] == self::ORDER_STATUS_UN_SEND) {
-                $selfGet = ['type' => 'selfGet', 'show' => 1, 'disable' => 1, 'name' => '自取'];
-                $send = ['type' => 'send', 'show' => 1, 'disable' => 1, 'name' => '发货'];
+                $selfGet = ['type' => 'selfGet', 'show' => 0, 'disable' => 1, 'name' => '自取'];
+                $send = ['type' => 'send', 'show' => 0, 'disable' => 1, 'name' => '发货'];
                 if ($order['hasItem'] == 2) {
                     return [$print, $selfGet, $send];
                 }
@@ -366,12 +366,12 @@ class OrderClass extends BaseClass
             }
             //配送中显示按钮
             if ($order['status'] == self::ORDER_STATUS_SENDING) {
-                $send = ['type' => 'send', 'show' => 1, 'disable' => 0, 'name' => '发货'];
+                $send = ['type' => 'send', 'show' => 0, 'disable' => 0, 'name' => '发货'];
                 return [$print, $send];
             }
             //完成
             if ($order['status'] == self::ORDER_STATUS_COMPLETE) {
-                $send = ['type' => 'send', 'show' => 1, 'disable' => 0, 'name' => '发货记录'];
+                $send = ['type' => 'send', 'show' => 0, 'disable' => 0, 'name' => '发货记录'];
                 //自取订单不显示发货按钮
                 if ($order['sendType'] == self::SEND_TYPE_NO) {
                     $send['show'] = 0;

+ 6 - 0
biz-ghs/order/classes/OrderItemClass.php

@@ -86,4 +86,10 @@ class OrderItemClass extends BaseClass
         return $respond;
     }
 
+    public static function getOrderInfoList($where)
+    {
+        $data = self::getList('*', $where, 'id DESC');
+        return $data;
+    }
+
 }

+ 11 - 0
biz-ghs/product/classes/ProductClass.php

@@ -490,6 +490,17 @@ class ProductClass extends BaseClass
         }
     }
 
+    public static function check($info, $shopId)
+    {
+        if (empty($info)) {
+            util::fail('没有花材信息');
+        }
+        if (isset($info->shopId) == false || $info->shopId != $shopId) {
+            util::fail('无效花材');
+        }
+        return true;
+    }
+
     //有效花材判断,包括id有效、同个门店等 ssh 2021.1.19
     public static function valid($list, $shopId)
     {