webpackJsonp([40],{Zam3:function(e,t){},spP7:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=a("SQ4B"),n=a("b9vf"),r=a("qI5z"),o=a("vGYV"),s={name:"IndividualAuthenticationCreate",data:function(){var e=this;return{userId:0,user:{},isModifyMode:!0,loading:!1,authentication:{IDCardPositivePhoto:"",realName:"",IDCard:"",bankAccount:"",address:""},rules:{IDCard:[{required:!0,message:"请输入身份证号",trigger:"blur"},{min:18,max:18,message:"身份证号输入有误",trigger:"blur"}],realName:[{required:!0,message:"请输入身份证上的姓名",trigger:"blur"}],IDCardPositivePhoto:[{validator:function(e,t,a){console.log(t),null==t||""==t?a(new Error("手持身份证照片不能为空")):a()},trigger:"blue"}],bankAccount:[{required:!0,message:"请输入银行卡账户",trigger:"blur"},{min:16,max:19,message:"银行卡账户输入有误",trigger:"blur"},{validator:function(t,a,i){e.checkNumber(a)?i():i(new Error("银行卡账户输入有误"))},trigger:"blur"}],address:[{required:!0,message:"请输入地址",trigger:"blur"}]}}},mounted:function(){var e=this;this.$nextTick(function(){e.init()})},methods:{init:function(){this.setUserInfo()},loadData:function(){},modifyInfo:function(){this.isModifyMode=!0},submitInfo:function(){var e=this;this.$refs.authentication.validate(function(t){if(!t)return Object(r.a)("error","表单填写错误!"),!1;e.showLoading();var a={userId:e.user.userVO.id,realName:e.authentication.realName,IDCard:e.authentication.IDCard,IDCardPositivePhoto:e.authentication.IDCardPositivePhoto,bankAccount:e.authentication.bankAccount,address:e.authentication.address};Object(o.V)(e.user.userVO.id,a,e.submitInfoSuccess,e.submitInfoFail)})},submitInfoSuccess:function(e){var t=this;console.log(e),Object(o.v)().then(function(e){Object(o.M)("user",e),t.user=e,Object(o.M)("rolesPermissions",Object(o.B)(e.roleList)),t.hideLoading(),t.sendBusMessage(),t.$alert("认证信息提交成功,将于3个工作日内审核完成","提交成功",{confirmButtonText:"确定",callback:function(e){t.$router.push({name:"IndividualAuthentication",params:{userId:t.user.userVO.id}})}})}).catch(function(e){t.hideLoading(),Object(r.a)("error","重新获取用户信息失败:"+e.data)})},submitInfoFail:function(e){this.hideLoading(),Object(r.a)("error",e.data)},cancelModify:function(){this.isModifyMode=!1},handleRemove:function(e,t){console.log(e,t)},handleExceed:function(e,t){this.$message.warning("当前限制选择 1 个文件,本次选择了 "+e.length+" 个文件,共选择了 "+(e.length+t.length)+" 个文件")},beforeRemove:function(e,t){},beforeFileUpload:function(e){if(e.size>1e7)return Object(r.a)("error","单个文件大小不能超过10M"),!1;var t=e.name,a=t.lastIndexOf(".");if(a<=0)return Object(r.a)("error","只能上传png/jpg格式的文件"),!1;var i=t.substr(a);return".jpg"!==i&&".png"!==i?(Object(r.a)("error","只能上传png/jpg格式的文件"),!1):void 0},uploadFile:function(e){var t=this;this.showLoading();var a=new FormData;a.append("file",e.file),i.a.upload(n.a.FILE.UPLOAD_IMAGE.replace("{userId}",this.user.userVO.id),a,{headers:{"Content-Type":"multipart/form-data"}}).then(function(e){t.hideLoading(),t.authentication.IDCardPositivePhoto=e.data,Object(r.a)("success","上传成功"),t.$refs.authentication.validateField("IDCardPositivePhoto")}).catch(function(e){t.hideLoading();try{413===e.response.status?Object(r.a)("error","文件过大,请选择小于20M的图片"):500===e.response.status&&Object(r.a)("error","上传文件发生错误,请稍后重试")}catch(t){Object(r.a)("error",e.data)}})},setUserInfo:function(){this.user=Object(o.K)("user")},showLoading:function(){this.loading=!0},hideLoading:function(){this.loading=!1},sendBusMessage:function(){this.$root.$emit("user",this.user)},checkNumber:function(e){return/^\d+$/.test(e)}},created:function(){}},u={render:function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}],staticClass:"create-container"},[a("div",{staticClass:"create-body"},[a("div",{staticClass:"title"},[e._v("个人信息认证")]),e._v(" "),a("el-form",{ref:"authentication",staticClass:"demo-report",attrs:{model:e.authentication,rules:e.rules,"label-width":"12%"}},[a("el-form-item",{attrs:{label:"姓名",prop:"realName"}},[e.isModifyMode?a("el-input",{attrs:{size:"small"},model:{value:e.authentication.realName,callback:function(t){e.$set(e.authentication,"realName",t)},expression:"authentication.realName"}}):e._e()],1),e._v(" "),a("el-form-item",{attrs:{prop:"IDCardPositivePhoto",label:"手持身份证照片"}},[a("el-upload",{staticClass:"avatar-uploader",attrs:{action:"","show-file-list":!1,accept:".jpg,.png","http-request":e.uploadFile,"before-upload":e.beforeFileUpload}},[e.authentication.IDCardPositivePhoto?a("img",{staticClass:"avatar",attrs:{src:e.authentication.IDCardPositivePhoto}}):a("i",{staticClass:"el-icon-plus avatar-uploader-icon"})])],1),e._v(" "),a("el-form-item",{attrs:{label:"身份证号",prop:"IDCard"}},[e.isModifyMode?a("el-input",{attrs:{size:"small"},model:{value:e.authentication.IDCard,callback:function(t){e.$set(e.authentication,"IDCard",t)},expression:"authentication.IDCard"}}):e._e()],1),e._v(" "),a("el-form-item",{attrs:{label:"地址",prop:"address"}},[e.isModifyMode?a("el-input",{attrs:{size:"small"},model:{value:e.authentication.address,callback:function(t){e.$set(e.authentication,"address",t)},expression:"authentication.address"}}):e._e()],1),e._v(" "),e.isModifyMode?a("el-form-item",[a("div",{staticClass:"btn btn-primary btn-info",on:{click:function(t){return e.submitInfo()}}},[e._v("提交")])]):e._e()],1)],1)])},staticRenderFns:[]};var c=a("VU/8")(s,u,!1,function(e){a("Zam3")},"data-v-376bf55c",null);t.default=c.exports}});