salary 最后调试
This commit is contained in:
parent
ac669510ed
commit
5d07bddeb7
@ -111,7 +111,10 @@
|
|||||||
<!-- Team Bill 卡片 -->
|
<!-- Team Bill 卡片 -->
|
||||||
<div class="team-bill-card" @click="goToTeamBill">
|
<div class="team-bill-card" @click="goToTeamBill">
|
||||||
<div class="card-content">
|
<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">
|
<div class="card-link">
|
||||||
<span>Team Bill</span>
|
<span>Team Bill</span>
|
||||||
<span class="arrow">></span>
|
<span class="arrow">></span>
|
||||||
@ -119,14 +122,14 @@
|
|||||||
<div class="card-details">
|
<div class="card-details">
|
||||||
<div class="detail-row">
|
<div class="detail-row">
|
||||||
<span class="detail-label">Host Salary:</span>
|
<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-label">Agent Salary:</span>
|
||||||
<span class="detail-value">{{ teamBillInfo.agentSalary }}</span>
|
<span class="detail-value">{{ loadingTeamBill ? '–' : teamBillInfo.agentSalary }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="detail-row">
|
<div class="detail-row">
|
||||||
<span class="detail-label">Total:</span>
|
<span class="detail-label">Total:</span>
|
||||||
<span class="detail-value">{{ teamBillInfo.total }}</span>
|
<span class="detail-value">{{ loadingTeamBill ? '–' : teamBillInfo.total }}</span>
|
||||||
<span class="status-badge">{{ teamBillInfo.status }}</span>
|
<span class="status-badge">{{ loadingTeamBill ? '–' : teamBillInfo.status }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -162,12 +165,12 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, reactive } from 'vue'
|
import { ref, reactive, onMounted } from 'vue'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
import MobileHeader from '../components/MobileHeader.vue'
|
import MobileHeader from '../components/MobileHeader.vue'
|
||||||
import {usePageInitializationWithConfig} from "@/utils/pageConfig.js";
|
import {usePageInitializationWithConfig} from "@/utils/pageConfig.js";
|
||||||
import {getTeamId} from "@/utils/userStore.js";
|
import {getTeamId} from "@/utils/userStore.js";
|
||||||
import {getTeamMemberCount} from "@/api/teamBill.js";
|
import {getTeamMemberCount, getTeamBill} from "@/api/teamBill.js";
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
@ -180,12 +183,13 @@ const loadingMemberCount = ref(false)
|
|||||||
|
|
||||||
// Team Bill 信息
|
// Team Bill 信息
|
||||||
const teamBillInfo = reactive({
|
const teamBillInfo = reactive({
|
||||||
date: '2025.08',
|
date: '–',
|
||||||
hostSalary: '–',
|
hostSalary: '–',
|
||||||
agentSalary: '–',
|
agentSalary: '–',
|
||||||
total: '–',
|
total: '–',
|
||||||
status: 'Pending'
|
status: '–'
|
||||||
})
|
})
|
||||||
|
const loadingTeamBill = ref(false)
|
||||||
|
|
||||||
// 页面跳转方法
|
// 页面跳转方法
|
||||||
const goToNotification = () => {
|
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 {
|
const {
|
||||||
userInfo,
|
userInfo,
|
||||||
@ -253,7 +308,7 @@ const {
|
|||||||
needsTeamInfo: true,
|
needsTeamInfo: true,
|
||||||
onDataLoaded: (data) => {
|
onDataLoaded: (data) => {
|
||||||
fetchTeamMemberCount()
|
fetchTeamMemberCount()
|
||||||
|
fetchTeamBillData() // 新增:获取团队账单数据
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -91,17 +91,23 @@
|
|||||||
<!-- 进度信息 -->
|
<!-- 进度信息 -->
|
||||||
<div class="progress-section">
|
<div class="progress-section">
|
||||||
<div class="progress-header">
|
<div class="progress-header">
|
||||||
<span class="progress-date">{{ progressInfo.date }}</span>
|
<span class="progress-date">
|
||||||
<span class="progress-status">{{ progressInfo.status }}</span>
|
<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>
|
||||||
|
|
||||||
<div class="progress-details">
|
<div class="progress-details">
|
||||||
<div class="progress-item">
|
<div class="progress-item">
|
||||||
<span>Level: {{ progressInfo.target }}</span>
|
<span>Level: {{ loadingProgressInfo.value ? '–' : progressInfo.target }}</span>
|
||||||
<span>Salary: ${{ progressInfo.salary }}</span>
|
<span>Salary: ${{ loadingProgressInfo.value ? '–' : progressInfo.salary }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="progress-item">
|
<div class="progress-item">
|
||||||
<span>Time(Days): {{ progressInfo.timeDays }}</span>
|
<span>Time(Days): {{ loadingProgressInfo.value ? '–' : progressInfo.timeDays }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -130,22 +136,83 @@ import { useRouter } from 'vue-router'
|
|||||||
import MobileHeader from '../components/MobileHeader.vue'
|
import MobileHeader from '../components/MobileHeader.vue'
|
||||||
import {usePageInitializationWithConfig} from "@/utils/pageConfig.js";
|
import {usePageInitializationWithConfig} from "@/utils/pageConfig.js";
|
||||||
import {isInApp} from "@/utils/appBridge.js";
|
import {isInApp} from "@/utils/appBridge.js";
|
||||||
|
import {getTeamMemberWork} from "@/api/teamBill.js";
|
||||||
|
import {getUserId} from "@/utils/userStore.js";
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
|
|
||||||
// 进度信息
|
// 进度信息
|
||||||
const progressInfo = reactive({
|
const progressInfo = reactive({
|
||||||
date: '2025.08',
|
date: '–',
|
||||||
status: 'Pending',
|
status: '–',
|
||||||
target: '-',
|
target: '–',
|
||||||
salary: 0.00,
|
salary: '–',
|
||||||
timeDays: 0,
|
timeDays: '–',
|
||||||
diamond: 50000,
|
|
||||||
hostSalary: '–',
|
hostSalary: '–',
|
||||||
agentSalary: '–',
|
agentSalary: '–',
|
||||||
total: '–'
|
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 = () => {
|
const showDatePicker = () => {
|
||||||
router.push('/history-salary')
|
router.push('/history-salary')
|
||||||
@ -176,6 +243,9 @@ const {
|
|||||||
getAvatarPlaceholder
|
getAvatarPlaceholder
|
||||||
} = usePageInitializationWithConfig('HOST_CENTER', {
|
} = usePageInitializationWithConfig('HOST_CENTER', {
|
||||||
needsTeamInfo: true,
|
needsTeamInfo: true,
|
||||||
|
onDataLoaded: () => {
|
||||||
|
fetchMemberWorkData() // 新增:获取成员工作数据
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user