Merge pull request 'fix(admin): 修复后台订单列表中商品单位名称显示问题' (#446) from dev into main

Reviewed-on: #446
This commit is contained in:
mkm 2025-01-08 16:17:00 +08:00
commit fad173b82d

View File

@ -82,7 +82,11 @@ class BeforehandOrderCartInfoLists extends BaseAdminDataLists implements ListsSe
->order(['id' => 'desc'])
->select()->each(function ($item) use ($system_store, $order_mark) {
$find = StoreProduct::where('id', $item['product_id'])->field('top_cate_id,store_name,image,unit')->withTrashed()->find();
$item->unit_name = StoreProductUnit::where('id', $find->unit)->value('name');
if($find->unit>0){
$item->unit_name = StoreProductUnit::where('id', $find->unit)->value('name');
}else{
$item->unit_name = '';
}
$item['warehouse_stock'] = WarehouseProductStorege::where('product_id', $item['product_id'])->where('warehouse_id',1)->value('nums') ?? 0;
$item['store_name'] = $find['store_name'];
$item['system_store'] = $system_store;