Bläddra i källkod

Merge branch 'feature_20251009_金牌店档案填写校验'

sunny 1 månad sedan
förälder
incheckning
9bd0d1adde
2 ändrade filer med 169 tillägg och 37 borttagningar
  1. 167 35
      src/views/storeManagement/JPattributeEditor.vue
  2. 2 2
      src/views/storeManagement/storeDetail.vue

+ 167 - 35
src/views/storeManagement/JPattributeEditor.vue

@@ -15,25 +15,26 @@
               size="small"
               style="color: white; background: rgb(0, 87, 186); border-radius: 6px"
               @click="sendCode(detail.ownerMobile)"
-              :disabled="time != null">
-              <span v-if="time">已发送({{ timeNum }})</span>
-              <span v-else>发送验证码</span>
+              :disabled="telConfirm">
+              <span v-if="telConfirm">已确认</span>
+              <span v-else>确认真实</span>
             </van-button>
           </template>
         </van-field>
-        <van-field
+        <span style="color: #ee0a24;font-size: 12px;">为了不打扰金牌店老板,不再发送短信验证码,请务必确认手机号正确无误!</span>
+        <!-- <van-field
           v-model="verificationVal"
           label="主经营者收到的验证码"
           placeholder="请输入验证码"
           type="number"
           @blur="verification(verificationVal)"
-          v-if="!verifyMobile" />
-        <van-field v-model="detail.ownerName" label="主经营者姓名" />
-        <van-field
+          v-if="!verifyMobile" /> -->
+        <van-field v-model="detail.ownerName" :error-message="ownerNameMsg" label="主经营者姓名" />
+        <!-- <van-field
           v-model="detail.ownerBirthday"
           label="主经营者出生日期"
           placeholder="请输入主经营者出生日期"
-          @click="getNyr('ownerBirthday', detail.ownerBirthday)" />
+          @click="getNyr('ownerBirthday', detail.ownerBirthday)" /> -->
         <van-field autosize type="textarea" label="主营/擅长经营品类">
           <template #input>
             <van-checkbox-group v-model="detail.mainProductCategorys" direction="horizontal">
@@ -50,9 +51,19 @@
         <van-field
           v-model="detail.totalSalesAmount"
           type="number"
-          label="门店24年总进货额(含所有品牌品类)" />
-        <van-field v-model="detail.performanceRatio" type="number" label="门店立邦业绩占比(%)" />
-        <van-field v-model="detail.mainBrand" autosize type="textarea" label="门店主营TOP3品牌" />
+          :error-message="totalSalesAmountMsg"
+          label="门店24年总进货额(含所有品牌品类,单位:万元)" />
+        <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>
             <van-radio-group
@@ -68,6 +79,7 @@
           v-if="detail.constructionResource == '是'"
           v-model="detail.constructionYearNum"
           type="number"
+          :error-message="constructionYearNumMsg"
           label="年工地数量" />
         <van-field label="是否有双包能力">
           <template #input>
@@ -90,10 +102,10 @@
           </template>
         </van-field>
         <van-field v-model="detail.emergencyContact" label="紧急联系人姓名" />
-        <van-field
+        <!-- <van-field
           v-model="detail.emergencyContactBirthday"
           label="紧急联系人出生日期"
-          @click="getNyr('emergencyContactBirthday', detail.emergencyContactBirthday)" />
+          @click="getNyr('emergencyContactBirthday', detail.emergencyContactBirthday)" /> -->
         <van-field
           v-model="detail.emergencyContactMobile"
           type="number"
