diff --git a/src/router/index.js b/src/router/index.js index 0c6e40c..47bc4bc 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -31,7 +31,7 @@ const routes = [ { path: '/mymatching', name: 'MyMatching', - component: () => import('@/views/MyMatching.vue'), + component: () => import('@/views/Matching.vue'), meta: { title: '资金匹配', requiresAuth: true diff --git a/src/utils/api.js b/src/utils/api.js index aa42253..45851b9 100644 --- a/src/utils/api.js +++ b/src/utils/api.js @@ -100,8 +100,13 @@ api.interceptors.response.use( ElMessage.error('服务器内部错误') break + case 400: + // 处理业务逻辑错误(如坏账等) + ElMessage.error(data.error?.message || data.message || '请求失败') + break + default: - ElMessage.error(data.message || '请求失败') + ElMessage.error(data.error?.message || data.message || '请求失败') } } else if (error.request) { // 网络错误 diff --git a/src/views/AgentDashboard.vue b/src/views/AgentDashboard.vue index 412fd1c..91095f3 100644 --- a/src/views/AgentDashboard.vue +++ b/src/views/AgentDashboard.vue @@ -41,7 +41,7 @@
{{ stats.used_codes || 0 }}
-
已使用邀请码
+
已使用二维码
有效:{{ stats.active_codes || 0 }}
@@ -52,9 +52,9 @@
-

生成邀请二维码

+

生成注册二维码

- 生成新的邀请码 + 生成新的邀请二维码
@@ -68,9 +68,9 @@
-

邀请码:{{ currentInviteCode.code }}

+

过期时间:{{ formatDate(currentInviteCode.expires_at) }}

-

商户扫描此二维码可自动填写激活码进行注册

+

商户扫描此二维码可直接进入注册页面

@@ -291,7 +291,7 @@ const generateInviteCode = async () => { }) currentInviteCode.value = data.data - ElMessage.success('邀请码生成成功') + ElMessage.success('二维码生成成功') // 刷新统计信息 loadStats() @@ -299,7 +299,7 @@ const generateInviteCode = async () => { if (error.response?.data?.message) { ElMessage.error(error.response.data.message) } else { - ElMessage.error('生成邀请码失败') + ElMessage.error('生成二维码失败') } } finally { generating.value = false @@ -319,7 +319,7 @@ const saveQRCode = () => { // 创建一个临时的a标签用于下载 const link = document.createElement('a') link.href = currentInviteCode.value.qr_code - link.download = `邀请码_${currentInviteCode.value.code}_${new Date().toISOString().slice(0, 10)}.png` + link.download = `注册二维码_${new Date().toISOString().slice(0, 10)}.png` // 触发下载 document.body.appendChild(link) diff --git a/src/views/Matching.vue b/src/views/Matching.vue index 37b5a82..b774bb6 100644 --- a/src/views/Matching.vue +++ b/src/views/Matching.vue @@ -262,7 +262,7 @@

转账信息

-

收款人: {{ transferDialog.toUser.name }}

+

收款人: {{ transferDialog.toUser.to_user_real_name }}

转账金额: ¥{{ transferDialog.amount }}

@@ -378,7 +378,8 @@ export default { wechatQr: '', alipayQr: '', unionpayQr: '', - bankCard: '' + bankCard: '', + to_user_real_name:'', }, amount: 0, actualAmount: 0, @@ -534,7 +535,8 @@ export default { wechatQr: userPaymentInfo.wechat_qr, alipayQr: userPaymentInfo.alipay_qr, unionpayQr: userPaymentInfo.unionpay_qr, - bankCard: userPaymentInfo.bank_card + bankCard: userPaymentInfo.bank_card, + to_user_real_name: allocation.to_user_real_name, }, amount: expectedAmount, actualAmount: expectedAmount diff --git a/src/views/MyMatching.vue b/src/views/MyMatching.vue index 4b00ce1..d685ce7 100644 --- a/src/views/MyMatching.vue +++ b/src/views/MyMatching.vue @@ -290,6 +290,41 @@ export default { window.addEventListener('autoStartMatching', handleAutoStartMatching) }, methods: { + /** + * 确认分配并创建转账记录 + * @param {number} allocationId - 分配ID + * @param {number} expectedAmount - 预期转账金额 + */ + async confirmAllocation(allocationId, expectedAmount) { + try { + // 获取分配详情和收款用户信息 + const allocationResponse = await api.get(`/matching/allocation/${allocationId}`) + const allocation = allocationResponse.data.data + + // 获取收款用户的收款码信息 + const userResponse = await api.get(`/users/payment-info/${allocation.to_user_id}`) + const userPaymentInfo = userResponse.data.data + + // 设置转账弹窗数据 + this.transferDialog = { + visible: true, + allocationId: allocationId, + toUser: { + id: allocation.to_user_id, + name: allocation.to_user_name, + wechatQr: userPaymentInfo.wechat_qr, + alipayQr: userPaymentInfo.alipay_qr, + unionpayQr: userPaymentInfo.unionpay_qr, + bankCard: userPaymentInfo.bank_card + }, + amount: expectedAmount, + actualAmount: expectedAmount + } + } catch (error) { + console.error('获取转账信息失败:', error) + this.$message.error('获取转账信息失败') + } + }, formatDeadline(deadlineString) { // 根据需要的格式进行处理,示例: return new Date(deadlineString).toLocaleString('zh-CN', { diff --git a/src/views/MyProfile.vue b/src/views/MyProfile.vue index 95aa712..4f55825 100644 --- a/src/views/MyProfile.vue +++ b/src/views/MyProfile.vue @@ -156,12 +156,15 @@ export default { // 加载账户信息 const loadAccountInfo = async () => { try { + console.log(userStore.user,'userStore.user'); + if (userStore.user?.id) { const response = await api.get(`/user/profile`); + console.log(response.data); if (response.data.success) { - accountInfo.value = response.data.data || { balance: '0.00' }; + accountInfo.value = response.data.user || { balance: '0.00' }; // 确保加载头像 - if (response.data.data?.avatar) { + if (response.data.user?.avatar) { avatarUrl.value = response.data.data.avatar; // 更新store中的头像 if(userStore.user) { diff --git a/src/views/MyShop.vue b/src/views/MyShop.vue index c05b393..4eac683 100644 --- a/src/views/MyShop.vue +++ b/src/views/MyShop.vue @@ -32,10 +32,15 @@
分类区
-
1
-
2
-
3
-
4
+
+
{{ category.icon }}
+
{{ category.name }}
+
@@ -44,32 +49,54 @@