diff --git a/beike/Shop/Services/TotalService.php b/beike/Shop/Services/TotalService.php
index c03236aa..84b6c834 100644
--- a/beike/Shop/Services/TotalService.php
+++ b/beike/Shop/Services/TotalService.php
@@ -21,6 +21,7 @@ class TotalService
'subtotal',
'tax',
'shipping',
+ 'customer_discount',
'order_total',
];
diff --git a/beike/Shop/Services/TotalServices/CustomerDiscountService.php b/beike/Shop/Services/TotalServices/CustomerDiscountService.php
new file mode 100644
index 00000000..e32134a5
--- /dev/null
+++ b/beike/Shop/Services/TotalServices/CustomerDiscountService.php
@@ -0,0 +1,47 @@
+
+ * @created 2023-02-07 18:49:15
+ * @modified 2023-02-07 18:49:15
+ */
+
+namespace Beike\Shop\Services\TotalServices;
+
+use Beike\Shop\Services\CheckoutService;
+
+class CustomerDiscountService
+{
+ /**
+ * @param CheckoutService $checkout
+ * @return array
+ */
+ public static function getTotal(CheckoutService $checkout)
+ {
+ $totalService = $checkout->totalService;
+
+ $discountFactor = current_customer()->customerGroup->discount_factor;
+ if ($discountFactor <= 0) {
+ return;
+ }
+ if ($discountFactor > 1) {
+ $discountFactor = 1;
+ }
+ $amount = $totalService->getSubTotal() * $discountFactor / 100;
+
+ $totalData = [
+ 'code' => 'customer_discount',
+ 'title' => trans('shop/carts.customer_discount'),
+ 'amount' => -$amount,
+ 'amount_format' => currency_format(-$amount),
+ ];
+
+ $totalService->amount += $totalData['amount'];
+ $totalService->totals[] = $totalData;
+
+ return $totalData;
+ }
+}
diff --git a/resources/beike/admin/views/pages/customer_groups/index.blade.php b/resources/beike/admin/views/pages/customer_groups/index.blade.php
index 20ba15e9..1872fa56 100644
--- a/resources/beike/admin/views/pages/customer_groups/index.blade.php
+++ b/resources/beike/admin/views/pages/customer_groups/index.blade.php
@@ -62,6 +62,12 @@
+
+
+ %
+
+
+
@if (0)
diff --git a/resources/lang/en/shop/carts.php b/resources/lang/en/shop/carts.php
index ca7bc4f1..097e17d2 100644
--- a/resources/lang/en/shop/carts.php
+++ b/resources/lang/en/shop/carts.php
@@ -17,6 +17,7 @@ return [
'quantity' => 'Quantity',
'subtotal' => 'Subtotal',
'product_total' => 'Product Total',
+ 'customer_discount' => 'Customer Discount',
'order_total' => 'Order Total',
'shipping_fee' => 'Shipping Fee',
'all' => 'All',
diff --git a/resources/lang/zh_cn/shop/carts.php b/resources/lang/zh_cn/shop/carts.php
index 6d6b8afa..df517dc2 100644
--- a/resources/lang/zh_cn/shop/carts.php
+++ b/resources/lang/zh_cn/shop/carts.php
@@ -17,6 +17,7 @@ return [
'quantity' => '数量',
'subtotal' => '小计',
'product_total' => '商品总计',
+ 'customer_discount' => '会员优惠',
'order_total' => '应付总金额',
'shipping_fee' => '运费',
'all' => '全部',