From 127445c0740ce0c3af09ebd1f4eb2a7888d01949 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 23 Dec 2024 15:39:18 +0800 Subject: [PATCH] =?UTF-8?q?feat(admin):=20=E5=A2=9E=E5=8A=A0=E5=95=86?= =?UTF-8?q?=E5=93=81=E8=BF=9B=E9=94=80=E5=AD=98=E4=BB=B7=E6=A0=BC=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 StoreProductPriceLists 类中添加商品的 current_purchase、current_cost 和 current_price 字段 - 从 StoreProduct 模型中获取商品的 purchase、cost 和 price 信息 - 在列表中显示商品的当前进价、成本价和销售价 --- .../lists/store_product_price/StoreProductPriceLists.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/admin/lists/store_product_price/StoreProductPriceLists.php b/app/admin/lists/store_product_price/StoreProductPriceLists.php index f2560fc28..297a7d332 100644 --- a/app/admin/lists/store_product_price/StoreProductPriceLists.php +++ b/app/admin/lists/store_product_price/StoreProductPriceLists.php @@ -48,15 +48,18 @@ class StoreProductPriceLists extends BaseAdminDataLists implements ListsSearchIn $this->searchWhere[]=['product_id','in',$store_id]; } return StoreProductPrice::where($this->searchWhere) - ->field(['id','bhoid','offer_id', 'product_id', 'purchase_price', 'purchase_lv', 'purchase', 'cost_lv', 'cost', 'price_lv', 'price', 'price_config', 'status']) + ->field(['id','bhoid','offer_id', 'product_id', 'purchase_price', 'purchase_lv', 'purchase', 'cost_lv', 'cost', 'price_lv', 'price', 'price_config', 'status','create_time','mark']) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function($item){ - $find = StoreProduct::with('unitName')->where('id', $item['product_id'])->field('image,store_name,store_info,unit')->withTrashed()->find(); + $find = StoreProduct::with('unitName')->where('id', $item['product_id'])->field('image,purchase,cost,price,store_name,store_info,unit')->withTrashed()->find(); $item['unit_name']=$find['unitName']['name'] ?? ''; $item['store_name']=$find['store_name']; $item['store_info']=$find['store_info']; $item['image']=$find['image']; + $item['current_purchase']=$find['purchase']; + $item['current_cost']=$find['cost']; + $item['current_price']=$find['price']; $item['status_name']=$item['status']==0?"未设置":"已设置"; }) ->toArray();