diff --git a/bank-backend/controllers/loanContractController.js b/bank-backend/controllers/loanContractController.js index 20a69dc..2e1e949 100644 --- a/bank-backend/controllers/loanContractController.js +++ b/bank-backend/controllers/loanContractController.js @@ -139,20 +139,7 @@ const getContractById = async (req, res) => { try { const { id } = req.params; - const contract = await LoanContract.findByPk(id, { - include: [ - { - model: User, - as: 'creator', - attributes: ['id', 'username', 'real_name', 'email', 'phone'] - }, - { - model: User, - as: 'updater', - attributes: ['id', 'username', 'real_name'] - } - ] - }); + const contract = await LoanContract.findByPk(id); if (!contract) { return res.status(404).json({ @@ -161,34 +148,32 @@ const getContractById = async (req, res) => { }); } - // 格式化数据 + // 格式化数据 - 使用数据库实际字段名 const formattedContract = { id: contract.id, - contractNumber: contract.contractNumber, - applicationNumber: contract.applicationNumber, - productName: contract.productName, - farmerName: contract.farmerName, - borrowerName: contract.borrowerName, - borrowerIdNumber: contract.borrowerIdNumber, - assetType: contract.assetType, - applicationQuantity: contract.applicationQuantity, - amount: parseFloat(contract.amount), - paidAmount: parseFloat(contract.paidAmount), + contractNumber: contract.contract_number, + applicationNumber: contract.application_number || '', + productName: contract.product_name || '', + farmerName: contract.farmer_name || contract.customer_name, + borrowerName: contract.borrower_name || contract.customer_name, + borrowerIdNumber: contract.borrower_id_number || contract.customer_id_card, + assetType: contract.asset_type || '', + applicationQuantity: contract.application_quantity || '', + amount: parseFloat(contract.loan_amount), + paidAmount: parseFloat(contract.paid_amount || 0), status: contract.status, - type: contract.type, - term: contract.term, - interestRate: parseFloat(contract.interestRate), - phone: contract.phone, - purpose: contract.purpose, - remark: contract.remark, - contractTime: contract.contractTime, - disbursementTime: contract.disbursementTime, - maturityTime: contract.maturityTime, - completedTime: contract.completedTime, - remainingAmount: parseFloat(contract.amount - contract.paidAmount), - repaymentProgress: contract.getRepaymentProgress(), - creator: contract.creator, - updater: contract.updater + type: contract.type || 'personal', + term: contract.loan_term, + interestRate: parseFloat(contract.interest_rate), + phone: contract.customer_phone, + purpose: contract.purpose || '', + remark: contract.remark || '', + contractTime: contract.contract_date, + disbursementTime: contract.disbursement_time, + maturityTime: contract.maturity_time, + completedTime: contract.completed_time, + remainingAmount: parseFloat(contract.loan_amount - (contract.paid_amount || 0)), + repaymentProgress: contract.getRepaymentProgress ? contract.getRepaymentProgress() : 0 }; res.json({ @@ -197,9 +182,15 @@ const getContractById = async (req, res) => { }); } catch (error) { console.error('获取贷款合同详情失败:', error); + console.error('错误详情:', { + message: error.message, + stack: error.stack, + name: error.name + }); res.status(500).json({ success: false, - message: '获取贷款合同详情失败' + message: '获取贷款合同详情失败', + error: process.env.NODE_ENV === 'development' ? error.message : undefined }); } }; diff --git a/bank-backend/controllers/projectController.js b/bank-backend/controllers/projectController.js index e0ea9f4..21f7551 100644 --- a/bank-backend/controllers/projectController.js +++ b/bank-backend/controllers/projectController.js @@ -92,12 +92,12 @@ const getProjectById = async (req, res) => { { model: User, as: 'creator', - attributes: ['id', 'username', 'name'] + attributes: ['id', 'username', 'real_name'] }, { model: User, as: 'updater', - attributes: ['id', 'username', 'name'] + attributes: ['id', 'username', 'real_name'] } ] }); diff --git a/bank-frontend/src/router/routes.js b/bank-frontend/src/router/routes.js index 20d99e4..8751026 100644 --- a/bank-frontend/src/router/routes.js +++ b/bank-frontend/src/router/routes.js @@ -69,6 +69,17 @@ const routes = [ roles: ['admin', 'manager', 'teller'] } }, + { + path: '/project-detail/:id', + name: 'ProjectDetail', + component: () => import('@/views/ProjectDetail.vue'), + meta: { + title: '项目详情', + requiresAuth: true, + roles: ['admin', 'manager', 'teller'], + hideInMenu: true + } + }, { path: '/supervision-tasks', name: 'SupervisionTasks', @@ -139,7 +150,7 @@ const routes = [ name: 'LoanProducts', component: () => import('@/views/loan/LoanProducts.vue'), meta: { - title: '贷款商品', + title: '· 贷款商品', requiresAuth: true, roles: ['admin', 'manager', 'teller'] } @@ -149,7 +160,7 @@ const routes = [ name: 'LoanApplications', component: () => import('@/views/loan/LoanApplications.vue'), meta: { - title: '贷款申请进度', + title: '· 贷款申请进度', requiresAuth: true, roles: ['admin', 'manager', 'teller'] } @@ -159,7 +170,7 @@ const routes = [ name: 'LoanContracts', component: () => import('@/views/loan/LoanContracts.vue'), meta: { - title: '贷款合同', + title: '· 贷款合同', requiresAuth: true, roles: ['admin', 'manager', 'teller'] } @@ -169,7 +180,7 @@ const routes = [ name: 'LoanRelease', component: () => import('@/views/loan/LoanRelease.vue'), meta: { - title: '贷款解押', + title: '· 贷款解押', requiresAuth: true, roles: ['admin', 'manager', 'teller'] } diff --git a/bank-frontend/src/views/ProjectDetail.vue b/bank-frontend/src/views/ProjectDetail.vue new file mode 100644 index 0000000..e024153 --- /dev/null +++ b/bank-frontend/src/views/ProjectDetail.vue @@ -0,0 +1,633 @@ + + + + + + + + + 返回 + + {{ projectDetail.name || '项目详情' }} + + + + + + 编辑项目 + + + + + + + + + + + 养殖场名称: + {{ projectDetail.farmName || '158****8989 养殖场' }} + + + 监管周期: + {{ projectDetail.supervisionPeriod || '1827天' }} + + + 耳标设备: + {{ projectDetail.earTagDevices || '0' }} + + + 饲喂机设备: + {{ projectDetail.feedingDevices || '0' }} + + + + + + + 监管对象: + {{ projectDetail.supervisionObject || '牛' }} + + + 监管金额: + {{ formatAmount(projectDetail.supervisionAmount || 500000) }} + + + 项圈设备: + {{ projectDetail.collarDevices || '0' }} + + + 养殖地址: + {{ projectDetail.farmAddress || '内蒙古自治区通辽市扎鲁特旗阿日昆都楞镇嘎查村:阿木古楞' }} + + + + + + + 监管数量: + {{ projectDetail.supervisionQuantity || '36头' }} + + + 时间范围: + {{ projectDetail.timeRange || '2023-05-08~2028-05-08' }} + + + 主机设备: + {{ projectDetail.mainDevices || '0' }} + + + 担保机构: + {{ projectDetail.guaranteeInstitution || '无' }} + + + + + + + + + + {{ tab.title }} + + + + + + + + + + + + + 当前生资总估值 + {{ formatAmount(projectDetail.totalValuation || 0) }} + + + + + + + + + + 项目贷款额度 + {{ formatAmount(projectDetail.loanAmount || 500000) }} + + + + + + + + + + 抵押生资总数量 + {{ projectDetail.mortgagedQuantity || 36 }} + + + + + + + + + + 风险评估 + + 低风险 + 动态估值 + + + + + + + + + + + + + {{ formatAmount(record.estimatedValue) }} + + + {{ formatAmount(record.exitValue) }} + + + 查看 + + + + 编辑 + 删除 + + + + + + + + + + + diff --git a/bank-frontend/src/views/ProjectList.vue b/bank-frontend/src/views/ProjectList.vue index 915bf2e..6375eed 100644 --- a/bank-frontend/src/views/ProjectList.vue +++ b/bank-frontend/src/views/ProjectList.vue @@ -305,10 +305,13 @@ +