jqMultipleShow("click", ".navList", ".tab", ".con"); var information = new Vue({ el:'#information', data:{ tabCurrentIndex:1, loginLoading: false, isRequset:true, params:{ userID:'', shopID:'', townID:'', provinceID: '',//省id cityID: '', address:'', name:'',//公司名称 sname:'',//公司简称 linkMan:'',//联系人 email:'',// contractPhone:'',//固定电话 fax:'',//传真 legalPerson:'',//法人代表 registeredCapital:'',//注册资本 nature:'',//公司性质 turnover:'',//年营业额 }, params2:{ userID:'', shopID:'', firstShopType:'',//公司类型 1医疗 2非医疗 secondShopType:'',//医疗下的二级分类 medicalPracticeLicenseImg1:'',//资质 mainpro:'',//主营产品 businessScope:'',//经营内容 info:'',//公司介绍 productDesc:'',//主打说明 }, params3:{ socialCreditCode:'',//营业执照编号 businessLicenseImage:'',//营业执照 logo:'',//公司logo productionLicence:'',//生产 hygienicLicense:'',//卫生 taxLicense:'',//税务 certificateHonor:'',//荣誉 productCertification:'',//产品 }, mainProEdit: '', shopScopeEdit:'', formData:new FormData(), HonorImagesList:[], productImagesList:[], mentuzCampNullList:[ {value:'1',name:'产品'}, {value:'2',name:'仪器'}, {value:'3',name:'服务'} ], Scopelist:[ {value:'1',name:'仪器护理类'}, {value:'2',name:'护肤品类'}, {value:'3',name:'纹绣类'}, {value:'4',name:'美体内衣'}, {value:'5',name:'整形耗材'}, {value:'6',name:'国际品牌'}, {value:'7',name:'美胸类'}, {value:'8',name:'健康保健类'}, {value:'9',name:'面膜类'}, {value:'10',name:'抗衰老'}, {value:'11',name:'生殖保养'}, {value:'12',name:'健康养生'}, {value:'13',name:'纤体减肥'} ], shopMainPros: [], shopScope:[], rule:{ name: '^[a-zA-Z\\u4e00-\\u9fa5]{2,}$', phone: '^\\d{6,12}$', code: '^\\d{6}$', license: '^[a-zA-Z0-9_]{18}$', email: '^(([^<>()\\[\\]\\\\.,;:\\s@"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@"]+)*)|(".+"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$', password: "^[^\\u4e00-\\u9fa5]{8,16}$", num:'/[^0-9]+/g' }, provinceArray:[], cityArray: [],//市 townArray: [],//区 }, methods:{ shopInfo:function(){ var _this = this; SupplierApi.shopInfo({userId:_this.params.userID},function(res){ if(res.code==0){ _this.isRequset=false; var shop = res.data.shop; var user = res.data.user; _this.params.name = shop.name; _this.params.sname = shop.sname; _this.params.linkMan = shop.linkMan; _this.params.email = user.email; _this.params.address = shop.provincialAddress; _this.params.provinceID = shop.provinceID; _this.params.cityID = shop.cityID; _this.params.townID = shop.townID; _this.params.contractPhone = shop.contractPhone; _this.params.fax = shop.fax; _this.params.legalPerson = shop.legalPerson; _this.params.registeredCapital = shop.registeredCapital; _this.params.nature = shop.nature; _this.params.turnover = shop.turnover; _this.shopMainPros = _this.setNewMainpro(shop.mainpro); _this.shopScope = _this.setNewScope(shop.businessScope); _this.params2.firstShopType = shop.firstShopType; _this.params2.secondShopType = shop.secondShopType; _this.params2.medicalPracticeLicenseImg1 = shop.medicalPracticeLicenseImg1; _this.params2.info = shop.info; _this.params2.productDesc = shop.productDesc; _this.params3.socialCreditCode = shop.socialCreditCode; _this.params3.businessLicenseImage = shop.businessLicenseImage; _this.params3.logo = shop.logo; _this.params3.productionLicence = shop.productionLicence; _this.params3.hygienicLicense = shop.hygienicLicense; _this.params3.taxLicense = shop.taxLicense; _this.params3.certificateHonor = shop.hygienicLicense; _this.HonorImagesList = res.data.certificateHonor; _this.productImagesList = res.data.productCertification; } }) }, shopSubmit:function(){ //提交 var _self = this; var params = {}; var pass = verifyForm(); if (_self.loginLoading) { return false; } this.$nextTick(function() { if (!pass) {return false;} _self.params2.mainpro = _self.shopMainPros.join("/"); _self.params2.businessScope = _self.shopScope.join("/"); if(_self.tabCurrentIndex==1){ params = _self.params; }else if(_self.tabCurrentIndex==2){ params = _self.params2 }else if(_self.tabCurrentIndex==3){ params = _self.params3 } console.log(params) SupplierApi.modifiedData(params,function (res) { console.log(res) if(res.code === 0){ CAIMEI.dialog('修改成功',true,function () { window.location.href='/supplier/dashboard.html'; _self.loginLoading = false; }); } else { CAIMEI.Alert(res.msg,'确定',false); _self.loginLoading = false; } }) }) }, mainProAdd: function(){//添加主营内容 var _self = this; if (_self.mainProEdit.length>0) { var obj = {name:_self.mainProEdit}; if(_self.checkedArray(_self.mainProEdit,_self.mentuzCampNullList)){ CAIMEI.dialog('主营内容已存在!',false); }else { _self.mentuzCampNullList.push(obj); } } }, shopScopeAdd:function(){ //经营内容 var _self = this; if (_self.shopScopeEdit.length>0) { var obj = {name:_self.shopScopeEdit}; if(_self.checkedArray(_self.shopScopeEdit,_self.Scopelist)){ CAIMEI.dialog('主营内容已存在!',false); }else { _self.Scopelist.push(obj); } } }, checkedArray:function(content,arr){//判断主营内容是否已存在 for(var i in arr){ if(arr[i].name == content){ return true; } } return false; }, uploadzizhiImageFn: function(event){//上传医疗资质 var _this = this; var inputDOM = _this.$refs.medicalPracticeLicenseImg1; var file = inputDOM.files; _this.formData.append('file', file[0]); PublicApi.uploadimg(_this.formData,function(response){ _this.params2.medicalPracticeLicenseImg1 = response.data; event.target.value = ''; }); }, uploadBusinessLicenseImageFn: function(event){//上传营业执照 var _this = this; var inputDOM = _this.$refs.businessLicenseImage; var file = inputDOM.files; _this.formData.append('file', file[0]); PublicApi.uploadimg(_this.formData,function(response){ _this.params3.businessLicenseImage = response.data; event.target.value = ''; }); }, uploadlogoImageFn: function(event){//上传公司logo var _this = this; var inputDOM = _this.$refs.logo; var file = inputDOM.files; _this.formData.append('file', file[0]); PublicApi.uploadimg(_this.formData,function(response){ _this.params3.logo = response.data; event.target.value = ''; }); }, uploadproductionLicenceImageFn: function(event){//上传生产 var _this = this; var inputDOM = _this.$refs.productionLicence; var file = inputDOM.files; _this.formData.append('file', file[0]); PublicApi.uploadimg(_this.formData,function(response){ _this.params3.productionLicence = response.data; event.target.value = ''; }); }, uploadhygienicLicenseImageFn: function(event){//上传卫生 var _this = this; var inputDOM = _this.$refs.hygienicLicense; var file = inputDOM.files; _this.formData.append('file', file[0]); PublicApi.uploadimg(_this.formData,function(response){ _this.params3.hygienicLicense = response.data; event.target.value = ''; }); }, uploadtaxLicenseImageFn: function(event){//上传税务 var _this = this; var inputDOM = _this.$refs.taxLicense; var file = inputDOM.files; _this.formData.append('file', file[0]); PublicApi.uploadimg(_this.formData,function(response){ _this.params3.taxLicense = response.data; event.target.value = ''; }); }, uploadHonorImageFn: function(event){//荣誉证书上传 var _this = this; var inputDOM = _this.$refs.Honor; var file = inputDOM.files; _this.formData.append('file', file[0]); PublicApi.uploadimg(_this.formData,function(response){ _this.HonorImagesList.push(response.data); _this.params3.certificateHonor =_this.HonorImagesList.toString()+','; event.target.value = ''; }); }, uploadproductImageFn: function(event){//产品证书上传 var _this = this; var inputDOM = _this.$refs.product; var file = inputDOM.files; _this.formData.append('file', file[0]); PublicApi.uploadimg(_this.formData,function(response){ _this.productImagesList.push(response.data); _this.params3.productCertification =_this.productImagesList.toString()+','; event.target.value = ''; }); }, deletaxImage:function(){//删除卫生 this.params3.taxLicense = ''; }, deletehygienicImage:function(){//删除卫生 this.params3.hygienicLicense = ''; }, deleteproducImage:function(){//删除生产 this.params3.productionLicence = ''; }, deletelogoImage:function(){//删除logo图片 this.params3.logo = ''; }, deleteBusinessImage:function(){//删除营业执照图片 this.params3.businessLicenseImage = ''; }, deleteMedicalImage:function(){//删除医疗执照图片 this.params2.medicalPracticeLicenseImg1 = ''; }, removeGoodsImagesFn: function(index){//删除荣誉图片 var _this = this; _this.HonorImagesList.splice(index,1); _this.params3.certificateHonor =_this.HonorImagesList.toString()+','; }, removeproductImagesFn: function(index){//删除产品图片 var _this = this; _this.productImagesList.splice(index,1); _this.params3.productCertification =_this.productImagesList.toString()+','; }, blurHandle: function(event) { // 失去焦点校验 var el = event.currentTarget; verifyHandle(el); }, checkedFn:function (index) { this.tabCurrentIndex = index; }, province:function () { var _this = this; _this.params.provinceID = event.target.value; if(_this.params.provinceID==''){//省为请选择时市区初始化 _this.cityArray=[]; _this.townArray=[]; _this.params.townID='' }else { _this.getcity(); } }, getcity:function(event){//加载市 var _this = this; PublicApi.GetCity({ provinceId: _this.params.provinceID },function(response){ if(response.code == 0 ){ _this.cityArray = response.data; _this.params.cityID = event.target.value; if(_this.params.cityID==''){ _this.townArray=[]; }else { _this.getcTown(); } } }) }, getcTown:function(event){ var _this = this; PublicApi.GetTown({cityId:_this.params.cityID},function(response){ if(response.code == 0 ){ _this.townArray = response.data; _this.params.townID = event.target.value; console.log(_this.params.townID) }else{ CAIMEI.Alert(response.msg, '确定', false); } }) }, setNewMainpro:function(arr){//回显处理主营内容 var newArr = []; arr.split('/').forEach(function(item){ newArr.push(item); }); return newArr }, setNewScope:function(arr){//回显处理主营内容 var newArr = []; arr.split('/').forEach(function(item){ newArr.push(item); }); return newArr }, }, mounted:function () { var _self=this; if(globalUserData){ _self.params.userID = globalUserData.userId; _self.params.shopID = globalUserData.shopId; _self.params2.userID = globalUserData.userId; _self.params2.shopID = globalUserData.shopId; _self.params3.userID = globalUserData.userId; _self.params3.shopID = globalUserData.shopId; }; _self.shopInfo(); PublicApi.GetProvince({},function(response){ //省份 if(response.code == 0){ console.log(response) _self.provinceArray = response.data }else{ CAIMEI.Alert(response.msg, '确定', false); } }); $('.navLayout').find('.navList').removeClass("on").find('.con').hide().find('a').removeClass("on"); $('.navLayout').find('.navList').eq(2).addClass("on").find('.con').show().find('a').eq(0).addClass("on"); } })