shish 5 лет назад
Родитель
Сommit
69bbd589d0
1 измененных файлов с 61 добавлено и 22 удалено
  1. 61 22
      biz-ghs/order/classes/OrderClass.php

+ 61 - 22
biz-ghs/order/classes/OrderClass.php

@@ -122,6 +122,61 @@ class OrderClass extends BaseClass
         return $data;
     }
 
+    //显示操作按钮
+    public static function getShowButton($showButton, $order)
+    {
+        if ($showButton == false) {
+            return [];
+        }
+        $item = ['type' => 'item', 'show' => 1, 'disable' => 0];
+        if ($order['sendStatus'] > 0) {
+            //只有待发货订单,花材按钮才能点击
+            $item['disable'] = 1;
+        }
+        $send = ['type' => 'send', 'show' => 1, 'disable' => 0];
+        if ($order['sendType'] == 1) {
+            //自取订单,发货按钮不可点
+            $send['disable'] = 1;
+        }
+        $selfGet = ['type' => 'selfGet', 'show' => 1, 'disable' => 1];
+        if ($order['sendType'] == 0) {
+            //只有未确认配送方式的订单才可点击自取
+            $selfGet['disable'] = 0;
+        }
+        return [$item, $send, $selfGet];
+    }
+
+    //显示进度 shish 2021.3.1
+    public static function getShowProgress($showProgress, $order)
+    {
+        if ($showProgress == false) {
+            return [];
+        }
+        $create = ['name' => '创建', 'complete' => 1];
+        $unConfirm = ['name' => '待确认', 'complete' => 0];
+        if ($order['status'] > 0) {
+            $unConfirm['complete'] = 1;
+        }
+        $out = ['name' => '出库', 'complete' => 0];
+        if ($order['status'] > 1) {
+            $out['complete'] = 1;
+        }
+        return [$create, $unConfirm, $out];
+    }
+
+    public static function getShowProduct($showProduct, $order)
+    {
+        if ($showProduct == false) {
+            return [];
+        }
+        return [
+            [
+                'cover' => 'https://img.huahb.com/uploads/12358/202101/13/0e713d46064ca89b1fb11095b710f244_small.jpeg',
+                'name' => '昆明B级红玫瑰卡罗拉', 'property' => 'B级', 'price' => '8.45', 'bigNum' => 2, 'smallNum' => 10, 'id' => 16,
+            ],
+        ];
+    }
+
     //整合订单员工和供货商等信息 shish 2021.1.19
     public static function groupOrder($list, $showButton = false, $showProgress = false, $showProduct = false)
     {
@@ -143,28 +198,12 @@ class OrderClass extends BaseClass
             $list[$key]['customAvatar'] = $customInfo[$customId]['smallAvatar'] ?? '';
             $list[$key]['customMobile'] = $customInfo[$customId]['mobile'] ?? '';
             $list[$key]['customAddress'] = $customInfo[$customId]['address'] ?? '';
-            if ($showButton) {
-                $list[$key]['buttonList'] = [
-                    ['type' => 'item', 'show' => 1, 'disable' => 1],
-                    ['type' => 'send', 'show' => 1, 'disable' => 0],
-                    ['type' => 'selfGet', 'show' => 1, 'disable' => 0],
-                ];
-            }
-            if ($showProgress) {
-                $list[$key]['progress'] = [
-                    ['name' => '创建', 'complete' => 1],
-                    ['name' => '待确认', 'complete' => 0],
-                    ['name' => '出库', 'complete' => 0],
-                ];
-            }
-            if ($showProduct) {
-                $list[$key]['product'] = [
-                    [
-                        'cover' => 'https://img.huahb.com/uploads/12358/202101/13/0e713d46064ca89b1fb11095b710f244_small.jpeg',
-                        'name' => '昆明B级红玫瑰卡罗拉', 'property' => 'B级', 'price' => '8.45', 'bigNum' => 2, 'smallNum' => 10, 'id' => 16,
-                    ],
-                ];
-            }
+            //显示列表页的操作按钮
+            $list[$key]['buttonList'] = self::getShowButton($showButton, $val);
+            //显示进度条
+            $list[$key]['progress'] = self::getShowProgress($showProgress, $val);
+            //显示产品
+            $list[$key]['product'] = self::getShowProduct($showProduct, $val);
         }
         return $list;
     }