feat: 修改了商品列表搜索功能
This commit is contained in:
parent
0214b50ca8
commit
b65ab15e2a
@ -62,25 +62,25 @@ class StoreProductLists extends BaseAdminDataLists implements ListsSearchInterfa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return StoreProduct::where($this->searchWhere)
|
return StoreProduct::where($this->searchWhere)
|
||||||
->field(['id', 'image', 'store_info','store_name', 'top_cate_id','two_cate_id','swap', 'product_type', 'cate_id', 'batch', 'price', 'vip_price', 'sales', 'stock', 'is_show', 'unit', 'cost', 'rose', 'purchase', 'bar_code', 'manufacturer_information'])
|
->field(['id', 'image', 'store_info', 'store_name', 'top_cate_id', 'two_cate_id', 'swap', 'product_type', 'cate_id', 'batch', 'price', 'vip_price', 'sales', 'stock', 'is_show', 'unit', 'cost', 'rose', 'purchase', 'bar_code', 'manufacturer_information'])
|
||||||
->limit($this->limitOffset, $this->limitLength)
|
->limit($this->limitOffset, $this->limitLength)
|
||||||
->order(['id' => 'desc'])
|
->order(['id' => 'desc'])
|
||||||
->select()->each(function ($item) {
|
->select()->each(function ($item) {
|
||||||
$item['bar_code_two']='';
|
$item['bar_code_two'] = '';
|
||||||
if(in_array($item['unit'],[2,21])){
|
if (in_array($item['unit'], [2, 21])) {
|
||||||
$item['bar_code_two']=$item['bar_code'];
|
$item['bar_code_two'] = $item['bar_code'];
|
||||||
if($item['bar_code']==0){
|
if ($item['bar_code'] == 0) {
|
||||||
$item['bar_code_two']='';
|
$item['bar_code_two'] = '';
|
||||||
}
|
}
|
||||||
$item['bar_code']='';
|
$item['bar_code'] = '';
|
||||||
$item['unit_names'] = '称重商品';
|
$item['unit_names'] = '称重商品';
|
||||||
}else{
|
} else {
|
||||||
if(strlen($item['bar_code'])<10){
|
if (strlen($item['bar_code']) < 10) {
|
||||||
$item['bar_code_two']=$item['bar_code'];
|
$item['bar_code_two'] = $item['bar_code'];
|
||||||
if($item['bar_code']==0){
|
if ($item['bar_code'] == 0) {
|
||||||
$item['bar_code_two']='';
|
$item['bar_code_two'] = '';
|
||||||
}
|
}
|
||||||
$item['bar_code']='';
|
$item['bar_code'] = '';
|
||||||
}
|
}
|
||||||
$item['unit_names'] = '标准商品';
|
$item['unit_names'] = '标准商品';
|
||||||
}
|
}
|
||||||
@ -90,18 +90,20 @@ class StoreProductLists extends BaseAdminDataLists implements ListsSearchInterfa
|
|||||||
$nums = WarehouseProductStorege::where('product_id', $item['id'])->sum('nums');
|
$nums = WarehouseProductStorege::where('product_id', $item['id'])->sum('nums');
|
||||||
$stock = StoreBranchProduct::where('store_id', '<>', '4')->where('product_id', $item['id'])->sum('stock');
|
$stock = StoreBranchProduct::where('store_id', '<>', '4')->where('product_id', $item['id'])->sum('stock');
|
||||||
$item['stock'] = bcadd($nums, $stock);
|
$item['stock'] = bcadd($nums, $stock);
|
||||||
$cate_name='';
|
$cate_name = '';
|
||||||
$category_top=StoreCategory::where('id', $item['top_cate_id'])->value('name');
|
$category_top = StoreCategory::where('id', $item['top_cate_id'])->value('name');
|
||||||
if($category_top!=''){
|
if ($category_top != '') {
|
||||||
$cate_name='/'.$category_top;
|
$cate_name = '/' . $category_top;
|
||||||
}
|
}
|
||||||
// $category_two=StoreCategory::where('id', $item['two_cate_id'])->value('name');
|
if (!$category_top) {
|
||||||
// if($category_two!=''){
|
$category_two = StoreCategory::where('id', $item['two_cate_id'])->value('name');
|
||||||
// $cate_name=$cate_name.'/'.$category_two;
|
if ($category_two != '') {
|
||||||
// }
|
$cate_name = $cate_name . '/' . $category_two;
|
||||||
$category_three=StoreCategory::where('id', $item['cate_id'])->value('name');
|
}
|
||||||
if($category_three){
|
}
|
||||||
$cate_name=$cate_name.'/'.$category_three;
|
$category_three = StoreCategory::where('id', $item['cate_id'])->value('name');
|
||||||
|
if ($category_three) {
|
||||||
|
$cate_name = $cate_name . '/' . $category_three;
|
||||||
}
|
}
|
||||||
$item['cate_name'] = $cate_name;
|
$item['cate_name'] = $cate_name;
|
||||||
// $item['cate_name'] = StoreCategory::where('id', $item['cate_id'])->value('name');
|
// $item['cate_name'] = StoreCategory::where('id', $item['cate_id'])->value('name');
|
||||||
@ -118,8 +120,8 @@ class StoreProductLists extends BaseAdminDataLists implements ListsSearchInterfa
|
|||||||
*/
|
*/
|
||||||
public function count(): int
|
public function count(): int
|
||||||
{
|
{
|
||||||
$export=$this->request->get('export');
|
$export = $this->request->get('export');
|
||||||
if($export==1){
|
if ($export == 1) {
|
||||||
$class_all = $this->request->get('class_all');
|
$class_all = $this->request->get('class_all');
|
||||||
if ($class_all) {
|
if ($class_all) {
|
||||||
//查3级别的
|
//查3级别的
|
||||||
@ -159,9 +161,9 @@ class StoreProductLists extends BaseAdminDataLists implements ListsSearchInterfa
|
|||||||
'id' => '商品id',
|
'id' => '商品id',
|
||||||
'unit_names' => '计价方式',
|
'unit_names' => '计价方式',
|
||||||
'store_name' => '商品名称',
|
'store_name' => '商品名称',
|
||||||
'cate_name'=>'分类',
|
'cate_name' => '分类',
|
||||||
'unit_name'=>'单位',
|
'unit_name' => '单位',
|
||||||
'store_info'=>'规格',
|
'store_info' => '规格',
|
||||||
'stock' => '库存',
|
'stock' => '库存',
|
||||||
'purchase' => '采购价',
|
'purchase' => '采购价',
|
||||||
'cost' => '商户',
|
'cost' => '商户',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user