From 8a4bce3add275dd5d15de87ee55dd26c0657e6f9 Mon Sep 17 00:00:00 2001 From: wjh Date: Wed, 4 Sep 2024 16:34:23 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=9B=BF=E8=BA=AB?= =?UTF-8?q?=E5=90=88=E5=90=8C=E7=BB=93=E7=AE=97=E5=AE=9E=E9=99=85=E9=87=8D?= =?UTF-8?q?=E9=87=8F=E4=B8=8D=E5=AF=B9=20(#1509)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-on: https://git.daoyoucloud.com/daoyoucloud/tachybase/pulls/1509 Reviewed-by: sealday Co-authored-by: wjh Co-committed-by: wjh --- .../src/server/services/settlement-service.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/plugins/@hera/plugin-rental/src/server/services/settlement-service.ts b/packages/plugins/@hera/plugin-rental/src/server/services/settlement-service.ts index adbeaac2c..b80fc66f8 100644 --- a/packages/plugins/@hera/plugin-rental/src/server/services/settlement-service.ts +++ b/packages/plugins/@hera/plugin-rental/src/server/services/settlement-service.ts @@ -485,7 +485,12 @@ export class SettlementService { data.count += item.weight_items.length ? item.weight_items.length ? item.weight_items.reduce((sum, curr) => { - return sum + curr.weight; + const weight = isRuleRecord.filter( + (productItem) => productItem.product.category_id === curr.product_category_id, + ).length + ? curr.weight + : 0; + return sum + weight; }, 0) : 0 : item.weight; @@ -530,7 +535,12 @@ export class SettlementService { data.count += item.weight_items.length ? item.weight_items.length ? item.weight_items.reduce((sum, curr) => { - return sum + curr.weight; + const weight = isRuleRecord.filter( + (productItem) => productItem.product.category_id === curr.product_category_id, + ).length + ? curr.weight + : 0; + return sum + weight; }, 0) : 0 : item.weight;