parent
fbefb493f4
commit
a19bf6f73b
@ -0,0 +1,94 @@
|
||||
import request from "@/utils/request";
|
||||
function customParamsSerializer(params) {
|
||||
let result = '';
|
||||
for (let key in params) {
|
||||
if (params.hasOwnProperty(key)) {
|
||||
if (Array.isArray(params[key])) {
|
||||
params[key].forEach((item,index) => {
|
||||
if (item instanceof Array) {
|
||||
item.forEach((item1, index1) => {
|
||||
result += `${key}[${index}][${index1}]=${item1}&`
|
||||
})
|
||||
} else if (typeof item === 'object') {
|
||||
for (let key1 in item) {
|
||||
result += `${key}[${index}][${key1}]=${item[key1]}&`
|
||||
}
|
||||
}
|
||||
// result += `${key}[${index}][key]=${item.key}&${key}[${index}][op]=${item.op}&${key}[${index}][value]=${item.value}&`;
|
||||
});
|
||||
} else {
|
||||
result += `${key}=${params[key]}&`;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result.slice(0, -1);
|
||||
}
|
||||
// 借款
|
||||
export function getBorrow(params,noloading = false){
|
||||
return request({
|
||||
method:'get',
|
||||
url:'/api/ht/borrow/index',
|
||||
params,
|
||||
noloading,
|
||||
paramsSerializer: customParamsSerializer
|
||||
})
|
||||
}
|
||||
|
||||
export function addBorrow(data){
|
||||
return request({
|
||||
method:"post",
|
||||
url:'/api/ht/borrow/save',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function detailBorrow(params){
|
||||
return request({
|
||||
method:'get',
|
||||
url:'/api/ht/borrow/show',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
export function delBorrow(params){
|
||||
return request({
|
||||
method:'get',
|
||||
url:'/api/ht/borrow/destroy',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
// 还款
|
||||
export function getRepayment(params,noloading = false){
|
||||
return request({
|
||||
method:'get',
|
||||
url:'/api/ht/borrow-repayment/index',
|
||||
params,
|
||||
noloading,
|
||||
paramsSerializer: customParamsSerializer
|
||||
})
|
||||
}
|
||||
|
||||
export function addRepayment(data){
|
||||
return request({
|
||||
method:"post",
|
||||
url:'/api/ht/borrow-repayment/save',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function detailRepayment(params){
|
||||
return request({
|
||||
method:'get',
|
||||
url:'/api/ht/borrow-repayment/show',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
export function delRepayment(params){
|
||||
return request({
|
||||
method:'get',
|
||||
url:'/api/ht/borrow-repayment/destroy',
|
||||
params
|
||||
})
|
||||
}
|
||||
@ -0,0 +1,274 @@
|
||||
<template>
|
||||
<div>
|
||||
<xy-dialog :is-show.sync="isShowDetail" type="normal" title="借还款记录" class="contract-detail">
|
||||
<template v-slot:default>
|
||||
<xy-table ref="xyTable" :showIndex="false" :list="list" :table-item="table" :isPage="false">
|
||||
<template v-slot:id>
|
||||
<el-table-column
|
||||
header-align="center"
|
||||
label="操作"
|
||||
width="50"
|
||||
type="expand"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<xy-table ref="payTable" :showIndex="false" :list="scope.row.repayments" :table-item="payTable" :isPage="false">
|
||||
<template v-slot:btns>
|
||||
<el-table-column
|
||||
header-align="center"
|
||||
label="操作"
|
||||
width="200"
|
||||
>
|
||||
<template slot-scope="repay">
|
||||
<Button
|
||||
class="slot-btns-item"
|
||||
size="small"
|
||||
type="primary"
|
||||
@click="openPay(scope.row,repay.row.id)"
|
||||
>
|
||||
编辑
|
||||
</Button>
|
||||
<Poptip
|
||||
:transfer="true"
|
||||
confirm
|
||||
|
||||
placement="bottom"
|
||||
title="确认要删除吗"
|
||||
@on-ok="() => delPay(repay.row.id)"
|
||||
>
|
||||
<i-button
|
||||
class="slot-btns-item"
|
||||
ghost
|
||||
size="small"
|
||||
type="error"
|
||||
style="margin-left:10px"
|
||||
>删除
|
||||
</i-button>
|
||||
</Poptip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
|
||||
</xy-table>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
</template>
|
||||
<template v-slot:btns>
|
||||
<el-table-column
|
||||
header-align="center"
|
||||
label="操作"
|
||||
width="200"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<!-- 没有发起流程的 发起流程 -->
|
||||
<Button
|
||||
v-if="scope.row.contract_flow_links && scope.row.contract_flow_links.length==0"
|
||||
class="slot-btns-item"
|
||||
size="small"
|
||||
type="primary"
|
||||
@click="openOa(scope.row)"
|
||||
>
|
||||
发起借款流程
|
||||
</Button>
|
||||
<!-- 有流程 且流程已经走完的 还款金额不能大于借款金额 才能发起还款 && <scope.row.money-->
|
||||
<Button
|
||||
v-if="scope.row.contract_flow_links && scope.row.contract_flow_links.length>0
|
||||
&& scope.row.contract_flow_links[0]['flow_status']==1 &&
|
||||
(!scope.row.repayment_total || (scope.row.repayment_total && parseFloat(scope.row.repayment_total)< parseFloat(scope.row.money)))
|
||||
"
|
||||
class="slot-btns-item"
|
||||
size="small"
|
||||
type="primary"
|
||||
@click="openPay(scope.row)"
|
||||
>
|
||||
新增还款
|
||||
</Button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
</xy-table>
|
||||
</template>
|
||||
<template v-slot:footerContent>
|
||||
<div style="display: flex;align-items: center;justify-content: flex-end;">
|
||||
<Button ghost type="primary" @click="isShowDetail=false">关闭</Button>
|
||||
</div>
|
||||
</template>
|
||||
</xy-dialog>
|
||||
<borrowPay ref="borrowPay" @refresh="getList"></borrowPay>
|
||||
<!-- oa办理-->
|
||||
<Modal :width="86" class-name="oa-modal" title="流程办理" fullscreen :mask-closable="false" v-model="isShowOaModal"
|
||||
footer-hide>
|
||||
<div style="width: 100%;height: 100%;">
|
||||
<iframe style="width: 100%;height: 100%;border-radius: 0 0 6px 6px;" :src="oaUrl" frameborder="0"></iframe>
|
||||
</div>
|
||||
</Modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getBorrow,
|
||||
delRepayment
|
||||
} from '@/api/borrow/borrow'
|
||||
import borrowPay from "../components/borrowPay.vue";
|
||||
import {
|
||||
getToken
|
||||
} from "@/utils/auth";
|
||||
import {
|
||||
flowStatusConfig
|
||||
} from "@/api/common";
|
||||
export default {
|
||||
components:{
|
||||
borrowPay
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
id: '',
|
||||
isShowDetail: false,
|
||||
isShowOaModal:false,
|
||||
custom_model_id: '',
|
||||
oaUrl:'',
|
||||
list: [],
|
||||
payTable:[{
|
||||
prop:'id',
|
||||
label:'id',
|
||||
width:50,
|
||||
},{
|
||||
prop:'money',
|
||||
label:'还款金额',
|
||||
width:120,
|
||||
},{
|
||||
prop:'remark',
|
||||
label:'还款备注',
|
||||
align:'left'
|
||||
},{
|
||||
prop:'admin.name',
|
||||
label:'还款人',
|
||||
width:120
|
||||
},{
|
||||
prop:'created_at',
|
||||
label:'发起时间',
|
||||
width:180
|
||||
}],
|
||||
table: [{
|
||||
prop:'id',
|
||||
label:'id',
|
||||
width:50,
|
||||
// type:'expend',
|
||||
// expendFn(row){
|
||||
// return "123"
|
||||
// }
|
||||
},{
|
||||
prop:'name',
|
||||
label:'借款说明',
|
||||
align:'left'
|
||||
},{
|
||||
prop:'money',
|
||||
label:'借款金额',
|
||||
width:120,
|
||||
},{
|
||||
prop:'remark',
|
||||
label:'借款备注',
|
||||
align:'left'
|
||||
},{
|
||||
prop:'status',
|
||||
label:'流程状态',
|
||||
align:'center',
|
||||
customFn: (row) => {
|
||||
if(row.contract_flow_links && row.contract_flow_links.length>0){
|
||||
return this.getStatus(row.contract_flow_links[0]['flow_status'])
|
||||
}
|
||||
},
|
||||
},{
|
||||
prop:'admin.name',
|
||||
label:'申请人',
|
||||
width:120
|
||||
},{
|
||||
prop:'created_at',
|
||||
label:'发起时间',
|
||||
width:180
|
||||
}]
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getFlowConfig()
|
||||
},
|
||||
watch: {
|
||||
isShowDetail(val) {
|
||||
if (val) {
|
||||
this.getList()
|
||||
}
|
||||
},
|
||||
isShowOaModal(newVal) {
|
||||
if (newVal) {
|
||||
|
||||
} else {
|
||||
this.oaUrl = ''
|
||||
this.getList()
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getStatus(status){
|
||||
let list = {
|
||||
'-1':'退回',
|
||||
'0':'处理中',
|
||||
'1':'已完成'
|
||||
}
|
||||
return list[status]
|
||||
},
|
||||
async getFlowConfig() {
|
||||
try {
|
||||
const res = await flowStatusConfig()
|
||||
let arr = []
|
||||
arr = res.map(i => JSON.parse(i.value))
|
||||
arr.map(item => {
|
||||
if (item.tag === 'unit_loan') {
|
||||
this.custom_model_id = item.custom_model_id
|
||||
}
|
||||
})
|
||||
|
||||
} catch (err) {
|
||||
this.custom_model_id = ''
|
||||
}
|
||||
},
|
||||
async getList() {
|
||||
const res = await getBorrow({
|
||||
page: 1,
|
||||
page_size: 999,
|
||||
contract_id:this.id,
|
||||
})
|
||||
this.list = res.data
|
||||
},
|
||||
openPay(row,id){
|
||||
this.$refs.borrowPay.setRow(row,id)
|
||||
this.$refs.borrowPay.isShowDetail = true
|
||||
},
|
||||
//删除合同
|
||||
delPay(id) {
|
||||
delRepayment({
|
||||
id,
|
||||
}).then((res) => {
|
||||
this.$message.success('操作成功')
|
||||
this.getList();
|
||||
});
|
||||
},
|
||||
openOa(res) {
|
||||
console.log("res",res)
|
||||
let default_json = {
|
||||
zhichuyongtu: res.name ? res.name : '',
|
||||
fukuanjine: res.money ? res.money : ''
|
||||
}
|
||||
let url =
|
||||
`${process.env.VUE_APP_OUT_URL}/#/flow/create?auth_token=${window.encodeURIComponent(getToken())}&module_name=oa&isSinglePage=1&module_id=${this.custom_model_id}&borrow_id=${res.id}&default_json=${window.encodeURIComponent(JSON.stringify(default_json))}`
|
||||
|
||||
this.oaUrl = url
|
||||
this.isShowOaModal = true
|
||||
},
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
@ -0,0 +1,244 @@
|
||||
<template>
|
||||
<div>
|
||||
<!-- 合同详情-->
|
||||
<xy-dialog :is-show.sync="isShowDetail" type="normal" title="经费借款" class="contract-detail">
|
||||
<template v-slot:default>
|
||||
<div class="base-info">
|
||||
<div class="base-info-item">
|
||||
<div class="base-info-item-title"><span style="color:red"></span>借款金额</div>
|
||||
<div class="base-info-item-content">
|
||||
{{borrow_money}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="base-info-item">
|
||||
<div class="base-info-item-title"><span style="color:red"></span>已还款金额</div>
|
||||
<div class="base-info-item-content">
|
||||
{{repayment_total}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="base-info-item">
|
||||
<div class="base-info-item-title"><span style="color:red">*</span>还款金额</div>
|
||||
<div class="base-info-item-content">
|
||||
<el-input type="number" placeholder="请填写借款金额" v-model="form.money" style="width: 300px;" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="base-info-item">
|
||||
<div class="base-info-item-title">备注</div>
|
||||
<div class="base-info-item-content">
|
||||
<el-input placeholder="请填写备注" v-model="form.remark" style="width: 300px;" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template v-slot:footerContent>
|
||||
<div style="display: flex;align-items: center;justify-content: flex-end;">
|
||||
<Button ghost type="primary" @click="isShowDetail=false">关闭</Button>
|
||||
<Button type="primary" style="margin-left: 10px;" @click="submit">确认</Button>
|
||||
</div>
|
||||
</template>
|
||||
</xy-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
addRepayment,
|
||||
detailRepayment
|
||||
} from "@/api/borrow/borrow";
|
||||
import {
|
||||
Message
|
||||
} from "element-ui";
|
||||
|
||||
|
||||
export default {
|
||||
props: {
|
||||
|
||||
},
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
//合同详情
|
||||
id: "",
|
||||
isShowDetail: false,
|
||||
borrow_money:0,
|
||||
repayment_total:0,
|
||||
form: {
|
||||
borrow_id: '',
|
||||
money: '',
|
||||
remark: ''
|
||||
}
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
setRow(row,id){
|
||||
this.repayment_total = row.repayment_total?row.repayment_total:0
|
||||
this.form.borrow_id = row.id
|
||||
this.borrow_money = row.money
|
||||
if(id){
|
||||
this.id = id
|
||||
this.getDetail(id)
|
||||
}
|
||||
},
|
||||
async getDetail(id) {
|
||||
this.id = id;
|
||||
let res = await detailRepayment({
|
||||
id: id,
|
||||
});
|
||||
this.form = res;
|
||||
},
|
||||
async submit() {
|
||||
if (!this.form.money) {
|
||||
this.$message.warning('请填写还款金额')
|
||||
return
|
||||
}
|
||||
if ((parseFloat(this.form.money)+parseFloat(this.repayment_total)) > parseFloat(this.borrow_money)) {
|
||||
this.$message.warning('还款总金额不能多于借款金额')
|
||||
return
|
||||
}
|
||||
|
||||
// return
|
||||
const res = await addRepayment({
|
||||
id:this.id?this.id:'',
|
||||
borrow_id: this.form.borrow_id,
|
||||
money: this.form.money,
|
||||
remark: this.form.remark
|
||||
})
|
||||
this.$message.success('提交成功')
|
||||
|
||||
this.$emit('refresh')
|
||||
this.isShowDetail = false
|
||||
},
|
||||
|
||||
},
|
||||
computed: {
|
||||
},
|
||||
watch: {
|
||||
isShowDetail(val) {
|
||||
if (val) {
|
||||
|
||||
} else {
|
||||
this.borrow_money = 0
|
||||
this.repayment_total = 0
|
||||
this.form = {
|
||||
borrow_id: '',
|
||||
money: '',
|
||||
remark: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
created() {},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.contract-detail {
|
||||
.base-info {
|
||||
&-title {
|
||||
font-weight: 600;
|
||||
|
||||
padding: 0 10px;
|
||||
}
|
||||
|
||||
&-item {
|
||||
display: flex;
|
||||
|
||||
margin-top: 8px;
|
||||
|
||||
&-title {
|
||||
padding: 0 20px;
|
||||
}
|
||||
|
||||
&-content {}
|
||||
|
||||
&-unit {
|
||||
margin-left: 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.link-budget-plan {
|
||||
margin-top: 20px;
|
||||
|
||||
&-title {
|
||||
@extend .base-info-title;
|
||||
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.sign-info {
|
||||
&-title {
|
||||
@extend .link-budget-plan-title;
|
||||
}
|
||||
|
||||
&-item {
|
||||
@extend .base-info-item;
|
||||
|
||||
&-title {
|
||||
@extend .base-info-item-title;
|
||||
}
|
||||
|
||||
&-content {
|
||||
@extend .base-info-item-content;
|
||||
}
|
||||
|
||||
&-unit {
|
||||
@extend .base-info-item-unit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.out-sign-info {
|
||||
margin-top: 20px;
|
||||
@extend .sign-info;
|
||||
}
|
||||
|
||||
.pay-plan {
|
||||
margin-top: 20px;
|
||||
|
||||
&-title {
|
||||
@extend .link-budget-plan-title;
|
||||
}
|
||||
}
|
||||
|
||||
.related-processes {
|
||||
margin-top: 20px;
|
||||
|
||||
&-title {
|
||||
@extend .link-budget-plan-title;
|
||||
}
|
||||
|
||||
&-item {
|
||||
//color: red;
|
||||
|
||||
display: flex;
|
||||
|
||||
&>div {
|
||||
cursor: pointer;
|
||||
|
||||
margin: 0 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.journal {
|
||||
margin-top: 20px;
|
||||
|
||||
&-title {
|
||||
@extend .link-budget-plan-title;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
a {
|
||||
color: red;
|
||||
|
||||
&:hover {
|
||||
color: red;
|
||||
text-decoration: underline;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue