feat(admin): 添加商品顶级分类信息

- 在 StoreOrderCartInfoTwoLists 类中添加商品顶级分类信息
- 在查询商品信息时,增加 top_cate_id 字段的获取
- 在结果集中添加 top_cate_name 字段,用于显示商品的顶级分类名称
This commit is contained in:
mkm 2024-11-07 16:19:10 +08:00
parent 110086e74b
commit 7af7906e01

View File

@ -76,7 +76,7 @@ class StoreOrderCartInfoTwoLists extends BaseAdminDataLists implements ListsSear
}
return $query->limit($this->limitOffset, $this->limitLength)
->select()->each(function ($item) use($is_group,$export){
$find = StoreProduct::where('id', $item['product_id'])->field('image,unit,cate_id,store_name,store_info')->withTrashed()->find();
$find = StoreProduct::where('id', $item['product_id'])->field('image,unit,top_cate_id,cate_id,store_name,store_info')->withTrashed()->find();
$item['nickname']='';
$item['mobile']='';
$item['order_id']='';
@ -104,6 +104,7 @@ class StoreOrderCartInfoTwoLists extends BaseAdminDataLists implements ListsSear
$item['store_info'] = $find['store_info']; //商品规格
$item['unit_name'] = StoreProductUnit::where('id', $find['unit'])->value('name') ?? '';
$item['cate_name'] = StoreCategory::where('id', $find['cate_id'])->value('name') ?? '';
$item['top_cate_name'] = StoreCategory::where('id', $find['top_cate_id'])->value('name') ?? '';
$item['system_store'] = SystemStore::where('id', $item['store_id'])->value('name') ?? '';
} else {
$item['image'] = ''; //商品图片
@ -160,6 +161,7 @@ class StoreOrderCartInfoTwoLists extends BaseAdminDataLists implements ListsSear
'store_name' => '商品名称',
'store_info' => '规格',
'unit_name' => '单位',
'top_cate_name' => '顶级分类',
'cate_name' => '分类',
'cart_num' => '数量',
'price' => '单价',
@ -172,6 +174,7 @@ class StoreOrderCartInfoTwoLists extends BaseAdminDataLists implements ListsSear
'store_name' => '商品名称',
'store_info' => '规格',
'unit_name' => '单位',
'top_cate_name' => '顶级分类',
'cate_name' => '分类',
'cart_num' => '数量',
'price' => '单价',