@@ -129,6 +141,11 @@ export default {
   name: 'JPattributeEditor',
   data() {
     return {
+      ownerNameMsg: '',
+      totalSalesAmountMsg: '',
+      performanceRatioMsg: '',
+      mainBrandMsg: '',
+      constructionYearNumMsg: '',
       detail: null,
       time: null, //计时
       timeNum: 60,
@@ -144,9 +161,16 @@ export default {
       currentDate: new Date(1945, 0, 1),
       mobileStatus: '0',
       verifyMobile: false, //手机号是否验证透通过
+      telConfirm: false,
     };
   },
   activated() {
+    this.telConfirm = false;
+    this.ownerNameMsg = '';
+    this.totalSalesAmountMsg = '';
+    this.performanceRatioMsg = '';
+    this.mainBrandMsg = '';
+    this.constructionYearNumMsg = '';
     this.detail = null;
     this.verificationVal = '';
     if (this.time) clearInterval(this.time);
@@ -179,8 +203,8 @@ export default {
             : [];
           this.detail = res.data;
           this.mobileStatus = res.data.mobileStatus;
-          // mobileStatus 1是 是否验证通过
-          if (res.data.mobileStatus == '1') {
+          // mobileStatus  是否验证通过 1,2是
+          if (res.data.mobileStatus == '1' || res.data.mobileStatus == '2') {
             this.verificationPassedPhoneNum = this.detail.ownerMobile;
           }
           // 验证码和发送按钮是否显示
@@ -194,7 +218,11 @@ export default {
         return;
       }
       if (tel != this.verificationPassedPhoneNum) {
+        this.telConfirm = false;
         this.verifyMobile = false;
+      } else {
+        this.telConfirm = false;
+        this.verifyMobile = true;
       }
     },
     // 发送验证码
@@ -203,26 +231,29 @@ export default {
         this.$toast('格式错误');
         return;
       }
-      if (this.time) return;
-      clearInterval(this.time);
-      this.timeNum = 60;
-      this.sendCodeFun(
-        {
-          type: '1', //String	调用类型:1:发送验证码 2:校验验证码
-          phone: val, //String	手机号
-          verification: '', //String	手机号验证码
-        },
-        () => {
-          this.time = setInterval(() => {
-            this.timeNum--;
-            if (this.timeNum <= 0) {
-              clearInterval(this.time);
-              this.time = null;
-            }
-          }, 1000);
-          this.$toast('发送成功');
-        }
-      );
+      this.telConfirm = true;
+      this.verificationPassedPhoneNum = val;
+      this.$toast('验证成功');
+      // if (this.time) return;
+      // clearInterval(this.time);
+      // this.timeNum = 60;
+      // this.sendCodeFun(
+      //   {
+      //     type: '1', //String	调用类型:1:发送验证码 2:校验验证码
+      //     phone: val, //String	手机号
+      //     verification: '', //String	手机号验证码
+      //   },
+      //   () => {
+      //     this.time = setInterval(() => {
+      //       this.timeNum--;
+      //       if (this.timeNum <= 0) {
+      //         clearInterval(this.time);
+      //         this.time = null;
+      //       }
+      //     }, 1000);
+      //     this.$toast('发送成功');
+      //   }
+      // );
     },
     sendCodeFun(params, callback) {
       sendAndCheckVerCode(params).then((res) => {
@@ -267,6 +298,93 @@ export default {
       //   this.detail.ownerBirthday = this.parseTime(time, '{y}-{m}-{d}');
       this.datetimeShowPicker = false;
     },
+    isValidOwnerName() {
+      this.ownerNameMsg = '';
+      let ownerName = this.detail.ownerName;
+      if (ownerName.length < 2) {
+        this.ownerNameMsg = '最短字数2';
+        return true;
+      }
+      if (ownerName.length > 20) {
+        this.ownerNameMsg = '最长字数20';
+        return true;
+      }
+      const chineseChars = ownerName.match(/[\u4e00-\u9fa5]/g) || [];
+      if (chineseChars.length < 1) {
+        this.ownerNameMsg = '至少一个汉字';
+        return true;
+      }
+      if (!/^[\u4e00-\u9fa5a-zA-Z0-9·]+$/.test(ownerName)) {
+        this.ownerNameMsg = '不可输入特殊符号';
+        return true;
+      }
+      return false;
+    },
+    isValidTotalSalesAmount() {
+      this.totalSalesAmountMsg = '';
+      let totalSalesAmount = this.detail.totalSalesAmount;
+      const value = parseFloat(totalSalesAmount);
+      if (isNaN(value)) {
+        this.totalSalesAmountMsg = '请输入数字';
+        return true;
+      }
+      if (value < 1) {
+        this.totalSalesAmountMsg = '最小值1';
+        return true;
+      }
+      if (value > 1000) {
+        this.totalSalesAmountMsg = '最大值1000';
+        return true;
+      }
+      return false;
+    },
+
+    isConstructionYearNum() {
+      this.constructionYearNumMsg = '';
+      let constructionYearNum = this.detail.constructionYearNum;
+      const value = parseFloat(constructionYearNum);
+      if (isNaN(value)) {
+        this.constructionYearNumMsg = '请输入数字';
+        return true;
+      }
+      if (value < 1) {
+        this.constructionYearNumMsg = '最小值1';
+        return true;
+      }
+      if (value > 10000) {
+        this.constructionYearNumMsg = '最大值10000';
+        return true;
+      }
+      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;
+      const chineseChars = mainBrand.match(/[\u4e00-\u9fa5]/g) || [];
+      if (chineseChars.length < 1) {
+        this.mainBrandMsg = '至少一个汉字';
+        return true;
+      }
+      return false;
+    },
     // 保存
     confirmShare() {
       if (
@@ -276,6 +394,20 @@ export default {
         this.$toast('请验证手机号');
         return;
       }
+      this.isValidOwnerName();
+      this.isValidTotalSalesAmount();
+      this.isPerformanceRatio();
+      this.isValidMainBrand();
+      if (this.detail.constructionResource == '是') {
+        this.isConstructionYearNum();
+      }
+      if (this.isValidOwnerName()) return;
+      if (this.isValidTotalSalesAmount()) return;
+      if (this.isPerformanceRatio()) return;
+      if (this.isValidMainBrand()) return;
+      if (this.detail.constructionResource == '是') {
+        if (this.isConstructionYearNum()) return;
+      }
       if (this.detail.emergencyContactMobile != '') {
         if (!/^1[123456789]\d{9}$/.test(this.detail.emergencyContactMobile)) {
           this.$toast('紧急联系人电话格式错误');

+ 2 - 2
src/views/storeManagement/storeDetail.vue

@@ -355,11 +355,11 @@
                 autosize
                 type="textarea"
                 v-model="list.storeArchives.totalSalesAmount"
-                label="门店24年总进货额(含所有品牌品类)" />
+                label="门店24年总进货额(含所有品牌品类,单位:万元)" />
               <van-field
                 readonly
                 v-model="list.storeArchives.performanceRatio"
-                label="门店立邦业绩占比(%)" />
+                label="门店立邦业绩占比(单位:%)" />
               <van-field
                 readonly
                 autosize