From 61b685c522e038c9547d3a1c86784793a37b8ce8 Mon Sep 17 00:00:00 2001 From: wjh Date: Tue, 11 Jun 2024 11:20:09 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E7=BB=93=E7=AE=97?= =?UTF-8?q?=E5=8D=95=E5=85=B6=E4=BB=96=E8=B4=B9=E7=94=A8=E7=9A=84=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E9=80=BB=E8=BE=91=20(#1146)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-on: https://git.daoyoucloud.com/daoyoucloud/tachybase/pulls/1146 Reviewed-by: sealday Co-authored-by: wjh Co-committed-by: wjh --- .../src/server/services/settlement-service.ts | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 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 b18f86b3f..65446a998 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 @@ -535,21 +535,20 @@ export class SettlementService { rule.conversion_logic_id !== ConversionLogics.ProductWeight ) { settlementAbout.records?.forEach((item) => { - if ( - dayjs(item.date).isBetween(ruleItem.start_date, ruleItem.end_date, 'day', '[]') && - dayjs(item.date).isSameOrAfter(settlementAbout.start_date) - ) { + if (dayjs(item.date).isBetween(settlementAbout.start_date, settlementAbout.end_date, 'day', '[]')) { const feeItem = item?.record_items.filter( (value) => value && value.product_id === rule.fee_product_id, ); if (feeItem.length) { feeItem.forEach((value) => { if (category === '其他') { - data.movement = item.movement; - data.count = value.count * Number(item.movement === '-1' ? '1' : '-1'); - data.date = item.date; - data.amount = data.count * data.unit_price; - createFeesDatas.push(data); + const otherData = { ...data }; + otherData.movement = item.movement; + otherData.count = value.count * Number(item.movement === '-1' ? '1' : '-1'); + otherData.date = dayjs(item.date).endOf('day'); + otherData.amount = otherData.count * otherData.unit_price; + otherData.item_count = value.count; + createFeesDatas.push(otherData); } else { data.count = data.count + value.count; conversion = true;