Kaynağa Gözat

feature_20250722_金牌店档案收集

zhujindu 4 ay önce
ebeveyn
işleme
5517de268e
1 değiştirilmiş dosya ile 19 ekleme ve 3 silme
  1. 19 3
      src/views/storeManagement/JPattributeEditor.vue

+ 19 - 3
src/views/storeManagement/JPattributeEditor.vue

@@ -8,8 +8,9 @@
           v-model="detail.ownerMobile"
           label="主经营者电话"
           placeholder="请输入主经营者电话"
+          @blur="sendCodeTelFn(detail.ownerMobile)"
           type="tel">
-          <template #button>
+          <template #button v-if="!verifyMobile">
             <van-button
               size="small"
               style="color: white; background: rgb(0, 87, 186); border-radius: 6px"
@@ -25,7 +26,8 @@
           label="主经营者收到的验证码"
           placeholder="请输入验证码"
           type="number"
-          @blur="verification(verificationVal)" />
+          @blur="verification(verificationVal)"
+          v-if="!verifyMobile" />
         <van-field v-model="detail.ownerName" label="主经营者姓名" />
         <van-field
           v-model="detail.ownerBirthday"
@@ -117,6 +119,7 @@ export default {
       maxDate: new Date(),
       currentDate: new Date(1945, 0, 1),
       mobileStatus: '0',
+      verifyMobile: false, //手机号是否验证透通过
     };
   },
   activated() {
@@ -151,12 +154,25 @@ export default {
             ? res.data.mainProductCategorys.split(',')
             : [];
           this.detail = res.data;
+          this.mobileStatus = res.data.mobileStatus;
           // mobileStatus 1是 是否验证通过
-          if (res.data.mobileStatus == '1')
+          if (res.data.mobileStatus == '1') {
             this.verificationPassedPhoneNum = this.detail.ownerMobile;
+          }
+          // 验证码和发送按钮是否显示
+          this.verifyMobile = this.mobileStatus == '0' ? true : false;
         }
       });
     },
+    sendCodeTelFn(tel) {
+      if (!/^1[3456789]\d{9}$/.test(tel) || tel == '') {
+        this.$toast('格式错误');
+        return;
+      }
+      if (tel != this.verificationPassedPhoneNum) {
+        this.verifyMobile = false;
+      }
+    },
     // 发送验证码
     sendCode(val) {
       if (!/^1[3456789]\d{9}$/.test(val) || val == '') {