teamBill 处理
This commit is contained in:
parent
369c8f6139
commit
06c37aac58
@ -140,6 +140,36 @@ export const processInviteMessage = async (data) => {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取团队账单列表
|
||||
* @param {string} teamId - 团队ID
|
||||
* @returns {Promise}
|
||||
*/
|
||||
export const getTeamBill = async (teamId) => {
|
||||
try {
|
||||
const response = await get(`/team/bill?id=${teamId}`)
|
||||
return response
|
||||
} catch (error) {
|
||||
console.error('Failed to fetch team bill:', error)
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取团队账单的工资成员信息
|
||||
* @param {string} billId - 账单ID
|
||||
* @returns {Promise}
|
||||
*/
|
||||
export const getTeamBillWorkMembers = async (billId) => {
|
||||
try {
|
||||
const response = await get(`/team/bill/work-members?id=${billId}`)
|
||||
return response
|
||||
} catch (error) {
|
||||
console.error('Failed to fetch team bill work members:', error)
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取团队成员工作报告
|
||||
* @param {string} userId - 用户ID
|
||||
@ -201,6 +231,11 @@ export const formatBillStatus = (status) => {
|
||||
class: 'pending',
|
||||
color: '#EF4444'
|
||||
},
|
||||
'PAY_OUT': {
|
||||
text: 'Completed',
|
||||
class: 'completed',
|
||||
color: '#10B981'
|
||||
},
|
||||
'PAID': {
|
||||
text: 'Completed',
|
||||
class: 'completed',
|
||||
|
||||
@ -1,78 +1,73 @@
|
||||
<template>
|
||||
<div class="team-bill-more">
|
||||
<!-- 抽屉背景蒙层 -->
|
||||
<div class="drawer-overlay" @click="$emit('close')"></div>
|
||||
|
||||
<!-- 抽屉主体 -->
|
||||
<div class="drawer-content">
|
||||
<!-- 拖拽指示器 -->
|
||||
<div class="drag-indicator"></div>
|
||||
|
||||
<!-- 头部区域 -->
|
||||
<div class="bill-header">
|
||||
<h2>{{ billData?.billTitle }}</h2>
|
||||
<div class="header-right">
|
||||
<span :class="['bill-status', getStatusClass(billData?.status)]">
|
||||
{{ getStatusText(billData?.status) }}
|
||||
</span>
|
||||
<button class="close-btn" @click="$emit('close')">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<!-- 头部区域 -->
|
||||
<div class="bill-header">
|
||||
<h2>{{ billData?.billTitle || 'Team Bill Details' }}</h2>
|
||||
<div class="header-right">
|
||||
<span :class="['bill-status', getStatusClass(billData?.status)]">
|
||||
{{ getStatusText(billData?.status) }}
|
||||
</span>
|
||||
<button class="close-btn" @click="$emit('close')">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 成员列表 -->
|
||||
<div class="members-container">
|
||||
<div v-if="loading" class="loading-container">
|
||||
<div class="loading-spinner"></div>
|
||||
<p>Loading members...</p>
|
||||
</div>
|
||||
|
||||
<!-- 薪资汇总信息 -->
|
||||
<div class="bill-summary-card">
|
||||
<h3>Salary Summary</h3>
|
||||
<div class="summary-grid">
|
||||
<div class="summary-item">
|
||||
<span class="summary-label">Host Salary:</span>
|
||||
<span class="summary-value">${{ formatSalaryValue(billData?.target?.ownSalary) }}</span>
|
||||
</div>
|
||||
<div class="summary-item">
|
||||
<span class="summary-label">Agent Salary:</span>
|
||||
<span class="summary-value">${{ formatSalaryValue(billData?.target?.memberSalary) }}</span>
|
||||
</div>
|
||||
<div class="summary-item total-salary">
|
||||
<span class="summary-label">Total Salary:</span>
|
||||
<span class="summary-value total-salary-value">${{ formatSalaryValue(billData?.target?.totalSalry) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 每日薪资详情 -->
|
||||
<div class="daily-details-card">
|
||||
<h3>Daily Salary Details</h3>
|
||||
<div v-if="billData?.target?.dailyTargets?.length > 0" class="daily-list">
|
||||
<div
|
||||
v-for="(daily, index) in billData.target.dailyTargets"
|
||||
:key="index"
|
||||
class="daily-item"
|
||||
>
|
||||
<div class="daily-header">
|
||||
<span class="daily-date">{{ formatDate(daily.dateNumber) }}</span>
|
||||
<span class="daily-time">{{ formatCreateTime(daily.createTime) }}</span>
|
||||
<div v-else-if="members && members.length > 0" class="members-list">
|
||||
<div
|
||||
v-for="(member, index) in members"
|
||||
:key="member.memberProfile?.id || index"
|
||||
class="member-item"
|
||||
>
|
||||
<!-- 用户头像 -->
|
||||
<div class="member-avatar">
|
||||
<img
|
||||
v-if="member.memberProfile?.userAvatar"
|
||||
:src="member.memberProfile.userAvatar"
|
||||
:alt="member.memberProfile?.userNickname"
|
||||
@error="handleImageError"
|
||||
/>
|
||||
<div v-else class="avatar-placeholder">
|
||||
{{ getAvatarPlaceholder(member.memberProfile?.userNickname) }}
|
||||
</div>
|
||||
<div class="daily-stats">
|
||||
<div class="daily-stat">
|
||||
<span class="stat-label">Host:</span>
|
||||
<span class="stat-value">${{ formatSalaryValue(daily.ownSalary) }}</span>
|
||||
</div>
|
||||
|
||||
<!-- 用户信息区域 -->
|
||||
<div class="member-details">
|
||||
<!-- 左侧:用户信息 -->
|
||||
<div class="user-info">
|
||||
<div class="user-name">{{ member.memberProfile?.userNickname || 'Unknown User' }}</div>
|
||||
<div class="user-id">ID: {{ member.memberProfile?.id || 'N/A' }}</div>
|
||||
<div class="user-target">
|
||||
<span class="target-badge">Target: A</span>
|
||||
</div>
|
||||
<div class="daily-stat">
|
||||
<span class="stat-label">Agent:</span>
|
||||
<span class="stat-value">${{ formatSalaryValue(daily.memberSalary) }}</span>
|
||||
</div>
|
||||
|
||||
<!-- 右侧:统计信息 -->
|
||||
<div class="member-stats">
|
||||
<div class="diamond-info">
|
||||
<span class="diamond-icon">🪙</span>
|
||||
<span class="diamond-value">{{ formatDiamondValue(member.target?.acceptGiftValue) }}</span>
|
||||
</div>
|
||||
<div class="daily-stat">
|
||||
<span class="stat-label">Total:</span>
|
||||
<span class="stat-value total-daily-value">${{ formatSalaryValue(daily.totalSalry) }}</span>
|
||||
<div class="time-info">
|
||||
<span class="time-label">Time (Days):</span>
|
||||
<span class="time-value">{{ calculateEffectiveDays(member.target?.onlineTime) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="no-daily-data">
|
||||
<div class="no-data-icon">💰</div>
|
||||
<p>No daily salary data available</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-else class="empty-state">
|
||||
<div class="empty-icon">👥</div>
|
||||
<p>No members data available</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -80,9 +75,7 @@
|
||||
|
||||
<script setup>
|
||||
import { ref, computed } from 'vue'
|
||||
import {
|
||||
formatDateDisplay
|
||||
} from '../../api/teamBill.js'
|
||||
import { formatBillStatus } from '../../api/teamBill.js'
|
||||
|
||||
const props = defineProps({
|
||||
billData: {
|
||||
@ -93,78 +86,99 @@ const props = defineProps({
|
||||
|
||||
const emit = defineEmits(['close'])
|
||||
|
||||
// 格式化薪资数值
|
||||
const formatSalaryValue = (value) => {
|
||||
if (!value || value === '0' || value === 0) return '0.00'
|
||||
const numValue = parseFloat(value)
|
||||
return numValue.toFixed(2)
|
||||
}
|
||||
const loading = ref(false)
|
||||
|
||||
// 从 billData 中获取成员数据
|
||||
const members = computed(() => {
|
||||
return props.billData?.members || []
|
||||
})
|
||||
|
||||
// 格式化状态文本
|
||||
const getStatusText = (status) => {
|
||||
const statusMap = {
|
||||
'UNPAID': 'In Progress',
|
||||
'HANG_UP': 'Pending',
|
||||
'PAID': 'Completed',
|
||||
'SETTLED': 'Settled'
|
||||
}
|
||||
return statusMap[status] || status
|
||||
const statusInfo = formatBillStatus(status)
|
||||
return statusInfo.text
|
||||
}
|
||||
|
||||
// 获取状态样式类
|
||||
const getStatusClass = (status) => {
|
||||
const statusClassMap = {
|
||||
'UNPAID': 'in-progress',
|
||||
'HANG_UP': 'pending',
|
||||
'PAID': 'completed',
|
||||
'SETTLED': 'settled'
|
||||
const statusInfo = formatBillStatus(status)
|
||||
return statusInfo.class
|
||||
}
|
||||
|
||||
// 格式化钻石数值
|
||||
const formatDiamondValue = (value) => {
|
||||
if (!value || value === '0') return '1234567890'
|
||||
|
||||
// 如果已经是格式化的字符串,直接返回
|
||||
if (typeof value === 'string' && (value.includes('K') || value.includes('M'))) {
|
||||
return value.replace(/[^0-9KM.]/g, '')
|
||||
}
|
||||
return statusClassMap[status] || 'unknown'
|
||||
|
||||
const numValue = parseInt(value)
|
||||
if (isNaN(numValue)) return '1234567890'
|
||||
|
||||
return numValue.toLocaleString()
|
||||
}
|
||||
|
||||
// 格式化日期
|
||||
const formatDate = (dateNumber) => {
|
||||
return formatDateDisplay(dateNumber)
|
||||
// 计算有效天数
|
||||
const calculateEffectiveDays = (onlineTime) => {
|
||||
if (!onlineTime) return '14'
|
||||
|
||||
// 如果在线时间大于60分钟,则计为1天
|
||||
const minutes = parseInt(onlineTime)
|
||||
if (isNaN(minutes)) return '14'
|
||||
|
||||
// 简单计算:每60分钟算作1天
|
||||
const days = Math.floor(minutes / 60)
|
||||
return days > 0 ? days.toString() : '14'
|
||||
}
|
||||
|
||||
// 格式化创建时间
|
||||
const formatCreateTime = (timestamp) => {
|
||||
if (!timestamp) return ''
|
||||
const date = new Date(timestamp)
|
||||
return date.toLocaleTimeString('en-US', {
|
||||
hour12: false,
|
||||
hour: '2-digit',
|
||||
minute: '2-digit'
|
||||
})
|
||||
// 头像占位符
|
||||
const getAvatarPlaceholder = (nickname) => {
|
||||
if (!nickname) return 'U'
|
||||
return nickname.charAt(0).toUpperCase()
|
||||
}
|
||||
|
||||
// 处理图片加载错误
|
||||
const handleImageError = (event) => {
|
||||
console.warn('头像加载失败:', event.target.src)
|
||||
// 可以在这里设置默认头像
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.team-bill-more {
|
||||
background-color: #f1f2f3;
|
||||
padding: 20px;
|
||||
min-height: 100%;
|
||||
background-color: #f5f5f5;
|
||||
min-height: 100vh;
|
||||
font-family: -apple-system, BlinkMacSystemFont, sans-serif;
|
||||
}
|
||||
|
||||
/* 账单头部 */
|
||||
/* 头部区域 */
|
||||
.bill-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 20px;
|
||||
padding: 16px 20px;
|
||||
background-color: white;
|
||||
border-bottom: 1px solid #e5e7eb;
|
||||
}
|
||||
|
||||
.bill-header h2 {
|
||||
margin: 0;
|
||||
font-size: 20px;
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.header-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.bill-status {
|
||||
padding: 6px 12px;
|
||||
border-radius: 6px;
|
||||
padding: 4px 8px;
|
||||
border-radius: 4px;
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
}
|
||||
@ -184,227 +198,168 @@ const formatCreateTime = (timestamp) => {
|
||||
color: #059669;
|
||||
}
|
||||
|
||||
.bill-status.settled {
|
||||
background-color: #E0E7FF;
|
||||
color: #5B21B6;
|
||||
.close-btn {
|
||||
background: none;
|
||||
border: none;
|
||||
font-size: 24px;
|
||||
cursor: pointer;
|
||||
color: #666;
|
||||
padding: 0;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
/* 卡片样式 */
|
||||
.bill-summary-card,
|
||||
.daily-details-card {
|
||||
background-color: white;
|
||||
border-radius: 12px;
|
||||
padding: 20px;
|
||||
margin-bottom: 20px;
|
||||
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
|
||||
/* 成员列表容器 */
|
||||
.members-container {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
.bill-summary-card h3,
|
||||
.daily-details-card h3 {
|
||||
margin: 0 0 16px 0;
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
/* 汇总网格 */
|
||||
.summary-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 16px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.summary-item {
|
||||
.members-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
gap: 0;
|
||||
}
|
||||
|
||||
.summary-label {
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
|
||||
.summary-value {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.diamond-value {
|
||||
color: #1E40AF !important;
|
||||
}
|
||||
|
||||
/* 结算信息 */
|
||||
.settlement-info {
|
||||
border-top: 1px solid #e5e7eb;
|
||||
padding-top: 16px;
|
||||
}
|
||||
|
||||
.settlement-row {
|
||||
/* 成员项目 */
|
||||
.member-item {
|
||||
background-color: white;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.settlement-label {
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.settlement-value {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.salary-value {
|
||||
color: #059669 !important;
|
||||
}
|
||||
|
||||
/* 道具奖励区域 */
|
||||
.props-reward-section {
|
||||
margin-top: 16px;
|
||||
padding: 16px;
|
||||
background-color: #f9fafb;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.props-reward-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.props-label {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.receive-props-btn {
|
||||
background-color: #3B82F6;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 6px 12px;
|
||||
border-radius: 6px;
|
||||
font-size: 12px;
|
||||
cursor: pointer;
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
transition: background-color 0.2s;
|
||||
}
|
||||
|
||||
.receive-props-btn:hover:not(:disabled) {
|
||||
background-color: #2563EB;
|
||||
.member-item:hover {
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
|
||||
.receive-props-btn:disabled {
|
||||
background-color: #9CA3AF;
|
||||
cursor: not-allowed;
|
||||
.member-item:first-child {
|
||||
border-top-left-radius: 8px;
|
||||
border-top-right-radius: 8px;
|
||||
}
|
||||
|
||||
.props-list {
|
||||
.member-item:last-child {
|
||||
border-bottom-left-radius: 8px;
|
||||
border-bottom-right-radius: 8px;
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
/* 用户头像 */
|
||||
.member-avatar {
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
border-radius: 50%;
|
||||
overflow: hidden;
|
||||
flex-shrink: 0;
|
||||
margin-right: 12px;
|
||||
}
|
||||
|
||||
.member-avatar img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.avatar-placeholder {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: #8B5CF6;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: white;
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.prop-item {
|
||||
/* 用户信息区域 */
|
||||
.member-details {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 8px;
|
||||
background-color: white;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.prop-info {
|
||||
/* 左侧用户信息 */
|
||||
.user-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.prop-name {
|
||||
font-size: 14px;
|
||||
.user-name {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.user-id {
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.user-target {
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.target-badge {
|
||||
background-color: #f3f4f6;
|
||||
color: #374151;
|
||||
padding: 2px 8px;
|
||||
border-radius: 12px;
|
||||
font-size: 11px;
|
||||
font-weight: 500;
|
||||
color: #333;
|
||||
border: 1px solid #d1d5db;
|
||||
}
|
||||
|
||||
.prop-type {
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.prop-value {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: #059669;
|
||||
}
|
||||
|
||||
/* 每日列表 */
|
||||
.daily-list {
|
||||
/* 右侧统计信息 */
|
||||
.member-stats {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
align-items: flex-end;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.daily-item {
|
||||
background-color: #f9fafb;
|
||||
border: 1px solid #e5e7eb;
|
||||
border-radius: 8px;
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.daily-header {
|
||||
.diamond-info {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.daily-date {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.daily-time {
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.daily-stats {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.daily-stat {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.stat-label {
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
.diamond-icon {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.stat-value {
|
||||
.diamond-value {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
/* 无数据状态 */
|
||||
.no-daily-data {
|
||||
.time-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.time-label {
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.time-value {
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
/* 加载状态 */
|
||||
.loading-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
@ -412,61 +367,51 @@ const formatCreateTime = (timestamp) => {
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.no-data-icon {
|
||||
.loading-spinner {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border: 3px solid #f3f3f3;
|
||||
border-top: 3px solid #8B5CF6;
|
||||
border-radius: 50%;
|
||||
animation: spin 1s linear infinite;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% { transform: rotate(0deg); }
|
||||
100% { transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
/* 空数据状态 */
|
||||
.empty-state {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 40px 20px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.empty-icon {
|
||||
font-size: 48px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.no-daily-data p {
|
||||
.empty-state p {
|
||||
margin: 0;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
/* 关闭按钮 */
|
||||
.close-button-container {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
padding: 20px 0;
|
||||
}
|
||||
|
||||
.close-btn {
|
||||
background-color: #6B7280;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 12px 24px;
|
||||
border-radius: 8px;
|
||||
font-size: 16px;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.2s;
|
||||
}
|
||||
|
||||
.close-btn:hover {
|
||||
background-color: #4B5563;
|
||||
}
|
||||
|
||||
/* 响应式设计 */
|
||||
@media (max-width: 480px) {
|
||||
.summary-grid {
|
||||
grid-template-columns: 1fr;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.daily-stats {
|
||||
.member-details {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
align-items: flex-start;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.daily-stat {
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.props-reward-header {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
gap: 8px;
|
||||
|
||||
.member-stats {
|
||||
align-self: flex-end;
|
||||
align-items: flex-end;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -7,9 +7,9 @@
|
||||
<div class="host-salary-card">
|
||||
<div class="salary-header">
|
||||
<h3>Host Salary</h3>
|
||||
<button class="info-btn" @click="showSalaryInfo">
|
||||
<!-- <button class="info-btn" @click="showSalaryInfo">
|
||||
<span>?</span>
|
||||
</button>
|
||||
</button>-->
|
||||
</div>
|
||||
<div class="salary-amount">${{ totalSalary }}</div>
|
||||
</div>
|
||||
@ -18,7 +18,14 @@
|
||||
<div class="work-report-section">
|
||||
<h3>Work report:</h3>
|
||||
|
||||
<div class="report-list">
|
||||
<!-- 加载状态 -->
|
||||
<div v-if="loading" class="loading-container">
|
||||
<div class="loading-spinner"></div>
|
||||
<p>Loading...</p>
|
||||
</div>
|
||||
|
||||
<!-- 报告列表 -->
|
||||
<div v-else-if="workReports.length > 0" class="report-list">
|
||||
<div
|
||||
v-for="report in workReports"
|
||||
:key="report.id"
|
||||
@ -49,8 +56,96 @@
|
||||
<span class="detail-value">{{ report.timeDays }}</span>
|
||||
</div>
|
||||
<div class="detail-item">
|
||||
<span class="detail-label">Diamond:</span>
|
||||
<span class="detail-value">{{ report.diamond }}</span>
|
||||
<span class="detail-label">Agent Salary:</span>
|
||||
<span class="detail-value">{{ report.agentSalary }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="detail-row">
|
||||
<div class="detail-item">
|
||||
<span class="detail-label">Total Salary:</span>
|
||||
<span class="detail-value total-salary">{{ report.totalSalary }}</span>
|
||||
</div>
|
||||
<div class="detail-item">
|
||||
<!-- More 按钮 -->
|
||||
<button v-if="report.hasDetails" class="more-btn" @click="showReportDetail(report)">
|
||||
<span>More</span>
|
||||
<span class="arrow">></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 空数据状态 -->
|
||||
<div v-else class="empty-state">
|
||||
<div class="empty-icon">📋</div>
|
||||
<p>No data available</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 详情模态框 -->
|
||||
<div v-if="showDetailModal" class="modal-overlay" @click="closeDetailModal">
|
||||
<div class="detail-modal" @click.stop>
|
||||
<div class="detail-header">
|
||||
<h3>{{ selectedReport?.date || 'Work Details' }}</h3>
|
||||
<button class="close-btn" @click="closeDetailModal">×</button>
|
||||
</div>
|
||||
|
||||
<div class="detail-content">
|
||||
<!-- 等级卡片 -->
|
||||
<div v-if="levelData" class="level-card">
|
||||
<div class="level-header">
|
||||
<h4>{{ levelData.level }}</h4>
|
||||
</div>
|
||||
<div class="level-stats">
|
||||
<div class="stat-row">
|
||||
<div class="stat-item">
|
||||
<span class="stat-label">Time (hours)</span>
|
||||
<span class="stat-value">{{ levelData.timeHours }}</span>
|
||||
</div>
|
||||
<div class="stat-item">
|
||||
<span class="stat-label">Target</span>
|
||||
<span class="stat-value">{{ levelData.target }}</span>
|
||||
</div>
|
||||
<div class="stat-item">
|
||||
<span class="stat-label">Host Salary</span>
|
||||
<span class="stat-value">${{ levelData.hostSalary }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="stat-row">
|
||||
<div class="stat-item">
|
||||
<span class="stat-label">Agent Salary</span>
|
||||
<span class="stat-value">${{ levelData.agentSalary }}</span>
|
||||
</div>
|
||||
<div class="stat-item">
|
||||
<span class="stat-label">Total Salary</span>
|
||||
<span class="stat-value">${{ levelData.totalSalary }}</span>
|
||||
</div>
|
||||
<div class="stat-item">
|
||||
<!-- 空占位 -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 每日目标列表 -->
|
||||
<div v-if="dailyTargets.length > 0" class="daily-targets">
|
||||
<h4>Daily Targets</h4>
|
||||
<div class="daily-list">
|
||||
<div v-for="daily in dailyTargets" :key="daily.dateNumber" class="daily-item">
|
||||
<div class="daily-date">{{ formatDateNumber(daily.dateNumber) }}</div>
|
||||
<div class="daily-stats">
|
||||
<div class="daily-stat">
|
||||
<span class="daily-label">Online Time:</span>
|
||||
<span class="daily-value">{{ formatOnlineTime(daily.onlineTime) }}</span>
|
||||
</div>
|
||||
<div class="daily-stat">
|
||||
<span class="daily-label">Gift Value:</span>
|
||||
<span class="daily-value">${{ formatGiftValue(daily.acceptGiftValue) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -88,29 +183,193 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive } from 'vue'
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import MobileHeader from '../components/MobileHeader.vue'
|
||||
import { getTeamMemberWork } from '../api/teamBill.js'
|
||||
|
||||
const router = useRouter()
|
||||
const totalSalary = ref('12345')
|
||||
const showSalaryModal = ref(false)
|
||||
const loading = ref(false)
|
||||
const showDetailModal = ref(false)
|
||||
const selectedReport = ref(null)
|
||||
const originalTargetsData = ref([]) // 保存原始数据
|
||||
|
||||
// 工作报告数据
|
||||
const workReports = reactive([
|
||||
{
|
||||
id: 1,
|
||||
date: '2025.07',
|
||||
status: 'In Progress',
|
||||
target: '-',
|
||||
salary: '-',
|
||||
timeDays: '-',
|
||||
diamond: '-'
|
||||
const workReports = ref([])
|
||||
const levelData = ref(null)
|
||||
const dailyTargets = ref([])
|
||||
|
||||
// 获取工作报告数据
|
||||
const fetchWorkReports = async (userId) => {
|
||||
try {
|
||||
loading.value = true
|
||||
const response = await getTeamMemberWork(userId)
|
||||
|
||||
if (response.status && response.body) {
|
||||
// 将 targets 数据转换为 workReports 格式
|
||||
const targets = response.body.targets || []
|
||||
originalTargetsData.value = targets // 保存原始数据
|
||||
|
||||
workReports.value = targets.map(target => ({
|
||||
id: target.id,
|
||||
date: target.billTitle,
|
||||
status: getStatusText(target.status),
|
||||
target: formatGiftValue(target.target?.acceptGiftValue) || '-',
|
||||
salary: formatSalaryValue(target.target?.settlementResult?.ownSalary) || '-',
|
||||
agentSalary: formatSalaryValue(target.target?.settlementResult?.memberSalary) || '-',
|
||||
totalSalary: formatSalaryValue(target.target?.settlementResult?.totalSalary) || '-',
|
||||
timeDays: target.target?.effectiveDay || '-',
|
||||
hasDetails: target.target && target.target.dailyTargets && target.target.dailyTargets.length > 0,
|
||||
originalData: target // 保存原始数据用于详情显示
|
||||
}))
|
||||
|
||||
// 计算总薪资
|
||||
const totalAmount = targets.reduce((sum, target) => {
|
||||
const salary = parseFloat(target.target?.ownSalary || 0)
|
||||
return sum + salary
|
||||
}, 0)
|
||||
totalSalary.value = totalAmount.toFixed(2)
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to fetch work reports:', error)
|
||||
// 保持默认数据作为fallback
|
||||
workReports.value = [
|
||||
{
|
||||
id: 1,
|
||||
date: '2025.07',
|
||||
status: 'In Progress',
|
||||
target: '-',
|
||||
salary: '-',
|
||||
timeDays: '-',
|
||||
diamond: '-'
|
||||
}
|
||||
]
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
])
|
||||
}
|
||||
|
||||
// 格式化薪资数值(与 TeamBillView 保持一致)
|
||||
const formatSalaryValue = (value) => {
|
||||
if (!value || value === '0' || value === 0) return '0.00'
|
||||
const numValue = parseFloat(value)
|
||||
return numValue.toFixed(2)
|
||||
}
|
||||
|
||||
// 格式化状态文本(与 TeamBillView 保持一致)
|
||||
const getStatusText = (status) => {
|
||||
const statusMap = {
|
||||
'UNPAID': 'In Progress',
|
||||
'HANG_UP': 'Pending',
|
||||
'PAID': 'Completed'
|
||||
}
|
||||
return statusMap[status] || status
|
||||
}
|
||||
|
||||
// 格式化礼物数值
|
||||
const formatGiftValue = (value) => {
|
||||
if (!value || value === '0') return '0'
|
||||
|
||||
// 如果已经是格式化的字符串,直接返回
|
||||
if (typeof value === 'string' && (value.includes('K') || value.includes('M'))) {
|
||||
return value
|
||||
}
|
||||
|
||||
const numValue = parseFloat(value)
|
||||
if (isNaN(numValue)) return '0'
|
||||
|
||||
if (numValue >= 1000000) {
|
||||
return `${(numValue / 1000000).toFixed(1)}M`
|
||||
} else if (numValue >= 1000) {
|
||||
return `${(numValue / 1000).toFixed(1)}K`
|
||||
}
|
||||
return numValue.toFixed(0)
|
||||
}
|
||||
|
||||
// 显示报告详情
|
||||
const showReportDetail = (report) => {
|
||||
selectedReport.value = report
|
||||
|
||||
if (report.originalData && report.originalData.target) {
|
||||
const targetData = report.originalData.target
|
||||
|
||||
// 生成等级数据(模拟 Lv.1, Lv.2 等)
|
||||
levelData.value = {
|
||||
level: `Lv.${getLevelFromGiftValue(targetData.acceptGiftValue)}`,
|
||||
timeHours: formatMinutesToHours(targetData.onlineTime),
|
||||
target: formatGiftValue(targetData.acceptGiftValue),
|
||||
hostSalary: formatSalaryValue(targetData.settlementResult?.ownSalary),
|
||||
agentSalary: formatSalaryValue(targetData.settlementResult?.memberSalary),
|
||||
totalSalary: formatSalaryValue(targetData.settlementResult?.totalSalary)
|
||||
}
|
||||
|
||||
// 设置每日目标数据
|
||||
dailyTargets.value = targetData.dailyTargets || []
|
||||
}
|
||||
|
||||
showDetailModal.value = true
|
||||
}
|
||||
|
||||
// 关闭详情模态框
|
||||
const closeDetailModal = () => {
|
||||
showDetailModal.value = false
|
||||
selectedReport.value = null
|
||||
levelData.value = null
|
||||
dailyTargets.value = []
|
||||
}
|
||||
|
||||
// 根据礼物数值获取等级
|
||||
const getLevelFromGiftValue = (giftValue) => {
|
||||
const value = parseFloat(giftValue) || 0
|
||||
if (value >= 214000) return 4
|
||||
if (value >= 108000) return 3
|
||||
if (value >= 65000) return 2
|
||||
return 1
|
||||
}
|
||||
|
||||
// 将分钟转换为小时
|
||||
const formatMinutesToHours = (minutes) => {
|
||||
const mins = parseInt(minutes) || 0
|
||||
return Math.round(mins / 60)
|
||||
}
|
||||
|
||||
// 格式化在线时间
|
||||
const formatOnlineTime = (minutes) => {
|
||||
const mins = parseInt(minutes) || 0
|
||||
const hours = Math.floor(mins / 60)
|
||||
const remainingMins = mins % 60
|
||||
|
||||
if (hours > 0) {
|
||||
return remainingMins > 0 ? `${hours}h ${remainingMins}m` : `${hours}h`
|
||||
}
|
||||
return `${mins}m`
|
||||
}
|
||||
|
||||
// 格式化日期数字
|
||||
const formatDateNumber = (dateNumber) => {
|
||||
if (!dateNumber) return ''
|
||||
const dateStr = dateNumber.toString()
|
||||
if (dateStr.length !== 8) return dateStr
|
||||
|
||||
const year = dateStr.substring(0, 4)
|
||||
const month = dateStr.substring(4, 6)
|
||||
const day = dateStr.substring(6, 8)
|
||||
return `${month}/${day}/${year}`
|
||||
}
|
||||
|
||||
// 显示薪资信息
|
||||
const showSalaryInfo = () => {
|
||||
showSalaryModal.value = true
|
||||
}
|
||||
|
||||
// 组件挂载时获取数据
|
||||
onMounted(() => {
|
||||
// 从路由参数或者默认值获取用户ID
|
||||
const userId = router.currentRoute.value.query.userId || '1911661502909562881'
|
||||
fetchWorkReports(userId)
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
@ -180,6 +439,44 @@ const showSalaryInfo = () => {
|
||||
color: #666;
|
||||
}
|
||||
|
||||
/* 加载状态 */
|
||||
.loading-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 40px 20px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.loading-spinner {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border: 3px solid #f3f3f3;
|
||||
border-top: 3px solid #8B5CF6;
|
||||
border-radius: 50%;
|
||||
animation: spin 1s linear infinite;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% { transform: rotate(0deg); }
|
||||
100% { transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
/* 空数据状态 */
|
||||
.empty-state {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 40px 20px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.empty-icon {
|
||||
font-size: 48px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.report-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@ -263,6 +560,187 @@ const showSalaryInfo = () => {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.total-salary {
|
||||
color: #10B981 !important;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
/* More 按钮 */
|
||||
.more-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
background: none;
|
||||
border: none;
|
||||
color: #8B5CF6;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
transition: color 0.2s;
|
||||
}
|
||||
|
||||
.more-btn:hover {
|
||||
color: #7C3AED;
|
||||
}
|
||||
|
||||
.arrow {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* 详情模态框样式 */
|
||||
.detail-modal {
|
||||
background: white;
|
||||
border-radius: 16px;
|
||||
width: 90%;
|
||||
max-width: 480px;
|
||||
max-height: 80vh;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.detail-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 16px 20px;
|
||||
border-bottom: 1px solid #e5e7eb;
|
||||
background-color: #f8f9fa;
|
||||
}
|
||||
|
||||
.detail-header h3 {
|
||||
margin: 0;
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.close-btn {
|
||||
background: none;
|
||||
border: none;
|
||||
font-size: 24px;
|
||||
cursor: pointer;
|
||||
color: #666;
|
||||
padding: 0;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.detail-content {
|
||||
padding: 20px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
/* 等级卡片样式 */
|
||||
.level-card {
|
||||
background-color: #f8f9fa;
|
||||
border: 1px solid #e5e7eb;
|
||||
border-radius: 8px;
|
||||
padding: 16px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.level-header {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.level-header h4 {
|
||||
margin: 0;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.level-stats {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.stat-row {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr 1fr;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.stat-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
text-align: center;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.stat-label {
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.stat-value {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
/* 每日目标样式 */
|
||||
.daily-targets {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.daily-targets h4 {
|
||||
margin: 0 0 12px 0;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.daily-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.daily-item {
|
||||
background-color: #f9fafb;
|
||||
border: 1px solid #e5e7eb;
|
||||
border-radius: 8px;
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
.daily-date {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.daily-stats {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.daily-stat {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
.daily-label {
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.daily-value {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
/* 弹窗样式 */
|
||||
.modal-overlay {
|
||||
position: fixed;
|
||||
|
||||
@ -34,18 +34,18 @@
|
||||
|
||||
<div class="bill-details">
|
||||
<div class="bill-row">
|
||||
<span class="bill-label">Host Salary:</span>
|
||||
<span class="bill-value">${{ formatSalaryValue(bill.target?.ownSalary) }}</span>
|
||||
<span class="bill-label">Create Time:</span>
|
||||
<span class="bill-value">{{ bill.createTimeFormatted }}</span>
|
||||
</div>
|
||||
|
||||
<div class="bill-row">
|
||||
<span class="bill-label">Agent Salary:</span>
|
||||
<span class="bill-value">${{ formatSalaryValue(bill.target?.memberSalary) }}</span>
|
||||
<span class="bill-label">Period:</span>
|
||||
<span class="bill-value">{{ bill.billBelong }}</span>
|
||||
</div>
|
||||
|
||||
<div class="bill-row">
|
||||
<span class="bill-label">Total Salary:</span>
|
||||
<span class="bill-value total-salary-value">${{ formatSalaryValue(bill.target?.totalSalry) }}</span>
|
||||
<span class="bill-label">Last Update:</span>
|
||||
<span class="bill-value">{{ bill.updateTimeFormatted }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -93,6 +93,11 @@
|
||||
</div>
|
||||
<div class="status-item">
|
||||
<span class="status-number">(3)</span>
|
||||
<span class="status-name">PAY_OUT:</span>
|
||||
<span class="status-desc">Work has been completed and paid out.</span>
|
||||
</div>
|
||||
<div class="status-item">
|
||||
<span class="status-number">(4)</span>
|
||||
<span class="status-name">PAID:</span>
|
||||
<span class="status-desc">Work has been completed and settled.</span>
|
||||
</div>
|
||||
@ -117,73 +122,81 @@
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import MobileHeader from '../components/MobileHeader.vue'
|
||||
import TeamBillMore from '../components/team/TeamBillMore.vue'
|
||||
import { getTeamMemberWork, formatDateDisplay } from '../api/teamBill.js'
|
||||
import { getTeamBill, getTeamBillWorkMembers, formatBillStatus } from '../api/teamBill.js'
|
||||
import { getTeamId } from "@/utils/userStore.js"
|
||||
|
||||
const router = useRouter()
|
||||
const loading = ref(false)
|
||||
const showHelpModal = ref(false)
|
||||
const showDetailModal = ref(false)
|
||||
const selectedBill = ref(null)
|
||||
|
||||
// 数据
|
||||
const memberProfile = ref(null)
|
||||
const billList = ref([])
|
||||
const selectedBillMembers = ref([])
|
||||
|
||||
// 获取团队成员工作数据
|
||||
const fetchTeamMemberWork = async (userId) => {
|
||||
// 获取团队账单列表
|
||||
const fetchTeamBill = async (teamId) => {
|
||||
try {
|
||||
loading.value = true
|
||||
const response = await getTeamMemberWork(userId)
|
||||
const response = await getTeamBill(teamId)
|
||||
|
||||
if (response.status && response.body) {
|
||||
memberProfile.value = response.body.memberProfile
|
||||
billList.value = response.body.targets || []
|
||||
billList.value = response.body.map(bill => ({
|
||||
...bill,
|
||||
// 将时间戳转换为可读格式
|
||||
createTimeFormatted: new Date(bill.createTime).toLocaleDateString(),
|
||||
updateTimeFormatted: new Date(bill.updateTime).toLocaleDateString()
|
||||
}))
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to fetch team member work:', error)
|
||||
console.error('Failed to fetch team bill:', error)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 格式化薪资数值
|
||||
const formatSalaryValue = (value) => {
|
||||
if (!value || value === '0' || value === 0) return '0.00'
|
||||
const numValue = parseFloat(value)
|
||||
return numValue.toFixed(2)
|
||||
// 获取账单的工资成员信息
|
||||
const fetchBillWorkMembers = async (billId) => {
|
||||
try {
|
||||
const response = await getTeamBillWorkMembers(billId)
|
||||
if (response.status && response.body) {
|
||||
return response.body
|
||||
}
|
||||
return []
|
||||
} catch (error) {
|
||||
console.error('Failed to fetch bill work members:', error)
|
||||
return []
|
||||
}
|
||||
}
|
||||
|
||||
// 格式化状态文本
|
||||
const getStatusText = (status) => {
|
||||
const statusMap = {
|
||||
'UNPAID': 'In Progress',
|
||||
'HANG_UP': 'Pending',
|
||||
'PAID': 'Completed'
|
||||
}
|
||||
return statusMap[status] || status
|
||||
const statusInfo = formatBillStatus(status)
|
||||
return statusInfo.text
|
||||
}
|
||||
|
||||
// 获取状态样式类
|
||||
const getStatusClass = (status) => {
|
||||
const statusClassMap = {
|
||||
'UNPAID': 'in-progress',
|
||||
'HANG_UP': 'pending',
|
||||
'PAID': 'completed'
|
||||
}
|
||||
return statusClassMap[status] || 'unknown'
|
||||
const statusInfo = formatBillStatus(status)
|
||||
return statusInfo.class
|
||||
}
|
||||
|
||||
// 格式化日期
|
||||
const formatDate = (dateNumber) => {
|
||||
return formatDateDisplay(dateNumber)
|
||||
}
|
||||
// 移除不再使用的函数
|
||||
// const formatDate = (dateNumber) => {
|
||||
// return formatDateDisplay(dateNumber)
|
||||
// }
|
||||
|
||||
// 显示账单详情
|
||||
const showBillDetail = (bill) => {
|
||||
selectedBill.value = bill
|
||||
const showBillDetail = async (bill) => {
|
||||
// 获取该账单的成员工作信息
|
||||
const membersData = await fetchBillWorkMembers(bill.id)
|
||||
selectedBillMembers.value = membersData
|
||||
selectedBill.value = {
|
||||
...bill,
|
||||
members: membersData
|
||||
}
|
||||
showDetailModal.value = true
|
||||
}
|
||||
|
||||
@ -211,9 +224,13 @@ const handlePropsReceived = () => {
|
||||
|
||||
// 组件挂载时获取数据
|
||||
onMounted(() => {
|
||||
// 从路由参数或者默认值获取用户ID
|
||||
const userId = router.currentRoute.value.query.userId || '1911661502909562881'
|
||||
fetchTeamMemberWork(userId)
|
||||
// 获取团队ID
|
||||
const teamId = getTeamId()
|
||||
if (teamId) {
|
||||
fetchTeamBill(teamId)
|
||||
} else {
|
||||
console.warn('未找到团队ID')
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user