teamBillMore 修改
This commit is contained in:
parent
3451ee849b
commit
d50ace8464
@ -46,7 +46,9 @@
|
|||||||
<div class="user-name">{{ member.memberProfile?.userNickname || 'Unknown User' }}</div>
|
<div class="user-name">{{ member.memberProfile?.userNickname || 'Unknown User' }}</div>
|
||||||
<div class="user-id">ID: {{ member.memberProfile?.account || 'N/A' }}</div>
|
<div class="user-id">ID: {{ member.memberProfile?.account || 'N/A' }}</div>
|
||||||
<div class="user-target">
|
<div class="user-target">
|
||||||
<span class="target-badge">Target: A</span>
|
<span :class="['target-badge', getTargetClass(member.target?.acceptGiftValue)]">
|
||||||
|
{{ formatTargetDisplay(member.target?.acceptGiftValue) }}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -74,8 +76,9 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed } from 'vue'
|
import { ref, computed, onMounted } from 'vue'
|
||||||
import { formatBillStatus } from '../../api/teamBill.js'
|
import { formatBillStatus, getTeamReleasePolicy } from '../../api/teamBill.js'
|
||||||
|
import { getTeamId } from '../../utils/userStore.js'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
billData: {
|
billData: {
|
||||||
@ -87,12 +90,90 @@ const props = defineProps({
|
|||||||
const emit = defineEmits(['close'])
|
const emit = defineEmits(['close'])
|
||||||
|
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
|
const policyData = ref(null)
|
||||||
|
const loadingPolicy = ref(false)
|
||||||
|
|
||||||
// 从 billData 中获取成员数据
|
// 从 billData 中获取成员数据
|
||||||
const members = computed(() => {
|
const members = computed(() => {
|
||||||
return props.billData?.members || []
|
return props.billData?.members || []
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 获取政策数据
|
||||||
|
const fetchPolicyData = async () => {
|
||||||
|
try {
|
||||||
|
loadingPolicy.value = true
|
||||||
|
const teamId = getTeamId()
|
||||||
|
if (!teamId) {
|
||||||
|
console.warn('No team ID available')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const response = await getTeamReleasePolicy(teamId)
|
||||||
|
if (response && response.status && response.body) {
|
||||||
|
policyData.value = response.body
|
||||||
|
console.debug('Policy data loaded:', policyData.value)
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Failed to fetch policy data:', error)
|
||||||
|
} finally {
|
||||||
|
loadingPolicy.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据礼物价值匹配政策等级
|
||||||
|
const getTargetLevel = (giftValue) => {
|
||||||
|
if (!policyData.value?.policy || !giftValue) {
|
||||||
|
return 'N/A'
|
||||||
|
}
|
||||||
|
|
||||||
|
const numValue = parseFloat(giftValue)
|
||||||
|
if (isNaN(numValue)) {
|
||||||
|
return 'N/A'
|
||||||
|
}
|
||||||
|
|
||||||
|
// 按target从大到小排序,找到第一个小于等于giftValue的level
|
||||||
|
const sortedPolicy = [...policyData.value.policy].sort((a, b) => {
|
||||||
|
return parseFloat(b.target) - parseFloat(a.target)
|
||||||
|
})
|
||||||
|
|
||||||
|
console.log('sortedPolicy', JSON.stringify(sortedPolicy))
|
||||||
|
console.log('numValue', JSON.stringify(numValue))
|
||||||
|
|
||||||
|
for (const policy of sortedPolicy) {
|
||||||
|
if (numValue >= parseFloat(policy.target)) {
|
||||||
|
return policy.level
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果都不匹配,返回最低等级
|
||||||
|
const minLevel = Math.min(...policyData.value.policy.map(p => p.level))
|
||||||
|
return minLevel
|
||||||
|
}
|
||||||
|
|
||||||
|
// 格式化Target显示
|
||||||
|
const formatTargetDisplay = (giftValue) => {
|
||||||
|
if (loadingPolicy.value) {
|
||||||
|
return 'Loading...'
|
||||||
|
}
|
||||||
|
|
||||||
|
const level = getTargetLevel(giftValue)
|
||||||
|
return `Level ${level}`
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取Target等级样式
|
||||||
|
const getTargetClass = (giftValue) => {
|
||||||
|
const level = getTargetLevel(giftValue)
|
||||||
|
if (typeof level === 'number') {
|
||||||
|
return `target-level-${level}`
|
||||||
|
}
|
||||||
|
return 'target-default'
|
||||||
|
}
|
||||||
|
|
||||||
|
// 组件挂载时获取政策数据
|
||||||
|
onMounted(() => {
|
||||||
|
fetchPolicyData()
|
||||||
|
})
|
||||||
|
|
||||||
// 格式化状态文本
|
// 格式化状态文本
|
||||||
const getStatusText = (status) => {
|
const getStatusText = (status) => {
|
||||||
const statusInfo = formatBillStatus(status)
|
const statusInfo = formatBillStatus(status)
|
||||||
@ -316,6 +397,44 @@ const handleImageError = (event) => {
|
|||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
border: 1px solid #d1d5db;
|
border: 1px solid #d1d5db;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 不同等级的颜色样式 */
|
||||||
|
.target-level-1 {
|
||||||
|
background-color: #dbeafe;
|
||||||
|
color: #1d4ed8;
|
||||||
|
border-color: #93c5fd;
|
||||||
|
}
|
||||||
|
|
||||||
|
.target-level-2 {
|
||||||
|
background-color: #dcfce7;
|
||||||
|
color: #166534;
|
||||||
|
border-color: #86efac;
|
||||||
|
}
|
||||||
|
|
||||||
|
.target-level-3 {
|
||||||
|
background-color: #fef3c7;
|
||||||
|
color: #92400e;
|
||||||
|
border-color: #fbbf24;
|
||||||
|
}
|
||||||
|
|
||||||
|
.target-level-4 {
|
||||||
|
background-color: #ede9fe;
|
||||||
|
color: #6b21a8;
|
||||||
|
border-color: #c4b5fd;
|
||||||
|
}
|
||||||
|
|
||||||
|
.target-level-5 {
|
||||||
|
background-color: #fce7f3;
|
||||||
|
color: #be185d;
|
||||||
|
border-color: #f9a8d4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.target-default {
|
||||||
|
background-color: #f3f4f6;
|
||||||
|
color: #6b7280;
|
||||||
|
border-color: #d1d5db;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 右侧统计信息 */
|
/* 右侧统计信息 */
|
||||||
|
|||||||
@ -298,7 +298,10 @@ export function usePageInitialization(options = {}) {
|
|||||||
if (response.status && response.body) {
|
if (response.status && response.body) {
|
||||||
// 更新任务信息
|
// 更新任务信息
|
||||||
taskInfo.anchorType = 'Chat' // 固定值
|
taskInfo.anchorType = 'Chat' // 固定值
|
||||||
taskInfo.minutesProgress = response.body.ownTime
|
const ownTime = Number(response.body.ownTime) || 0
|
||||||
|
const otherTime = Number(response.body.otherTime) || 0
|
||||||
|
const totalTime = ownTime + otherTime
|
||||||
|
taskInfo.minutesProgress = totalTime >= taskInfo.minutesTotal ? taskInfo.minutesTotal : totalTime
|
||||||
taskInfo.giftTask = response.body.acceptGiftValue || 0 // acceptGiftValue
|
taskInfo.giftTask = response.body.acceptGiftValue || 0 // acceptGiftValue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -97,7 +97,7 @@
|
|||||||
|
|
||||||
<div class="progress-details">
|
<div class="progress-details">
|
||||||
<div class="progress-item">
|
<div class="progress-item">
|
||||||
<span>Target: {{ progressInfo.target }}</span>
|
<span>Level: {{ progressInfo.target }}</span>
|
||||||
<span>Salary: ${{ progressInfo.salary }}</span>
|
<span>Salary: ${{ progressInfo.salary }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="progress-item">
|
<div class="progress-item">
|
||||||
@ -138,9 +138,9 @@ const router = useRouter()
|
|||||||
const progressInfo = reactive({
|
const progressInfo = reactive({
|
||||||
date: '2025.08',
|
date: '2025.08',
|
||||||
status: 'Pending',
|
status: 'Pending',
|
||||||
target: 'B',
|
target: '-',
|
||||||
salary: 50,
|
salary: 0.00,
|
||||||
timeDays: 20,
|
timeDays: 0,
|
||||||
diamond: 50000,
|
diamond: 50000,
|
||||||
hostSalary: '–',
|
hostSalary: '–',
|
||||||
agentSalary: '–',
|
agentSalary: '–',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user