feat(代理中心): 调整历史收入的计算方式,跳过还未结算的当月记录
This commit is contained in:
parent
1d5ee3996d
commit
68072cf81e
@ -456,22 +456,28 @@ const fetchMemberWorkData = async () => {
|
|||||||
const userIdentity = await getUserIdentity()
|
const userIdentity = await getUserIdentity()
|
||||||
|
|
||||||
// 计算总薪资 - 根据用户身份选择对应的薪资字段
|
// 计算总薪资 - 根据用户身份选择对应的薪资字段
|
||||||
const totalAmount = targets.reduce((sum, target) => {
|
const totalAmount = targets.reduce((sum, target, index) => {
|
||||||
let salary = 0
|
let salary = 0
|
||||||
|
|
||||||
// 根据用户身份决定使用哪个薪资字段
|
// 跳过第一项(当月还在计算中),从第二项开始计算
|
||||||
if (userIdentity.body?.agent) {
|
if (index > 0) {
|
||||||
// agent 为 true 时,使用 ownSalary
|
// 根据用户身份决定使用哪个薪资字段
|
||||||
salary = parseFloat(
|
if (userIdentity.body?.agent) {
|
||||||
(target.target?.settlementResult?.ownSalary || 0) +
|
// agent 为 true 时,使用 ownSalary
|
||||||
(target.target?.settlementResult?.memberSalary || 0)
|
salary = parseFloat(
|
||||||
)
|
(target.target?.settlementResult?.ownSalary || 0) +
|
||||||
} else if (userIdentity.body?.anchor) {
|
(target.target?.settlementResult?.memberSalary || 0)
|
||||||
// anchor 为 true 时,使用 memberSalary
|
)
|
||||||
salary = parseFloat(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)
|
}, 0)
|
||||||
|
|
||||||
totalSalary.value = totalAmount.toFixed(2)
|
totalSalary.value = totalAmount.toFixed(2)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user