From 68072cf81ebcd634df94d3ed7759f5e32a757b9e Mon Sep 17 00:00:00 2001 From: hzj <1304805162@qq.com> Date: Tue, 23 Dec 2025 14:34:40 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E4=BB=A3=E7=90=86=E4=B8=AD=E5=BF=83):=20?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=8E=86=E5=8F=B2=E6=94=B6=E5=85=A5=E7=9A=84?= =?UTF-8?q?=E8=AE=A1=E7=AE=97=E6=96=B9=E5=BC=8F=EF=BC=8C=E8=B7=B3=E8=BF=87?= =?UTF-8?q?=E8=BF=98=E6=9C=AA=E7=BB=93=E7=AE=97=E7=9A=84=E5=BD=93=E6=9C=88?= =?UTF-8?q?=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/AgencyCenter/index.vue | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/src/views/AgencyCenter/index.vue b/src/views/AgencyCenter/index.vue index 295ad93..7cc4b1e 100644 --- a/src/views/AgencyCenter/index.vue +++ b/src/views/AgencyCenter/index.vue @@ -456,22 +456,28 @@ const fetchMemberWorkData = async () => { const userIdentity = await getUserIdentity() // 计算总薪资 - 根据用户身份选择对应的薪资字段 - const totalAmount = targets.reduce((sum, target) => { + const totalAmount = targets.reduce((sum, target, index) => { let salary = 0 - // 根据用户身份决定使用哪个薪资字段 - if (userIdentity.body?.agent) { - // agent 为 true 时,使用 ownSalary - salary = parseFloat( - (target.target?.settlementResult?.ownSalary || 0) + - (target.target?.settlementResult?.memberSalary || 0) - ) - } else if (userIdentity.body?.anchor) { - // anchor 为 true 时,使用 memberSalary - salary = parseFloat(target.target?.settlementResult?.memberSalary || 0) - } + // 跳过第一项(当月还在计算中),从第二项开始计算 + if (index > 0) { + // 根据用户身份决定使用哪个薪资字段 + if (userIdentity.body?.agent) { + // agent 为 true 时,使用 ownSalary + salary = parseFloat( + (target.target?.settlementResult?.ownSalary || 0) + + (target.target?.settlementResult?.memberSalary || 0) + ) + } else if (userIdentity.body?.anchor) { + // anchor 为 true 时,使用 memberSalary + salary = parseFloat(target.target?.settlementResult?.memberSalary || 0) + } - return sum + salary + return sum + salary + } else { + // 对于第一项,只返回当前的sum,不添加任何值 + return sum + } }, 0) totalSalary.value = totalAmount.toFixed(2)