diff --git a/src/api/wallet.js b/src/api/wallet.js index c43e4eb..a574efd 100644 --- a/src/api/wallet.js +++ b/src/api/wallet.js @@ -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 - 时间戳(毫秒) diff --git a/src/views/AgencyCenterView.vue b/src/views/AgencyCenterView.vue index 99cc626..72ca239 100644 --- a/src/views/AgencyCenterView.vue +++ b/src/views/AgencyCenterView.vue @@ -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}`) diff --git a/src/views/ApplyView.vue b/src/views/ApplyView.vue index b0aaa79..0852be1 100644 --- a/src/views/ApplyView.vue +++ b/src/views/ApplyView.vue @@ -18,7 +18,6 @@ type="text" placeholder="Please enter the agent ID" class="agent-input" - @input="onAgentIdChange" /> @@ -36,7 +35,7 @@ > {{ isLoading ? 'Applying...' : 'Apply' }} - +

您已有在处理中的申请,请等待审核结果

@@ -46,16 +45,37 @@
-

Application Records

-
-
-
-

{{ record.reason }}

-

{{ new Date(record.createTime).toLocaleString() }}

+

Application Records

+
+
+
+
+

申请加入团队:

+

Team ID: {{ record.teamProfile?.id }}

+

{{ record.teamProfile?.country?.countryName }} ({{ record.teamProfile?.country?.countryCode }})

+
+
+

团队所有者:

+
+ +
+

{{ record.ownUserProfile?.userNickname }}

+ +
+
+
+
+
+ + Pending + +
- - {{ getStatusText(record.status) }} -
@@ -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() +})