salary 最后调试

This commit is contained in:
tianfeng 2025-08-27 02:49:04 +00:00
parent ac669510ed
commit 5d07bddeb7
2 changed files with 146 additions and 21 deletions

View File

@ -111,7 +111,10 @@
<!-- Team Bill 卡片 -->
<div class="team-bill-card" @click="goToTeamBill">
<div class="card-content">
<div class="card-date">{{ teamBillInfo.date }}</div>
<div class="card-date">
<span v-if="loadingTeamBill">Loading...</span>
<span v-else>{{ teamBillInfo.date }}</span>
</div>
<div class="card-link">
<span>Team Bill</span>
<span class="arrow">></span>
@ -119,14 +122,14 @@
<div class="card-details">
<div class="detail-row">
<span class="detail-label">Host Salary:</span>
<span class="detail-value">{{ teamBillInfo.hostSalary }}</span>
<span class="detail-value">{{ loadingTeamBill ? '' : teamBillInfo.hostSalary }}</span>
<span class="detail-label">Agent Salary:</span>
<span class="detail-value">{{ teamBillInfo.agentSalary }}</span>
<span class="detail-value">{{ loadingTeamBill ? '' : teamBillInfo.agentSalary }}</span>
</div>
<div class="detail-row">
<span class="detail-label">Total:</span>
<span class="detail-value">{{ teamBillInfo.total }}</span>
<span class="status-badge">{{ teamBillInfo.status }}</span>
<span class="detail-value">{{ loadingTeamBill ? '' : teamBillInfo.total }}</span>
<span class="status-badge">{{ loadingTeamBill ? '' : teamBillInfo.status }}</span>
</div>
</div>
</div>
@ -162,12 +165,12 @@
</template>
<script setup>
import { ref, reactive } from 'vue'
import { ref, reactive, onMounted } from 'vue'
import { useRouter } from 'vue-router'
import MobileHeader from '../components/MobileHeader.vue'
import {usePageInitializationWithConfig} from "@/utils/pageConfig.js";
import {getTeamId} from "@/utils/userStore.js";
import {getTeamMemberCount} from "@/api/teamBill.js";
import {getTeamMemberCount, getTeamBill} from "@/api/teamBill.js";
const router = useRouter()
@ -180,12 +183,13 @@ const loadingMemberCount = ref(false)
// Team Bill
const teamBillInfo = reactive({
date: '2025.08',
date: '',
hostSalary: '',
agentSalary: '',
total: '',
status: 'Pending'
status: ''
})
const loadingTeamBill = ref(false)
//
const goToNotification = () => {
@ -242,6 +246,57 @@ const fetchTeamMemberCount = async () => {
}
}
//
const fetchTeamBillData = async () => {
try {
loadingTeamBill.value = true
const teamId = getTeamId()
if (!teamId) {
console.warn('No team ID available')
return
}
const response = await getTeamBill(teamId)
if (response.status && response.body && Array.isArray(response.body)) {
//
const latestBill = response.body[0]
if (latestBill) {
// 202508 -> 08/2025
const billBelong = latestBill.billBelong.toString()
const year = billBelong.substring(0, 4)
const month = billBelong.substring(4, 6)
//
const formatStatus = (status) => {
const statusMap = {
'SETTLED': 'Settled',
'UNPAID': 'Pending',
'HANG_UP': 'Pending',
'PAID': 'Completed'
}
return statusMap[status] || status
}
//
Object.assign(teamBillInfo, {
date: `${month}/${year}`,
hostSalary: latestBill.settleResult?.memberSalary?.toFixed(2) || '',
agentSalary: latestBill.settleResult?.ownSalary?.toFixed(2) || '',
total: latestBill.settleResult?.totalSalary?.toFixed(2) || '',
status: formatStatus(latestBill.status)
})
}
} else {
console.warn('No team bill data available')
}
} catch (error) {
console.error('Failed to fetch team bill data:', error)
} finally {
loadingTeamBill.value = false
}
}
const {
userInfo,
@ -253,7 +308,7 @@ const {
needsTeamInfo: true,
onDataLoaded: (data) => {
fetchTeamMemberCount()
fetchTeamBillData() //
}
})
</script>

