fix(admin): 修复提前单统计功能问题

- 在创建提前单时添加审核状态字段
- 优化提前单统计查询条件
- 增加按订单类型筛选的功能
- 调整订单类型统计的字段名
This commit is contained in:
mkm 2025-01-11 14:59:39 +08:00
parent ca43cf01fa
commit cc8eb3e72f

View File

@ -570,6 +570,7 @@ class BeforehandOrderLogic extends BaseLogic
'order_type' => 4, 'order_type' => 4,
'deduction_price' => 0, 'deduction_price' => 0,
'paid' => 0, 'paid' => 0,
'audit_status' => 1,
'mark' => $params['mark'] ?? '', 'mark' => $params['mark'] ?? '',
'other_data' => json_encode($other_data, true) 'other_data' => json_encode($other_data, true)
@ -985,6 +986,9 @@ class BeforehandOrderLogic extends BaseLogic
->where($where2) ->where($where2)
->group('order_type') ->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_0 = BeforehandOrder::where([['is_outbound', '=', 0], ['order_type', '<>', 5]])->where($where2)->count();
$outbound_1 = BeforehandOrder::where([['is_outbound', '=', 1]])->where($where2)->count(); $outbound_1 = BeforehandOrder::where([['is_outbound', '=', 1]])->where($where2)->count();
$warehousing_0 = BeforehandOrder::where([['is_warehousing', '=', 0]])->where($where2)->count(); $warehousing_0 = BeforehandOrder::where([['is_warehousing', '=', 0]])->where($where2)->count();