webpackJsonp([41],{oO1F:function(e,t){},onCQ: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:"EnterpriseAuthentication",data:function(){var e=this;return{userId:0,user:{},isModifyMode:!1,loading:!1,authentication:{enterpriseName:"",legalPersonName:"",bankAccount:"",businessLicensePhoto:o.c.image,unifiedSocialCreditCode:"",address:"",authStatus:{text:"审核中",style:"warning"},explain:""},rules:{enterpriseName:[{required:!0,message:"请输入公司名称",trigger:"blur"},{min:3,max:50,message:"机构名称长度在 3 到 50 个字符",trigger:"blur"}],businessLicensePhoto:[{validator:function(e,t,i){null==t||""==t?i(new Error("公司营业执照不能为空")):i()},trigger:"blur"}],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(),this.getAuthInfo()},getAuthInfo:function(){this.showLoading(),Object(o.t)(this.user.userVO.id,this.getAuthInfoSuccess,this.getAuthInfoFail)},getAuthInfoSuccess:function(e){this.hideLoading(),this.authentication.enterpriseName=null==e.enterpriseName?"暂未填写":e.enterpriseName,this.authentication.legalPersonName=null==e.legalPersonName?"暂未填写":e.legalPersonName,this.authentication.businessLicensePhoto=null==e.businessLicensePhoto?o.c.image:e.businessLicensePhoto,this.authentication.unifiedSocialCreditCode=null==e.unifiedSocialCreditCode?"暂未填写":e.unifiedSocialCreditCode,this.authentication.bankAccount=null==e.bankAccount?"暂未填写":e.bankAccount,this.authentication.address=null==e.address?"暂未填写":e.address,this.authentication.authStatus=e.authStatus,this.authentication.explain=e.explain,console.log(this.authentication)},getAuthInfoFail:function(e){this.hideLoading(),Object(s.a)("error","加载认证信息失败:"+e.data)},modifyInfo:function(){this.isModifyMode=!0},updateAuthInfo: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.O)(e.user.userVO.id,i,e.updateAuthInfoSuccess,e.updateAuthInfoFail)})},updateAuthInfoSuccess:function(e){var t=this;this.hideLoading(),this.cancelModify(),console.log(e),this.authentication.enterpriseName=null==e.enterpriseName?"暂未填写":e.enterpriseName,this.authentication.legalPersonName=null==e.legalPersonName?"暂未填写":e.legalPersonName,this.authentication.businessLicensePhoto=null==e.businessLicensePhoto?o.c.image:e.businessLicensePhoto,this.authentication.unifiedSocialCreditCode=null==e.unifiedSocialCreditCode?"暂未填写":e.unifiedSocialCreditCode,this.authentication.bankAccount=null==e.bankAccount?"暂未填写":e.bankAccount,this.authentication.address=null==e.address?"暂未填写":e.address,Object(s.a)("success","认证信息修改成功,正在为您刷新用户信息"),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(),Object(s.a)("success","用户信息刷新成功")}).catch(function(e){t.hideLoading(),Object(s.a)("error","重新获取用户信息失败:"+e.data)})},updateAuthInfoFail: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","上传成功")}).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",{staticClass:"create-container"},[i("div",{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}],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",{model:{value:e.authentication.enterpriseName,callback:function(t){e.$set(e.authentication,"enterpriseName",t)},expression:"authentication.enterpriseName"}}):e._e(),e._v(" "),e.isModifyMode?e._e():i("span",[e._v(e._s(e.authentication.enterpriseName))])],1),e._v(" "),i("el-form-item",{attrs:{label:"公司营业执照",prop:"businessLicensePhoto"}},[e.isModifyMode?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"})]):e._e(),e._v(" "),e.isModifyMode?e._e():i("span",[i("el-image",{staticStyle:{width:"100px"},attrs:{src:e.authentication.businessLicensePhoto,fit:"scale-down"}})],1)],1),e._v(" "),e.isModifyMode?e._e():i("el-form-item",{attrs:{label:"认证状态",prop:"name"}},[i("el-tag",{attrs:{type:e.authentication.authStatus.style}},[e._v(e._s(e.authentication.authStatus.text))])],1),e._v(" "),e.isModifyMode||"认证失败"!=e.authentication.authStatus.text?e._e():i("el-form-item",{attrs:{label:"失败原因",prop:"name"}},[null!=e.authentication.explain&&""!=e.authentication.explain?i("el-link",{attrs:{type:"danger",disabled:""}},[e._v("\n "+e._s(e.authentication.explain)+"\n ")]):e._e(),e._v(" "),null==e.authentication.explain||""==e.authentication.explain?i("el-link",{attrs:{type:"danger",disabled:""}},[e._v("管理员未填写\n ")]):e._e()],1),e._v(" "),i("el-form-item",{attrs:{label:"公司法人姓名",prop:"legalPersonName"}},[e.isModifyMode?i("el-input",{model:{value:e.authentication.legalPersonName,callback:function(t){e.$set(e.authentication,"legalPersonName",t)},expression:"authentication.legalPersonName"}}):e._e(),e._v(" "),e.isModifyMode?e._e():i("span",[e._v(e._s(e.authentication.legalPersonName))])],1),e._v(" "),i("el-form-item",{attrs:{label:"统一社会信用代码",prop:"unifiedSocialCreditCode"}},[e.isModifyMode?i("el-input",{model:{value:e.authentication.unifiedSocialCreditCode,callback:function(t){e.$set(e.authentication,"unifiedSocialCreditCode",t)},expression:"authentication.unifiedSocialCreditCode"}}):e._e(),e._v(" "),e.isModifyMode?e._e():i("span",[e._v(e._s(e.authentication.unifiedSocialCreditCode))])],1),e._v(" "),i("el-form-item",{attrs:{label:"公司地址",prop:"address"}},[e.isModifyMode?i("el-input",{model:{value:e.authentication.address,callback:function(t){e.$set(e.authentication,"address",t)},expression:"authentication.address"}}):e._e(),e._v(" "),e.isModifyMode?e._e():i("span",[e._v(e._s(e.authentication.address))])],1),e._v(" "),e.isModifyMode?e._e():i("el-form-item",[i("div",{staticClass:"btn btn-medium btn-info",on:{click:function(t){return e.modifyInfo()}}},[e._v("修改")])]),e._v(" "),e.isModifyMode?i("el-form-item",[i("div",{staticClass:"btn btn-primary btn-info",on:{click:function(t){return e.updateAuthInfo()}}},[e._v("提交")]),e._v(" "),i("div",{staticClass:"btn btn-primary",on:{click:function(t){return e.cancelModify()}}},[e._v("取消")])]):e._e()],1)],1)])},staticRenderFns:[]};var c=i("VU/8")(r,u,!1,function(e){i("oO1F")},"data-v-1f8e7aa9",null);t.default=c.exports}});