View File

@ -91,17 +91,23 @@
<!-- 进度信息 -->
<div class="progress-section">
<div class="progress-header">
<span class="progress-date">{{ progressInfo.date }}</span>
<span class="progress-status">{{ progressInfo.status }}</span>
<span class="progress-date">
<span v-if="loadingProgressInfo.value">Loading...</span>
<span v-else>{{ progressInfo.date }}</span>
</span>
<span class="progress-status">
<span v-if="loadingProgressInfo.value"></span>
<span v-else>{{ progressInfo.status }}</span>
</span>
</div>
<div class="progress-details">
<div class="progress-item">
<span>Level: {{ progressInfo.target }}</span>
<span>Salary: ${{ progressInfo.salary }}</span>
<span>Level: {{ loadingProgressInfo.value ? '' : progressInfo.target }}</span>
<span>Salary: ${{ loadingProgressInfo.value ? '' : progressInfo.salary }}</span>
</div>
<div class="progress-item">
<span>Time(Days): {{ progressInfo.timeDays }}</span>
<span>Time(Days): {{ loadingProgressInfo.value ? '' : progressInfo.timeDays }}</span>
</div>
</div>
</div>
@ -130,22 +136,83 @@ import { useRouter } from 'vue-router'
import MobileHeader from '../components/MobileHeader.vue'
import {usePageInitializationWithConfig} from "@/utils/pageConfig.js";
import {isInApp} from "@/utils/appBridge.js";
import {getTeamMemberWork} from "@/api/teamBill.js";
import {getUserId} from "@/utils/userStore.js";
const router = useRouter()
//
const progressInfo = reactive({
date: '2025.08',
status: 'Pending',
target: '-',
salary: 0.00,
timeDays: 0,
diamond: 50000,
date: '',
status: '',
target: '',
salary: '',
timeDays: '',
hostSalary: '',
agentSalary: '',
total: ''
})
const loadingProgressInfo = reactive({ value: false })
//
const fetchMemberWorkData = async () => {
try {
loadingProgressInfo.value = true
const userId = getUserId()
if (!userId) {
console.warn('No user ID available')
return
}
const response = await getTeamMemberWork(userId)
if (response && response.status && response.body) {
const data = response.body
// target
if (data.targets && data.targets.length > 0) {
const latestTarget = data.targets[0]
// 202508 -> 08/2025
const billBelong = latestTarget.billBelong.toString()
const year = billBelong.substring(0, 4)
const month = billBelong.substring(4, 6)
//
const formatStatus = (status) => {
const statusMap = {
'SETTLED': 'Settled',
'UNPAID': 'Pending',
'HANG_UP': 'Pending',
'PAID': 'Completed'
}
return statusMap[status] || status
}
// level
const level = latestTarget.target?.settlementResult?.level || latestTarget.target?.level || ''
//
Object.assign(progressInfo, {
date: `${month}/${year}`,
status: formatStatus(latestTarget.status),
target: level,
salary: latestTarget.target?.settlementResult?.ownSalary?.toFixed(2) || '',
timeDays: latestTarget.target?.effectiveDay || ''
})
} else {
console.warn('No targets data available')
}
} else {
console.warn('No member work data available')
}
} catch (error) {
console.error('Failed to fetch member work data:', error)
} finally {
loadingProgressInfo.value = false
}
}
const showDatePicker = () => {
router.push('/history-salary')
@ -176,6 +243,9 @@ const {
getAvatarPlaceholder
} = usePageInitializationWithConfig('HOST_CENTER', {
needsTeamInfo: true,
onDataLoaded: () => {
fetchMemberWorkData() //
}
})
</script>