-
{{ teamBillInfo.date }}
+
+ Loading...
+ {{ teamBillInfo.date }}
+
Team Bill
>
@@ -119,14 +122,14 @@
Host Salary:
- {{ teamBillInfo.hostSalary }}
+ {{ loadingTeamBill ? '–' : teamBillInfo.hostSalary }}
Agent Salary:
- {{ teamBillInfo.agentSalary }}
+ {{ loadingTeamBill ? '–' : teamBillInfo.agentSalary }}
Total:
- {{ teamBillInfo.total }}
- {{ teamBillInfo.status }}
+ {{ loadingTeamBill ? '–' : teamBillInfo.total }}
+ {{ loadingTeamBill ? '–' : teamBillInfo.status }}
@@ -162,12 +165,12 @@
diff --git a/src/views/HostCenterView.vue b/src/views/HostCenterView.vue
index 3a9cd42..1fc826b 100644
--- a/src/views/HostCenterView.vue
+++ b/src/views/HostCenterView.vue
@@ -91,17 +91,23 @@
- Level: {{ progressInfo.target }}
- Salary: ${{ progressInfo.salary }}
+ Level: {{ loadingProgressInfo.value ? '–' : progressInfo.target }}
+ Salary: ${{ loadingProgressInfo.value ? '–' : progressInfo.salary }}
- Time(Days): {{ progressInfo.timeDays }}
+ Time(Days): {{ loadingProgressInfo.value ? '–' : progressInfo.timeDays }}
@@ -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() // 新增:获取成员工作数据
+ }
})