Przeglądaj źródła

feature_20250722_金牌店档案收集

zhujindu 4 miesięcy temu
rodzic
commit
c17dc4d58f
1 zmienionych plików z 31 dodań i 10 usunięć
  1. 31 10
      src/views/deviceWithin/addStoreVisit.vue

+ 31 - 10
src/views/deviceWithin/addStoreVisit.vue

@@ -187,8 +187,8 @@
               v-model="item.answerValue"
               :placeholder="item.text"
               type="tel"
-              @blur="telFn(item, index, 'A')">
-              <template #button>
+              @blur="sendCodeTelFn(item, index, 'A')">
+              <template #button v-if="!verifyMobile">
                 <van-button
                   size="small"
                   style="color: white; background: rgb(0, 87, 186); border-radius: 6px"
@@ -205,7 +205,7 @@
               {{ item.collectionOptionList[0].collectionOption }}
             </p>
           </div>
-          <div v-if="item.answerType == 'check_code'" class="formLabel z-cell">
+          <div v-if="item.answerType == 'check_code' && !verifyMobile" class="formLabel z-cell">
             <van-cell>
               <template #title>
                 <span v-if="item.isMust == 0" class="van-f-red">*</span>
@@ -575,8 +575,8 @@
                         v-model="childitem.collectionOptionList[0].answerValue"
                         :placeholder="item.text"
                         type="tel"
-                        @blur="telFn(childitem, index)">
-                        <template #button>
+                        @blur="sendCodeTelFn(childitem, index)">
+                        <template #button v-if="!verifyMobile">
                           <van-button
                             size="small"
                             style="color: white; background: rgb(0, 87, 186); border-radius: 6px"
@@ -599,7 +599,9 @@
                         {{ childitem.collectionOptionList[0].collectionOption }}
                       </p>
                     </div>
-                    <div v-if="childitem.answerType == 'check_code'" class="formLabel z-cell">
+                    <div
+                      v-if="childitem.answerType == 'check_code' && !verifyMobile"
+                      class="formLabel z-cell">
                       <van-cell>
                         <template #title>
                           <span v-if="childitem.isMust == 0" class="van-f-red">*</span>
@@ -2997,7 +2999,9 @@ export default {
       timeNum: 60,
       datetimeShowPicker: false,
       activatNyrItem: '',
-      verificationPassedPhoneNum: '',
+      verificationPassedPhoneNum: '', //验证通过的手机号
+      verifyMobile: false, //手机号是否验证透通过
+      verifyMobileFlag: false, //手机号是否改变
     };
   },
   beforeRouteLeave(to, from, next) {
@@ -3431,6 +3435,24 @@ export default {
         this.$toast(val.collectionName + '格式错误');
       }
     },
+    sendCodeTelFn(val) {
+      let answerValue = '';
+      if (val.collectionOptionList && val.collectionOptionList.length) {
+        answerValue = val.collectionOptionList[0].answerValue;
+      } else {
+        answerValue = val.answerValue;
+      }
+
+      if (!/^1[3456789]\d{9}$/.test(answerValue) || answerValue == '') {
+        this.$toast(val.collectionName + '格式错误');
+        return;
+      }
+      if (answerValue != this.verificationPassedPhoneNum) {
+        this.verifyMobile = false;
+      } else {
+        this.verifyMobile = true;
+      }
+    },
     numberFn(val, index, type) {
       if (type == 'A') {
         if (!/^[+-]?\d*\.{0,1}\d{0,1}$/.test(this.collectionItemList[index].answerValue)) {
@@ -3549,9 +3571,7 @@ export default {
         }
         this.infoShow = res.data.isMust;
         // 主经营者电话验证是否通过
-        // if( false ){
-        //   this.verificationPassed =
-        // }
+        this.verifyMobile = res.data.verifyMobile;
         if (this.$route.query.taskType == 1 || this.$route.query.taskType == 4) {
           for (var q = 0; q < collectionItemLists.length; q++) {
             if (
@@ -5121,6 +5141,7 @@ export default {
           verification: answerValue, //String	手机号验证码
         },
         (res) => {
+          this.verificationPassedPhoneNum = sendPhone;
           this.$toast(res.data ? '验证成功' : '验证码错误');
         }
       );