Commit 98052e66 authored by caimeng's avatar caimeng

沃日

parent 7e3a28fb
......@@ -87,10 +87,12 @@
<el-form-item label="还款凭证" prop="attach">
<el-upload
list-type="picture-card"
:multiple="oss.multiple"
:action="oss.action"
:data="oss.data"
:limit="3"
:multiple="true"
accept=".jpeg,.jpg,.png"
:on-exceed="masterFileMax"
:before-upload="handleBeforeApplyUpload"
:on-success="handleLoanApplySuccess"
:on-remove="handleLoanApplyRemove">
......@@ -153,7 +155,7 @@ export default {
userDay: '',
userMonth: '',
memo: '',
attach: '',
attach: [],
bankAccount: '',
bankOwner: '',
raiseAmt:''
......@@ -188,6 +190,7 @@ export default {
this.handleClose();
} else {
this.ruleForm = res.data.result;
this.ruleForm.attach = [];
}
}).catch(error => {
......@@ -200,6 +203,10 @@ export default {
},
methods: {
masterFileMax(files,fileList){
console.log(files, fileList);
this.$message.warning(`最多上传3个文件。`);
},
/** 提交点击 */
backedTransfer() {
......@@ -233,7 +240,8 @@ export default {
tempOss.action = result.host;
tempOss.data = data;
this.oss = tempOss;
this.ruleForm.attach = result.dir
const cacheImg = this.ruleForm.attach;
this.ruleForm.attach = cacheImg.concat(result.dir)
});
},
......@@ -242,7 +250,7 @@ export default {
},
handleLoanApplyRemove(res, file, fileList) {
this.ruleForm.attach = fileList
},
//参数
buildParam() {
......
<template>
<el-dialog
:append-to-body="true"
class="client-data-dialog"
title="创建转账还款单"
width="60%"
:visible.sync="visible"
:before-close="handleClose">
<el-dialog :append-to-body="true" class="client-data-dialog" title="创建转账还款单" width="60%" :visible.sync="visible"
:before-close="handleClose">
<div class="b-table">
<table class="table">
......@@ -32,13 +27,8 @@
</table>
</div>
<el-form
size="small"
label-suffix=":"
:model="ruleForm"
:rules="rules"
ref="ruleForm"
label-width="140px" class="demo-ruleForm">
<el-form size="small" label-suffix=":" :model="ruleForm" :rules="rules" ref="ruleForm" label-width="140px"
class="demo-ruleForm">
<el-form-item label="还款银行账号" prop="bankAccount">
<el-col :span="20">
<el-input v-model="ruleForm.bankAccount" placeholder="请输入还款银行账号"></el-input>
......@@ -55,15 +45,9 @@
</el-col>
</el-form-item>
<el-form-item label="还款凭证" prop="attach">
<el-upload
list-type="picture-card"
:multiple="oss.multiple"
:action="oss.action"
:data="oss.data"
accept=".jpeg,.jpg,.png"
:before-upload="handleBeforeApplyUpload"
:on-success="handleLoanApplySuccess"
:on-remove="handleLoanApplyRemove">
<el-upload list-type="picture-card" :on-exceed="masterFileMax" :limit="3" :multiple="true" :action="oss.action" :data="oss.data"
accept=".jpeg,.jpg,.png" :before-upload="handleBeforeApplyUpload" :on-success="handleLoanApplySuccess"
:on-remove="handleLoanApplyRemove">
<i class="el-icon-plus"></i>
</el-upload>
</el-form-item>
......@@ -136,7 +120,7 @@ export default {
planAmt: '',
planBen: '',
planXi: '',
attach: '',
attach: [],
planNo: '',
bankAccount: '',
bankOwner: '',
......@@ -144,16 +128,16 @@ export default {
memo: '',
},
rules: {
bankAccount: [{required: true, message: '请输入还款银行账号', trigger: 'blur'}],
bankOwner: [{required: true, message: '请输入还款银行账户名称', trigger: 'blur'}],
planAmt: [{required: true, message: '请输入还款金额', trigger: 'blur'}],
attach: [{required: true, message: '请添加还款凭证', trigger: 'blur'}],
bankAccount: [{ required: true, message: '请输入还款银行账号', trigger: 'blur' }],
bankOwner: [{ required: true, message: '请输入还款银行账户名称', trigger: 'blur' }],
planAmt: [{ required: true, message: '请输入还款金额', trigger: 'blur' }],
attach: [{ required: true, message: '请添加还款凭证', trigger: 'blur' }],
},
loginName: '',
oss: {
action: '',
data: {},
multiple: false,
multiple: true,
},
}
},
......@@ -170,6 +154,7 @@ export default {
planBen: this.planBen,
planXi: this.planXi,
accountAmt: this.accountAmt,
attach: []
}
},
......@@ -178,6 +163,12 @@ export default {
},
methods: {
masterFileMax(files,fileList){
console.log(files, fileList);
this.$message.warning(`最多上传3个文件。`);
},
/** 提交点击 */
backedTransfer() {
this.$refs['ruleForm'].validate((valid) => {
......@@ -189,43 +180,50 @@ export default {
this.$message.error(res.data.message);
return
}
this.$message({message: '操作成功', type: 'success'});
this.$message({ message: '操作成功', type: 'success' });
this.handleClose();
this.$emit('callback')
})
.catch(err => {
alert("error!")
})
.catch(err => {
alert("error!")
})
})
},
handleBeforeApplyUpload(file) {
var attachType = 'LOESS_TRANSFER_APPLY'
return this.$$get(`/oss/signature/?fileType=` + attachType + "&fileName=" + file.name).then(res => {
if (res.data.code != 200) {
this.$message.error(res.data.message);
return
}
const result = res.data.result.result;
const data = {};
const tempOss = {};
data.OSSAccessKeyId = result.accessId;
data.policy = result.policy;
data.Signature = result.signature;
data.key = result.dir;
tempOss.action = result.host;
tempOss.data = data;
this.oss = tempOss;
this.ruleForm.attach = result.dir
});
try {
var attachType = 'LOESS_TRANSFER_APPLY'
return this.$$get(`/oss/signature/?fileType=` + attachType + "&fileName=" + file.name).then(res => {
if (res.data.code != 200) {
this.$message.error(res.data.message);
return
}
const result = res.data.result.result;
const data = {};
const tempOss = {};
data.OSSAccessKeyId = result.accessId;
data.policy = result.policy;
data.Signature = result.signature;
data.key = result.dir;
tempOss.action = result.host;
tempOss.data = data;
this.oss = tempOss;
const cacheImg = this.ruleForm.attach;
this.ruleForm.attach = cacheImg.concat(result.dir)
});
} catch (err) {
console.log('沃日')
this.$message.error(res.data.message);
}
},
handleLoanApplySuccess(res, file, fileList) {
this.$notify({title: '成功', message: file.name + ",上传成功", type: 'success'});
this.$notify({ title: '成功', message: file.name + ",上传成功", type: 'success' });
},
handleLoanApplyRemove(res, file, fileList) {
handleLoanApplyRemove(file, fileList) {
console.log(file,fileList,'=====删除')
this.ruleForm.attach = fileList
},
//参数
......@@ -256,6 +254,4 @@ export default {
}
</script>
<style scoped>
</style>
<style scoped></style>
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