Browse Source

Merge branch 'feature_20250722_金牌店档案收集' into uat(dev)

# Conflicts:
#	src/views/deviceWithin/addStoreVisit.vue
zhujindu 4 months ago
parent
commit
84febd6e03
2 changed files with 180 additions and 12 deletions
  1. 171 11
      src/views/deviceWithin/addStoreVisit.vue
  2. 9 1
      src/views/historicalVisit/hisvistdeils.vue

+ 171 - 11
src/views/deviceWithin/addStoreVisit.vue

@@ -164,11 +164,63 @@
       </div>
     </div>
     <div
-      v-if="taskType == 1"
+      v-if="taskType == 1 || taskType == 4"
       class="container"
       style="width: 94%; margin: 0 auto; border-radius: 6px; padding: 10px 10px 10px 0">
       <van-form ref="tabstoreVal">
         <div v-for="(item, index) in collectionItemList" :key="index">
+          <div v-if="item.answerType == 'tel_send_code'" class="formLabel z-cell">
+            <van-cell>
+              <template #title>
+                <span v-if="item.isMust == 0" class="van-f-red">*</span>
+                {{ item.collectionName }}
+                <!-- 操作说明图片和电话 -->
+                <taskTips
+                  v-if="item.contactPhone || item.examplePhoto"
+                  :contactPhone="item.contactPhone"
+                  :examplePhoto="item.examplePhoto">
+                </taskTips>
+              </template>
+            </van-cell>
+            <van-field
+              v-model="item.answerValue"
+              :placeholder="item.text"
+              type="tel"
+              @blur="telFn(item, index, 'A')">
+              <template #button>
+                <van-button
+                  size="small"
+                  type="primary"
+                  @click="sendCode(item)"
+                  :disabled="time != null"
+                  >发送验证码<span v-if="time">({{ timeNum }})</span>
+                </van-button>
+              </template>
+            </van-field>
+            <p
+              style="color: #444; font-size: 12px; margin: 0; padding: 10px 0; text-align: right"
+              v-if="item.collectionOptionList[0].collectionOption">
+              {{ item.collectionOptionList[0].collectionOption }}
+            </p>
+          </div>
+          <div v-if="item.answerType == 'check_code'" class="formLabel z-cell">
+            <van-cell>
+              <template #title>
+                <span v-if="item.isMust == 0" class="van-f-red">*</span>
+                {{ item.collectionName }}
+              </template>
+            </van-cell>
+            <van-field
+              v-model="item.answerValue"
+              :placeholder="item.text"
+              type="number"
+              @input="numberFn(item, index, 'A')"></van-field>
+            <p
+              style="color: red; font-size: 14px; margin: 0; padding: 10px 0; text-align: right"
+              v-if="item.collectionOptionList[0].collectionOption">
+              {{ item.collectionOptionList[0].collectionOption }}
+            </p>
+          </div>
           <div v-if="item.answerType == 'sz'" class="formLabel z-cell">
             <van-cell>
               <template #title
@@ -494,6 +546,70 @@
               <div v-for="(child, indexc) in item.collectionOptionList" :key="indexc">
                 <div v-if="child.isCheck == 1">
                   <div v-for="(childitem, childIndex) in child.collectionItems" :key="childIndex">
+                    <div v-if="childitem.answerType == 'tel_send_code'" class="formLabel z-cell">
+                      <van-cell>
+                        <template #title>
+                          <span v-if="childitem.isMust == 0" class="van-f-red">*</span>
+                          {{ childitem.collectionName }}
+                          <!-- 操作说明图片和电话 -->
+                          <taskTips
+                            v-if="childitem.contactPhone || childitem.examplePhoto"
+                            :contactPhone="childitem.contactPhone"
+                            :examplePhoto="childitem.examplePhoto">
+                          </taskTips>
+                        </template>
+                      </van-cell>
+                      <van-field
+                        v-model="childitem.collectionOptionList[0].answerValue"
+                        :placeholder="item.text"
+                        type="tel"
+                        @blur="telFn(childitem, index)">
+                        <template #button>
+                          <van-button
+                            size="small"
+                            type="primary"
+                            @click="sendCode(childitem)"
+                            :disabled="time != null"
+                            >发送验证码<span v-if="time">({{ timeNum }})</span>
+                          </van-button>
+                        </template>
+                      </van-field>
+                      <p
+                        style="
+                          color: #444;
+                          font-size: 12px;
+                          margin: 0;
+                          padding: 10px 0;
+                          text-align: right;
+                        "
+                        v-if="childitem.collectionOptionList[0].collectionOption">
+                        {{ childitem.collectionOptionList[0].collectionOption }}
+                      </p>
+                    </div>
+                    <div v-if="childitem.answerType == 'check_code'" class="formLabel z-cell">
+                      <van-cell>
+                        <template #title>
+                          <span v-if="childitem.isMust == 0" class="van-f-red">*</span>
+                          {{ childitem.collectionName }}
+                        </template>
+                      </van-cell>
+                      <van-field
+                        v-model="childitem.collectionOptionList[0].answerValue"
+                        :placeholder="item.text"
+                        type="number"
+                        @input="numberFn(childitem, index)"></van-field>
+                      <p
+                        style="
+                          color: red;
+                          font-size: 14px;
+                          margin: 0;
+                          padding: 10px 0;
+                          text-align: right;
+                        "
+                        v-if="childitem.collectionOptionList[0].collectionOption">
+                        {{ childitem.collectionOptionList[0].collectionOption }}
+                      </p>
+                    </div>
                     <div v-if="childitem.answerType == 'wb'" class="formLabel z-cell">
                       <van-cell>
                         <template #title>
