From f8b852e00d72efe568a3a4ebc91eb30c6e6fcdbf Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Mon, 18 Aug 2025 16:29:15 +0800 Subject: [PATCH] =?UTF-8?q?apply=20=E9=A1=B5=E9=9D=A2=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/wallet.js | 11 + src/views/AgencyCenterView.vue | 78 ++---- src/views/ApplyView.vue | 421 ++++++++++++--------------------- src/views/HostCenterView.vue | 31 +-- 4 files changed, 193 insertions(+), 348 deletions(-) diff --git a/src/api/wallet.js b/src/api/wallet.js index 01ce27e..b78b9ab 100644 --- a/src/api/wallet.js +++ b/src/api/wallet.js @@ -135,6 +135,17 @@ export function sendTeamApplyJoin(data) { return post('/team/user/apply', data) } +/** + * 获取团队申请记录 + * @param {Object} params - 查询参数 + * @param {string} params.teamId - 团队ID + * @param {string} params.status - 状态 (WAIT/AGREE/REJECT) + * @returns {Promise} 返回申请记录列表 + */ +export function getTeamApplyRecord(params) { + return get('/team/user/apply/record', { params }) +} + /** * 格式化时间戳为可读格式 * @param {number} timestamp - 时间戳(毫秒) diff --git a/src/views/AgencyCenterView.vue b/src/views/AgencyCenterView.vue index 42c8fcb..99cc626 100644 --- a/src/views/AgencyCenterView.vue +++ b/src/views/AgencyCenterView.vue @@ -53,11 +53,12 @@
-
+ +

Current Salary:

${{ salaryInfo.currentSalary }}

@@ -154,6 +155,7 @@ import { ref, reactive, onMounted } from 'vue' import { useRouter } from 'vue-router' import MobileHeader from '../components/MobileHeader.vue' import { get } from '../utils/http.js' +import {getBankBalance} from "@/api/wallet.js"; const router = useRouter() @@ -173,13 +175,6 @@ const salaryInfo = reactive({ currentSalary: 12345 }) -// 身份选项 -const identities = [ - { label: 'Host', value: 'host' }, - { label: 'Agency', value: 'agency' }, - { label: 'Coin Seller', value: 'coin-seller' } -] - // 用户信息 const userInfo = reactive({ name: 'User1', @@ -203,23 +198,6 @@ const teamBillInfo = reactive({ status: 'Pending' }) -// 身份切换处理 -const handleIdentityChange = (identity) => { - switch (identity) { - case 'host': - router.push('/host-center') - break - case 'coin-seller': - router.push('/coin-seller') - break - case 'agency': - default: - // 保持在当前页面 - currentIdentity.value = identity - break - } -} - // 页面跳转方法 const goToNotification = () => { router.push('/message') @@ -237,10 +215,6 @@ const goToTeamMember = () => { router.push('/team-member') } -const goToPlatformPolicy = () => { - router.push('/platform-policy') -} - const exchangeGoldCoins = () => { router.push('/exchange-gold-coins') } @@ -275,9 +249,30 @@ const fetchTeamMemberCount = async () => { } } +// 获取银行余额 +const fetchBankBalance = async () => { + + try { + const response = await getBankBalance() + + if (response.status && typeof response.body === 'number') { + // 格式化余额显示,保留2位小数 + salaryInfo.currentSalary = response.body.toFixed(2) + } else { + salaryInfo.currentSalary = 0.00 + } + } catch (error) { + console.error('Failed to fetch bank balance:', error) + salaryInfo.currentSalary = 0.00 + // 可以显示错误提示 + alert('Failed to load balance. Please try again.') + } +} + // 组件挂载时获取数据 onMounted(() => { fetchTeamMemberCount() + fetchBankBalance() }) @@ -714,29 +709,6 @@ onMounted(() => { color: #1F2937; } -/* Platform Policy 链接 */ -.policy-link { - display: flex; - justify-content: space-between; - align-items: center; - padding: 12px 16px; - margin-top: 12px; - background-color: #f8f9fa; - border-radius: 8px; - cursor: pointer; - transition: all 0.2s; - border: 1px solid #e9ecef; -} - -.policy-link:hover { - background-color: #e9ecef; - border-color: #8B5CF6; -} - -.policy-link:active { - transform: scale(0.98); -} - .policy-link span:first-child { font-size: 14px; font-weight: 500; diff --git a/src/views/ApplyView.vue b/src/views/ApplyView.vue index 6c1181c..983d3d3 100644 --- a/src/views/ApplyView.vue +++ b/src/views/ApplyView.vue @@ -1,5 +1,5 @@ diff --git a/src/views/HostCenterView.vue b/src/views/HostCenterView.vue index 90d910c..695400c 100644 --- a/src/views/HostCenterView.vue +++ b/src/views/HostCenterView.vue @@ -52,11 +52,12 @@
-
+ +

Current Salary:

${{ salaryInfo.currentSalary }}

@@ -178,27 +179,11 @@ const connectToApp = async () => { console.log(' - window.webkit:', !!window.webkit) connectApplication(async (access) => { - console.log('📥 Received data from APP:') - console.log(' - Data type:', typeof access) - console.log(' - Data length:', access ? access.length : 0) - console.log(' - Raw data:', access) - const result = parseAccessOrigin(access) - console.log('🔍 Parsing result:') - console.log(' - Success:', result.success) if (result.success) { - console.log('✅ Access data parsed successfully') - // 解析头部信息 headerInfo.value = parseHeader(result.data) - console.log('📋 Parsed header info:') - console.log(' - Authorization:', headerInfo.value.authorization ? '✅ Present' : '❌ Missing') - console.log(' - Language:', headerInfo.value.reqLang) - console.log(' - App Version:', headerInfo.value.appVersion) - console.log(' - Build Version:', headerInfo.value.buildVersion) - console.log(' - System Origin:', headerInfo.value.sysOrigin) - console.log(' - Device ID:', headerInfo.value.reqImei ? '✅ Present' : '❌ Missing') // 设置HTTP请求头 console.log('🔧 Setting HTTP headers...') @@ -322,6 +307,11 @@ const fetchTeamEntry = async () => { } } catch (error) { console.error('获取团队信息失败:', error) + // HTTP 406错误通常表示NOT_TEAM_MEMBER + if (error.message && error.message.includes('406')) { + await router.push('/apply') + return + } } return null } @@ -385,11 +375,6 @@ const transfer = () => { onMounted(async () => { // 先连接APP获取认证信息 await connectToApp() - - // 如果不是APP环境,直接获取银行余额 - if (!isInApp()) { - fetchBankBalance() - } })