+
-
+
+
+
+
+
+
@@ -32,6 +37,7 @@
import { getInfo } from "@/api/login/index";
import { getMember , base64Attach , userUpdate , showUserImg , deleteUserImg} from "@/api/user/index";
import {Dialog} from "vant";
+import {base64Upload} from "@/api/register";
export default {
name: "userInformation",
data() {
@@ -44,15 +50,19 @@ export default {
fileType:'',
bizPath:'transaction',
tableName:'t_transaction_member',
- tableId:''
+ tableId:'',
},
userForm:{
idCardNum:'',
realname:'',
address:'',
+ idCardPic :'',
+ accountOpenCert:'',
},
userInfo:[],
- upLoadList:[]
+ upLoadList:[],
+ fileListSFZ:[],
+ fileListYHK:[]
};
},
created() {
@@ -69,55 +79,92 @@ export default {
this.userForm.address = response.data.address;
this.userForm.id = response.data.id;
this.form.tableId = response.data.id;
- this.tel = response.data.phone
- showUserImg(response.data.id).then(responseSecond => {
- console.log(responseSecond)
- for (var i = 0 ; i < responseSecond.data.length ; i++){
- this.fileList.push({url:this.global.severApi+responseSecond.data[i].fileUrl,id:responseSecond.data[i].id})
- }
- });
+ this.tel = response.data.phone;
+
+ if (response.data.idCardPic!=''){
+ this.fileListSFZ = [{
+ url:'/api'+response.data.idCardPic,
+ isImage: true
+ }];
+ }
+
+ if (response.data.accountOpenCert!=''){
+ this.fileListYHK = [{
+ url:'/api'+response.data.accountOpenCert,
+ isImage: true
+ }];
+ }
+
+
+
+ // showUserImg(response.data.id).then(responseSecond => {
+ // console.log(responseSecond)
+ // for (var i = 0 ; i < responseSecond.data.length ; i++){
+ // this.fileList.push({url:this.global.severApi+responseSecond.data[i].fileUrl,id:responseSecond.data[i].id})
+ // }
+ // });
});
});
},
- afterRead(file) {
+ afterReadSFZ(file) {
// 此时可以自行将文件上传至服务器
- for ( var i = 0 ; i < this.fileList.length ; i++){
- console.log(this.fileList[i].url)
- if(this.fileList[i].url == undefined&&this.fileList!='') {
- this.fileList[i] = {url:this.fileList[i].content, id: '', isImage: true};
- }
- }
+ let params1 = new FormData();
+ params1.append("file", file.content);
+ base64Upload(params1).then((r1) => {
+ this.userForm.idCardPic = r1.fileName;
+ })
},
- deleteFile(elIndex){
- if(elIndex.id != ''){
- deleteUserImg(elIndex.id).then(response => {});
+ afterReadYHK(file) {
+ // 此时可以自行将文件上传至服务器
+ let params1 = new FormData();
+ params1.append("file", file.content);
+ base64Upload(params1).then((r1) => {
+ this.userForm.accountOpenCert = r1.fileName;
+ })
+ },
+ deleteFileSFZ(elIndex){
+ return (file, name) => {
+ let fileIndex = name.index
+ this.fileListSFZ[elIndex].splice(fileIndex, 1)
+ this.userForm.idCardPic = '';
}
+ },
+ deleteFileYHK(elIndex){
return (file, name) => {
let fileIndex = name.index
- this.fileList[elIndex].splice(fileIndex, 1)
- this.upLoadList[elIndex].splice(fileIndex, 1)
+ this.fileListYHK[elIndex].splice(fileIndex, 1)
+ this.userForm.accountOpenCert = '';
}
},
submitForm(){
- this.form.files = [];
- userUpdate(this.userForm).then(response => {
- var imgList = [];
- console.log(this.fileList)
- for (var i = 0 ; i < this.fileList.length ; i++){
- if(this.fileList[i].url.indexOf('http') == -1&&this.fileList!=''){
- this.form.files.push(this.fileList[i].url);
+ if (this.userForm.idCardPic == ''){
+ this.$toast({
+ icon: 'error', // 找到自己需要的图标
+ message: '请上传身份证',
+ duration:"2000",
+ onClose:function(){
}
- }
- console.log(this.form.files)
- base64Attach(this.form).then(responseSecond => {
- if(response.code == 200 && responseSecond.code == 200){
- Dialog.confirm({
- title: '系统提示',
- message: '修改成功',
- confirmButtonText: '确定',
- })
+ })
+ return;
+ }
+ if (this.userForm.accountOpenCert == ''){
+ this.$toast({
+ icon: 'error', // 找到自己需要的图标
+ message: '请上传银行卡',
+ duration:"2000",
+ onClose:function(){
}
- });
+ })
+ return;
+ }
+ userUpdate(this.userForm).then(response => {
+ if(response.code == 200){
+ Dialog.confirm({
+ title: '系统提示',
+ message: '修改成功',
+ confirmButtonText: '确定',
+ })
+ }
});
}
},