修改商品列表查询

This commit is contained in:
DESKTOP-GMUNQ1B\Administrator 2024-12-05 17:46:03 +08:00
parent baeb03fd84
commit 444b011d0f
2 changed files with 11 additions and 2 deletions

View File

@ -9,8 +9,10 @@ use app\common\model\store_product\StoreProduct;
use app\common\lists\ListsSearchInterface;
use app\common\model\store_branch_product\StoreBranchProduct;
use app\common\model\store_category\StoreCategory;
use app\common\model\store_product_group_price\StoreProductGroupPrice;
use app\common\model\store_product_unit\StoreProductUnit;
use app\common\model\system_store\SystemStore;
use app\common\model\user\User;
use app\common\model\warehouse_product_storege\WarehouseProductStorege;
use app\common\lists\ListsExcelInterface;
@ -62,10 +64,11 @@ class StoreProductLists extends BaseAdminDataLists implements ListsSearchInterfa
}
}
$is_warehouse=$this->request->get('is_warehouse',0);
return StoreProduct::where($this->searchWhere)
$list = StoreProduct::where($this->searchWhere)
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()->each(function ($item) use($is_warehouse) {
$item['product_id'] = $item['id'];
$item['bar_code_two'] = '';
if (in_array($item['unit'], [2, 21])) {
$item['bar_code_two'] = $item['bar_code'];
@ -110,6 +113,11 @@ class StoreProductLists extends BaseAdminDataLists implements ListsSearchInterfa
}
return $item;
})?->toArray();
if (!empty($this->params['user_id'])) {
$userShip = User::where('id', $this->params['user_id'])->value('user_ship');
$list = StoreProductGroupPrice::resetProductsPrice($list, $userShip);
}
return $list;
}

View File

@ -52,8 +52,9 @@ class StoreProductPriceLists extends BaseAdminDataLists implements ListsSearchIn
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()->each(function($item){
$find = StoreProduct::where('id', $item['product_id'])->field('image,store_name')->find();
$find = StoreProduct::where('id', $item['product_id'])->field('image,store_name,store_info')->find();
$item['store_name']=$find['store_name'];
$item['store_info']=$find['store_info'];
$item['image']=$find['image'];
$item['status_name']=$item['status']==0?"未设置":"已设置";
})