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;