@@ -2853,6 +2969,8 @@ export default {
       inspectionType: '',
       competitortableData: [],
       isEditSDHCL: true, //是否可以编辑生动化陈列
+      time: null, //计时
+      timeNum: 0,
     };
   },
   beforeRouteLeave(to, from, next) {
@@ -2890,6 +3008,8 @@ export default {
     store.dispatch('setShotsNum', 0);
     this.show = false;
     this.stillDistribute = false;
+    this.time = null; //计时
+    this.timeNum = 0;
   },
   watch: {
     $route(to, from) {
@@ -3374,7 +3494,7 @@ export default {
       console.log(params.id);
       getCollectionInfos(params).then((res) => {
         loading1.clear();
-        this.productTitles = res.data.productTitles; //产品类型表头数据
+        this.productTitles = res.data.productTitles || null; //产品类型表头数据
         var checkUnManage = res.data;
         var collectionItemLists = res.data.collectionItemList;
         if (checkUnManage.checkUnManage != null && checkUnManage.checkUnManage != 'N') {
@@ -3406,14 +3526,16 @@ export default {
           this.processKey = false;
         }
         this.infoShow = res.data.isMust;
-        if (this.$route.query.taskType == 1) {
+        if (this.$route.query.taskType == 1 || this.$route.query.taskType == 4) {
           for (var q = 0; q < collectionItemLists.length; q++) {
             if (
               collectionItemLists[q].answerType == 'sz' ||
               collectionItemLists[q].answerType == 'wb' ||
               collectionItemLists[q].answerType == 'sm' ||
               collectionItemLists[q].answerType == 'tel' ||
-              collectionItemLists[q].answerType == 'date'
+              collectionItemLists[q].answerType == 'date' ||
+              collectionItemLists[q].answerType == 'tel_send_code' ||
+              collectionItemLists[q].answerType == 'check_code'
             ) {
               collectionItemLists[q].answerValue =
                 collectionItemLists[q].collectionOptionList[0].answerValue;
@@ -3492,6 +3614,22 @@ export default {
                           listchild[qq1].answerValue = '';
                         }
                       }
+                      if (listchild[qq1].answerType == 'tel_send_code') {
+                        if (listchild[qq1].collectionOptionList[0].answerValue != null) {
+                          listchild[qq1].answerValue =
+                            listchild[qq1].collectionOptionList[0].answerValue;
+                        } else {
+                          listchild[qq1].answerValue = '';
+                        }
+                      }
+                      if (listchild[qq1].answerType == 'check_code') {
+                        if (listchild[qq1].collectionOptionList[0].answerValue != null) {
+                          listchild[qq1].answerValue =
+                            listchild[qq1].collectionOptionList[0].answerValue;
+                        } else {
+                          listchild[qq1].answerValue = '';
+                        }
+                      }
                       if (listchild[qq1].answerType == 'date') {
                         if (listchild[qq1].collectionOptionList[0].answerValue != null) {
                           listchild[qq1].answerValue =
@@ -4326,14 +4464,16 @@ export default {
         };
       }
 
-      if (this.$route.query.taskType == 1) {
+      if (this.$route.query.taskType == 1 || this.$route.query.taskType == 4) {
         for (var b = 0; b < this.collectionItemList.length; b++) {
           if (
             this.collectionItemList[b].answerType == 'sz' ||
             this.collectionItemList[b].answerType == 'sm' ||
             this.collectionItemList[b].answerType == 'wb' ||
             this.collectionItemList[b].answerType == 'tel' ||
-            this.collectionItemList[b].answerType == 'date'
+            this.collectionItemList[b].answerType == 'date' ||
+            this.collectionItemList[b].answerType == 'tel_send_code' ||
+            this.collectionItemList[b].answerType == 'check_code'
           ) {
             formData.collectionAnswers.push({
               collectionId: this.collectionItemList[b].collectionId,
@@ -4386,7 +4526,9 @@ export default {
                     listDatas[f2].answerType == 'wb' ||
                     listDatas[f2].answerType == 'sm' ||
                     listDatas[f2].answerType == 'tel' ||
-                    listDatas[f2].answerType == 'date'
+                    listDatas[f2].answerType == 'date' ||
+                    listDatas[f2].answerType == 'tel_send_code' ||
+                    listDatas[f2].answerType == 'check_code'
                   ) {
                     formData.collectionAnswers.push({
                       collectionId: listDatas[f2].collectionId,
@@ -4453,7 +4595,9 @@ export default {
                             listDatas2[f10].answerType == 'wb' ||
                             listDatas2[f10].answerType == 'sm' ||
                             listDatas2[f10].answerType == 'date' ||
-                            listDatas2[f10].answerType == 'tel'
+                            listDatas2[f10].answerType == 'tel' ||
+                            listDatas2[f10].answerType == 'tel_send_code' ||
+                            listDatas2[f10].answerType == 'check_code'
                           ) {
                             formData.collectionAnswers.push({
                               collectionId: listDatas2[f10].collectionId,
@@ -4539,7 +4683,9 @@ export default {
                                     listc4[fc4].answerType == 'wb' ||
                                     listc4[fc4].answerType == 'sm' ||
                                     listc4[fc4].answerType == 'date' ||
-                                    listc4[fc4].answerType == 'tel'
+                                    listc4[fc4].answerType == 'tel' ||
+                                    listc4[fc4].answerType == 'tel_send_code' ||
+                                    listc4[fc4].answerType == 'check_code'
                                   ) {
                                     formData.collectionAnswers.push({
                                       collectionId: listc4[fc4].collectionId,
@@ -4640,7 +4786,9 @@ export default {
                                             listc5[fc5].answerType == 'wb' ||
                                             listc5[fc5].answerType == 'sm' ||
                                             listc5[fc5].answerType == 'date' ||
-                                            listc5[fc5].answerType == 'tel'
+                                            listc5[fc5].answerType == 'tel' ||
+                                            listc5[fc5].answerType == 'tel_send_code' ||
+                                            listc5[fc5].answerType == 'check_code'
                                           ) {
                                             formData.collectionAnswers.push({
                                               collectionId: listc5[fc5].collectionId,
@@ -4762,7 +4910,6 @@ export default {
                 answerValue: this.tableData1[d].xdjhchjj,
               });
             }
-            debugger;
             if (dd == 2) {
               formData.collectionAnswers.push({
                 collectionId: this.tableData1[d].collectionId,
@@ -4864,6 +5011,19 @@ export default {
         return true;
       }
     },
+    // 发送验证码
+    sendCode(val) {
+      if (!/^1[3456789]\d{9}$/.test(val.answerValue) || val.answerValue == '') {
+        this.$toast(val.collectionName + '格式错误');
+        return;
+      }
+      if (this.time) return;
+      this.timeNum = 0;
+      this.time = setInterval(() => {
+        this.timeNum++;
+        if (this.timeNum == 60) this.time = null;
+      }, 1000);
+    },
     onClickLeft() {
       this.$router.go(-1);
     },

+ 9 - 1
src/views/historicalVisit/hisvistdeils.vue

@@ -94,9 +94,17 @@
     <div
       class="container containert"
       style="width: 94%; margin: 0 auto; border-radius: 6px"
-      v-if="taskType == 1">
+      v-if="taskType == 1 || taskType == 4">
       <van-form ref="tabstoreVal">
         <div v-for="(item, index) in collectionItemList" :key="index">
+          <div v-if="item.answerType == 'tel_send_code'" class="formLabel z-cell">
+            <van-cell>
+              <template #title> {{ index + 1 }}.{{ item.collectionName }} </template>
+            </van-cell>
+            <div class="selesetText">
+              <p class="mg0">{{ item.answerValue }}</p>
+            </div>
+          </div>
           <div class="formLabel z-cell z-cells" v-if="item.answerType == 'sz'">
             <van-cell>
               <template #title> {{ index + 1 }}.{{ item.collectionName }} </template>