Browse Source

注册信息校验优化

wangdy 8 năm trước cách đây
mục cha
commit
b27cb365e0
1 tập tin đã thay đổi với 37 bổ sung31 xóa
  1. 37 31
      components/register-saler/register/StepFirst.vue

+ 37 - 31
components/register-saler/register/StepFirst.vue

@@ -8,7 +8,7 @@
       <div class="row">
         <label class="col-sm-2 x-required">企业名称:</label>
         <div class="col-sm-5">
-          <input type="text" @change="nameCheck" :disabled="!loginData.isSelf" v-model="data.name" class="form-control" name="name" required="" placeholder="填写营业执照上的企业名称">
+          <input type="text" @change="nameCheck(3)" :disabled="!loginData.isSelf" v-model="data.name" class="form-control" name="name" required="" placeholder="填写营业执照上的企业名称">
         </div>
         <div class="x-text-help" v-show="validName.isValidTypeName && validName.isValidName && !validName.init">
           <i class="glyphicon glyphicon-ok x-icon-left"></i>
@@ -56,7 +56,7 @@
       <div class="row">
         <label class="col-sm-2 x-required">营业执照号:</label>
         <div class="col-sm-5">
-          <input type="text" :disabled="!loginData.isSelf" @change="licenceCheck" v-model="data.licenceId" class="form-control" name="name" required="" placeholder="请填写营业执照上的注册号">
+          <input type="text" :disabled="!loginData.isSelf" @change="licenceCheck(3)" v-model="data.licenceId" class="form-control" name="name" required="" placeholder="请填写营业执照上的注册号">
         </div>
         <div class="x-text-help" v-show="validLicence.isValidLicence && !validLicence.init">
           <i class="glyphicon glyphicon-ok x-icon-left"></i>
@@ -189,9 +189,9 @@
           this.data.website = val.enUrl || ''
           this.data.url = val.enBussinessCodeImage || ''
           if (this.loginData.isSelf) {
-            this.nameCheck()
+            this.nameCheck(3)
             this.simpleNameCheck()
-            this.licenceCheck()
+            this.licenceCheck(3)
             this.addressCheck()
             this.websiteCheck()
             this.imgUrlCheck()
@@ -300,20 +300,23 @@
           this.validSimpleName.isValidSimpleName &&
           this.validAddress.isValidAddress
       },
-      nameCheck: function () {
-        let tmpInit = this.validName.init
-        this.validName.init = true
-        this.$http.post('/basic/enterprise/register/valid/name?name=' + this.data.name)
-          .then(response => {
-            if (response.data.code !== 12) {
-              this.validName.init = false
-              this.validName.isValidName = response.data.success
-              this.validName.isValidTypeName = this.data.name !== '' && this.data.name.length >= 2 && this.data.name.length <= 99 && this.commonValid(this.data.name)
-              this.validCheck()
-            } else {
-              this.validName.init = tmpInit
-            }
-          })
+      nameCheck: function (num) {
+    //    let tmpInit = this.validName.init
+    //    this.validName.init = true
+        if (num > 0) {
+          this.$http.post('/basic/enterprise/register/valid/name?name=' + this.data.name)
+            .then(response => {
+              if (response.data.code !== 12) {
+                this.validName.init = false
+                this.validName.isValidName = response.data.success
+                this.validName.isValidTypeName = this.data.name !== '' && this.data.name.length >= 2 && this.data.name.length <= 99 && this.commonValid(this.data.name)
+                this.validCheck()
+              } else {
+                //          this.validName.init = tmpInit
+                this.nameCheck(num - 1)
+              }
+            })
+        }
       },
       simpleNameCheck: function () {
         this.validSimpleName.init = false
@@ -324,19 +327,22 @@
         this.validUpload.init = false
         this.validUpload.isValidUpload = this.data.url !== ''
       },
-      licenceCheck: function () {
-        let tmpInit = this.validLicence.init
-        this.validLicence.init = true
-        this.$http.post('/basic/enterprise/register/valid/businessCode?businessCode=' + this.data.licenceId)
-          .then(response => {
-            if (response.data.code !== 12) {
-              this.validLicence.init = false
-              this.validLicence.isValidLicence = response.data.success && this.data.licenceId
-              this.validCheck()
-            } else {
-              this.validLicence.init = tmpInit
-            }
-          })
+      licenceCheck: function (num) {
+     //   let tmpInit = this.validLicence.init
+     //   this.validLicence.init = true
+        if (num > 0) {
+          this.$http.post('/basic/enterprise/register/valid/businessCode?businessCode=' + this.data.licenceId)
+            .then(response => {
+              if (response.data.code !== 12) {
+                this.validLicence.init = false
+                this.validLicence.isValidLicence = response.data.success && this.data.licenceId
+                this.validCheck()
+              } else {
+                //      this.validLicence.init = tmpInit
+                this.licenceCheck(num - 1)
+              }
+            })
+        }
       },
       addressCheck: function () {
         this.validAddress.init = false