Merge pull request '根据用户权限隐藏价格信息' (#270) from dev into main

Reviewed-on: #270
This commit is contained in:
mkm 2024-10-15 14:28:31 +08:00
commit 9e7d0a3cc2
3 changed files with 24 additions and 4 deletions

View File

@ -51,8 +51,9 @@ class BeforehandOrderThreeLists extends BaseAdminDataLists implements ListsSearc
$this->outbound_id=$outbound_id;
$this->searchWhere[]=['oid','=',$outbound_id];
$this->searchWhere[]=['financial_pm','=',0];
$job_ids=$this->adminInfo['job_ids']??[];
return WarehouseProduct::where($this->searchWhere)->select()
->each(function($item){
->each(function($item) use($job_ids){
$find=StoreProduct::where('id',$item['product_id'])->field('store_name,image,unit')->withTrashed()->find();
$item['store_name']=$find['store_name'];
$item['image']=$find['image'];
@ -66,6 +67,12 @@ class BeforehandOrderThreeLists extends BaseAdminDataLists implements ListsSearc
}else{
$item['supplier_name']='';
}
foreach($job_ids as $k=>$v){
if($v==1){
$item->price='*';
$item->total_price='*';
}
}
return $item;
})
->toArray();

View File

@ -51,8 +51,9 @@ class BeforehandOrderTwoLists extends BaseAdminDataLists implements ListsSearchI
$this->warehousing_id=$warehousing_id;
$this->searchWhere[]=['oid','=',$warehousing_id];
$this->searchWhere[]=['financial_pm','=',1];
$job_ids=$this->adminInfo['job_ids']??[];
return WarehouseProduct::where($this->searchWhere)->select()
->each(function($item){
->each(function($item) use($job_ids){
$find=StoreProduct::where('id',$item['product_id'])->field('store_name,image,unit')->withTrashed()->find();
$item['store_name']=$find['store_name'];
$item['image']=$find['image'];
@ -66,6 +67,12 @@ class BeforehandOrderTwoLists extends BaseAdminDataLists implements ListsSearchI
}else{
$item['supplier_name']='';
}
foreach($job_ids as $k=>$v){
if($v==1){
$item->price='*';
$item->total_price='*';
}
}
return $item;
})
->toArray();

View File

@ -57,11 +57,12 @@ class PurchaseProductOfferLists extends BaseAdminDataLists implements ListsSearc
$this->is_ids=1;
}
}
$job_ids=$this->adminInfo['job_ids']??[];
return PurchaseProductOffer::where($this->searchWhere)
->field(['id', 'supplier_id', 'order_id', 'product_id', 'price','total_price', 'buyer_nums', 'unit', 'is_buyer', 'buyer_confirm', 'is_storage', 'is_stream', 'need_num', 'mark', 'buyer_id', 'status', 'stream_admin_id', 'stream_time', 'storage_admin_id'])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()->each(function($item){
->select()->each(function($item) use($job_ids){
$find=StoreProduct::where('id',$item->product_id)->withTrashed()->find();
$item->store_name=$find->store_name;
$item->store_info=$find->store_info;
@ -95,7 +96,12 @@ class PurchaseProductOfferLists extends BaseAdminDataLists implements ListsSearc
$item->is_storage_name='未入库';
}
$item->pay_type_name=$item->pay_type==1?'赊账':'现金';
foreach($job_ids as $k=>$v){
if($v==1){
$item->price='*';
$item->total_price='*';
}
}
})
->toArray();
}