diff --git a/beike/Shop/Http/Resources/CartDetail.php b/beike/Shop/Http/Resources/CartDetail.php index df6f9807..ceb00e35 100644 --- a/beike/Shop/Http/Resources/CartDetail.php +++ b/beike/Shop/Http/Resources/CartDetail.php @@ -47,6 +47,7 @@ class CartDetail extends JsonResource 'subtotal' => $subTotal, 'subtotal_format' => currency_format($subTotal), 'variant_labels' => trim($sku->getVariantLabel()), + 'active' => $product->active ]; return hook_filter('resource.cart.detail', $result); diff --git a/beike/Shop/Services/CartService.php b/beike/Shop/Services/CartService.php index 0ba7f8ad..b9af543d 100644 --- a/beike/Shop/Services/CartService.php +++ b/beike/Shop/Services/CartService.php @@ -195,6 +195,13 @@ class CartService if (empty($carts)) { $carts = self::list(current_customer()); } + // 判断:禁止选中 非直接下单产品 + $carts = array_map(function($cartItem){ + if(!$cartItem['active']){ + $cartItem['selected'] = 0; + } + return $cartItem; + },$carts); $cartList = collect($carts)->where('selected', 1); diff --git a/themes/default/cart/cart.blade.php b/themes/default/cart/cart.blade.php index 43104ec9..8c696f7b 100644 --- a/themes/default/cart/cart.blade.php +++ b/themes/default/cart/cart.blade.php @@ -46,7 +46,8 @@