You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

439 lines
16 KiB

<template>
<div class="app-container">
<div v-show="viewState == 1">
<div class="tab-header webtop">
<div>{{ viewTitle }}</div>
<div>
<el-button type="primary" size="small" :disabled="submitdisabled" @click="toChannel()">导入</el-button>
<el-button type="primary" size="small" :disabled="submitdisabled" @click="saveOrUpdate()">保存</el-button>
<el-button type="primary" size="small" :disabled="submitdisabled" @click="submit()">提交</el-button>
<el-button type="info" size="small" @click="handleReturn()">关闭</el-button>
</div>
</div>
<div class="listconadd">
<el-form ref="form_obj" :model="formobj" :rules="rules" class="formaddcopy02">
<el-row style="border-top: 1px solid #e0e3eb">
<el-col :span="8">
<div class="span-sty">申请部门</div>
<el-form-item><span class="addinputInfo">{{ formobj.deptName }}</span></el-form-item>
</el-col>
<el-col :span="8">
<div class="span-sty">申请人</div>
<el-form-item><span class="addinputInfo">{{ formobj.createByName }}</span></el-form-item>
</el-col>
<el-col :span="8">
<div class="span-sty">申请日期</div>
<el-form-item><span class="addinputInfo">{{ formobj.createTime }}</span></el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<div class="span-sty">财务付款形式</div>
<el-form-item>
<el-select class="addinputInfo" disabled v-model="formobj.finPaymentFormKey" placeholder="请选择" clearable filterable>
<el-option v-for="item in finPayment_list" :disabled="item.dictValue == '按收款账号合并付款'" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<div class="span-sty">付款时需备注内容</div>
<el-form-item><el-input v-model="formobj.paymentRemarks" clearable placeholder="" class="addinputInfo addinputw" /></el-form-item>
</el-col>
<el-col :span="8">
<div class="span-sty">其他说明</div>
<el-form-item><el-input v-model="formobj.remarks" clearable placeholder="" class="addinputInfo addinputw" /></el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<div class="span-sty">附件</div>
<el-form-item>
<upload-img ref="uploadImg" class="addinputInfo" :accept="accept" v-model="formobj.fileUrlList" :limit="50" bucket="map" :upload-data="{ type: '0001' }"/>
</el-form-item>
</el-col>
</el-row>
<el-table :key="tableKey" :data="formobj.loanBePadsincereVehList" :index="index" border style="width: 100%" :cell-style="cellStyle" show-summary :summary-method="getSummaries">
<el-table-column fixed width="80" label="序号" type="index" :index="index + 1" align="center"/>
<el-table-column prop="loanContractNo" label="贷款合同编号" align="center" width="160"/>
<el-table-column prop="vinNo" label="车架号" align="center" width="100" />
<el-table-column prop="bankName" label="资方" align="center" width="100" />
<el-table-column prop="bankContractNo" label="资方合同编号" align="center" width="160" />
<el-table-column prop="customerName" label="客户名称" align="center" width="130" />
<el-table-column prop="borrowerName" label="贷款人" align="center" width="100" />
<el-table-column prop="period" label="期数" align="center" width="80" />
<el-table-column prop="sysBeMoney" label="平台逾期月还" align="center" width="140" />
<el-table-column label="资方逾期月还" align="center" width="140">
<template slot-scope="scope">
<el-input @input="padMoneySum(scope.row)" v-model="scope.row.bankBeMoney" clearable placeholder=""/>
</template>
</el-table-column>
<el-table-column label="资方逾期利息" align="center" width="140">
<template slot-scope="scope">
<el-input @input="padMoneySum(scope.row)" v-model="scope.row.bankBeInter" clearable placeholder=""/>
</template>
</el-table-column>
<el-table-column prop="padMoney" label="垫款金额" align="center" width="130" />
<el-table-column label="付款账户名称" align="center" width="200">
<template slot-scope="scope">
<el-input v-model="scope.row.paymentAccount" clearable placeholder=""/>
</template>
</el-table-column>
<el-table-column label="付款账号" align="center" width="200">
<template slot-scope="scope">
<el-input v-model="scope.row.paymentNum" clearable placeholder=""/>
</template>
</el-table-column>
<el-table-column label="资方收款账户名称" align="center" width="200">
<template slot-scope="scope">
<el-input v-model="scope.row.bankCollectionAcc" clearable placeholder=""/>
</template>
</el-table-column>
<el-table-column label="资方收款账号" align="center" width="200">
<template slot-scope="scope">
<el-input v-model="scope.row.bankCollectionNum" clearable placeholder=""/>
</template>
</el-table-column>
<el-table-column label="备注" align="center" min-width="200">
<template slot-scope="scope">
<el-input v-model="scope.row.remarks" clearable placeholder=""/>
</template>
</el-table-column>
</el-table>
</el-form>
</div>
</div>
<!-- 导入 -->
<el-dialog :visible.sync="dialogVisible" width="60%" :show-close="false">
<div>
<el-button style="font-weight: bold" size="small" type="text" @click="downLoad">下载当月资方逾期记录模板</el-button>
</div>
<el-card class="box-card">
<div>
<el-upload
ref="upload"
class="upload-demo"
accept=".xls"
name="file"
:action="updateAction"
:on-success="handleSuccess"
:file-list="fileList"
:auto-upload="false"
:multiple="false"
:limit="1"
:data="uploadData"
:headers="headers"
>
<el-button slot="trigger" size="small" type="primary">选取文件</el-button>
<el-button style="margin-left: 10px;" size="small" type="success" @click="submitUpload">上传</el-button>
</el-upload>
</div>
<div>
<h3>文件上传结果</h3>
<el-card class="box-card">
<div>{{ uploadResultMesssage }}</div>
</el-card>
</div>
</el-card>
<div slot="footer" class="dialog-footer" style="text-align: center">
<el-button type="primary" size="small" @click="handleConfirm">确定</el-button>
<el-button size="small" @click="dialogVisible = false">取消</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import req from '@/api/advancerequest/advancerequest'
import uploadImg from '@/components/uploadFile/uploadImg'
import { typeValues } from '@/api/Common/dictcommons'
export default {
name: 'AdvanceRequestAdd',
components: {
uploadImg
},
data() {
return {
viewTitle: '',
viewState: 1,
submitdisabled: false,
tableKey: 0,
index: 0,
accept: '.jpg,.jpeg,.png',
dialogVisible: false,
updateAction: process.env.VUE_APP_BASE_API + '/riskcenter/v1/loanbepadsincereapply/getExcelInfo',
fileList: [],
upload_list: [],
uploadResultMesssage: '',
uploadData: {
sid: ''
},
headers: {
token: window.sessionStorage.getItem('token')
},
finPayment_list: [],
formobj: {
billNo: '',
createByName: '',
createBySid: '',
createTime: '',
deptName: '',
deptSid: '',
finPaymentFormKey: '',
finPaymentFormValue: '',
fileUrlList: [],
loanBePadsincereVehList: [],
nodeSid: '',
nodeState: '',
orgPath: '',
paymentRemarks: '',
procDefId: '',
procInstSid: '',
sid: '',
taskId: '',
useOrgName: '',
useOrgSid: '',
remarks: ''
},
rules: {}
}
},
methods: {
cellStyle({ row, column, rowIndex, columnIndex }) {
// 定义样式变量
let cell = ''
if (parseFloat(row.sysBeMoney) !== parseFloat(row.bankBeMoney) && row.sysBeMoney !== '' && row.bankBeMoney !== '') {
cell = 'background: #ff6961;'
}
if (column.label == '平台逾期月还' || column.label == '资方逾期月还') {
return cell
}
},
// 合计
getSummaries(param) {
const { columns, data } = param
const sums = []
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = '合计'
return
}
const values = data.map(item => Number(item[column.property]))
if (column.property === 'sysBeMoney') {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr)
if (!isNaN(value)) {
return prev + curr
} else {
return prev
}
}, 0)
sums[index] += ''
} else if (column.property === 'bankBeMoney') {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr)
if (!isNaN(value)) {
return prev + curr
} else {
return prev
}
}, 0)
sums[index] += ''
} else if (column.property === 'bankBeInter') {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr)
if (!isNaN(value)) {
return prev + curr
} else {
return prev
}
}, 0)
sums[index] += ''
} else if (column.property === 'padMoney') {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr)
if (!isNaN(value)) {
return prev + curr
} else {
return prev
}
}, 0)
sums[index] += ''
}
})
return sums
},
init() {
typeValues({ type: 'payForm' }).then((resp) => {
if (resp.success) {
this.finPayment_list = resp.data
}
})
},
showAdd() {
this.viewTitle = '【新增】垫款申请'
this.$nextTick(() => {
this.$refs['form_obj'].clearValidate()
})
this.init()
req.init({ orgPath: window.sessionStorage.getItem('defaultOrgPath'), userSid: window.sessionStorage.getItem('userSid') }).then((res) => {
if (res.success) {
this.formobj = res.data
this.formobj.finPaymentFormKey = '01'
this.formobj.finPaymentFormValue = '按资方合同编号单笔付款'
}
})
},
showEdit(row) {
this.viewTitle = '【编辑】垫款申请'
this.$nextTick(() => {
this.$refs['form_obj'].clearValidate()
})
this.init()
req.fetchBySid(row.sid).then((res) => {
if (res.success) {
this.formobj = res.data
this.formobj.instanceId = res.data.procInstSid
}
})
},
// 导入
toChannel() {
this.dialogVisible = true
this.fileList = []
this.upload_list = []
this.uploadResultMesssage = ''
},
downLoad() {
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
})
req.downloadExcel().then((resp) => {
loading.close()
const blob = new Blob([resp], {
type: 'application/vnd.ms-excel'
})
const fileName = '当月资方逾期记录模板' + '.xls'
const elink = document.createElement('a')
elink.download = fileName
elink.style.display = 'nonde'
elink.href = URL.createObjectURL(blob)
document.body.appendChild(elink)
elink.click()
URL.revokeObjectURL(elink.href)
document.body.removeChild(elink)
}).catch(() => {
loading.close()
})
},
submitUpload() {
this.$refs.upload.submit()
},
handleSuccess(resp, file, fileList) {
const _this = this
if (resp.success) {
_this.uploadResultMesssage = resp.msg
// 上传文件数据成功后立即保存数据
if (resp.data.length > 0 && resp.data !== null) {
this.upload_list = resp.data
}
} else {
_this.uploadResultMesssage = resp.msg
}
},
handleConfirm() {
if (this.upload_list.length === 0) {
this.$message({ showClose: true, type: 'error', message: '请先上传当月资方逾期记录' })
return
} else {
this.formobj.loanBePadsincereVehList = this.upload_list
this.dialogVisible = false
}
},
padMoneySum(row) {
if (row.bankBeMoney !== '' && row.bankBeInter !== '') {
row.padMoney = parseFloat(row.bankBeMoney) + parseFloat(row.bankBeInter)
} else {
row.padMoney = ''
}
},
saveOrUpdate() {
this.$refs['form_obj'].validate((valid) => {
if (valid) {
this.submitdisabled = true
req.saveOrUpdate(this.formobj).then((res) => {
if (res.success) {
this.$message({ showClose: true, type: 'success', message: '保存成功' })
this.handleReturn('true')
} else {
this.submitdisabled = false
}
}).catch(() => {
this.submitdisabled = false
})
}
})
},
submit() {
if (this.formobj.loanBePadsincereVehList.length === 0) {
this.$message({ showClose: true, type: 'error', message: '车辆列表信息不能为空' })
return
}
this.$refs['form_obj'].validate((valid) => {
if (valid) {
this.submitdisabled = true
req.submit(this.formobj).then((res) => {
if (res.success) {
this.$message({ showClose: true, type: 'success', message: '操作成功' })
this.handleReturn('true')
} else {
this.submitdisabled = false
}
}).catch(() => {
this.submitdisabled = false
})
}
})
},
handleReturn(isreload) {
if (isreload === 'true') this.$emit('reloadlist')
this.formobj = {
billNo: '',
createByName: '',
createBySid: '',
createTime: '',
deptName: '',
deptSid: '',
fileUrlList: [],
loanBePadsincereVehList: [],
nodeSid: '',
nodeState: '',
orgPath: '',
procDefId: '',
procInstSid: '',
sid: '',
taskId: '',
useOrgName: '',
useOrgSid: ''
}
this.fileList = []
this.upload_list = []
this.uploadResultMesssage = ''
this.submitdisabled = false
this.$emit('doback')
}
}
}
</script>
<style scoped>
.span-sty {
width: 130px !important;
}
.addinputInfo {
margin-left: 120px !important;
}
</style>