feat(团队收入页): 总收入计算并展示
This commit is contained in:
parent
fda26afb80
commit
650f714f48
@ -24,7 +24,7 @@
|
||||
>
|
||||
<div style="display: flex; flex-direction: column; gap: 10px">
|
||||
<div>{{ t('history_team_income') }}</div>
|
||||
<div style="font-weight: 600">$0</div>
|
||||
<div style="font-weight: 600">${{ totalIncome }}</div>
|
||||
</div>
|
||||
<div
|
||||
style="
|
||||
@ -73,7 +73,7 @@
|
||||
:hostSalary="bill.hostSalary"
|
||||
:agencySalary="bill.agencySalary"
|
||||
:totalSalary="bill.totalSalary"
|
||||
more="true"
|
||||
:more="true"
|
||||
@showMore="showBillDetail(bill)"
|
||||
></workReportBox>
|
||||
</div>
|
||||
@ -180,8 +180,8 @@ const policyData = ref(null)
|
||||
const loadingPolicy = ref(false)
|
||||
|
||||
// 数据
|
||||
const billList = ref([])
|
||||
const selectedBillMembers = ref([])
|
||||
const billList = ref([]) //账单列表
|
||||
const totalIncome = ref(0) //历史收益
|
||||
|
||||
// 格式化状态
|
||||
const formatStatus = (status) => {
|
||||
@ -201,19 +201,26 @@ const fetchTeamBill = async (teamId) => {
|
||||
const response = await getTeamBill(teamId)
|
||||
|
||||
if (response.status && response.body) {
|
||||
billList.value = response.body.map((bill) => ({
|
||||
...bill,
|
||||
// 将时间戳转换为可读格式
|
||||
date: `${bill.billBelong.toString().substring(0, 4)}.${bill.billBelong
|
||||
.toString()
|
||||
.substring(4, 6)}`,
|
||||
status: formatStatus(bill.status),
|
||||
hostSalary: formatSalaryValue(bill.settleResult?.memberSalary || 0) || '-',
|
||||
agencySalary: formatSalaryValue(bill.settleResult?.ownSalary || 0) || '-',
|
||||
totalSalary: formatSalaryValue(bill.settleResult?.totalSalary || 0) || '-',
|
||||
createTimeFormatted: new Date(bill.createTime).toLocaleDateString(),
|
||||
updateTimeFormatted: new Date(bill.updateTime).toLocaleDateString(),
|
||||
}))
|
||||
let historyTotalIncome = 0 // 历史收入累加
|
||||
billList.value = response.body.map((bill) => {
|
||||
if (bill.status == 'SETTLED') {
|
||||
historyTotalIncome += bill.settleResult?.totalSalary || 0
|
||||
}
|
||||
return {
|
||||
...bill,
|
||||
// 将时间戳转换为可读格式
|
||||
date: `${bill.billBelong.toString().substring(0, 4)}.${bill.billBelong
|
||||
.toString()
|
||||
.substring(4, 6)}`,
|
||||
status: formatStatus(bill.status),
|
||||
hostSalary: formatSalaryValue(bill.settleResult?.memberSalary || 0) || '-',
|
||||
agencySalary: formatSalaryValue(bill.settleResult?.ownSalary || 0) || '-',
|
||||
totalSalary: formatSalaryValue(bill.settleResult?.totalSalary || 0) || '-',
|
||||
createTimeFormatted: new Date(bill.createTime).toLocaleDateString(),
|
||||
updateTimeFormatted: new Date(bill.updateTime).toLocaleDateString(),
|
||||
}
|
||||
})
|
||||
totalIncome.value = historyTotalIncome.toFixed(2)
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to fetch team bill:', error)
|
||||
@ -323,7 +330,6 @@ const getStatusClass = (status) => {
|
||||
const showBillDetail = async (bill) => {
|
||||
// 获取该账单的成员工作信息
|
||||
const membersData = await fetchBillWorkMembers(bill.id)
|
||||
selectedBillMembers.value = membersData
|
||||
selectedBill.value = {
|
||||
...bill,
|
||||
members: membersData,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user