diff --git a/app/Admin/Services/OrderPackageService.php b/app/Admin/Services/OrderPackageService.php index 9dc7a728..4941f085 100644 --- a/app/Admin/Services/OrderPackageService.php +++ b/app/Admin/Services/OrderPackageService.php @@ -25,10 +25,10 @@ class OrderPackageService if (!($order->isWaitShipping() || $order->isShipping())) { throw new BizException('订单状态异常,无法发货'); } - if (!isset($params['packages']) || count($params['packages']) <= 0) { - throw new BizException('请选择发货商品'); - } foreach ($params['packages'] as $item) { + if (isset($item['_remove_']) && $item['_remove_']) {//如果是已被移除选项则直接移除 + continue; + } if ($item['quantity'] < 1) { throw new BizException('发货数量不能小于1'); } @@ -41,6 +41,9 @@ class OrderPackageService ]; } } + if (count($packageProducts) <= 0) { + throw new BizException('请选择发货商品'); + } foreach ($packageProducts as $product) { $_orderProduct = OrderProduct::where('order_id', $order->id) ->where('after_sale_state', '<>', 1)