Commit a18d2e0b authored by 沈翠玲's avatar 沈翠玲

资产分配

parent d93d2ff5
...@@ -15,6 +15,10 @@ export const getLoanpage = (params) => { ...@@ -15,6 +15,10 @@ export const getLoanpage = (params) => {
export const distributeLoan = (tenantId, data) => { export const distributeLoan = (tenantId, data) => {
return request.post(`/LoanDistribute/distribute?tenantId=${tenantId}`, data); return request.post(`/LoanDistribute/distribute?tenantId=${tenantId}`, data);
}; };
// 手动调整分配CPE,确认
export const confirm = (data) => {
return request.post(`/LoanDistribute/confirm`, data);
};
// 系统自动分配; 分配到CPE // 系统自动分配; 分配到CPE
export const distributeCpe = (data) => { export const distributeCpe = (data) => {
return request.post(`/LoanDistribute/distributeCpe?type=${data.type}`, data); return request.post(`/LoanDistribute/distributeCpe?type=${data.type}`, data);
......
...@@ -18,9 +18,15 @@ ...@@ -18,9 +18,15 @@
</div> </div>
<template v-if="radio === 0 || radio === 1"> <template v-if="radio === 0 || radio === 1">
<div class="mainContent"> <div class="mainContent">
<div class="tree-wrapper"> <div class="flex items-center my-3">
<el-tree :data="data" :props="defaultProps" @node-click="handleNodeClick" /> <span class="mr-2">
{{radio === 0 ? '调解中心' : '分配到调解中心的cpe'}}
</span>
<el-select v-model="currentTenant" placeholder="请选择调解中心" style="width: 210px" @change="handleNodeClick">
<el-option :label="item.name" :value="item.id" v-for="(item,index) in data" :key="index" />
</el-select>
</div> </div>
<!-- <el-transfer <!-- <el-transfer
v-model="value1" v-model="value1"
:data="data1" :data="data1"
...@@ -30,7 +36,7 @@ ...@@ -30,7 +36,7 @@
/> --> /> -->
</div> </div>
</template> </template>
<div class="top" v-if="radio === 0 || (radio === 1 && currentTenant.id)"> <div class="top" v-if="radio === 0 || (radio === 1 && currentTenant)">
<div class="number-box"> <div class="number-box">
<div class="number-left"> <div class="number-left">
<div class="icon-wrapper"> <div class="icon-wrapper">
...@@ -65,7 +71,7 @@ ...@@ -65,7 +71,7 @@
</div> </div>
</div> </div>
</div> </div>
<template v-if="radio === 1 && currentTenant.id"> <template v-if="radio === 1 && currentTenant">
<p class="my-2">分配方案</p> <p class="my-2">分配方案</p>
<div class="idea-box"> <div class="idea-box">
<div class="left-idea"> <div class="left-idea">
...@@ -99,8 +105,11 @@ ...@@ -99,8 +105,11 @@
</div> </div>
</div> </div>
<template #footer> <template #footer>
<el-button type="primary" @click="saveFrom" :disabled="!currentTenant" v-if="radio === 1"
>保存</el-button
>
<el-button type="default" @click="showModal = false">取消</el-button> <el-button type="default" @click="showModal = false">取消</el-button>
<el-button type="primary" @click="submitForm" :disabled="!currentTenant.id" <el-button type="primary" @click="submitForm" :disabled="!currentTenant || (radio === 1 && !SaveBol)"
>确认提交</el-button >确认提交</el-button
> >
</template> </template>
...@@ -114,6 +123,7 @@ ...@@ -114,6 +123,7 @@
import { import {
getLoanDistribute, getLoanDistribute,
distributeLoan, distributeLoan,
confirm,
distributeCpe, distributeCpe,
changeDistributeCpe, changeDistributeCpe,
} from '@/api/allcation'; } from '@/api/allcation';
...@@ -125,25 +135,25 @@ ...@@ -125,25 +135,25 @@
const data = ref([]); const data = ref([]);
const mytransfer = ref(); const mytransfer = ref();
const tabledata = ref([]); const tabledata = ref([]);
const SaveBol = ref(false);
const showModal = ref(false); const showModal = ref(false);
const currentInfo = ref({}); const currentTenant = ref();
const currentTenant = ref({});
const statisis = ref({}); const statisis = ref({});
const currentAllBtn = ref(); const currentAllBtn = ref();
const editRowIndex = ref(-1); const editRowIndex = ref(-1);
const pageParams = ref({}); const pageParams = ref({});
const radio = ref(null); const radio = ref(null);
const step = ref(0); const step = ref(0);
const searchParam = ref();
const onHide = () => { const onHide = () => {
currentInfo.value = {};
}; };
const getStatisis = (params, id) => { const getStatisis = (params, id) => {
const p = JSON.parse(JSON.stringify(params)); const p = JSON.parse(JSON.stringify(params));
if (id) { if (id) {
p['tenentId'] = id; p['tenantId'] = id;
} }
delete p['current']
delete p['size']
getLoanDistribute(p).then((res) => { getLoanDistribute(p).then((res) => {
if (res.success) { if (res.success) {
statisis.value = res.result; statisis.value = res.result;
...@@ -165,24 +175,12 @@ ...@@ -165,24 +175,12 @@
currentAllBtn.value = type; currentAllBtn.value = type;
distributeCpe({ distributeCpe({
type: currentAllBtn.value, type: currentAllBtn.value,
caseId: currentInfo.value.caseId, borrowerName: pageParams.value.borrowerName,
payOrg: currentInfo.value.payOrg, borrowerIdCard: pageParams.value.idCard,
manageOrg: currentInfo.value.manageOrg.orgName, borrowerPhone: pageParams.value.borrowerPhone,
product: currentInfo.value.product, commissionAmount: pageParams.value.commissionAmount,
borrowerName: currentInfo.value.borrower.name, remainingAmount: pageParams.value.remainingAmount,
borrowerIdCard: currentInfo.value.borrower.idCard, tenantId: currentTenant.value,
borrowerPhone: currentInfo.value.borrower.phone,
commissionAmount: currentInfo.value.commissionAmount,
sumRepayAmount: currentInfo.value.sumRepayAmount,
sumReductionAmount: currentInfo.value.sumReductionAmount,
remainingAmount: currentInfo.value.remainingAmount,
principalBalance: currentInfo.value.principalBalance,
remaininginterest: currentInfo.value.remaininginterest,
commission: currentInfo.value.commission,
followStatus: currentInfo.value.followStatus,
phoneResultStatus: currentInfo.value.phoneResultStatus,
caseStatus: currentInfo.value.caseStatus,
tenantId: currentTenant.value.id,
}).then((res) => { }).then((res) => {
if (res.success) { if (res.success) {
tabledata.value = res.result; tabledata.value = res.result;
...@@ -191,24 +189,22 @@ ...@@ -191,24 +189,22 @@
}; };
const changeRadio = () => { const changeRadio = () => {
radio.value === 0 && getStatisis(pageParams.value); radio.value === 0 && getStatisis(pageParams.value);
currentTenant.value = {}; currentTenant.value = null;
}; };
const openModal = (info, param) => { const openModal = (param) => {
showModal.value = true; showModal.value = true;
currentInfo.value = info;
console.log('currentInfo.value', currentInfo.value);
pageParams.value = param; pageParams.value = param;
currentAllBtn.value = null
getTree(); getTree();
step.value = 0; step.value = 0;
currentTenant.value = {}; SaveBol.value = false
currentTenant.value = null;
editRowIndex.value = -1; editRowIndex.value = -1;
}; };
const backform = () => { const backform = () => {
step.value = 0; step.value = 0;
}; };
const submitForm = () => { const saveFrom = () => {
if (step.value || radio.value === 0) {
if (step.value) {
if (currentAllBtn.value === 'CASE') { if (currentAllBtn.value === 'CASE') {
const sum = tabledata.value.reduce((pre, cur) => pre + cur.caseNum, 0); const sum = tabledata.value.reduce((pre, cur) => pre + cur.caseNum, 0);
if (Number(sum) !== Number(statisis.value.unCaseNum)) if (Number(sum) !== Number(statisis.value.unCaseNum))
...@@ -227,6 +223,25 @@ ...@@ -227,6 +223,25 @@
changeDistributeCpe({ changeDistributeCpe({
records: tabledata.value, records: tabledata.value,
distributeType: currentAllBtn.value, distributeType: currentAllBtn.value,
}).then((res) => {
if (res.success) {
ElMessage.success({
message: '保存成功',
plain: true,
});
SaveBol.value = true
}
});
}
const submitForm = () => {
if (radio.value === 1){
if (!SaveBol.value) ElMessage.warning({
message: '要先保存',
plain: true,
});
confirm({
records: tabledata.value,
distributeType: currentAllBtn.value,
}).then((res) => { }).then((res) => {
if (res.success) { if (res.success) {
ElMessage.success({ ElMessage.success({
...@@ -237,26 +252,15 @@ ...@@ -237,26 +252,15 @@
emits('success'); emits('success');
} }
}); });
} else { } else if (radio.value === 0){
distributeLoan(currentTenant.value.id, { // chooseIdea('BORROWER');
caseId: currentInfo.value.caseId, distributeLoan(currentTenant.value, {
payOrg: currentInfo.value.payOrg, borrowerName: pageParams.value.borrowerName,
manageOrg: currentInfo.value.manageOrg.orgName, borrowerIdCard: pageParams.value.idCard,
product: currentInfo.value.product, borrowerPhone: pageParams.value.borrowerPhone,
borrowerName: currentInfo.value.borrower.name, commissionAmount: pageParams.value.commissionAmount,
borrowerIdCard: currentInfo.value.borrower.idCard, remainingAmount: pageParams.value.remainingAmount,
borrowerPhone: currentInfo.value.borrower.phone, tenantId: currentTenant.value,
commissionAmount: currentInfo.value.commissionAmount,
sumRepayAmount: currentInfo.value.sumRepayAmount,
sumReductionAmount: currentInfo.value.sumReductionAmount,
remainingAmount: currentInfo.value.remainingAmount,
principalBalance: currentInfo.value.principalBalance,
remaininginterest: currentInfo.value.remaininginterest,
commission: currentInfo.value.commission,
followStatus: currentInfo.value.followStatus,
phoneResultStatus: currentInfo.value.phoneResultStatus,
caseStatus: currentInfo.value.caseStatus,
tenantId: currentTenant.value.id,
}).then((res) => { }).then((res) => {
if (res.success) { if (res.success) {
ElMessage.success({ ElMessage.success({
...@@ -268,18 +272,13 @@ ...@@ -268,18 +272,13 @@
} }
}); });
} }
} else {
// chooseIdea('BORROWER');
step.value = 1;
}
}; };
const handleNodeClick = (data) => { const handleNodeClick = () => {
console.log('data11111', data); const item = data.value.find(v => v.id === currentTenant.value)
currentTenant.value = data;
if (radio.value === 0) { if (radio.value === 0) {
} else { } else {
getStatisis(pageParams.value, data.id); getStatisis(pageParams.value, currentTenant.value);
tabledata.value = data.users.map((v) => ({ tabledata.value = item.users.map((v) => ({
cpe: v, cpe: v,
borrowerNum: null, borrowerNum: null,
caseNum: null, caseNum: null,
...@@ -483,11 +482,6 @@ ...@@ -483,11 +482,6 @@
} }
.mainContent { .mainContent {
display: flex; display: flex;
.tree-wrapper {
border: 1px solid #ebeef5;
width: 290px;
height: 318px;
}
:deep(.el-transfer-panel .el-transfer-panel__header) { :deep(.el-transfer-panel .el-transfer-panel__header) {
border-top-left-radius: 0; border-top-left-radius: 0;
background: #fff; background: #fff;
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
<template #left_buttons> <template #left_buttons>
<el-button <el-button
type="primary" type="primary"
:disabled="!selectdList || selectdList.length !== 1"
@click="allocation" @click="allocation"
>分配 >分配
</el-button> </el-button>
...@@ -239,7 +238,6 @@ ...@@ -239,7 +238,6 @@
const allocation = (row) => { const allocation = (row) => {
allocationModalRef.value.openModal( allocationModalRef.value.openModal(
JSON.parse(JSON.stringify(selectdList.value[0])),
JSON.parse(JSON.stringify(curParam.value)) JSON.parse(JSON.stringify(curParam.value))
); );
}; };
......
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