webpackJsonp([32],{AhyU:function(e,t){},wot2:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=i("SQ4B"),a=i("b9vf"),s=i("qI5z"),o=i("vGYV"),r={name:"EnterpriseAuthenticationCreate",data:function(){var e=this;return{userId:0,user:{},isModifyMode:!0,loading:!1,authentication:{enterpriseName:"",legalPersonName:"",bankAccount:"",businessLicensePhoto:"",unifiedSocialCreditCode:"",address:""},rules:{enterpriseName:[{required:!0,message:"请输入公司名称",trigger:"blur"},{min:3,max:50,message:"机构名称长度在 3 到 50 个字符",trigger:"blur"}],businessLicensePhoto:[{validator:function(e,t,i){console.log(t),null==t||""==t?i(new Error("公司营业执照不能为空")):i()},trigger:"blue"}],legalPersonName:[{required:!0,message:"请输入公司法人姓名",trigger:"blur"}],bankAccount:[{required:!0,message:"请输入对公账户",trigger:"blur"},{min:16,max:19,message:"对公账户输入有误",trigger:"blur"},{validator:function(t,i,n){e.checkNumber(i)?n():n(new Error("对公账户输入有误"))},trigger:"blur"}],unifiedSocialCreditCode:[{required:!0,message:"请输入统一社会信用代码",trigger:"blur"},{validator:function(t,i,n){e.checkNumberAndWord(i)?n():n(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(s.a)("error","表单填写错误!"),!1;e.showLoading();var i={userId:e.user.userVO.id,enterpriseName:e.authentication.enterpriseName,legalPersonName:e.authentication.legalPersonName,businessLicensePhoto:e.authentication.businessLicensePhoto,unifiedSocialCreditCode:e.authentication.unifiedSocialCreditCode,bankAccount:e.authentication.bankAccount,address:e.authentication.address};Object(o.S)(e.user.userVO.id,i,e.submitInfoSuccess,e.submitInfoFail)})},submitInfoSuccess:function(e){var t=this;console.log(e),Object(o.v)().then(function(e){Object(o.K)("user",e),t.user=e,t.sendBusMessage(),Object(o.K)("rolesPermissions",Object(o.B)(e.roleList)),t.hideLoading(),t.$alert("认证信息提交成功,将于3个工作日内审核完成","提交成功",{confirmButtonText:"确定",callback:function(e){t.$router.push({name:"EnterpriseAuthentication",params:{userId:t.user.userVO.id}})}})}).catch(function(e){t.hideLoading(),Object(s.a)("error","重新获取用户信息失败:"+e.data)})},submitInfoFail:function(e){this.hideLoading(),Object(s.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(s.a)("error","单个文件大小不能超过10M"),!1;var t=e.name,i=t.lastIndexOf(".");if(i<=0)return Object(s.a)("error","只能上传png/jpg格式的文件"),!1;var n=t.substr(i);return".jpg"!==n&&".png"!==n?(Object(s.a)("error","只能上传png/jpg格式的文件"),!1):void 0},uploadFile:function(e){var t=this;this.showLoading();var i=new FormData;i.append("file",e.file),n.a.upload(a.a.FILE.UPLOAD_IMAGE.replace("{userId}",this.user.userVO.id),i,{headers:{"Content-Type":"multipart/form-data"}}).then(function(e){t.hideLoading(),console.log("上传成功"),t.authentication.businessLicensePhoto=e.data,console.log(e.data),Object(s.a)("success","上传成功"),t.$refs.authentication.validateField("businessLicensePhoto")}).catch(function(e){t.hideLoading();try{413===e.response.status?Object(s.a)("error","文件过大,请选择小于20M的图片"):500===e.response.status&&Object(s.a)("error","上传文件发生错误,请稍后重试")}catch(t){Object(s.a)("error",e.data)}})},setUserInfo:function(){this.user=Object(o.J)("user")},test:function(){},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)},checkNumberAndWord:function(e){return/^[^_IOZSVa-z\W]{2}\d{6}[^_IOZSVa-z\W]{10}$/g.test(e)||/^[A-Za-z0-9]\w{14}$/g.test(e)}}},u={render:function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}],staticClass:"create-container"},[i("div",{staticClass:"create-body"},[i("div",{staticClass:"title"},[e._v("企业信息认证")]),e._v(" "),i("el-form",{ref:"authentication",staticClass:"demo-report",attrs:{model:e.authentication,rules:e.rules,"label-width":"15%"}},[i("el-form-item",{attrs:{label:"公司名",prop:"enterpriseName"}},[e.isModifyMode?i("el-input",{attrs:{size:"small"},model:{value:e.authentication.enterpriseName,callback:function(t){e.$set(e.authentication,"enterpriseName",t)},expression:"authentication.enterpriseName"}}):e._e()],1),e._v(" "),i("el-form-item",{attrs:{label:"公司营业执照",prop:"businessLicensePhoto"}},[i("el-upload",{staticClass:"avatar-uploader",attrs:{action:"https://jsonplaceholder.typicode.com/posts/","show-file-list":!1,"http-request":e.uploadFile,"before-upload":e.beforeFileUpload}},[e.authentication.businessLicensePhoto?i("img",{staticClass:"avatar",attrs:{src:e.authentication.businessLicensePhoto}}):i("i",{staticClass:"el-icon-plus avatar-uploader-icon"})])],1),e._v(" "),i("el-form-item",{attrs:{label:"公司法人姓名",prop:"legalPersonName"}},[e.isModifyMode?i("el-input",{attrs:{size:"small"},model:{value:e.authentication.legalPersonName,callback:function(t){e.$set(e.authentication,"legalPersonName",t)},expression:"authentication.legalPersonName"}}):e._e()],1),e._v(" "),i("el-form-item",{attrs:{label:"统一社会信用代码",prop:"unifiedSocialCreditCode"}},[e.isModifyMode?i("el-input",{attrs:{size:"small"},model:{value:e.authentication.unifiedSocialCreditCode,callback:function(t){e.$set(e.authentication,"unifiedSocialCreditCode",t)},expression:"authentication.unifiedSocialCreditCode"}}):e._e()],1),e._v(" "),i("el-form-item",{attrs:{label:"公司地址",prop:"address"}},[e.isModifyMode?i("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?i("el-form-item",[i("div",{staticClass:"btn btn-primary btn-info",on:{click:function(t){return e.submitInfo()}}},[e._v("提交")])]):e._e()],1)],1)])},staticRenderFns:[]};var c=i("VU/8")(r,u,!1,function(e){i("AhyU")},"data-v-4312953e",null);t.default=c.exports}});