From 700390790f11fbb1e85028e9f66e1bb06c37738c Mon Sep 17 00:00:00 2001 From: Edward Yang Date: Mon, 22 Aug 2022 20:51:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=B4=AD=E7=89=A9=E8=BD=A6?= =?UTF-8?q?=E5=92=8C=E7=BB=93=E8=B4=A6=E9=A1=B5=E5=A4=9A=E8=AF=AD=E8=A8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- beike/Shop/Services/CheckoutService.php | 12 ++++++------ resources/lang/en/shop/carts.php | 8 +++++++- resources/lang/zh_cn/shop/carts.php | 8 +++++++- themes/default/cart/cart.blade.php | 4 ++-- 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/beike/Shop/Services/CheckoutService.php b/beike/Shop/Services/CheckoutService.php index e1a8b6e7..3f14c9f6 100644 --- a/beike/Shop/Services/CheckoutService.php +++ b/beike/Shop/Services/CheckoutService.php @@ -40,12 +40,12 @@ class CheckoutService $this->customer = current_customer(); } if (empty($this->customer) || !($this->customer instanceof Customer)) { - throw new \Exception("购物车客户无效"); + throw new \Exception(trans('shop/carts.invalid_customer')); } $this->cart = CartRepo::createCart($this->customer); $this->selectedProducts = CartRepo::selectedCartProducts($this->customer->id); if ($this->selectedProducts->count() == 0) { - throw new \Exception("购物车商品为空"); + throw new \Exception(trans('shop/carts.empty_selected_products')); } } @@ -113,22 +113,22 @@ class CheckoutService $shippingAddressId = $current['shipping_address_id']; if (empty(Address::query()->find($shippingAddressId))) { - throw new \Exception('配送地址无效'); + throw new \Exception(trans('shop/carts.invalid_shipping_address')); } $paymentAddressId = $current['payment_address_id']; if (empty(Address::query()->find($paymentAddressId))) { - throw new \Exception('账单地址无效'); + throw new \Exception(trans('shop/carts.invalid_payment_address')); } $shippingMethodCode = $current['shipping_method_code']; if (!PluginRepo::shippingEnabled($shippingMethodCode)) { - throw new \Exception('配送方式不可用'); + throw new \Exception(trans('shop/carts.invalid_shipping_method')); } $paymentMethodCode = $current['payment_method_code']; if (!PluginRepo::paymentEnabled($paymentMethodCode)) { - throw new \Exception('支付方式不可用'); + throw new \Exception(trans('shop/carts.invalid_payment_method')); } } diff --git a/resources/lang/en/shop/carts.php b/resources/lang/en/shop/carts.php index fad75986..c62deea8 100644 --- a/resources/lang/en/shop/carts.php +++ b/resources/lang/en/shop/carts.php @@ -29,5 +29,11 @@ return [ 'mini' => 'Your cart', 'delete' => 'Delete', 'check_cart' => 'Check the shopping cart', - 'subtotal' => 'Subtotal', + + 'invalid_customer' => 'Invalid customer.', + 'empty_selected_products' => 'Empty selected products.', + 'invalid_shipping_address' => 'Invalid shipping address', + 'invalid_payment_address' => 'Invalid payment address.', + 'invalid_shipping_method' => 'Invalid shipping method.', + 'invalid_payment_method' => 'Invalid payment method.', ]; diff --git a/resources/lang/zh_cn/shop/carts.php b/resources/lang/zh_cn/shop/carts.php index e104acd1..86fd3f34 100644 --- a/resources/lang/zh_cn/shop/carts.php +++ b/resources/lang/zh_cn/shop/carts.php @@ -29,5 +29,11 @@ return [ 'mini' => '您的购物车', 'delete' => '删除', 'check_cart' => '查看购物车', - 'subtotal' => '小计', + + 'invalid_customer' => '购物车客户无效', + 'empty_selected_products' => '购物车选中商品为空', + 'invalid_shipping_address' => '配送地址无效', + 'invalid_payment_address' => '账单地址无效', + 'invalid_shipping_method' => '配送方式不可用', + 'invalid_payment_method' => '支付方式不可用', ]; diff --git a/themes/default/cart/cart.blade.php b/themes/default/cart/cart.blade.php index cacb5c49..a469eb74 100644 --- a/themes/default/cart/cart.blade.php +++ b/themes/default/cart/cart.blade.php @@ -18,7 +18,7 @@ @if ($errors->has('error')) - + @endif
@@ -136,7 +136,7 @@ methods: { checkedBtnToCheckout() { if (!this.products.some(e => e.selected)) { - layer.msg('{{ __('shop/carts.nust_select') }}', ()=>{}) + layer.msg('{{ __('shop/carts.empty_selected_products') }}', ()=>{}) return }