diff --git a/app/admin/lists/store_product/StoreProductLists.php b/app/admin/lists/store_product/StoreProductLists.php index 338ab1517..cb942673f 100644 --- a/app/admin/lists/store_product/StoreProductLists.php +++ b/app/admin/lists/store_product/StoreProductLists.php @@ -10,6 +10,7 @@ use app\common\lists\ListsSearchInterface; use app\common\model\store_category\StoreCategory; use app\common\model\store_product_unit\StoreProductUnit; use app\common\model\system_store\SystemStore; +use app\common\model\warehouse_product_storege\WarehouseProductStorege; /** * 商品列表列表 @@ -64,6 +65,7 @@ class StoreProductLists extends BaseAdminDataLists implements ListsSearchInterfa ->order(['id' => 'desc']) ->select()->each(function ($item) { $item['unit_name'] = StoreProductUnit::where('id', $item['unit'])->value('name'); + $item['stock'] = WarehouseProductStorege::where('product_id', $item['id'])->sum('nums'); $item['cate_name'] = StoreCategory::where('id', $item['cate_id'])->value('name'); return $item; })?->toArray();