Merge pull request 'feat(admin): 增加商品进销存价格列表显示' (#404) from dev into main

Reviewed-on: #404
This commit is contained in:
mkm 2024-12-23 15:53:32 +08:00
commit 56b14aedd2

View File

@ -48,15 +48,18 @@ class StoreProductPriceLists extends BaseAdminDataLists implements ListsSearchIn
$this->searchWhere[]=['product_id','in',$store_id]; $this->searchWhere[]=['product_id','in',$store_id];
} }
return StoreProductPrice::where($this->searchWhere) return StoreProductPrice::where($this->searchWhere)
->field(['id','bhoid','offer_id', 'product_id', 'purchase_price', 'purchase_lv', 'purchase', 'cost_lv', 'cost', 'price_lv', 'price', 'price_config', 'status']) ->field(['id','bhoid','offer_id', 'product_id', 'purchase_price', 'purchase_lv', 'purchase', 'cost_lv', 'cost', 'price_lv', 'price', 'price_config', 'status','create_time','mark'])
->limit($this->limitOffset, $this->limitLength) ->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc']) ->order(['id' => 'desc'])
->select()->each(function($item){ ->select()->each(function($item){
$find = StoreProduct::with('unitName')->where('id', $item['product_id'])->field('image,store_name,store_info,unit')->withTrashed()->find(); $find = StoreProduct::with('unitName')->where('id', $item['product_id'])->field('image,purchase,cost,price,store_name,store_info,unit')->withTrashed()->find();
$item['unit_name']=$find['unitName']['name'] ?? ''; $item['unit_name']=$find['unitName']['name'] ?? '';
$item['store_name']=$find['store_name']; $item['store_name']=$find['store_name'];
$item['store_info']=$find['store_info']; $item['store_info']=$find['store_info'];
$item['image']=$find['image']; $item['image']=$find['image'];
$item['current_purchase']=$find['purchase'];
$item['current_cost']=$find['cost'];
$item['current_price']=$find['price'];
$item['status_name']=$item['status']==0?"未设置":"已设置"; $item['status_name']=$item['status']==0?"未设置":"已设置";
}) })
->toArray(); ->toArray();