gorden 7 місяців тому
батько
коміт
99147deca2
1 змінених файлів з 8 додано та 4 видалено
  1. 8 4
      app/admin/service/goods/GoodsService.php

+ 8 - 4
app/admin/service/goods/GoodsService.php

@@ -232,10 +232,14 @@ class GoodsService
                 $query->where('goods_classify', $classify);
             }
         })->when( !empty($type),function ($query) use ($type){
-                if ($type == 'storageWarning'){
-                    $query->where('goods_running.goods_running_storage','<=',2);
-                }
-            })
+            if ($type == 'storageWarning'){
+                $query->where('goods_running.goods_running_storage','<=',2);
+            }
+        })->when(!empty($goodsSupplierId),function($query) use ($goodsSupplierId){
+            $query->where('join_goods_supplier_id', $goodsSupplierId);
+        })->when(!empty($goodsStatus),function($query) use ($goodsStatus){
+            $query->where('goods_status', $goodsStatus);
+        })
             ->count();
 
         foreach ($rows as &$row) {