审核通过和拒绝接通
This commit is contained in:
parent
cee6b25a3d
commit
a2b8aa1c23
@ -145,6 +145,35 @@ export function getTeamApplyRecord(teamId, status) {
|
||||
return get(`/team/user/apply/record?teamId=${teamId}&status=${status}`)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取自己的申请记录
|
||||
* @returns {Promise} 返回申请记录列表
|
||||
*/
|
||||
export function getWaitApplyRecord() {
|
||||
return get('/team/wait-apply/profile')
|
||||
}
|
||||
|
||||
/**
|
||||
* 撤销申请
|
||||
* @param {string} applyId - 申请ID
|
||||
* @returns {Promise} 返回撤销结果
|
||||
*/
|
||||
export function cancelApply(id) {
|
||||
return post('/team/user/join-apply-cancel', { id })
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理申请(同意/拒绝)
|
||||
* @param {Object} data - 处理数据
|
||||
* @param {string} data.id - 申请记录ID
|
||||
* @param {string} data.status - 审核状态 (AGREE/REJECT)
|
||||
* @returns {Promise} 返回处理结果
|
||||
*/
|
||||
export function processUserApply(data) {
|
||||
return post('/team/process/user/apply', data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化时间戳为可读格式
|
||||
* @param {number} timestamp - 时间戳(毫秒)
|
||||
|
||||
@ -156,6 +156,7 @@ import { useRouter } from 'vue-router'
|
||||
import MobileHeader from '../components/MobileHeader.vue'
|
||||
import { get } from '../utils/http.js'
|
||||
import {getBankBalance} from "@/api/wallet.js";
|
||||
import {getTeamId} from "@/utils/userStore.js";
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
@ -232,7 +233,7 @@ const fetchTeamMemberCount = async () => {
|
||||
try {
|
||||
loadingMemberCount.value = true
|
||||
// 使用传入的teamId,这里使用示例中的ID
|
||||
const teamId = '1927993836921233409'
|
||||
const teamId = getTeamId()
|
||||
|
||||
const response = await get(`/team/members/count?id=${teamId}`)
|
||||
|
||||
|
||||
@ -18,7 +18,6 @@
|
||||
type="text"
|
||||
placeholder="Please enter the agent ID"
|
||||
class="agent-input"
|
||||
@input="onAgentIdChange"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@ -36,7 +35,7 @@
|
||||
>
|
||||
{{ isLoading ? 'Applying...' : 'Apply' }}
|
||||
</button>
|
||||
|
||||
|
||||
<!-- 已有申请记录时的提示 -->
|
||||
<div v-else class="existing-application">
|
||||
<p>您已有在处理中的申请,请等待审核结果</p>
|
||||
@ -46,16 +45,37 @@
|
||||
|
||||
<!-- 申请记录 -->
|
||||
<div v-if="applyRecords.length > 0" class="records-section">
|
||||
<h3>Application Records</h3>
|
||||
<div class="record-list">
|
||||
<div v-for="record in applyRecords" :key="record.id" class="record-item">
|
||||
<div class="record-info">
|
||||
<p class="record-reason">{{ record.reason }}</p>
|
||||
<p class="record-time">{{ new Date(record.createTime).toLocaleString() }}</p>
|
||||
<h3>Application Records</h3>
|
||||
<div class="record-list">
|
||||
<div v-for="record in applyRecords" :key="record.messageId" class="record-item">
|
||||
<div class="record-info">
|
||||
<div class="team-info">
|
||||
<p class="team-label">申请加入团队:</p>
|
||||
<p class="team-id">Team ID: {{ record.teamProfile?.id }}</p>
|
||||
<p class="team-country">{{ record.teamProfile?.country?.countryName }} ({{ record.teamProfile?.country?.countryCode }})</p>
|
||||
</div>
|
||||
<div class="owner-info">
|
||||
<p class="owner-label">团队所有者:</p>
|
||||
<div class="owner-profile">
|
||||
<img v-if="record.ownUserProfile?.userAvatar" :src="record.ownUserProfile.userAvatar" class="owner-avatar" />
|
||||
<div>
|
||||
<p class="owner-name">{{ record.ownUserProfile?.userNickname }}</p>
|
||||
<p class="owner-account">ID: {{ record.ownUserProfile?.account }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="record-actions">
|
||||
<span class="record-status status-pending">
|
||||
Pending
|
||||
</span>
|
||||
<button
|
||||
class="cancel-btn"
|
||||
@click="handleCancelApply(record)"
|
||||
>
|
||||
撤销
|
||||
</button>
|
||||
</div>
|
||||
<span :class="['record-status', getStatusClass(record.status)]">
|
||||
{{ getStatusText(record.status) }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -75,7 +95,7 @@
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import MobileHeader from '../components/MobileHeader.vue'
|
||||
import { sendTeamApplyJoin, getTeamApplyRecord } from '../api/wallet.js'
|
||||
import { sendTeamApplyJoin, getWaitApplyRecord, cancelApply } from '../api/wallet.js'
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
@ -87,12 +107,10 @@ const applyRecords = ref([])
|
||||
|
||||
// 获取申请记录
|
||||
const fetchApplyRecords = async () => {
|
||||
if (!agentId.value.trim()) return
|
||||
|
||||
try {
|
||||
const response = await getTeamApplyRecord(agentId.value.trim(), 'WAIT')
|
||||
const response = await getWaitApplyRecord()
|
||||
if (response.status && response.body) {
|
||||
applyRecords.value = response.body
|
||||
applyRecords.value = [response.body] // 单个记录包装成数组
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取申请记录失败:', error)
|
||||
@ -100,12 +118,26 @@ const fetchApplyRecords = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
// 用户输入ID后查询申请记录
|
||||
const onAgentIdChange = () => {
|
||||
if (agentId.value.trim()) {
|
||||
fetchApplyRecords()
|
||||
} else {
|
||||
applyRecords.value = []
|
||||
|
||||
// 撤销申请
|
||||
const handleCancelApply = async (record) => {
|
||||
if (!confirm('确定要撤销这个申请吗?')) {
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await cancelApply(record.messageId)
|
||||
if (response.status) {
|
||||
alert('撤销成功!')
|
||||
// 刷新申请记录
|
||||
applyRecords.value = [] // 清空记录
|
||||
await fetchApplyRecords()
|
||||
} else {
|
||||
alert(response.message || '撤销失败,请重试')
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('撤销申请失败:', error)
|
||||
alert('撤销失败,请重试')
|
||||
}
|
||||
}
|
||||
|
||||
@ -169,10 +201,10 @@ const getStatusClass = (status) => {
|
||||
return classMap[status] || ''
|
||||
}
|
||||
|
||||
// 页面加载时不再自动获取申请记录
|
||||
// onMounted(() => {
|
||||
// fetchApplyRecords()
|
||||
// })
|
||||
// 页面加载时获取申请记录
|
||||
onMounted(() => {
|
||||
fetchApplyRecords()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
@ -347,6 +379,22 @@ const getStatusClass = (status) => {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.record-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.cancel-btn {
|
||||
padding: 4px 8px;
|
||||
background-color: #EF4444;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
font-size: 12px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.record-reason {
|
||||
margin: 0 0 4px 0;
|
||||
font-size: 14px;
|
||||
@ -359,6 +407,49 @@ const getStatusClass = (status) => {
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.team-info, .owner-info {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.team-label, .owner-label {
|
||||
margin: 0 0 4px 0;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.team-id, .team-country {
|
||||
margin: 0 0 2px 0;
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.owner-profile {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.owner-avatar {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border-radius: 16px;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.owner-name {
|
||||
margin: 0 0 2px 0;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.owner-account {
|
||||
margin: 0;
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.record-status {
|
||||
padding: 4px 8px;
|
||||
border-radius: 4px;
|
||||
|
||||
@ -52,7 +52,8 @@ import { ref, onMounted } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import MobileHeader from '../components/MobileHeader.vue'
|
||||
import { getApplyRecord } from '../api/teamBill.js'
|
||||
import {getTeamId, getTeamInfo, getUserId} from "@/utils/userStore.js";
|
||||
import { processUserApply } from '../api/wallet.js'
|
||||
import {getTeamId} from "@/utils/userStore.js";
|
||||
|
||||
const router = useRouter()
|
||||
const loading = ref(false)
|
||||
@ -73,7 +74,7 @@ const fetchMessages = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const response = await getApplyRecord(getTeamId(), 'WAIT')
|
||||
|
||||
|
||||
if (response.status && response.body) {
|
||||
// 根据新的接口结构映射数据
|
||||
messages.value = response.body.map(item => ({
|
||||
@ -101,22 +102,50 @@ const fetchMessages = async () => {
|
||||
}
|
||||
|
||||
// 同意申请
|
||||
const handleAgree = (message) => {
|
||||
alert(`Agreed to ${message.name}'s request`)
|
||||
// 从列表中移除
|
||||
const index = messages.value.findIndex(m => m === message)
|
||||
if (index > -1) {
|
||||
messages.value.splice(index, 1)
|
||||
const handleAgree = async (message) => {
|
||||
try {
|
||||
const response = await processUserApply({
|
||||
id: message.id,
|
||||
status: 'AGREE'
|
||||
})
|
||||
|
||||
if (response.status) {
|
||||
alert(`已同意 ${message.name} 的申请`)
|
||||
// 从列表中移除
|
||||
const index = messages.value.findIndex(m => m.id === message.id)
|
||||
if (index > -1) {
|
||||
messages.value.splice(index, 1)
|
||||
}
|
||||
} else {
|
||||
alert('操作失败,请重试')
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('同意申请失败:', error)
|
||||
alert('操作失败,请重试')
|
||||
}
|
||||
}
|
||||
|
||||
// 拒绝申请
|
||||
const handleRefuse = (message) => {
|
||||
alert(`Refused ${message.name}'s request`)
|
||||
// 从列表中移除
|
||||
const index = messages.value.findIndex(m => m === message)
|
||||
if (index > -1) {
|
||||
messages.value.splice(index, 1)
|
||||
const handleRefuse = async (message) => {
|
||||
try {
|
||||
const response = await processUserApply({
|
||||
id: message.id,
|
||||
status: 'REJECT'
|
||||
})
|
||||
|
||||
if (response.status) {
|
||||
alert(`已拒绝 ${message.name} 的申请`)
|
||||
// 从列表中移除
|
||||
const index = messages.value.findIndex(m => m.id === message.id)
|
||||
if (index > -1) {
|
||||
messages.value.splice(index, 1)
|
||||
}
|
||||
} else {
|
||||
alert('操作失败,请重试')
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('拒绝申请失败:', error)
|
||||
alert('操作失败,请重试')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -87,6 +87,7 @@ import { ref, onMounted } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import MobileHeader from '../components/MobileHeader.vue'
|
||||
import { get } from '../utils/http.js'
|
||||
import {getTeamId} from "@/utils/userStore.js";
|
||||
|
||||
const router = useRouter()
|
||||
const loading = ref(false)
|
||||
@ -99,10 +100,7 @@ const fetchTeamPolicy = async () => {
|
||||
loading.value = true
|
||||
|
||||
// 从路由参数获取 teamId 和 role,如果没有则使用默认值
|
||||
const teamId = router.currentRoute.value.query.teamId || '1927993836921233409'
|
||||
const userRole = router.currentRoute.value.query.role || 'OWN'
|
||||
role.value = userRole
|
||||
|
||||
const teamId = getTeamId()
|
||||
const response = await get(`/team/release/policy?id=${teamId}`)
|
||||
|
||||
if (response.status && response.body && response.body.policy) {
|
||||
|
||||
@ -76,6 +76,7 @@ import { ref, onMounted } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import MobileHeader from '../components/MobileHeader.vue'
|
||||
import { getTeamMembers, deleteMember as deleteMemberApi } from '../api/teamBill.js'
|
||||
import {getTeamId} from "@/utils/userStore.js";
|
||||
|
||||
const router = useRouter()
|
||||
const loading = ref(false)
|
||||
@ -89,7 +90,7 @@ const fetchTeamMembers = async () => {
|
||||
try {
|
||||
loading.value = true
|
||||
// 这里需要传入实际的 teamId,可以从路由参数或者用户状态获取
|
||||
const teamId = router.currentRoute.value.query.teamId || '1927993836921233409'
|
||||
const teamId = getTeamId()
|
||||
|
||||
const response = await getTeamMembers(teamId)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user