diff --git a/src/views/invest/creditInstallmentAnalysis/index.vue b/src/views/invest/creditInstallmentAnalysis/index.vue
index 13f24fd..d164b73 100644
--- a/src/views/invest/creditInstallmentAnalysis/index.vue
+++ b/src/views/invest/creditInstallmentAnalysis/index.vue
@@ -148,17 +148,26 @@
-
+
{{ scope.$index + 1 }}
-
+
-
+
-
+
+
+ {{ item.bankCardLendName }}(本金:{{ item.principal }}元,利息:{{ item.interest }}元,合计:{{ item.currentAmount }}元)
+
+
+
@@ -293,7 +302,8 @@ const historyObj = ref({
dueDetail: '',
repaidDetail: '',
leftDetail: '',
- historyDetailList: []
+ historyDetailList: [],
+ tableHistoryDetailList: []
})
const chartData = ref({
@@ -301,6 +311,14 @@ const chartData = ref({
value1: []
})
+// 计算属性:倒序后的表格数据
+const reversedTableData = computed(() => {
+ if (historyObj.value.tableHistoryDetailList && historyObj.value.tableHistoryDetailList.length > 0) {
+ return [...historyObj.value.tableHistoryDetailList].reverse()
+ }
+ return []
+})
+
function getList() {
loading.value = true
chartData.value = { name: [], value1: [] }
diff --git a/src/views/invest/onlineLendAnalysis/index.vue b/src/views/invest/onlineLendAnalysis/index.vue
index 07266ec..5059047 100644
--- a/src/views/invest/onlineLendAnalysis/index.vue
+++ b/src/views/invest/onlineLendAnalysis/index.vue
@@ -148,22 +148,86 @@
-
+
{{ scope.$index + 1 }}
-
+
-
+
-
+
+
+ {{ item.bankCardLendName }}(本金:{{ item.principal }}元,利息:{{ item.interest }}元,合计:{{ item.currentAmount }}元)
+ 还款
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -196,6 +260,7 @@ const dates = [
const loading = ref(true)
const total = ref(0)
const radioVal = ref('柱状图')
+const repaymentOpen = ref(false)
const creditCardList = ref([])
const dateValidate = (rules, value, callback) => {
@@ -231,10 +296,26 @@ const data = reactive({
},
rules: {
time: [{ validator: dateValidate, dateType: 'months', num: 35, dateRange: '月', message: '时间跨度不能大于36个月,默认选择开始日期的36个月' }]
+ },
+ repaymentForm: {
+ id: null,
+ bankCardLendName: '',
+ repaymentDate: '',
+ principal: 0,
+ interest: 0,
+ currentAmount: 0,
+ postingState: '1',
+ remark: ''
+ },
+ repaymentRules: {
+ repaymentDate: [{ required: true, message: '还款日期不能为空', trigger: 'blur' }],
+ principal: [{ required: true, message: '应还本金不能为空', trigger: 'blur' }],
+ interest: [{ required: true, message: '应还利息不能为空', trigger: 'blur' }],
+ postingState: [{ required: true, message: '还款状态不能为空', trigger: 'change' }]
}
})
-const { queryParams, queryCreditCardParams, rules } = toRefs(data)
+const { queryParams, queryCreditCardParams, rules, repaymentForm, repaymentRules } = toRefs(data)
const handleCreditChange = (id) => {
queryParams.value.id = id
getList()
@@ -294,7 +375,8 @@ const historyObj = ref({
dueDetail: '',
repaidDetail: '',
leftDetail: '',
- historyDetailList: []
+ historyDetailList: [],
+ tableHistoryDetailList: []
})
const chartData = ref({
@@ -302,6 +384,14 @@ const chartData = ref({
value1: []
})
+// 计算属性:倒序后的表格数据
+const reversedTableData = computed(() => {
+ if (historyObj.value.tableHistoryDetailList && historyObj.value.tableHistoryDetailList.length > 0) {
+ return [...historyObj.value.tableHistoryDetailList].reverse()
+ }
+ return []
+})
+
function getList() {
loading.value = true
chartData.value = { name: [], value1: [] }
@@ -537,6 +627,47 @@ const handleRadioChange = (type) => {
break
}
}
+
+/** 还款按钮操作 */
+function handleRepayment(item) {
+ repaymentForm.value = {
+ id: item.id,
+ bankCardLendName: item.bankCardLendName,
+ repaymentDate: dayjs(new Date().getTime()).format('YYYY-MM-DD'),
+ principal: item.principal,
+ interest: item.interest,
+ currentAmount: item.currentAmount,
+ postingState: '1',
+ remark: ''
+ }
+ repaymentOpen.value = true
+}
+
+/** 计算合计金额 */
+function calculateTotalAmount() {
+ const principal = parseFloat(repaymentForm.value.principal) || 0
+ const interest = parseFloat(repaymentForm.value.interest) || 0
+ repaymentForm.value.currentAmount = (principal + interest).toFixed(2)
+}
+
+/** 提交还款 */
+function submitRepayment() {
+ proxy.$refs.repaymentFormRef.validate((valid) => {
+ if (valid) {
+ proxy.$modal
+ .confirm('是否确认已还款?')
+ .then(function () {
+ // TODO: 这里需要调用后端接口更新还款状态
+ // 示例: return updateInstallmentDetail(repaymentForm.value)
+ proxy.$modal.msgSuccess('还款成功')
+ repaymentOpen.value = false
+ getList() // 刷新列表
+ })
+ .catch(() => {})
+ }
+ })
+}
+
getCreditCardList()
getList()
diff --git a/src/views/invest/onlineLendHistory/index.vue b/src/views/invest/onlineLendHistory/index.vue
index 6d13cfc..d95690f 100644
--- a/src/views/invest/onlineLendHistory/index.vue
+++ b/src/views/invest/onlineLendHistory/index.vue
@@ -227,6 +227,9 @@
+
+
+
@@ -587,6 +590,22 @@ function handleUpdateDetail(row) {
})
}
+/** 还款按钮操作 */
+function handleRepayment(row) {
+ resetDetail()
+ getInstallmentDetail(row.id).then((response) => {
+ formDetail.value = response.data
+ // 默认设置还款状态为已还款
+ formDetail.value.postingState = '1'
+ // 设置还款日期为当前日期
+ if (!formDetail.value.repaymentDate) {
+ formDetail.value.repaymentDate = dayjs(new Date().getTime()).format('YYYY-MM-DD')
+ }
+ openDetail.value = true
+ titleDetail.value = '贷款还款'
+ })
+}
+
/** 提交按钮 */
function submitForm() {
proxy.$refs.installmentHistoryRef.validate((valid) => {