Parcourir la source

feature_20251009_金牌店档案填写校验

sunny il y a 1 mois
Parent
commit
9827b4eec1
1 fichiers modifiés avec 21 ajouts et 1 suppressions
  1. 21 1
      src/views/storeManagement/JPattributeEditor.vue

+ 21 - 1
src/views/storeManagement/JPattributeEditor.vue

@@ -52,7 +52,7 @@
           type="number"
           :error-message="totalSalesAmountMsg"
           label="门店24年总进货额(含所有品牌品类)" />
-        <van-field v-model="detail.performanceRatio" type="number" label="门店立邦业绩占比(%)" />
+        <van-field v-model="detail.performanceRatio" type="number" :error-message="performanceRatioMsg" label="门店立邦业绩占比(%)" />
         <van-field v-model="detail.mainBrand" autosize type="textarea" :error-message="mainBrandMsg" label="门店主营TOP3品牌" />
         <van-field label="是否有工地资源(支持工地配送,承接工地双包等)">
           <template #input>
@@ -132,6 +132,7 @@ export default {
     return {
       ownerNameMsg: '',
       totalSalesAmountMsg: '',
+      performanceRatioMsg: '',
       mainBrandMsg: '',
       detail: null,
       time: null, //计时
@@ -311,6 +312,24 @@ export default {
       }
       return false;
     },
+    isPerformanceRatio(){
+      this.performanceRatioMsg = '';
+      let performanceRatio = this.detail.performanceRatio;
+      const value = parseFloat(performanceRatio);
+      if (isNaN(value)) {
+        this.performanceRatioMsg = '请输入数字';
+        return true;
+      }
+      if (value < 1) {
+        this.performanceRatioMsg = '最小值1';
+        return true;
+      } 
+      if (value > 100) {
+        this.performanceRatioMsg = '最大值100';
+        return true;
+      }
+      return false;
+    },
     isValidMainBrand(){
       this.mainBrandMsg = '';
       let mainBrand = this.detail.mainBrand;
@@ -332,6 +351,7 @@ export default {
       }
       if(this.isValidOwnerName()) return;
       if(this.isValidTotalSalesAmount()) return;
+      if(this.isPerformanceRatio()) return;
       if(this.isValidMainBrand()) return;
       if (this.detail.emergencyContactMobile != '') {
         if (!/^1[123456789]\d{9}$/.test(this.detail.emergencyContactMobile)) {