From ed6894932670545be0fa9686fe2f37b073947ef3 Mon Sep 17 00:00:00 2001 From: lewis <604446095@qq.com> Date: Tue, 14 Jan 2025 16:57:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A2=84=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E4=B8=80=E9=94=AE=E5=85=A5=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lists/store_order/StoreOrderLists.php | 5 +++-- .../beforehand_order/BeforehandOrderLogic.php | 19 +++++++++++++------ .../BeforehandOrderCartInfoLogic.php | 1 + 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/app/admin/lists/store_order/StoreOrderLists.php b/app/admin/lists/store_order/StoreOrderLists.php index 1e2e9c23c..652fafa17 100644 --- a/app/admin/lists/store_order/StoreOrderLists.php +++ b/app/admin/lists/store_order/StoreOrderLists.php @@ -31,8 +31,9 @@ class StoreOrderLists extends BaseAdminDataLists implements ListsSearchInterface public function setSearch(): array { return [ - '=' => ['order_id', 'store_id', 'pay_type', 'staff_id', 'shipping_type', 'delivery_id', 'paid', 'status', 'is_writeoff', 'is_merge', 'uid', 'source'], - 'between_time' => 'create_time' + '=' => ['store_id', 'pay_type', 'staff_id', 'shipping_type', 'delivery_id', 'paid', 'status', 'is_writeoff', 'is_merge', 'uid', 'source'], + 'between_time' => 'create_time', + '%like%' => ['order_id'], ]; } diff --git a/app/admin/logic/beforehand_order/BeforehandOrderLogic.php b/app/admin/logic/beforehand_order/BeforehandOrderLogic.php index 0e5a772f7..5b620003f 100644 --- a/app/admin/logic/beforehand_order/BeforehandOrderLogic.php +++ b/app/admin/logic/beforehand_order/BeforehandOrderLogic.php @@ -529,6 +529,9 @@ class BeforehandOrderLogic extends BaseLogic $total_price = $order['total_price']; $uid = $order['uid']; foreach ($info as $k => $v) { + if ($v['refund_num'] >= $v['cart_num']) { + continue; + } $datas[$k]['product_id'] = $v['product_id']; $datas[$k]['uid'] = $uid; $datas[$k]['cart_num'] = $v['cart_num']; @@ -541,6 +544,9 @@ class BeforehandOrderLogic extends BaseLogic $datas[$k]['update_time'] = time(); $total_num += $v['nums']; } + if (empty($datas)) { + throw new BusinessException('该订单商品已全部退款'); + } $other_data = [ 'nickname' => $order['real_name'] ?? '', 'phone' => $order['user_phone'] ?? '', @@ -991,13 +997,14 @@ class BeforehandOrderLogic extends BaseLogic switch ($params['warehouse_type']) { case 1: $where[] = ['is_outbound', '=', 0]; - $where[] = ['order_type', '<>', 5]; + $where[] = ['order_type', 'not in', [5, 7]]; break; case 2: $where[] = ['is_outbound', '=', 1]; break; case 3: $where[] = ['is_warehousing', '=', 0]; + $where[] = ['order_type', '<>', 1]; break; case 4: $where[] = ['is_warehousing', '=', 1]; @@ -1011,12 +1018,12 @@ class BeforehandOrderLogic extends BaseLogic ->group('order_type') ->field([Db::raw('count(*) as count'), 'order_type'])->select(); if ($params['order_type'] > 0) { - $where2[] = ['order_type', '=', $params['order_type']]; + $where[] = ['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(); + $outbound_0 = BeforehandOrder::where([['is_outbound', '=', 0], ['order_type', 'not in', [5, 7]]])->where($where)->count(); + $outbound_1 = BeforehandOrder::where([['is_outbound', '=', 1]])->where($where)->count(); + $warehousing_0 = BeforehandOrder::where([['is_warehousing', '=', 0]])->where('order_type', '<>', 1)->where($where)->count(); + $warehousing_1 = BeforehandOrder::where([['is_warehousing', '=', 1]])->where($where)->count(); $data = [ 'order_type_1' => 0, 'order_type_2' => 0, diff --git a/app/admin/logic/beforehand_order_cart_info/BeforehandOrderCartInfoLogic.php b/app/admin/logic/beforehand_order_cart_info/BeforehandOrderCartInfoLogic.php index 19c2f89ce..c79fdbb57 100644 --- a/app/admin/logic/beforehand_order_cart_info/BeforehandOrderCartInfoLogic.php +++ b/app/admin/logic/beforehand_order_cart_info/BeforehandOrderCartInfoLogic.php @@ -205,6 +205,7 @@ class BeforehandOrderCartInfoLogic extends BaseLogic $arr = [ 'warehouse_id' => $params['warehouse_id'], 'supplier_id' => 0, + 'oid' => $beforehandOrder['id'], 'admin_id' => $params['admin_id'], 'financial_pm' => 1, 'batch' => 0,