feat(团队收入页): 总收入计算并展示

This commit is contained in:
hzj 2025-11-21 16:46:23 +08:00
parent fda26afb80
commit 650f714f48

View File

@ -24,7 +24,7 @@
> >
<div style="display: flex; flex-direction: column; gap: 10px"> <div style="display: flex; flex-direction: column; gap: 10px">
<div>{{ t('history_team_income') }}</div> <div>{{ t('history_team_income') }}</div>
<div style="font-weight: 600">$0</div> <div style="font-weight: 600">${{ totalIncome }}</div>
</div> </div>
<div <div
style=" style="
@ -73,7 +73,7 @@
:hostSalary="bill.hostSalary" :hostSalary="bill.hostSalary"
:agencySalary="bill.agencySalary" :agencySalary="bill.agencySalary"
:totalSalary="bill.totalSalary" :totalSalary="bill.totalSalary"
more="true" :more="true"
@showMore="showBillDetail(bill)" @showMore="showBillDetail(bill)"
></workReportBox> ></workReportBox>
</div> </div>
@ -180,8 +180,8 @@ const policyData = ref(null)
const loadingPolicy = ref(false) const loadingPolicy = ref(false)
// //
const billList = ref([]) const billList = ref([]) //
const selectedBillMembers = ref([]) const totalIncome = ref(0) //
// //
const formatStatus = (status) => { const formatStatus = (status) => {
@ -201,7 +201,12 @@ const fetchTeamBill = async (teamId) => {
const response = await getTeamBill(teamId) const response = await getTeamBill(teamId)
if (response.status && response.body) { if (response.status && response.body) {
billList.value = response.body.map((bill) => ({ let historyTotalIncome = 0 //
billList.value = response.body.map((bill) => {
if (bill.status == 'SETTLED') {
historyTotalIncome += bill.settleResult?.totalSalary || 0
}
return {
...bill, ...bill,
// //
date: `${bill.billBelong.toString().substring(0, 4)}.${bill.billBelong date: `${bill.billBelong.toString().substring(0, 4)}.${bill.billBelong
@ -213,7 +218,9 @@ const fetchTeamBill = async (teamId) => {
totalSalary: formatSalaryValue(bill.settleResult?.totalSalary || 0) || '-', totalSalary: formatSalaryValue(bill.settleResult?.totalSalary || 0) || '-',
createTimeFormatted: new Date(bill.createTime).toLocaleDateString(), createTimeFormatted: new Date(bill.createTime).toLocaleDateString(),
updateTimeFormatted: new Date(bill.updateTime).toLocaleDateString(), updateTimeFormatted: new Date(bill.updateTime).toLocaleDateString(),
})) }
})
totalIncome.value = historyTotalIncome.toFixed(2)
} }
} catch (error) { } catch (error) {
console.error('Failed to fetch team bill:', error) console.error('Failed to fetch team bill:', error)
@ -323,7 +330,6 @@ const getStatusClass = (status) => {
const showBillDetail = async (bill) => { const showBillDetail = async (bill) => {
// //
const membersData = await fetchBillWorkMembers(bill.id) const membersData = await fetchBillWorkMembers(bill.id)
selectedBillMembers.value = membersData
selectedBill.value = { selectedBill.value = {
...bill, ...bill,
members: membersData, members: membersData,