From cc8eb3e72f4b4cd0c222a8b12a32047b2e6ae937 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Sat, 11 Jan 2025 14:59:39 +0800 Subject: [PATCH] =?UTF-8?q?fix(admin):=20=E4=BF=AE=E5=A4=8D=E6=8F=90?= =?UTF-8?q?=E5=89=8D=E5=8D=95=E7=BB=9F=E8=AE=A1=E5=8A=9F=E8=83=BD=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在创建提前单时添加审核状态字段 - 优化提前单统计查询条件 - 增加按订单类型筛选的功能 - 调整订单类型统计的字段名 --- .../beforehand_order/BeforehandOrderLogic.php | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/app/admin/logic/beforehand_order/BeforehandOrderLogic.php b/app/admin/logic/beforehand_order/BeforehandOrderLogic.php index cb40bab46..0dbac1f3d 100644 --- a/app/admin/logic/beforehand_order/BeforehandOrderLogic.php +++ b/app/admin/logic/beforehand_order/BeforehandOrderLogic.php @@ -570,6 +570,7 @@ class BeforehandOrderLogic extends BaseLogic 'order_type' => 4, 'deduction_price' => 0, 'paid' => 0, + 'audit_status' => 1, 'mark' => $params['mark'] ?? '', 'other_data' => json_encode($other_data, true) @@ -956,10 +957,10 @@ class BeforehandOrderLogic extends BaseLogic { $where = []; $where2 = []; - if($params['store_id']>0){ + if ($params['store_id'] > 0) { $where2[] = ['store_id', '=', $params['store_id']]; } - if($params['start_time']!=''&& $params['end_time']!=''){ + if ($params['start_time'] != '' && $params['end_time'] != '') { $where2[] = ['create_time', 'between', [strtotime($params['start_time']), strtotime($params['end_time'])]]; } if ($params['warehouse_type'] > 0) { @@ -984,22 +985,25 @@ class BeforehandOrderLogic extends BaseLogic $orderCounts = BeforehandOrder::where('order_type', 'in', [1, 2, 3, 4, 5, 7, 8]) ->where($where2) ->group('order_type') - ->field([Db::raw('count(*) as count'),'order_type'])->select(); + ->field([Db::raw('count(*) as count'), 'order_type'])->select(); + if ($params['order_type'] > 0) { + $where2[] = ['order_type', '=', $params['order_type']]; + } $outbound_0 = BeforehandOrder::where([['is_outbound', '=', 0], ['order_type', '<>', 5]])->where($where2)->count(); $outbound_1 = BeforehandOrder::where([['is_outbound', '=', 1]])->where($where2)->count(); $warehousing_0 = BeforehandOrder::where([['is_warehousing', '=', 0]])->where($where2)->count(); $warehousing_1 = BeforehandOrder::where([['is_warehousing', '=', 1]])->where($where2)->count(); - $data=[ - 'order_type_1' =>0, - 'order_type_2'=>0, - 'order_type_3'=>0, - 'order_type_4'=>0, - 'order_type_5'=>0, - 'order_type_7'=>0, - 'order_type_8'=>0 + $data = [ + 'order_type_1' => 0, + 'order_type_2' => 0, + 'order_type_3' => 0, + 'order_type_4' => 0, + 'order_type_5' => 0, + 'order_type_7' => 0, + 'order_type_8' => 0 ]; foreach ($orderCounts as $k => $v) { - $data['order_type'.'_'.$v['order_type']] =$v['count'] ; + $data['order_type' . '_' . $v['order_type']] = $v['count']; } $data['outbound_0'] = $outbound_0; $data['outbound_1'] = $outbound_1;