Browse Source

企业开店申请

gaoxm 7 years ago
parent
commit
286faa1bc3
1 changed files with 48 additions and 54 deletions
  1. 48 54
      components/register-saler/register/StepFirst.vue

+ 48 - 54
components/register-saler/register/StepFirst.vue

@@ -62,7 +62,7 @@
       <div class="row">
         <label class="col-sm-2 x-required">企业地址:</label>
         <div class="col-sm-5">
-          <input type="text" readonly aria-haspopup="true" aria-expanded="false" @click="onShowAddress" :style="!loginData.isSelf?'background-color: #eee;':''" :disabled="!loginData.isSelf" v-model="data.address" class="form-control" name="name" required="" placeholder="填写总部所在地详细地址" style="padding-left:20px;background-color: transparent;">
+          <input type="text" readonly aria-haspopup="true" aria-expanded="false" @click="onShowAddress" v-model="data.address" class="form-control" name="name" required="" placeholder="填写总部所在地详细地址" style="padding-left:20px;background-color: transparent;">
           <span class="fa fa-map-marker"></span>
           <div v-show="showAddressBox"
                @mouseenter="isInAddressBox = true"
@@ -310,23 +310,33 @@
     props: ['loginData', 'enterpriseData', 'businessImgUrl'],
     watch: {
       enterpriseData: function (val, oldVal) {
-        if (val !== {}) {
-          if (this.loginData.isSelf) {
-            this.initSelfData(val)
-            this.nameCheck(3)
-            this.nameTypeCheck()
-            this.licenceCheck(3)
-            this.addressCheck()
+        if (val.name) {  // 个人
+          this.initData(val)
+          this.nameCheck(3)
+          this.nameTypeCheck()
+          this.licenceCheck(3)
+          this.addressCheck()
 //            this.imgUrlCheck()
 //            this.lawPersonCheck()
 //            this.phoneCheck()
 //            this.emailCheck()
 //            this.faxCheck()
-            this.checkFullData()
-            this.submitRegisterData()
-          } else {
-            this.initEnterpriseData(val)
-          }
+          this.checkFullData()
+          this.submitRegisterData()
+        }
+        if (val.spaceName) {  // 企业
+          this.initData(val)
+//          this.nameCheck(3)
+//          this.nameTypeCheck()
+//          this.licenceCheck(3)
+          this.enAddressCheck()
+//            this.imgUrlCheck()
+//            this.lawPersonCheck()
+//            this.phoneCheck()
+//            this.emailCheck()
+//            this.faxCheck()
+//          this.checkFullData()
+          this.submitRegisterData()
         }
       }
 //      businessImgUrl: function (val, oldVal) {
@@ -350,51 +360,20 @@
 //      })
     },
     methods: {
-      initEnterpriseData: function (val) {
-        this.data.name = val.name || ''
+      initData: function (val) {
+        this.data.name = val.spaceName || val.name || ''
         this.data.licenceId = val.businessCode || ''
-//        this.data.url = val.businessCodeImage || ''
-//        this.data.lawPerson = val.corporation || ''
-        this.data.address = val.address || ''
-//        this.data.website = val.url || ''
-//        this.data.linkman = val.contactMan || ''
-//        this.data.phone = val.contactTel || ''
-//        this.data.email = val.contactEmail || ''
-//        this.data.fax = val.fax || ''
-//        this.data.logoUrl = val.logoImage || ''
-//        this.data.profession = val.profession || ''
-//        this.data.tagsData = val.tags || []
-//        if (typeof val.tags === 'string') {
-// //          let tmp = val.tags || ''
-//          this.data.tagsData = val.tags.split(',')
-//        } else {
-//          this.data.tagsData = []
-//        }
-      },
-      initSelfData: function (val) {
-        this.data.name = val.name || ''
-        this.data.licenceId = val.licenceId || ''
-//        this.data.url = val.url || ''
-//        this.data.lawPerson = val.lawPerson || ''
         this.data.address = val.address || ''
-//        this.data.website = val.website || ''
-//        this.data.linkman = val.linkman || ''
-//        this.data.phone = val.phone || ''
-//        this.data.email = val.email || ''
-//        this.data.fax = val.fax || ''
-//        this.data.logoUrl = val.logoUrl || ''
-//        this.data.profession = val.profession || ''
-//        if (typeof val.tagsData === 'string' || !val.tagsData) {
-//          this.data.tagsData = val.tagsData.split(',') || []
-//        } else {
-//          this.data.tagsData = val.tagsData || []
-//        }
       },
       sectionChange: function (type) {
-        if (this.loginData.isSelf && !this.isValid) {
+        if (!this.isValid) {
           this.$message.error('请填写正确的注册信息')
         } else {
-          this.checkFullData()
+          if (this.enterpriseData.spaceUU) {
+            this.enCheckFullData()
+          } else {
+            this.checkFullData()
+          }
           let enterprise = this.data
 //          enterprise.tagsData = enterprise.tagsData.toString()
 //          if (typeof this.data.tagsData === 'string') {
@@ -490,6 +469,9 @@
 //          (this.validEmail.init || this.validEmail.isValidEmail) &&
 //          (this.validFax.init || this.validFax.isValidFax)
       },
+      enValidCheck: function () {
+        this.isValid = this.validAddress.isValidAddress && !this.validAddress.init
+      },
       checkFullData: function () {
         this.isValid =
 //          this.validUpload.isValidUpload &&
@@ -498,6 +480,9 @@
           this.validAddress.isValidAddress
 //          this.validLawPerson.isValidLawPerson
       },
+      enCheckFullData: function () {
+        this.isValid = this.validAddress.isValidAddress
+      },
       nameTypeCheck: function () {
         this.validName.isValidTypeName = this.data.name !== '' && this.data.name.length >= 2 && this.data.name.length <= 99 && this.commonValid(this.data.name)
         this.validName.init = false
@@ -541,11 +526,16 @@
           this.validCheck()
         }
       },
-      addressCheck: function () {
+      addressCheck: function () {  // 个人地址校验
         this.validAddress.init = false
         this.validAddress.isValidAddress = this.data.address !== ''
         this.validCheck()
       },
+      enAddressCheck: function () {  // 企业地址校验
+        this.validAddress.init = false
+        this.validAddress.isValidAddress = this.data.address !== ''
+        this.enValidCheck()
+      },
 //      lawPersonCheck: function () {
 //        this.validLawPerson.init = false
 //        this.validLawPerson.isValidLawPerson = (/^\S{1,255}$/).test(this.data.lawPerson)
@@ -632,7 +622,11 @@
           if (this.address.detail !== '') {
             this.data.address = this.address.currentProvince + this.address.currentCity + this.address.currentDistrict + this.address.detail
             this.showAddressBox = false
-            this.addressCheck()
+            if (this.enterpriseData.spaceUU) {
+              this.enAddressCheck()
+            } else {
+              this.addressCheck()
+            }
           } else {
             this.$message.error('请输入详细地址')
           }