From 19d9ca9734c3b9eab56869cd323d9d4ebce074e3 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Thu, 9 Jan 2025 12:03:35 +0800 Subject: [PATCH] =?UTF-8?q?feat(store-product):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=B4=BB=E5=8A=A8=E4=BB=B7=E6=9F=A5=E8=AF=A2=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 StoreProductLists 类中添加 order_type 参数处理 - 当 order_type 为 2 时,查询并应用活动价 - 更新商品列表,显示活动价和相应标识 --- app/admin/lists/store_product/StoreProductLists.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/admin/lists/store_product/StoreProductLists.php b/app/admin/lists/store_product/StoreProductLists.php index 3bfcd58e7..c864e6e15 100644 --- a/app/admin/lists/store_product/StoreProductLists.php +++ b/app/admin/lists/store_product/StoreProductLists.php @@ -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) {