Browse Source

feature_20250722_金牌店档案收集

zhujindu 4 months ago
parent
commit
25e3dfeff6

+ 10 - 0
src/api/storeManagement.js

@@ -0,0 +1,10 @@
+import request from '@/utils/request';
+
+// 根据门店编码获取档案信息接口
+export function getStoreArchives(query) {
+  return request({
+    url: 'mobile/store/getStoreArchives',
+    method: 'get',
+    params: query,
+  });
+}

+ 14 - 6
src/views/deviceWithin/addStoreVisit.vue

@@ -2992,7 +2992,7 @@ export default {
       inspectionType: '',
       competitortableData: [],
       time: null, //计时
-      timeNum: 0,
+      timeNum: 30,
       datetimeShowPicker: false,
       activatNyrItem: '',
     };
@@ -3032,8 +3032,9 @@ export default {
     store.dispatch('setShotsNum', 0);
     this.show = false;
     this.stillDistribute = false;
+    clearInterval(this.time);
     this.time = null; //计时
-    this.timeNum = 0;
+    this.timeNum = 30;
   },
   watch: {
     $route(to, from) {
@@ -5057,7 +5058,8 @@ export default {
         return;
       }
       if (this.time) return;
-      this.timeNum = 0;
+      clearInterval(this.time);
+      this.timeNum = 30;
       this.sendCodeFun(
         {
           type: '1', //String	调用类型:1:发送验证码 2:校验验证码
@@ -5066,8 +5068,11 @@ export default {
         },
         () => {
           this.time = setInterval(() => {
-            this.timeNum++;
-            if (this.timeNum == 30) this.time = null;
+            this.timeNum--;
+            if (this.timeNum <= 0) {
+              clearInterval(this.time);
+              this.time = null;
+            }
           }, 1000);
           this.$toast('发送成功');
         }
@@ -5128,6 +5133,9 @@ export default {
     onClickLeft() {
       this.$router.go(-1);
     },
+    destroyed() {
+      if (this.time) clearInterval(this.time);
+    },
   },
 };
 </script>
@@ -5286,7 +5294,7 @@ export default {
     border: none !important;
     input {
       border: 1px solid #f1f1f1;
-      height:35px
+      height: 35px;
     }
   }
 }

+ 109 - 2
src/views/storeManagement/JPattributeEditor.vue

@@ -3,7 +3,27 @@
     <van-nav-bar class="navBar" title="金牌店档案编辑" left-arrow @click-left="onClickLeft" />
     <div class="content" v-if="detail">
       <van-form ref="tabstoreVal">
-        <van-field v-model="detail.ownerMobile" label="主经营者电话" />
+        <van-field
+          class="sendCode"
+          v-model="detail.ownerMobile"
+          label="主经营者电话"
+          placeholder="请输入主经营者电话"
+          type="tel">
+          <template #button>
+            <van-button
+              size="small"
+              style="color: white; background: rgb(0, 87, 186); border-radius: 6px"
+              @click="sendCode(item, index)"
+              :disabled="time != null"
+              >发送验证码<span v-if="time">({{ timeNum }})</span>
+            </van-button>
+          </template>
+        </van-field>
+        <van-field
+          v-model="verificationVal"
+          placeholder="请输入验证码"
+          type="number"
+          @blur="verification(verificationVal)" />
         <van-field v-model="detail.ownerName" label="主经营者姓名" />
         <van-field v-model="detail.ownerBirthday" label="主经营者出生日期" />
         <van-field v-model="detail.mainProductCategorys" label="主营/擅长经营品类" />
@@ -28,14 +48,86 @@
 </template>
 
 <script>
+import { sendAndCheckVerCode } from '@/api/index';
+import { getStoreArchives } from '@/api/storeManagement';
 export default {
   name: 'JPattributeEditor',
   data() {
     return {
       detail: null,
+      time: null, //计时
+      timeNum: 30,
+      verificationVal: '',
     };
   },
+  activated() {
+    if (this.time) clearInterval(this.time);
+    this.time = null; //计时
+    this.timeNum = 30;
+    this.getDetaild();
+  },
   methods: {
+    getDetaild() {
+      getStoreArchives({ storeCode: this.$route.query.storeCode }).then((res) => {
+        if (res.code == 200) {
+          this.detail = res.data;
+        }
+      });
+    },
+    // 发送验证码
+    sendCode(val) {
+      if (!/^1[3456789]\d{9}$/.test(val) || val == '') {
+        this.$toast('格式错误');
+        return;
+      }
+      if (this.time) return;
+      clearInterval(this.time);
+      this.timeNum = 30;
+      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) => {
+        if (res.code == 200) {
+          callback && callback(res);
+        }
+      });
+    },
+    verification(val) {
+      // 验证码
+      if (val == '') {
+        return;
+      }
+      // 手机号
+      if (this.detail.ownerMobile == '') {
+        return;
+      }
+      this.sendCodeFun(
+        {
+          type: '2', //String	调用类型:1:发送验证码 2:校验验证码
+          phone: this.detail.ownerMobile, //String	手机号
+          verification: val, //String	手机号验证码
+        },
+        (res) => {
+          this.$toast(res.data ? '验证成功' : '验证码错误');
+        }
+      );
+    },
     // 保存
     confirmShare() {},
     onClickLeft() {
@@ -45,7 +137,7 @@ export default {
 };
 </script>
 
-<style lang="scss" scoped>
+<style lang="scss">
 .JPattributeEditor {
   width: 100%;
   height: 100%;
@@ -59,6 +151,21 @@ export default {
     background: #fff;
     padding: 10px 15px;
     margin-top: 10px;
+    background: #fff;
+    .van-cell {
+      padding: 10px 0;
+      border-bottom: 1px solid #ccc;
+    }
+    .van-field__label {
+      width: 9em;
+    }
+    .sendCode {
+      border: none !important;
+      input {
+        border: 1px solid #f1f1f1;
+        height: 35px;
+      }
+    }
   }
   .footer-btn {
     display: flex;

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

@@ -1677,7 +1677,7 @@ export default {
     attributeEditor() {
       this.$router.push({
         path: '/JPattributeEditor',
-        query: { id: this.$route.query.id },
+        query: { storeCode: this.list.storeCode },
       });
     },
   },