Commit 0f8bd637 authored by 沈翠玲's avatar 沈翠玲

优化

parent 4653e425
......@@ -23,6 +23,7 @@
"autoprefixer": "^10.4.20",
"axios": "^1.7.8",
"date-fns": "^4.1.0",
"decimal.js": "^10.5.0",
"dotenv": "^16.4.5",
"element-plus": "^2.8.8",
"eslint": "^8.57.0",
......
......@@ -11,3 +11,7 @@ export const getPlatformPage = (params) => {
export const deletePlatforms = (ids) => {
return request.get('/LoanPlatform/batchDeleteByIds', { ids });
};
export const getByIdPlatforms = (id) => {
return request.get('/LoanPlatform/getById', { id });
};
\ No newline at end of file
......@@ -159,7 +159,7 @@
},
{
field: 'applyDate',
title: '减免申请时间',
title: '减免截止时间',
search: {
el: 'date-picker',
props: { type: 'datetime', valueFormat: 'YYYY-MM-DD HH:mm:ss' },
......
......@@ -36,11 +36,11 @@
</template>
<script setup name="case-audit" lang="jsx">
import { Picture, Download } from '@element-plus/icons-vue';
import { ElButton, Download } from '@element-plus/icons-vue';
import { inject } from 'vue';
import { computed } from 'vue';
import callDrawer from './components/callDrawer.vue';
import { ElMessageBox, ElMessage, ElButton } from 'element-plus';
import { ElMessageBox, ElMessage } from 'element-plus';
import { onMounted } from 'vue';
import { getAppEnvConfig } from '@/utils/env';
import { getTrackRecord } from '@/api/property';
......@@ -281,9 +281,9 @@
if (row.images && row.images.length > 0) {
return (
<>
<el-icon>
<Picture onClick={() => preview(row, 'images')} />
</el-icon>
<div className="flex justify-center">
<ElButton onClick={() => preview(row, 'images')} link type="primary">查看</ElButton>
</div>
</>
);
}
......@@ -299,9 +299,9 @@
if (row.notes && row.notes.length > 0) {
return (
<>
<el-icon>
<Picture onClick={() => preview(row, 'notes')} />
</el-icon>
<div className="flex justify-center">
<ElButton onClick={() => preview(row, 'notes')} link type="primary">查看</ElButton>
</div>
</>
);
}
......@@ -317,9 +317,9 @@
if (row.others && row.others.length > 0) {
return (
<>
<el-icon>
<Picture onClick={() => preview(row, 'others')} />
</el-icon>
<div className="flex justify-center">
<ElButton onClick={() => preview(row, 'others')} link type="primary">查看</ElButton>
</div>
</>
);
}
......
......@@ -35,7 +35,7 @@
</div>
</div>
<div>
<ProTable :config="config" :data="tabledata" :showPagination="false" :showToolBar="false">
<ProTable :config="config" :data="tabledata" ref="ProTableRef" :showPagination="false" :showToolBar="false">
<template #table_top>
<p class="font-bold">关联案件:</p>
</template>
......@@ -234,6 +234,7 @@
const tabledata = ref([]);
const progressFlag = ref(false);
const loadProgress = ref(0);
const ProTableRef = ref();
const dialogImageUrl = ref('');
const dialogVisible = ref(false);
const emits = defineEmits(['success']);
......@@ -392,10 +393,17 @@
const index = form.others.findIndex((v) => v.name === uploadFile.name);
form.others.splice(index, 1);
};
const onCheckboxAll = (flag) => {
if(flag.checked){
selectdList.value = flag.records
} else {
selectdList.value = []
}
}
const config = reactive({
minHeight: 200,
columns: [
// { type: 'checkbox', width: 50 },
{ type: 'checkbox', width: 50 },
{
field: 'caseId',
title: '案件ID',
......@@ -426,6 +434,7 @@
},
],
onCheckboxChange: onCheckboxChange,
onCheckboxAll: onCheckboxAll,
toolbarConfig: { enabled: false },
});
const openModal = (info, detail, caselist) => {
......@@ -445,6 +454,12 @@
resuleObj.label = '本人可联';
resuleObj.childrenlabel = null;
tabledata.value = caselist;
setTimeout(()=>{
if (ProTableRef.value.element) {
ProTableRef.value.element.setAllCheckboxRow(true)
selectdList.value = caselist
}
}, 500)
};
const submitForm = () => {
if (!form.phoneResultStatus)
......@@ -456,7 +471,7 @@
message: '跟进结果必选',
});
saveTrackRecord({
loans: tabledata.value,
loans: selectdList.value,
guarantor: currentInfo.value,
trackTime: form.trackTime,
nextTime: form.nextTime,
......
......@@ -30,7 +30,7 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item class="w-full" label="减免申请时间:" prop="code">
<el-form-item class="w-full" label="减免截止时间:" prop="code">
<el-date-picker v-model="form.applyDate" type="datetime" />
</el-form-item>
</el-col>
......@@ -61,7 +61,7 @@
</el-form>
<div>
<ProTable :config="config" :data="tabledata" :showPagination="false" :showToolBar="false">
<ProTable :config="config" ref="ProTableRef" :data="tabledata" :showPagination="false" :dataCallback="dataCallback" :showToolBar="false">
<template #table_top>
<p class="font-bold">关联案件:</p>
</template>
......@@ -82,9 +82,13 @@
import { reactive, ref } from 'vue';
import { saveReduce } from '@/api/property';
import { ElMessage } from 'element-plus';
import { onMounted } from 'vue';
import { watch } from 'vue';
import Decimal from "decimal.js"
const emits = defineEmits(['success']);
const showModal = ref(false);
const tabledata = ref([]);
const ProTableRef = ref();
const form = reactive({
totalReduceAmount: 0,
totalNumber: '',
......@@ -96,11 +100,33 @@
const onCheckboxChange = (row) => {
selectdList.value = row.records;
form.totalNumber = row.records.length;
form.totalReduceAmount = 0;
form.remainingAmount = 0;
selectdList.value.forEach((item) => {
form.totalReduceAmount = Decimal(form.totalReduceAmount).add(Decimal(Number(item.reduceAmount) || 0))
form.remainingAmount = Decimal(form.remainingAmount).add(Decimal(Number(item.payAmount) || 0))
});
};
const onCheckboxAll = (flag) => {
if(flag.checked){
selectdList.value = flag.records
form.totalNumber = flag.records.length
} else {
selectdList.value = []
form.totalNumber = 0
}
form.totalReduceAmount = 0;
form.remainingAmount = 0;
selectdList.value.forEach((item) => {
form.totalReduceAmount = Decimal(form.totalReduceAmount).add(Decimal(Number(item.reduceAmount) || 0))
form.remainingAmount = Decimal(form.remainingAmount).add(Decimal(Number(item.payAmount) || 0))
});
}
const currentDetail = ref({});
const onHide = (done) => {
done();
};
const options = [
{
value: 'settle',
......@@ -114,7 +140,7 @@
const config = reactive({
minHeight: 200,
columns: [
// { type: 'checkbox', title: '', width: '40px' },
{ type: 'checkbox', title: '', width: '40px' },
{
field: 'loan.caseId',
title: '案件ID',
......@@ -162,15 +188,16 @@
},
],
onCheckboxChange: onCheckboxChange,
onCheckboxAll: onCheckboxAll,
toolbarConfig: { enabled: false },
});
const changeNum = (row) => {
row.payAmount = row.loan.remainingAmount - row.reduceAmount;
row.payAmount = Decimal(row.loan.remainingAmount).sub(Decimal(row.reduceAmount))
form.totalReduceAmount = 0;
form.remainingAmount = 0;
tabledata.value.forEach((item) => {
form.totalReduceAmount += Number(item.reduceAmount) || 0;
form.remainingAmount += Number(item.payAmount) || 0;
selectdList.value.forEach((item) => {
form.totalReduceAmount = Decimal(form.totalReduceAmount).add(Decimal(Number(item.reduceAmount) || 0))
form.remainingAmount = Decimal(form.remainingAmount).add(Decimal(Number(item.payAmount) || 0))
});
};
const openModal = (detail, caselist) => {
......@@ -183,14 +210,20 @@
caselist.forEach((item) => {
const payAmount = Number(item.remainingAmount) || 0;
list.push({ reduceAmount: Number(item.reduceAmount) || 0, payAmount: payAmount, loan: item });
form.totalReduceAmount += Number(item.reduceAmount) || 0;
form.remainingAmount += payAmount;
form.totalReduceAmount = Decimal(form.totalReduceAmount).add(Decimal(Number(item.reduceAmount) || 0))
form.remainingAmount = Decimal(form.remainingAmount).add(Decimal(payAmount))
});
tabledata.value = list;
form.totalNumber = caselist.length;
setTimeout(()=>{
if (ProTableRef.value.element) {
ProTableRef.value.element.setAllCheckboxRow(true)
selectdList.value = list
}
}, 500)
};
const submitForm = () => {
const list = JSON.parse(JSON.stringify(tabledata.value));
const list = JSON.parse(JSON.stringify(selectdList.value));
list.forEach((item) => {
delete item.payAmount;
......
......@@ -16,7 +16,7 @@
<td>结清减免</td>
<td class="label">减免申请ID</td>
<td>{{ currentInfo.id }}</td>
<td class="label">减免申请时间</td>
<td class="label">减免截止时间</td>
<td>{{ currentInfo.applyDate }}</td>
</tr>
<tr>
......
......@@ -9,7 +9,7 @@
>
<div class="h-full flex-col flex mydrawer pb-2">
<div>
<ProTable :config="config" :data="tabledata" :showPagination="false" :showToolBar="false">
<ProTable :config="config" ref="ProTableRef" :data="tabledata" :showPagination="false" :showToolBar="false">
<template #table_top>
<p class="font-bold">关联案件:</p>
</template>
......@@ -59,6 +59,7 @@
:key="item.value"
:label="item.label"
:value="item.value"
:disabled="item.disabled"
/>
</el-select>
</el-form-item>
......@@ -134,7 +135,12 @@
import { computed } from 'vue';
import { reactive, ref } from 'vue';
import { ElInputNumber, ElMessage } from 'element-plus';
import { savebyStages } from '@/api/property';
import { savebyStages } from '@/api/property'
import { getByIdPlatforms } from '@/api/platform'
;
import Decimal from "decimal.js"
const ProTableRef = ref();
const showModal = ref(false);
const editFirst = ref(false);
const tabledata = ref([]);
......@@ -148,25 +154,12 @@
firstApplyDate: dayjs().format('YYYY-MM-DD'),
effectiveTime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
});
const minAmount = ref(0)
const currentDetail = ref({});
const onHide = (done) => {
done();
};
const add = (a, b) => {
return (parseFloat(a) + parseFloat(b)).toFixed(2);
};
const minus = (a, b) => {
return (parseFloat(a) - parseFloat(b)).toFixed(2);
};
const multiply = (a, b) => {
return (parseFloat(a) * parseFloat(b)).toFixed(2);
};
const divide = (a, b) => {
return (parseFloat(a) / parseFloat(b)).toFixed(2);
};
const editOrConfirm = () => {
if (editFirst.value) {
if (!splitdata.value[0].applyAmount || isNaN(Number(splitdata.value[0].applyAmount)))
......@@ -176,7 +169,8 @@
});
const otherNum = form.totalRepayAmount - Number(splitdata.value[0].applyAmount);
const list = [splitdata.value[0]];
const crash = divide(Math.round(divide(otherNum, form.totalPeriod - 1) * 100), 100);
const crash = Decimal(Decimal(otherNum).div(Decimal(form.totalPeriod - 1))).toSignificantDigits(2)
for (let i = 0; i < form.totalPeriod - 1; i++) {
console.log('i', i);
const playApplyDate = dayjs(form.firstApplyDate)
......@@ -184,13 +178,13 @@
.format('YYYY-MM-DD');
if (i === form.totalPeriod - 2) {
const other = list.reduce((pre, cur) => {
return add(pre, cur.applyAmount);
return Decimal(pre).add(Decimal(cur.applyAmount))
}, 0);
list.push({
period: i + 1,
playApplyDate: playApplyDate,
repayStatus: 'pending',
applyAmount: minus(form.totalRepayAmount, other),
applyAmount: Decimal(form.totalRepayAmount).sub(Decimal(other)),
});
} else {
list.push({
......@@ -208,7 +202,7 @@
const changePeriod = () => {
const list = [];
const crash = divide(Math.round(divide(form.totalRepayAmount, form.totalPeriod) * 100), 100);
const crash = Decimal(Decimal(form.totalRepayAmount).div(Decimal(form.totalPeriod))).toSignificantDigits(2)
for (let i = 0; i < form.totalPeriod; i++) {
console.log('i', i);
const playApplyDate = dayjs(form.firstApplyDate)
......@@ -216,13 +210,13 @@
.format('YYYY-MM-DD');
if (i === form.totalPeriod - 1) {
const other = list.reduce((pre, cur) => {
return add(pre, cur.applyAmount);
return Decimal(pre).add(Decimal(cur.applyAmount));
}, 0);
list.push({
period: i + 1,
playApplyDate: playApplyDate,
repayStatus: 'pending',
applyAmount: minus(form.totalRepayAmount, other),
applyAmount: Decimal(form.totalRepayAmount).sub(Decimal(other))
});
} else {
list.push({
......@@ -235,7 +229,7 @@
}
splitdata.value = list;
};
const options = [
const options = ref([
{
value: 2,
label: '2',
......@@ -256,7 +250,46 @@
value: 6,
label: '6',
},
];
]);
const getPlatforms = (id) => {
options.value = [
{
value: 2,
label: '2',
},
{
value: 3,
label: '3',
},
{
value: 4,
label: '4',
},
{
value: 5,
label: '5',
},
{
value: 6,
label: '6',
},
]
getByIdPlatforms(id).then(res => {
console.log('resres', res)
if (res.success) {
if (res.result.maxStagesNum){
const list = options.value.filter(v => v.value > res.result.maxStagesNum)
list.forEach(e => {
e['disabled'] = true
})
}
if (res.result.minAmount){
minAmount.value = res.result.minAmount
}
}
//
})
}
const repayStatusOpt = [
{
value: 'pending',
......@@ -270,11 +303,38 @@
const selectdList = ref([]);
const onCheckboxChange = (row) => {
selectdList.value = row.records;
form.totalRepayAmount = 0;
form.remainingAmount = 0;
selectdList.value.forEach((item) => {
form.totalRepayAmount = Decimal(form.totalRepayAmount).add(Decimal(Number(item.remainingAmount) || 0));
form.remainingAmount = Decimal(form.remainingAmount).add(Decimal(Number(item.remainingAmount) || 0));
});
if(selectdList.value.length > 0) {
getPlatforms(selectdList.value[0].loanPlatform.id)
}
changePeriod()
};
const onCheckboxAll = (flag) => {
if(flag.checked){
selectdList.value = flag.records
} else {
selectdList.value = []
}
form.totalRepayAmount = 0;
form.remainingAmount = 0;
selectdList.value.forEach((item) => {
form.totalRepayAmount = Decimal(form.totalRepayAmount).add(Decimal(Number(item.remainingAmount) || 0));
form.remainingAmount = Decimal(form.remainingAmount).add(Decimal(Number(item.remainingAmount) || 0));
});
if(selectdList.value.length > 0) {
getPlatforms(selectdList.value[0].loanPlatform.id)
}
changePeriod()
}
const config = reactive({
minHeight: 200,
columns: [
// { type: 'checkbox', width: 50 },
{ type: 'checkbox', width: 50 },
{
field: 'caseId',
title: '案件ID',
......@@ -305,6 +365,7 @@
},
],
onCheckboxChange: onCheckboxChange,
onCheckboxAll: onCheckboxAll,
toolbarConfig: { enabled: false },
});
const splitconfig = computed(() => {
......@@ -362,10 +423,20 @@
form.totalRepayAmount = 0;
form.remainingAmount = 0;
caselist.forEach((item) => {
form.totalRepayAmount += Number(item.remainingAmount) || 0;
form.remainingAmount += Number(item.remainingAmount) || 0;
form.totalRepayAmount = Decimal(form.totalRepayAmount).add(Decimal(Number(item.remainingAmount) || 0));
form.remainingAmount = Decimal(form.remainingAmount).add(Decimal(Number(item.remainingAmount) || 0));
});
tabledata.value = caselist;
setTimeout(()=>{
if (ProTableRef.value.element) {
ProTableRef.value.element.setAllCheckboxRow(true)
selectdList.value = caselist
// 获取最大分期数
if(selectdList.value.length > 0) {
getPlatforms(selectdList.value[0].loanPlatform.id)
}
}
}, 500)
changePeriod();
};
const emits = defineEmits(['success']);
......@@ -375,11 +446,16 @@
message: '修改分期数值后要确认',
plain: true,
});
const arr = splitdata.value.filter(v => v.applyAmount<minAmount.value)
if (arr.length > 0) return ElMessage.warning({
message: '分期金额要大于借款平台的分期最低金额',
plain: true,
});
const params = {
...currentDetail.value,
...form,
byStagesRecords: splitdata.value,
loans: tabledata.value,
loans: selectdList.value,
flowStatus: 'pending',
id: null,
};
......
......@@ -232,7 +232,7 @@
getRepayRecords,
getGuarantors,
} from '@/api/property';
import { Picture, Download } from '@element-plus/icons-vue';
import { Download } from '@element-plus/icons-vue';
import { saveAudit } from '@/api/audit';
import { inject } from 'vue';
const envs = getAppEnvConfig();
......@@ -439,9 +439,9 @@
if (row.images && row.images.length > 0) {
return (
<>
<el-icon>
<Picture onClick={() => preview(row, 'images')} />
</el-icon>
<div className="flex justify-center">
<ElButton onClick={() => preview(row, 'images')} link type="primary">查看</ElButton>
</div>
</>
);
}
......@@ -456,9 +456,9 @@
if (row.notes && row.notes.length > 0) {
return (
<>
<el-icon>
<Picture onClick={() => preview(row, 'notes')} />
</el-icon>
<div className="flex justify-center">
<ElButton onClick={() => preview(row, 'notes')} link type="primary">查看</ElButton>
</div>
</>
);
}
......@@ -472,10 +472,10 @@
default: ({ row, rowIndex }) => {
if (row.others && row.others.length > 0) {
return (
<>
<el-icon>
<Picture onClick={() => preview(row, 'others')} />
</el-icon>
<>
<div className="flex justify-center">
<ElButton onClick={() => preview(row, 'others')} link type="primary">查看</ElButton>
</div>
</>
);
}
......@@ -815,7 +815,7 @@
},
{
field: 'applyDate',
title: '减免申请时间',
title: '减免截止时间',
},
{
field: 'inEffectDate',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment