From 7c21a22f28a39d8e27630f7ad678524dc0b8d487 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Thu, 7 Nov 2024 17:12:50 +0800 Subject: [PATCH] =?UTF-8?q?refactor(warehouse):=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E4=BB=93=E5=BA=93=E4=BA=A7=E5=93=81=E5=88=97=E8=A1=A8=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加对软删除数据的查询 - 修复价格和总价的空值问题 - 调整字段名称和计算逻辑 - 优化数据展示格式 --- .../warehouse_product/WarehouseProductLists.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/app/admin/lists/warehouse_product/WarehouseProductLists.php b/app/admin/lists/warehouse_product/WarehouseProductLists.php index c8bf6bef4..3ff7eeedb 100644 --- a/app/admin/lists/warehouse_product/WarehouseProductLists.php +++ b/app/admin/lists/warehouse_product/WarehouseProductLists.php @@ -76,10 +76,12 @@ class WarehouseProductLists extends BaseAdminDataLists implements ListsSearchInt ->field(['id', 'oid','admin_id','supplier_id', 'store_id', 'warehouse_id', 'product_id', 'financial_pm', 'batch', 'nums', 'price', 'purchase', 'cost', 'total_price', 'manufacture', 'expiration_date', 'status', 'mark', 'create_time','is_pay']) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) + ->withTrashed() ->select()->each(function ($item) { $item->store_name = ''; $item->image = ''; - $item->price = ''; + $item->price = $item['price']??0; + $item->purchase = $item['purchase']??0; $item->unit_name = ''; $item->store_info = ''; $item->top_cate_name = ''; @@ -106,8 +108,12 @@ class WarehouseProductLists extends BaseAdminDataLists implements ListsSearchInt $item->admin_name = ''; } if ($item->product_id) { - $find = StoreProduct::where('id', $item->product_id)->field('price,image,store_name,unit,store_info,top_cate_id')->withTrashed()->find(); + $find = StoreProduct::where('id', $item->product_id)->field('price,purchase,image,store_name,unit,store_info,top_cate_id')->withTrashed()->find(); if($find){ + if($item->purchase<=0){ + $item->purchase = $find->purchase; + $item->total_price=bcmul($find->purchase,$item->nums,2); + } $item->store_name = $find->store_name . '|' . $item->product_id; $item->image = $find->image; $item->price = $find->price; @@ -200,8 +206,9 @@ class WarehouseProductLists extends BaseAdminDataLists implements ListsSearchInt 'financial_pm_name' => '出入库', 'system_store_name' => '门店', 'nums' => '数量', - 'purchase' => '价格', - 'total_price' => '总价', + 'purchase' => '供货价', + 'price' => '零售价', + 'total_price' => '供货总价', 'create_time' => '操作时间', ]; }