; var information = new Vue({ el:'#information', data:{ tabCurrentIndex:1, loginLoading: false, isRequset:true, params:{ userId:'', shopId:'', townId:'', provinceId: '',//省id cityId: '', address:'', name:'',//公司名称 shortName:'',//公司简称 linkMan:'',//联系人 contractEmail:'',// contractPhone:'',//固定电话 faxNumber:'',//传真 legalPerson:'',//法人代表 registeredCapital:'',//注册资本 companyNature:'',//公司性质 turnover:'',//年营业额 }, form:{ townID:'', provinceID: '',//省id cityID: '', }, params2:{ userId:'', shopId:'', firstShopType:'',//公司类型 1医疗 2非医疗 secondShopType:'',//医疗下的二级分类 medicalPracticeLicense:'',//资质 mainProduct:'',//主营产品 businessScope:'',//经营内容 website:'', //公司网址 wxOfficialAccount:'',//微信公众号 wxApplets:'',//微信小程序 shopDesc:'',//公司介绍 mainProductDesc:'',//主打说明 }, params3:{ socialCreditCode:'',//营业执照编号 businessLicense:'',//营业执照 logo:'',//公司logo operationLicence:'',//生产 hygienicLicense:'',//卫生 taxLicense:'',//税务 honorCertification:'',//荣誉 productCertification:'',//产品 }, mainProEdit: '', shopScopeEdit:'', formData:new FormData(), HonorImagesList:[], productImagesList:[], mentuzCampNullList:[ {value:'1',name:'产品',checked:false}, {value:'2',name:'仪器',checked:false}, {value:'3',name:'服务',checked:false} ], Scopelist:[ {value:'1',name:'仪器护理类',checked:false}, {value:'2',name:'护肤品类',checked:false}, {value:'3',name:'纹绣类',checked:false}, {value:'4',name:'美体内衣',checked:false}, {value:'5',name:'整形耗材',checked:false}, {value:'6',name:'国际品牌',checked:false}, {value:'7',name:'美胸类',checked:false}, {value:'8',name:'健康保健类',checked:false}, {value:'9',name:'面膜类',checked:false}, {value:'10',name:'抗衰老',checked:false}, {value:'11',name:'生殖保养',checked:false}, {value:'12',name:'健康养生',checked:false}, {value:'13',name:'纤体减肥',checked:false} ], 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:'^[1-9]+(.[0-9]{2})?$' }, provinceArray:[], cityArray: [],//市 townArray: [],//区 }, methods:{ //图片放大 showViewerbigImage:function(){ var viewer = new Viewer(document.getElementById('uploadImage')); }, showViewerImageFn:function(){ var viewer = new Viewer(document.getElementById('businessImage')); }, showViewerImageFn1:function(){ var viewer = new Viewer(document.getElementById('logoImage')); }, showViewerImageFn2:function(){ var viewer = new Viewer(document.getElementById('zizhiImage')); }, showViewerImageFn3:function(){ var viewer = new Viewer(document.getElementById('hygienicImage')); }, showViewerImageFn4:function(){ var viewer = new Viewer(document.getElementById('taxImage')); }, showViewerImageFn5:function(){ var viewer = new Viewer(document.getElementById('HonorImages')); }, showViewerImageFn6:function(){ var viewer = new Viewer(document.getElementById('productImages')); }, shopInfo:function(){ var _this = this; SupplierApi.shopInfo({userId:_this.params.userId},function(res){ if(res.code==0){ console.log('asda-=======',res.data); _this.isRequset=false; var shop = res.data.shop; var user = res.data.user; _this.params.name = shop.name; _this.params.shortName = shop.shortName; _this.params.linkMan = shop.linkMan; _this.params.contractEmail = shop.contractEmail; _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.faxNumber = shop.faxNumber; _this.params.legalPerson = shop.legalPerson; _this.params.registeredCapital = shop.registeredCapital; _this.params.companyNature = shop.companyNature; _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.medicalPracticeLicense = shop.medicalPracticeLicense; _this.params2.website = shop.website; _this.params2.wxOfficialAccount = shop.wxOfficialAccount; _this.params2.wxApplets = shop.wxApplets; _this.params2.shopDesc = shop.shopDesc; _this.params2.mainProductDesc = shop.mainProductDesc; _this.params3.socialCreditCode = shop.socialCreditCode; _this.params3.businessLicense = shop.businessLicense; _this.params3.logo = shop.logo; _this.params3.operationLicence = shop.operationLicence; _this.params3.hygienicLicense = shop.hygienicLicense; _this.params3.taxLicense = shop.taxLicense; _this.params3.honorCertification = shop.honorCertification; _this.params3.productCertification = shop.productCertification; _this.HonorImagesList = shop.honorCertification; _this.productImagesList = shop.productCertification; if(shop.mainpro != "" && shop.mainProduct != null){ _this.mentuzCampNullList = _this.setNewMainpro(shop.mainProduct); _this.mentuzCampNullList.forEach(function (item) { if(item.checked){ _this.shopMainPros.push(item.name) } }) } if(shop.businessScope != "" && shop.businessScope != null){ _this.Scopelist = _this.setNewScope(shop.businessScope); _this.Scopelist.forEach(function (item) { if(item.checked){ _this.shopScope.push(item.name) } }) } if(shop.cityId!=''&&shop.cityId!=null){ _this.getcity() } if(shop.townId!=''&&shop.townId!=null){ _this.getcTown(); } } }) }, changeMainPros:function(event){ var _this = this; var values = event.target.value; if(event.target.checked){ _this.shopMainPros.push(values) }else { _this.shopMainPros.splice(_this.shopMainPros.indexOf(values), 1); } }, changeScope:function(event){ var _this = this; var values = event.target.value; if(event.target.checked){ _this.shopScope.push(values) }else { _this.shopScope.splice(_this.shopScope.indexOf(values), 1); } }, shopSubmit:function(){ //提交 var _self = this; var params = {}; var pass = verifyForm(); if (_self.loginLoading) { return false; } this.$nextTick(function() { if (!pass) {return false;} if(_self.tabCurrentIndex==1){ params = _self.params; }else if(_self.tabCurrentIndex==2){ _self.params2.mainProduct = _self.shopMainPros.join("/"); _self.params2.businessScope = _self.shopScope.join("/"); params = _self.params2 }else if(_self.tabCurrentIndex==3){ params = _self.params3 } if(_self.params2.website!=''){ var WebRegExp = new RegExp(/^((http|ftp|https):\/\/[a-zA-Z0-9]|[a-zA-Z0-9])[-a-zA-Z0-9]{0,62}(.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+.?$/); if (!WebRegExp.test(_self.params2.website)) { $('#website').parent().addClass("error"); $('#website').siblings('.errTips').text('请填写正确的网址').addClass("show"); return false; } } params = Object.assign(_self.params,_self.params2,_self.params3); SupplierApi.modifiedData(params,function (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.medicalPracticeLicense = 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.businessLicense = 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.operationLicence = 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.honorCertification =_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.operationLicence = ''; }, deletelogoImage:function(){//删除logo图片 this.params3.logo = ''; }, deleteBusinessImage:function(){//删除营业执照图片 this.params3.businessLicense = ''; }, deleteMedicalImage:function(){//删除医疗执照图片 this.params2.medicalPracticeLicense = ''; }, removeGoodsImagesFn: function(index){//删除荣誉图片 var _this = this; _this.HonorImagesList.splice(index,1); _this.params3.honorCertification =_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; console.log( this.tabCurrentIndex); }, province:function () { var _this = this; _this.params.provinceId = event.target.value; if(_this.params.provinceId==0){//省为请选择时市区初始化 _this.cityArray=[]; _this.townArray=[]; _this.params.townId=0; _this.params.cityId = 0; }else { _this.getcity(); _this.params.cityId = 0; } }, 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==0){ _this.townArray=[]; _this.params.townId = 0; }else { _this.getcTown(); _this.params.townId = 0; } } }) }, 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; }else{ CAIMEI.Alert(response.msg, '确定', false); } }) }, setNewMainpro:function(arr){//回显处理主营内容 var newArr = []; arr.split('/').forEach(function(item,index){ newArr.push({value:(index+1).toString(),'name':item,checked:true}); }); return newArr }, setNewScope:function(arr) {//回显处理主营内容 var newArr = []; arr.split('/').forEach(function(item,index){ newArr.push({value:(index+1).toString(),'name':item,checked:true}); }); 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"); } })