|
@@ -0,0 +1,292 @@
|
|
|
+var registerPage = new Vue({
|
|
|
+ el: "#registerPage",
|
|
|
+ data: {
|
|
|
+
|
|
|
+ loginLoading:false,
|
|
|
+ showSupplierConfirm:true,
|
|
|
+ supplierUser: {
|
|
|
+ userID:0,
|
|
|
+ shopID:0,
|
|
|
+ linkMan:'',
|
|
|
+ email:'',
|
|
|
+ name:'',
|
|
|
+ sname:'',
|
|
|
+ socialCreditCode:'',
|
|
|
+ businessLicenseImage:'',
|
|
|
+ provinceID :'',
|
|
|
+ cityID : '',
|
|
|
+ townID : '',
|
|
|
+ address:'',
|
|
|
+ firstShopType:'',
|
|
|
+ secondShopType: '',
|
|
|
+ mainpro:'',
|
|
|
+ isAgreed:1,
|
|
|
+ },
|
|
|
+ isAgree:true,
|
|
|
+ isShowAgree:false,
|
|
|
+ mentuzCampNullList:[
|
|
|
+ {value:'1',name:'产品'},
|
|
|
+ {value:'2',name:'仪器'},
|
|
|
+ {value:'3',name:'服务'}
|
|
|
+ ],
|
|
|
+ shopMainPros: [],
|
|
|
+ formData:new FormData(),
|
|
|
+ mainProEdit: '',
|
|
|
+ ProvinceList:[],
|
|
|
+ cityArray:[],
|
|
|
+ townArray:[],
|
|
|
+ addressfrom: {
|
|
|
+ province: '',//省id
|
|
|
+ city: '',
|
|
|
+ town: ''
|
|
|
+ },
|
|
|
+ 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: "^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{8,16}$"
|
|
|
+ },
|
|
|
+ infoData:{},
|
|
|
+ flagshow:false,
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ shopInfo:function(){
|
|
|
+ var _this = this;
|
|
|
+ SupplierApi.shopInfo({userId:_this.supplierUser.userId},function(res){
|
|
|
+ if(res.code==0){
|
|
|
+ var shop = res.data.shop;
|
|
|
+ var user = res.data.user;
|
|
|
+ _this.supplierUser.name = shop.name;
|
|
|
+ _this.supplierUser.linkMan = shop.linkMan;
|
|
|
+ _this.supplierUser.email = user.email;
|
|
|
+ _this.supplierUser.sname = shop.sname;
|
|
|
+ _this.supplierUser.provinceID = shop.provinceID;
|
|
|
+ _this.supplierUser.cityID = shop.cityID;
|
|
|
+ _this.supplierUser.townID = shop.townID;
|
|
|
+ _this.supplierUser.address = shop.address;
|
|
|
+ _this.supplierUser.socialCreditCode = shop.socialCreditCode;
|
|
|
+ _this.supplierUser.businessLicenseImage = shop.businessLicenseImage;
|
|
|
+ _this.supplierUser.firstShopType = shop.firstShopType;
|
|
|
+ _this.supplierUser.secondShopType = shop.secondShopType;
|
|
|
+ if(shop.mainpro != "" && shop.mainpro != null){
|
|
|
+ _this.mentuzCampNullList = _this.setNewMainpro(shop.mainpro);
|
|
|
+ _this.mentuzCampNullList.forEach(function (item) {
|
|
|
+ if(item.checked){
|
|
|
+ _this.shopMainPros.push(item.name)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if(shop.cityID!=''&&shop.cityID!=null){
|
|
|
+ _this.ChangeGetcity()
|
|
|
+ }
|
|
|
+ if(shop.townID!=''&&shop.townID!=null){
|
|
|
+ _this.ChangeGetcTown();
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ CAIMEI.Alert(res.msg,'确定',false);
|
|
|
+ }
|
|
|
+
|
|
|
+ })
|
|
|
+ },
|
|
|
+ supplierRegister: function(){//供应商修改资料提交
|
|
|
+ var _self = this;
|
|
|
+ var pass = verifyForm();
|
|
|
+ if (_self.loginLoading) { return false; }
|
|
|
+ this.$nextTick(function() {
|
|
|
+ if (!pass) {return false;}
|
|
|
+ if (!_self.isAgree){
|
|
|
+ _self.isShowAgree = true;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(_self.supplierUser.townID == 0 || _self.supplierUser.address==''){
|
|
|
+ _self.flagshow = true;
|
|
|
+ setTimeout(function () {
|
|
|
+ _self.flagshow = false;
|
|
|
+ },2000)
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if(_self.supplierUser.businessLicenseImage==''||_self.supplierUser.businessLicenseImage==null){
|
|
|
+ $('#formbusinessLicenseImage').parent().addClass("error").find('.checked').removeClass("show");
|
|
|
+ $('#formbusinessLicenseImage').siblings('.errTips').text('请上传营业执照图片').addClass("show");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if(_self.supplierUser.firstShopType == ''){
|
|
|
+ $('#firstClubType').parent().addClass("error");
|
|
|
+ $('#firstClubType').siblings('.errTips').text('请选择机构类型').addClass("show");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if(_self.shopMainPros == ''){
|
|
|
+ $('#secondShopType').parent().addClass("error");
|
|
|
+ $('#secondShopType').siblings('.errTips').text('请选择主营内容').addClass("show");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ _self.loginLoading = true;
|
|
|
+ _self.supplierUser.mainpro = _self.shopMainPros.join("/");
|
|
|
+ UserApi.UpdateCompanyInfo(_self.supplierUser,function (response) {
|
|
|
+ if(response.code === 0){
|
|
|
+ CAIMEI.Alert('您的资料已提交成功,系统将在1-2个工作日内进行审核~','知道了',true,function () {
|
|
|
+ window.location.href = '/index.html';
|
|
|
+ _self.loginLoading = false;
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ CAIMEI.Alert(response.msg,'确定',false);
|
|
|
+ _self.loginLoading = false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ ChangeFirstClubType:function(event){
|
|
|
+ $('#firstClubType').parent().removeClass("error");
|
|
|
+ $('#firstClubType').siblings('.errTips').removeClass("show");
|
|
|
+ },
|
|
|
+ ChangeSecondShopType:function(event){
|
|
|
+ $('#secondShopType').parent().removeClass("error");
|
|
|
+ $('#secondShopType').siblings('.errTips').removeClass("show");
|
|
|
+ },
|
|
|
+ GetProvinceFn: function(){//获取全部省份
|
|
|
+ var _this = this;
|
|
|
+ PublicApi.GetProvince({},function(response){
|
|
|
+ if(response.code == 0){
|
|
|
+ _this.ProvinceList =response.data;
|
|
|
+ }else{
|
|
|
+ CAIMEI.Alert(response.msg,'确定',false);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ 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.supplierUser.businessLicenseImage = response.data;
|
|
|
+ $('#formbusinessLicenseImage').parent().removeClass("error");
|
|
|
+ $('#formbusinessLicenseImage').siblings('.errTips').removeClass("show");
|
|
|
+ event.target.value = '';
|
|
|
+ });
|
|
|
+ },
|
|
|
+ deleteBusinessImage:function(){//清楚营业执照图片
|
|
|
+ this.supplierUser.businessLicenseImage = '';
|
|
|
+ },
|
|
|
+ ChangeProvince:function () {
|
|
|
+ var _this = this;
|
|
|
+ if (_this.supplierUser.provinceID!=0){
|
|
|
+ _this.supplierUser.provinceID = event.target.value;
|
|
|
+ _this.ChangeGetcity();
|
|
|
+ _this.supplierUser.cityID = 0;
|
|
|
+ }else {
|
|
|
+ _this.cityArray=[];
|
|
|
+ _this.townArray=[];
|
|
|
+ _this.supplierUser.townID=0;
|
|
|
+ _this.supplierUser.cityID = 0;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ ChangeGetcity:function(event){//加载市
|
|
|
+ var _this = this;
|
|
|
+ PublicApi.GetCity({ provinceId: _this.supplierUser.provinceID },function(response){
|
|
|
+ if(response.code == 0 ){
|
|
|
+ _this.cityArray = response.data;
|
|
|
+ _this.supplierUser.cityID = event.target.value;
|
|
|
+ if(_this.supplierUser.cityID==0){
|
|
|
+ _this.townArray=[];
|
|
|
+ _this.supplierUser.townID = 0;
|
|
|
+ }else {
|
|
|
+ _this.ChangeGetcTown();
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ CAIMEI.Alert(response.msg,'确定',false);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ ChangeGetcTown:function(event){//选择地区
|
|
|
+ var _this = this;
|
|
|
+ PublicApi.GetTown({ cityId: _this.supplierUser.cityID },function(response){
|
|
|
+ if(response.code == 0 ){
|
|
|
+ _this.townArray = response.data;
|
|
|
+ _this.supplierUser.townID = event.target.value;
|
|
|
+ console.log(_this.supplierUser.townID)
|
|
|
+ }else{
|
|
|
+ CAIMEI.Alert(response.msg,'确定',false);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ mainProAdd: function(){//添加主营内容
|
|
|
+ var _self = this;
|
|
|
+ if(_self.mainProEdit==''){
|
|
|
+ CAIMEI.dialog('请输入主营内容!',false);
|
|
|
+ return
|
|
|
+ }
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ setNewMainpro:function(arr){//回显处理主营内容
|
|
|
+ var newArr = [];
|
|
|
+ arr.split('/').forEach(function(item,index){
|
|
|
+ newArr.push({value:(index+1).toString(),'name':item,checked:true});
|
|
|
+ });
|
|
|
+ return newArr
|
|
|
+ },
|
|
|
+ checkedArray:function(content,arr){//判断主营内容是否已存在
|
|
|
+ for(var i in arr){
|
|
|
+ if(arr[i].name == content){
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ },
|
|
|
+ showPassword: function(event) {//密码眼睛切换
|
|
|
+ var el = event.currentTarget;
|
|
|
+ var pwdEle = $(el).siblings('input');
|
|
|
+ if(pwdEle.attr('type') === 'password') {
|
|
|
+ $(el).addClass('on');
|
|
|
+ pwdEle.attr('type','text');
|
|
|
+ } else {
|
|
|
+ $(el).removeClass('on');
|
|
|
+ pwdEle.attr('type','password');
|
|
|
+ }
|
|
|
+ },
|
|
|
+ blurHandle: function(event) { // 失去焦点校验
|
|
|
+ var el = event.currentTarget;
|
|
|
+ verifyHandle(el);
|
|
|
+ },
|
|
|
+ showSupplier:function () {//同意
|
|
|
+ var _self = this;
|
|
|
+ _self.showSupplierConfirm = false;
|
|
|
+ },
|
|
|
+ checkedIsAgreeFn:function () {//勾选协议
|
|
|
+ var _self = this;
|
|
|
+ _self.isAgree = !_self.isAgree;
|
|
|
+ if (_self.isAgree){
|
|
|
+ _self.isShowAgree = false;
|
|
|
+ _self.supplierUser.isAgreed = 1;
|
|
|
+ }else{
|
|
|
+ _self.isShowAgree = true;
|
|
|
+ _self.supplierUser.isAgreed = 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created: function () {
|
|
|
+
|
|
|
+ },
|
|
|
+ mounted: function () {
|
|
|
+ var _self = this;
|
|
|
+ if(globalUserData) {
|
|
|
+ _self.supplierUser.userId = globalUserData.userId;
|
|
|
+ _self.supplierUser.shopId = globalUserData.shopId;
|
|
|
+ }
|
|
|
+ _self.infoData = JSON.parse(CAIMEI.Storage.getItem('userInfo'));
|
|
|
+ _self.shopInfo();
|
|
|
+ _self.GetProvinceFn();
|
|
|
+ }
|
|
|
+});
|