<template>
|
<div class="refund">
|
<el-button
|
type="primary"
|
style="margin-bottom:24px"
|
icon="el-icon-circle-plus-outline"
|
@click="addRefundFee"
|
size="medium"
|
v-if="isrefund == 1"
|
>新增退息费信息</el-button>
|
<el-table
|
stripe
|
:data="refunds"
|
:header-cell-style="{background:'#f5f5f5',color:'#222222'}"
|
highlight-current-row
|
>
|
<el-table-column min-width="220">
|
<template slot="header">
|
<span>
|
<span class="red-star">*</span>
|
<span style="padding-left:8px">退息费日期</span>
|
</span>
|
</template>
|
<template slot-scope="{row}">
|
<span style="padding-left:15px" v-show="!row.isEdit">{{row.refunddate}}</span>
|
<div style="padding-left:15px">
|
<el-date-picker
|
v-model="row.refunddate"
|
type="date"
|
v-show="row.isEdit"
|
format="yyyy/MM/dd"
|
value-format="yyyy/MM/dd"
|
size="small"
|
placeholder="选择日期">
|
</el-date-picker>
|
</div>
|
</template>
|
</el-table-column>
|
<el-table-column min-width="220">
|
<template slot="header">
|
<span>
|
<span class="red-star">*</span>
|
<span style="padding-left:8px">退利息金额</span>
|
</span>
|
</template>
|
<template slot-scope="{row}">
|
<span style="padding-left:15px" v-show="!row.isEdit">{{formatMoney(row.refundpayinterestamt)}}</span>
|
<el-input style="padding-left:15px" size="small" v-show="row.isEdit" v-model="row.refundpayinterestamt" placeholder="请输入" @blur="row.refundpayinterestamt=formatMoney(row.refundpayinterestamt)"></el-input>
|
</template>
|
</el-table-column>
|
<el-table-column min-width="220">
|
<template slot="header">
|
<span>
|
<span class="red-star">*</span>
|
<span style="padding-left:8px">退手续费金额</span>
|
</span>
|
</template>
|
<template slot-scope="{row}">
|
<span style="padding-left:15px" v-show="!row.isEdit">{{formatMoney(row.refundcharge)}}</span>
|
<el-input style="padding-left:15px" size="small" v-show="row.isEdit" v-model="row.refundcharge" placeholder="请输入" @blur="row.refundcharge=formatMoney(row.refundcharge)"></el-input>
|
</template>
|
</el-table-column>
|
<el-table-column min-width="220">
|
<template slot="header">
|
<span>
|
<span class="red-star">*</span>
|
<span style="padding-left:8px">退担保费</span>
|
</span>
|
</template>
|
<template slot-scope="{row}">
|
<span style="padding-left:15px" v-show="!row.isEdit">{{formatMoney(row.refundguarantee)}}</span>
|
<el-input style="padding-left:15px" size="small" v-show="row.isEdit" v-model="row.refundguarantee" placeholder="请输入" @blur="row.refundguarantee=formatMoney(row.refundguarantee)"></el-input>
|
</template>
|
</el-table-column>
|
<el-table-column min-width="220">
|
<template slot="header">
|
<span>
|
<span class="red-star">*</span>
|
<span style="padding-left:8px">退平台服务费</span>
|
</span>
|
</template>
|
<template slot-scope="{row}">
|
<span style="padding-left:15px" v-show="!row.isEdit">{{formatMoney(row.refundservicefee)}}</span>
|
<el-input style="padding-left:15px" size="small" v-show="row.isEdit" v-model="row.refundservicefee" placeholder="请输入" @blur="row.refundservicefee=formatMoney(row.refundservicefee)"></el-input>
|
</template>
|
</el-table-column>
|
<el-table-column min-width="220">
|
<template slot="header">
|
<span>
|
<span class="red-star">*</span>
|
<span style="padding-left:8px">退息费银行流水</span>
|
</span>
|
</template>
|
<template slot-scope="{row}">
|
<span style="padding-left:15px" v-show="!row.isEdit">{{row.refundtxno}}</span>
|
<el-input style="padding-left:15px" size="small" v-show="row.isEdit" v-model="row.refundtxno" placeholder="请输入"></el-input>
|
</template>
|
</el-table-column>
|
<el-table-column min-width="220" label="备注" show-overflow-tooltip>
|
<template slot-scope="{row}">
|
<span style="padding-left:15px" v-show="!row.isEdit">{{row.remark}}</span>
|
<el-input style="padding-left:15px" size="small" v-show="row.isEdit" v-model="row.remark" placeholder="请输入"></el-input>
|
</template>
|
</el-table-column>
|
<el-table-column label="操作管理" width="110">
|
<template slot-scope="scope">
|
<el-button type="text" @click.native="handleSave(scope.row)" v-show="scope.row.isEdit">保存</el-button>
|
<el-button type="text" @click.native="handlecancel(scope.$index)" v-show="scope.row.isEdit">取消</el-button>
|
<el-button type="text" @click="handleDelete(scope.row,scope.$index)" v-show="!scope.row.isEdit && isrefund == 1">删除</el-button>
|
<el-button type="text" v-show="isrefund != 1">--</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
</div>
|
</template>
|
<script>
|
import {
|
saveRefundFeeMulti,
|
delRefundInfo
|
} from '@api/product'
|
import common from '@/utils/common'
|
export default {
|
props: ['refunds','isrefund'],
|
data () {
|
return {
|
applyInfo:this.$store.state.product.applyInfo,
|
}
|
},
|
methods: {
|
// 金额格式化
|
formatMoney(value) {
|
if (value) {
|
value =
|
parseFloat((value + "").replace(/[^\d\.-]/g, "")).toFixed(2) + "";
|
if (value == "NaN") return;
|
let l = value
|
.split(".")[0]
|
.split("")
|
.reverse();
|
let r = value.split(".")[1];
|
let t = "";
|
for (let i = 0; i < l.length; i++) {
|
t += l[i] + ((i + 1) % 3 === 0 && i + 1 !== l.length ? "," : "");
|
}
|
return (
|
t
|
.split("")
|
.reverse()
|
.join("") +
|
"." +
|
r
|
);
|
}
|
},
|
// 新增退息费信息
|
addRefundFee(){
|
for (let i = 0; i < this.refunds.length; i++) {
|
if(this.refunds[i].isEdit){
|
this.$message.warning('请先保存当前退息费信息再新增')
|
return;
|
}
|
};
|
this.refunds.unshift({
|
refunddate:'',
|
refundpayinterestamt:'',
|
refundcharge:'',
|
refundguarantee:'',
|
refundservicefee:'',
|
refundtxno:'',
|
remark:'',
|
isEdit:true
|
})
|
},
|
// 保存退息费信息
|
handleSave(row){
|
if(!row.refunddate){
|
this.$message.warning('退息费日期不能为空')
|
return;
|
}
|
if(!row.refundpayinterestamt){
|
this.$message.warning('退利息金额不能为空')
|
return;
|
}
|
if(!row.refundcharge){
|
this.$message.warning('退手续费金额不能为空')
|
return;
|
}
|
if(!row.refundguarantee){
|
this.$message.warning('退担保费不能为空')
|
return;
|
}
|
if(!row.refundservicefee){
|
this.$message.warning('退平台服务费不能为空')
|
return;
|
}
|
if(!row.refundtxno){
|
this.$message.warning('退息费银行流水不能为空')
|
return;
|
}
|
row.objectno = this.applyInfo.serialNo;
|
saveRefundFeeMulti({refundRegistrationInfos:this.refunds}).then(res=>{
|
if(res.code == '00'){
|
this.$message.success('保存成功')
|
this.$emit('sendReFund',true)
|
this.$set(row,'isEdit',false)
|
}
|
})
|
},
|
// 删除
|
handleDelete(row,index){
|
// 这里删除成功后数据需要splice
|
if(!row.isEdit){
|
common.comfirm('提示',`请确认是否需要删除:${row.propertyowner}?`,async ()=>{
|
if(row.serialno){
|
const res = await delRefundInfo({serialno:row.serialno})
|
if(res.code != '00')return;
|
}
|
this.$message.success('删除成功')
|
this.refunds.splice(index,1)
|
})
|
}else{
|
this.refunds.splice(index,1)
|
}
|
},
|
// 取消
|
handlecancel(index){
|
this.refunds.splice(index,1)
|
}
|
}
|
}
|
</script>
|
<style lang="stylus">
|
.refund
|
width 100%
|
margin-bottom 24px
|
.el-date-editor
|
width 100%
|
.red-star
|
width 7px
|
display inline-block
|
vertical-align: middle;
|
color: #FF4300;
|
</style>
|