feat(store-product): 添加活动价查询功能

- 在 StoreProductLists 类中添加 order_type 参数处理
- 当 order_type 为 2 时,查询并应用活动价
- 更新商品列表,显示活动价和相应标识
This commit is contained in:
mkm 2025-01-09 12:03:35 +08:00
parent caab5cca6f
commit 19d9ca9734

View File

@ -66,6 +66,7 @@ class StoreProductLists extends BaseAdminDataLists implements ListsSearchInterfa
}
}
$is_warehouse=$this->request->get('is_warehouse',0);
$order_type=$this->request->get('order_type',0);
$userShip = 0;
if (!empty($this->params['user_id'])) {
$userShip = User::where('id', $this->params['user_id'])->value('user_ship');
@ -87,7 +88,7 @@ class StoreProductLists extends BaseAdminDataLists implements ListsSearchInterfa
}
$list = $query->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()->each(function ($item) use($is_warehouse, $userShip) {
->select()->each(function ($item) use($is_warehouse, $userShip,$order_type) {
$item['product_id'] = $item['id'];
$item['bar_code_two'] = '';
if (in_array($item['unit'], [2, 21])) {
@ -142,6 +143,15 @@ class StoreProductLists extends BaseAdminDataLists implements ListsSearchInterfa
}else{
$item['status_msg']='下架|不常用|是否有替换';
}
if ($order_type == 2) {
$price=StoreProductGroupPrice::where('group_id', 42)->where('product_id', $item['product_id'])->value('price');
if($price>0){
$item['price'] = $price;
$item['store_name'] = $item['store_name'].'|活动价';
}
}
return $item;
})?->toArray();
// if ($userShip > 0 && $userShip != 4) {