history salary 修复
This commit is contained in:
parent
f63e6d869c
commit
33faea64ae
@ -218,7 +218,8 @@
|
||||
import {onMounted, ref} from 'vue'
|
||||
import MobileHeader from '../components/MobileHeader.vue'
|
||||
import {getTeamMemberWork, getTeamReleasePolicy} from '../api/teamBill.js'
|
||||
import {getTeamId, getUserId} from "@/utils/userStore.js";
|
||||
import {getTeamId, getUserId, getUserProfile} from "@/utils/userStore.js";
|
||||
import {getUserIdentity} from "@/api/wallet.js";
|
||||
|
||||
const totalSalary = ref('0.00')
|
||||
const showSalaryModal = ref(false)
|
||||
@ -293,24 +294,36 @@ const fetchWorkReports = async (userId) => {
|
||||
const targets = response.body.targets || []
|
||||
originalTargetsData.value = targets // 保存原始数据
|
||||
|
||||
const userIdentity = await getUserIdentity()
|
||||
|
||||
workReports.value = targets.map(target => ({
|
||||
id: target.id,
|
||||
date: target.billTitle,
|
||||
status: getStatusText(target.status),
|
||||
target: getLevelFromPolicy(target.target?.acceptGiftValue), // 使用政策数据计算等级
|
||||
salary: formatSalaryValue(target.target?.settlementResult?.ownSalary) || '-',
|
||||
agentSalary: formatSalaryValue(target.target?.settlementResult?.memberSalary) || '-',
|
||||
salary: formatSalaryValue(target.target?.settlementResult?.[userIdentity.body?.agent ? 'ownSalary' : userIdentity.body?.anchor ? 'memberSalary' : null]) || '-',
|
||||
totalSalary: formatSalaryValue(target.target?.settlementResult?.totalSalary) || '-',
|
||||
timeDays: target.target?.effectiveDay || '-',
|
||||
hasDetails: target.target && target.target.dailyTargets && target.target.dailyTargets.length > 0,
|
||||
originalData: target // 保存原始数据用于详情显示
|
||||
}))
|
||||
|
||||
// 计算总薪资 - 汇总所有 targets 中 target.settlementResult.ownSalary
|
||||
// 计算总薪资 - 根据用户身份选择对应的薪资字段
|
||||
const totalAmount = targets.reduce((sum, target) => {
|
||||
const ownSalary = parseFloat(target.target?.settlementResult?.ownSalary || 0)
|
||||
return sum + ownSalary
|
||||
let salary = 0
|
||||
|
||||
// 根据用户身份决定使用哪个薪资字段
|
||||
if (userIdentity.body?.agent) {
|
||||
// agent 为 true 时,使用 ownSalary
|
||||
salary = parseFloat(target.target?.settlementResult?.ownSalary || 0)
|
||||
} else if (userIdentity.body?.anchor) {
|
||||
// anchor 为 true 时,使用 memberSalary
|
||||
salary = parseFloat(target.target?.settlementResult?.memberSalary || 0)
|
||||
}
|
||||
|
||||
return sum + salary
|
||||
}, 0)
|
||||
|
||||
totalSalary.value = totalAmount.toFixed(2)
|
||||
}
|
||||
} catch (error) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user