修改政府端前端,银行端小程序和后端接口

This commit is contained in:
2025-09-26 17:52:50 +08:00
parent 852adbcfff
commit 00dfa83fd1
237 changed files with 9172 additions and 33500 deletions

View File

@@ -40,6 +40,13 @@ const getContracts = async (req, res) => {
} else if (searchField === 'applicationNumber') {
// 数据库中实际没有applicationNumber字段使用id作为替代
where.id = { [Op.like]: `%${searchValue}%` };
} else if (searchField === 'borrowerName') {
where.customer_name = { [Op.like]: `%${searchValue}%` };
} else if (searchField === 'farmerName') {
where.customer_name = { [Op.like]: `%${searchValue}%` };
} else if (searchField === 'productName') {
// 产品名称搜索暂时不处理,因为数据库中没有这个字段
// 可以在前端过滤
}
}
@@ -72,18 +79,32 @@ const getContracts = async (req, res) => {
limit
});
// 格式化数据
// 格式化数据 - 匹配前端期望的字段
const contracts = rows.map(contract => ({
id: contract.id,
contract_number: contract.contract_number,
customer_name: contract.customer_name,
customer_phone: contract.customer_phone,
customer_id_card: contract.customer_id_card,
loan_amount: parseFloat(contract.loan_amount),
loan_term: contract.loan_term,
interest_rate: parseFloat(contract.interest_rate),
contract_date: contract.contract_date,
contractNumber: contract.contract_number,
applicationNumber: `APP-${String(contract.id).padStart(6, '0')}`, // 生成申请单号
productName: '养殖贷款', // 默认产品名称
farmerName: contract.customer_name || '未知养殖户',
borrowerName: contract.customer_name || '未知借款人',
borrowerIdNumber: contract.customer_id_card || '',
assetType: '养殖设备', // 默认生资种类
applicationQuantity: '1', // 默认申请数量
amount: parseFloat(contract.loan_amount),
paidAmount: 0, // 默认已还款金额
status: contract.status,
type: 'livestock_collateral', // 默认类型
term: contract.loan_term,
interestRate: parseFloat(contract.interest_rate),
phone: contract.customer_phone || '',
purpose: '养殖经营', // 默认用途
remark: '', // 默认备注
contractTime: contract.contract_date,
disbursementTime: null,
maturityTime: null,
completedTime: null,
remainingAmount: parseFloat(contract.loan_amount), // 剩余金额等于贷款金额
repaymentProgress: 0, // 默认还款进度
created_at: contract.created_at,
updated_at: contract.updated_at
}));