Quellcode durchsuchen

feature_20251009_金牌店档案填写校验

sunny vor 1 Monat
Ursprung
Commit
a6cdbc802d
1 geänderte Dateien mit 14 neuen und 12 gelöschten Zeilen
  1. 14 12
      src/views/storeManagement/JPattributeEditor.vue

+ 14 - 12
src/views/storeManagement/JPattributeEditor.vue

@@ -276,22 +276,22 @@ export default {
       let ownerName = this.detail.ownerName;
       if(ownerName.length < 2){
         this.ownerNameMsg = '最短字数2';
-        return;
+        return true;
       }
        if(ownerName.length > 20){
         this.ownerNameMsg = '最长字数20';
-        return;
+        return true;
       }
       const chineseChars = ownerName.match(/[\u4e00-\u9fa5]/g) || [];
       if (chineseChars.length < 1) {
         this.ownerNameMsg = '至少一个汉字';
-        return;
+        return true;
       }
       if (/[^a-zA-Z0-9\u4e00-\u9fa5]/.test(ownerName)) {
         this.ownerNameMsg = '不可输入特殊符号';
-        return;
+        return true;
       }
-     
+      return false;
     },
     isValidTotalSalesAmount(){
       this.totalSalesAmountMsg = '';
@@ -299,16 +299,17 @@ export default {
       const value = parseFloat(totalSalesAmount);
       if (isNaN(value)) {
         this.totalSalesAmountMsg = '请输入数字';
-        return;
+        return true;
       }
       if (value < 1) {
         this.totalSalesAmountMsg = '最小值1';
-        return;
+        return true;
       } 
       if (value > 1000) {
         this.totalSalesAmountMsg = '最大值1000';
-        return;
+        return true;
       }
+      return false;
     },
     isValidMainBrand(){
       this.mainBrandMsg = '';
@@ -316,14 +317,12 @@ export default {
       const chineseChars = mainBrand.match(/[\u4e00-\u9fa5]/g) || [];
       if (chineseChars.length < 1) {
         this.mainBrandMsg = '至少一个汉字';
-        return;
+        return true;
       }
+      return false;
     },
     // 保存
     confirmShare() {
-      this.isValidOwnerName();
-      this.isValidTotalSalesAmount();
-      this.isValidMainBrand();
       if (
         this.verificationPassedPhoneNum == '' ||
         this.detail.ownerMobile != this.verificationPassedPhoneNum
@@ -331,6 +330,9 @@ export default {
         this.$toast('请验证手机号');
         return;
       }
+      if(this.isValidOwnerName()) return;
+      if(this.isValidTotalSalesAmount()) return;
+      if(this.isValidMainBrand()) return;
       if (this.detail.emergencyContactMobile != '') {
         if (!/^1[123456789]\d{9}$/.test(this.detail.emergencyContactMobile)) {
           this.$toast('紧急联系人电话格式错误');