fix(admin): 修复后台订单列表中商品单位名称显示问题
- 在 BeforehandOrderCartInfoLists 类中,增加了对商品单位 ID 的判断 - 当商品单位 ID 大于 0 时,正常查询并显示单位名称 - 当商品单位 ID 小于等于 0 时,将单位名称设置为空字符串,避免查询报错
This commit is contained in:
parent
554ca5fa6d
commit
f0eda34869
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user