| 
					
				 | 
			
			
				@@ -222,7 +222,7 @@ class GoodsService 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             ->get() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             ->toArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        $total = Goods::leftJoin('goods_running', 'goods_running.join_running_goods_id', '=', 'goods.goods_id') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $totalModel = Goods::leftJoin('goods_running', 'goods_running.join_running_goods_id', '=', 'goods.goods_id') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             ->when($goodsName != '', function ($query) use ($goodsName) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 $query->where(function ($q) use ($goodsName) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     $q->where('goods_name', 'like', '%' . $goodsName . '%'); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -238,7 +238,7 @@ class GoodsService 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } else if ($classify == 'RECHARGE' && empty($categoryId)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     $query->where('goods_status', 'ON'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     $query->where('goods_classify', $classify); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                }  else if ($classify != 'GOODS' && empty($categoryId)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } else if ($classify != 'GOODS' && empty($categoryId)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     $query->where('goods_classify', $classify); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             })->when(!empty($type), function ($query) use ($type) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -249,8 +249,13 @@ class GoodsService 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 $query->where('join_goods_supplier_id', $goodsSupplierId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             })->when(!empty($goodsStatus), function ($query) use ($goodsStatus) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 $query->where('goods_status', $goodsStatus); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            ->count(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $goodsOnTotalModel = clone $totalModel; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $goodsOnTotal = $goodsOnTotalModel->where('goods_status', 'ON')->count(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $goodsWarningTotalModel = clone $totalModel; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $goodsWarningTotal = $goodsWarningTotalModel->where('goods_running_storage', '<=', 2)->count(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $total = $totalModel->count(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         foreach ($rows as &$row) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             $row['goods_cover'] = getenv('STORAGE_DOMAIN') . $row['goods_cover']; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -265,7 +270,7 @@ class GoodsService 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        return json_success('', compact('rows', 'page', 'pageSize', 'total')); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return json_success('', compact('rows', 'page', 'pageSize', 'total', 'goodsOnTotal', 'goodsWarningTotal')); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public static function selectSpecial(Request $request) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -308,12 +313,19 @@ class GoodsService 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             ->forPage($page, $pageSize) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             ->get() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             ->toArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        $total = Goods::when($goodsName != '', function ($query) use ($goodsName) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $totalModel = Goods::when($goodsName != '', function ($query) use ($goodsName) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             $query->where(function ($q) use ($goodsName) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 $q->where('goods_name', 'like', '%' . $goodsName . '%'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                    ->OrWhere('goods_title', 'like', '%' . $goodsName . '%'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        })->whereIn('join_goods_category_id', $categoryId)->count(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        })->leftJoin('goods_running', 'goods_running.join_running_goods_id', '=', 'goods.goods_id') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ->whereIn('join_goods_category_id', $categoryId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $goodsOnTotalModel = clone $totalModel; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $goodsOnTotal = $goodsOnTotalModel->where('goods_status', 'ON')->count(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $goodsWarningTotalModel = clone $totalModel; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $goodsWarningTotal = $goodsWarningTotalModel->where('goods_running_storage', '<=', 2)->count(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $total = $totalModel->count(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         foreach ($rows as &$row) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             $row['goods_cover'] = getenv('STORAGE_DOMAIN') . $row['goods_cover']; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -322,7 +334,7 @@ class GoodsService 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        return json_success('', compact('rows', 'page', 'pageSize', 'total')); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return json_success('', compact('rows', 'page', 'pageSize', 'total', 'goodsOnTotal', 'goodsWarningTotal')); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public static function selectPicking(Request $request) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -375,14 +387,20 @@ class GoodsService 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             ->forPage($page, $pageSize) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             ->get() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             ->toArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        $total = Goods::when($goodsName != '', function ($query) use ($goodsName) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $totalModel = Goods::when($goodsName != '', function ($query) use ($goodsName) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             $query->where(function ($q) use ($goodsName) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 $q->where('goods_name', 'like', '%' . $goodsName . '%') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     ->OrWhere('goods_title', 'like', '%' . $goodsName . '%'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        })->whereIn('join_goods_category_id', $categoryIds) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            ->count(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        })->leftJoin('goods_running', 'goods_running.join_running_goods_id', '=', 'goods.goods_id') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ->whereIn('join_goods_category_id', $categoryIds); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $goodsOnTotalModel = clone $totalModel; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $goodsOnTotal = $goodsOnTotalModel->where('goods_status', 'ON')->count(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $goodsWarningTotalModel = clone $totalModel; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $goodsWarningTotal = $goodsWarningTotalModel->where('goods_running_storage', '<=', 2)->count(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $total = $totalModel->count(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         foreach ($rows as &$row) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             $row['goods_cover'] = getenv('STORAGE_DOMAIN') . $row['goods_cover']; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (isset($row['running'])) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -390,7 +408,7 @@ class GoodsService 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        return json_success('', compact('rows', 'page', 'pageSize', 'total')); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return json_success('', compact('rows', 'page', 'pageSize', 'total', 'goodsOnTotal', 'goodsWarningTotal')); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public static function selectPackage(Request $request) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -431,39 +449,31 @@ class GoodsService 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             ->forPage($page, $pageSize) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             ->get() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             ->toArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        $total = Goods::when($goodsName != '', function ($query) use ($goodsName) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $totalModel = Goods::when($goodsName != '', function ($query) use ($goodsName) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             $query->where(function ($q) use ($goodsName) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 $q->where('goods_name', 'like', '%' . $goodsName . '%') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     ->OrWhere('goods_title', 'like', '%' . $goodsName . '%'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         })->when($categoryId != null, function ($query) use ($categoryId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             $query->where('join_goods_category_id', $categoryId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        })->where('goods_classify', 'PACKAGE')->count(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        })->leftJoin('goods_running', 'goods_running.join_running_goods_id', '=', 'goods.goods_id') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ->where('goods_classify', 'PACKAGE'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $goodsOnTotalModel = clone $totalModel; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $goodsOnTotal = $goodsOnTotalModel->where('goods_status', 'ON')->count(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $goodsWarningTotalModel = clone $totalModel; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $goodsWarningTotal = $goodsWarningTotalModel->where('goods_running_storage', '<=', 2)->count(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $total = $totalModel->count(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         foreach ($rows as &$row) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             $row['goods_cover'] = getenv('STORAGE_DOMAIN') . $row['goods_cover']; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (isset($row['running'])) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 $row['running']['goods_running_storage'] = intval($row['running']['goods_running_storage']); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            if (!empty($row['component'])) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                $ids = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                $contentList = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                foreach ($row['component'] as $component) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                    $ids[] = $component['join_component_goods_id']; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                    $configJson = json_decode($component['goods_component_config_json'], true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                    $contentList[] = [ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                        'goods_name' => $configJson['goods_name'] ?? '', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                        'goods_sales_price' => $component['goods_component_price'], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                        'nbr' => $configJson['nbr'] ?? 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                    ]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                $row['join_component_goods_id'] = $ids; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                $row['goodsContentList'] = $contentList; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        return json_success('', compact('rows', 'page', 'pageSize', 'total')); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return json_success('', compact('rows', 'page', 'pageSize', 'total', 'goodsOnTotal', 'goodsWarningTotal')); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /** 
			 |