From d57a9dec8f6eed56beda14dcfbc5fd9f4964ab3f Mon Sep 17 00:00:00 2001 From: szz <961120009@qq.com> Date: Fri, 8 Aug 2025 09:41:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=88=E5=B9=B6=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 2 +- .env.production | 6 ++- src/router/index.js | 14 ++++++ src/views/Loading.vue | 106 ++++++++++++++++++++++++++++++++++++++++ src/views/Matching.vue | 2 +- src/views/Transfers.vue | 28 +++++++---- vite.config.js | 4 +- 7 files changed, 147 insertions(+), 15 deletions(-) create mode 100644 src/views/Loading.vue diff --git a/.env.development b/.env.development index 8686c0c..74b4618 100644 --- a/.env.development +++ b/.env.development @@ -1,3 +1,3 @@ # 开发环境配置 VITE_API_BASE_URL=/api -VITE_UPLOAD_BASE_URL=http://localhost:3000/api/upload \ No newline at end of file +VITE_UPLOAD_BASE_URL=http://localhost:3001/api/upload \ No newline at end of file diff --git a/.env.production b/.env.production index f30164f..e315c75 100644 --- a/.env.production +++ b/.env.production @@ -1,3 +1,5 @@ # 生产环境配置 -VITE_API_BASE_URL=https://www.zrbjr.com/api -VITE_UPLOAD_BASE_URL=https://www.zrbjr.com/api/upload +# VITE_API_BASE_URL=https://www.zrbjr.com/api +# VITE_UPLOAD_BASE_URL=https://www.zrbjr.com/api/upload +VITE_API_BASE_URL=http://114.55.111.44:3001/api +VITE_UPLOAD_BASE_URL=http://114.55.111.44:3001/api/upload diff --git a/src/router/index.js b/src/router/index.js index f2192e7..3444e64 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -53,6 +53,14 @@ const routes = [ title: '个人中心' } }, + { + path: '/loading', + name: 'Loading', + component: () => import('@/views/Loading.vue'), + meta: { + title: '维护中' + } + }, { path: '/mypoints-history', name: 'MyPointsHistory', @@ -235,6 +243,12 @@ const router = createRouter({ router.beforeEach(async (to, from, next) => { NProgress.start() + // 系统维护模式:所有页面都跳转到维护页面 + // if (to.name !== 'Loading') { + // next({ name: 'Loading' }) + // return + // } + const userStore = useUserStore() // 设置页面标题 diff --git a/src/views/Loading.vue b/src/views/Loading.vue new file mode 100644 index 0000000..561ab52 --- /dev/null +++ b/src/views/Loading.vue @@ -0,0 +1,106 @@ + + + \ No newline at end of file diff --git a/src/views/Matching.vue b/src/views/Matching.vue index bfdf38c..c95f256 100644 --- a/src/views/Matching.vue +++ b/src/views/Matching.vue @@ -519,7 +519,7 @@ export default { cancelButtonText: '取消', type: 'warning' }).then(() => { - this.$router.push('/profile') + this.$router.push('/myprofile') }).catch(() => {}) } else { this.$message.error(errorMessage) diff --git a/src/views/Transfers.vue b/src/views/Transfers.vue index 8ff3187..20c0ab6 100644 --- a/src/views/Transfers.vue +++ b/src/views/Transfers.vue @@ -205,7 +205,7 @@ -
+
- 未收到款 + 拒绝收款
@@ -342,12 +342,20 @@ watch(statusFilter, () => { // 方法 const loadPendingTransfers = async () => { try { - const response = await api.get('/transfers/pending') + const response = await api.get('/transfers/pending', { + params: { + user_id: userStore.user.id + } + }) if (response.data.success) { - pendingTransfers.value = response.data.data + // 过滤出需要当前用户确认的转账记录 + pendingTransfers.value = response.data.data.filter( + transfer => transfer.to_user_id === userStore.user.id && transfer.status === 'pending' + ) } } catch (error) { console.error('加载待确认转账失败:', error) + ElMessage.error('加载待确认转账失败') } } @@ -703,7 +711,6 @@ const confirmReturn = async () => { /** * 显示转账凭证并确认收款 - * @param {number} transferId - 转账ID */ const confirmReceived = async (transferId) => { try { @@ -717,8 +724,11 @@ const confirmReceived = async (transferId) => { // 设置当前转账信息并显示凭证对话框 currentTransfer.value = transfer showVoucherDialog.value = true + + // 直接调用确认收款方法 + await doConfirmReceived() } catch (error) { - console.error('显示转账凭证失败:', error) + console.error('确认收款失败:', error) ElMessage.error('操作失败') } } @@ -739,13 +749,13 @@ const doConfirmReceived = async () => { ) confirmLoading.value = true - const response = await transferAPI.confirmReceived(currentTransfer.value.id) + const response = await api.post(`/transfers/confirm-received/${currentTransfer.value.id}`) if (response.data.success) { ElMessage.success(response.data.message) showVoucherDialog.value = false loadTransferHistory() - loadAccountInfo() + loadPendingTransfers() // 重新加载待确认转账 } } catch (error) { if (error !== 'cancel') { diff --git a/vite.config.js b/vite.config.js index d4a540e..a464500 100644 --- a/vite.config.js +++ b/vite.config.js @@ -14,11 +14,11 @@ export default defineConfig({ port: 5173, proxy: { '/api': { - target: 'http://114.55.111.44:3000', + target: 'http://127.0.0.1:3001', changeOrigin: true }, '/uploads': { - target: 'http://114.55.111.44:3000', + target: 'http://127.0.0.1:3001', changeOrigin: true } }