Browse Source

Merge branch 'feature_20250926_数字题型&单行文本题型' into uat(dev)

# Conflicts:
#	src/api/index.js
zhujindu 1 month ago
parent
commit
bb057313f5
2 changed files with 154 additions and 7 deletions
  1. 9 0
      src/api/index.js
  2. 145 7
      src/views/deviceWithin/addStoreVisit.vue

+ 9 - 0
src/api/index.js

@@ -1097,3 +1097,12 @@ export function getSummaryQrCodeUUID(query) {
     params: query,
     params: query,
   });
   });
 }
 }
+
+// 电话确认接口
+export function confirmPhone(query) {
+  return request({
+    url: '/mobile/storeGroup/confirmPhone',
+    method: 'get',
+    params: query,
+  });
+}

+ 145 - 7
src/views/deviceWithin/addStoreVisit.vue

@@ -204,6 +204,38 @@
               </template>
               </template>
             </van-field>
             </van-field>
           </div>
           </div>
+          <div v-if="item.answerType == 'tel_confirm'" class="formLabel z-cell">
+            <van-cell>
+              <template #title>
+                <span v-if="item.isMust == 0" class="van-f-red">*</span>
+                <span>{{ 1 + index + '.' }}</span>
+                {{ item.collectionName }}
+                <!-- 操作说明图片和电话 -->
+                <taskTips
+                  v-if="item.contactPhone || item.examplePhoto"
+                  :contactPhone="item.contactPhone"
+                  :examplePhoto="item.examplePhoto">
+                </taskTips>
+              </template>
+            </van-cell>
+            <van-field
+              class="sendCode"
+              v-model="item.answerValue"
+              :placeholder="item.collectionOptionList[0].collectionOption"
+              type="tel"
+              @blur="telConfirmBlur(item, index, 'A')">
+              <template #button v-if="!verifyMobile">
+                <van-button
+                  size="small"
+                  style="color: white; background: rgb(0, 87, 186); border-radius: 6px"
+                  @click="telConfirm(item, index)"
+                  :disabled="confirmed">
+                  <span v-if="confirmed">已确认</span>
+                  <span v-else>确认真实</span>
+                </van-button>
+              </template>
+            </van-field>
+          </div>
           <div v-if="item.answerType == 'check_code' && !verifyMobile" class="formLabel z-cell">
           <div v-if="item.answerType == 'check_code' && !verifyMobile" class="formLabel z-cell">
             <van-cell>
             <van-cell>
               <template #title>
               <template #title>
@@ -674,6 +706,39 @@
                         </template>
                         </template>
                       </van-field>
                       </van-field>
                     </div>
                     </div>
+                    <div v-if="childitem.answerType == 'tel_confirm'" class="formLabel z-cell">
+                      <van-cell>
+                        <template #title>
+                          <span v-if="childitem.isMust == 0" class="van-f-red">*</span>
+                          <span>{{ 1 + index + '.' }}</span>
+                          <span>{{ 1 + childIndex + '.' }}</span>
+                          {{ childitem.collectionName }}
+                          <!-- 操作说明图片和电话 -->
+                          <taskTips
+                            v-if="childitem.contactPhone || childitem.examplePhoto"
+                            :contactPhone="childitem.contactPhone"
+                            :examplePhoto="childitem.examplePhoto">
+                          </taskTips>
+                        </template>
+                      </van-cell>
+                      <van-field
+                        class="sendCode"
+                        v-model="childitem.collectionOptionList[0].answerValue"
+                        :placeholder="childitem.collectionOptionList[0].collectionOption"
+                        type="tel"
+                        @blur="telConfirmBlur(childitem, index)">
+                        <template #button v-if="!verifyMobile">
+                          <van-button
+                            size="small"
+                            style="color: white; background: rgb(0, 87, 186); border-radius: 6px"
+                            @click="telConfirm(childitem, index)"
+                            :disabled="confirmed">
+                            <span v-if="confirmed">已确认</span>
+                            <span v-else>确认真实</span>
+                          </van-button>
+                        </template>
+                      </van-field>
+                    </div>
                     <div
                     <div
                       v-if="childitem.answerType == 'check_code' && !verifyMobile"
                       v-if="childitem.answerType == 'check_code' && !verifyMobile"
                       class="formLabel z-cell">
                       class="formLabel z-cell">
@@ -3703,6 +3768,7 @@ import {
   deleteTaskAnswer,
   deleteTaskAnswer,
   getCollectionShowHistory,
   getCollectionShowHistory,
   sendAndCheckVerCode,
   sendAndCheckVerCode,
+  confirmPhone,
 } from '@/api/index';
 } from '@/api/index';
 import zRadio from '@/components/zRadio';
 import zRadio from '@/components/zRadio';
 import zCheckbox from '@/components/zCheckbox';
 import zCheckbox from '@/components/zCheckbox';
@@ -3818,6 +3884,7 @@ export default {
       continuousShoot: '0',
       continuousShoot: '0',
       machineInTheStore: '否',
       machineInTheStore: '否',
       validatorFlag: true, //是否验证通过
       validatorFlag: true, //是否验证通过
+      confirmed: false,
     };
     };
   },
   },
   beforeRouteLeave(to, from, next) {
   beforeRouteLeave(to, from, next) {
@@ -3827,6 +3894,8 @@ export default {
     next();
     next();
   },
   },
   activated() {
   activated() {
+    this.verificationPassedPhoneNum = '';
+    this.confirmed = false;
     this.showCode = false;
     this.showCode = false;
     this.flag = false;
     this.flag = false;
     this.link = '3';
     this.link = '3';
@@ -4268,6 +4337,25 @@ export default {
         this.verifyMobile = false;
         this.verifyMobile = false;
       }
       }
     },
     },
+    telConfirmBlur(val) {
+      let answerValue = '';
+      if (val.answerValue != null) {
+        answerValue = val.answerValue;
+      } else if (val.answerValue && val.collectionOptionList.length) {
+        answerValue = val.collectionOptionList[0].answerValue;
+      }
+
+      if (!/^1[123456789]\d{9}$/.test(answerValue) || answerValue == '') {
+        this.$toast(val.collectionName + '格式错误');
+        return;
+      }
+      if (answerValue != this.verificationPassedPhoneNum) {
+        this.verifyMobile = false;
+        this.confirmed = false;
+      } else {
+        this.verifyMobile = true;
+      }
+    },
     numberFn(val, index, type) {
     numberFn(val, index, type) {
       let value = this.collectionItemList[index].answerValue;
       let value = this.collectionItemList[index].answerValue;
       if (value) {
       if (value) {
@@ -4551,7 +4639,8 @@ export default {
               collectionItemLists[q].answerType == 'check_code' ||
               collectionItemLists[q].answerType == 'check_code' ||
               collectionItemLists[q].answerType == 'nyr' ||
               collectionItemLists[q].answerType == 'nyr' ||
               collectionItemLists[q].answerType == 'dhwb' ||
               collectionItemLists[q].answerType == 'dhwb' ||
-              collectionItemLists[q].answerType == 'xm'
+              collectionItemLists[q].answerType == 'xm' ||
+              collectionItemLists[q].answerType == 'tel_confirm'
             ) {
             ) {
               collectionItemLists[q].answerValue =
               collectionItemLists[q].answerValue =
                 collectionItemLists[q].collectionOptionList[0].answerValue;
                 collectionItemLists[q].collectionOptionList[0].answerValue;
@@ -4583,6 +4672,19 @@ export default {
             if (collectionItemLists[q].answerType == 'xm') {
             if (collectionItemLists[q].answerType == 'xm') {
               this.XMsizeComparison(collectionItemLists[q], 'A');
               this.XMsizeComparison(collectionItemLists[q], 'A');
             }
             }
+            if (
+              collectionItemLists[q].answerType == 'tel_send_code' ||
+              collectionItemLists[q].answerType == 'tel_confirm'
+            ) {
+              if (
+                collectionItemLists[q].collectionOptionList[0].answerValue != null &&
+                this.verifyMobile
+              ) {
+                this.verificationPassedPhoneNum =
+                  collectionItemLists[q].collectionOptionList[0].answerValue;
+                console.log(this.verificationPassedPhoneNum);
+              }
+            }
             if (
             if (
               collectionItemLists[q].answerType == 'duox' ||
               collectionItemLists[q].answerType == 'duox' ||
               collectionItemLists[q].answerType == 'dx'
               collectionItemLists[q].answerType == 'dx'
@@ -4658,7 +4760,10 @@ export default {
                           listchild[qq1].answerValue = '';
                           listchild[qq1].answerValue = '';
                         }
                         }
                       }
                       }
-                      if (listchild[qq1].answerType == 'tel_send_code') {
+                      if (
+                        listchild[qq1].answerType == 'tel_send_code' ||
+                        listchild[qq1].answerType == 'tel_confirm'
+                      ) {
                         if (listchild[qq1].collectionOptionList[0].answerValue != null) {
                         if (listchild[qq1].collectionOptionList[0].answerValue != null) {
                           listchild[qq1].answerValue =
                           listchild[qq1].answerValue =
                             listchild[qq1].collectionOptionList[0].answerValue;
                             listchild[qq1].collectionOptionList[0].answerValue;
@@ -5593,7 +5698,8 @@ export default {
             this.collectionItemList[b].answerType == 'check_code' ||
             this.collectionItemList[b].answerType == 'check_code' ||
             this.collectionItemList[b].answerType == 'nyr' ||
             this.collectionItemList[b].answerType == 'nyr' ||
             this.collectionItemList[b].answerType == 'dhwb' ||
             this.collectionItemList[b].answerType == 'dhwb' ||
-            this.collectionItemList[b].answerType == 'xm'
+            this.collectionItemList[b].answerType == 'xm' ||
+            this.collectionItemList[b].answerType == 'tel_confirm'
           ) {
           ) {
             formData.collectionAnswers.push({
             formData.collectionAnswers.push({
               collectionId: this.collectionItemList[b].collectionId,
               collectionId: this.collectionItemList[b].collectionId,
@@ -5651,7 +5757,8 @@ export default {
                     listDatas[f2].answerType == 'check_code' ||
                     listDatas[f2].answerType == 'check_code' ||
                     listDatas[f2].answerType == 'nyr' ||
                     listDatas[f2].answerType == 'nyr' ||
                     listDatas[f2].answerType == 'dhwb' ||
                     listDatas[f2].answerType == 'dhwb' ||
-                    listDatas[f2].answerType == 'xm'
+                    listDatas[f2].answerType == 'xm' ||
+                    listDatas[f2].answerType == 'tel_confirm'
                   ) {
                   ) {
                     formData.collectionAnswers.push({
                     formData.collectionAnswers.push({
                       collectionId: listDatas[f2].collectionId,
                       collectionId: listDatas[f2].collectionId,
@@ -5723,7 +5830,8 @@ export default {
                             listDatas2[f10].answerType == 'check_code' ||
                             listDatas2[f10].answerType == 'check_code' ||
                             listDatas2[f10].answerType == 'nyr' ||
                             listDatas2[f10].answerType == 'nyr' ||
                             listDatas2[f10].answerType == 'dhwb' ||
                             listDatas2[f10].answerType == 'dhwb' ||
-                            listDatas2[f10].answerType == 'xm'
+                            listDatas2[f10].answerType == 'xm' ||
+                            listDatas2[f10].answerType == 'tel_confirm'
                           ) {
                           ) {
                             formData.collectionAnswers.push({
                             formData.collectionAnswers.push({
                               collectionId: listDatas2[f10].collectionId,
                               collectionId: listDatas2[f10].collectionId,
@@ -5814,7 +5922,8 @@ export default {
                                     listc4[fc4].answerType == 'check_code' ||
                                     listc4[fc4].answerType == 'check_code' ||
                                     listc4[fc4].answerType == 'nyr' ||
                                     listc4[fc4].answerType == 'nyr' ||
                                     listc4[fc4].answerType == 'dhwb' ||
                                     listc4[fc4].answerType == 'dhwb' ||
-                                    listc4[fc4].answerType == 'xm'
+                                    listc4[fc4].answerType == 'xm' ||
+                                    listc4[fc4].answerType == 'tel_confirm'
                                   ) {
                                   ) {
                                     formData.collectionAnswers.push({
                                     formData.collectionAnswers.push({
                                       collectionId: listc4[fc4].collectionId,
                                       collectionId: listc4[fc4].collectionId,
@@ -5920,7 +6029,8 @@ export default {
                                             listc5[fc5].answerType == 'check_code' ||
                                             listc5[fc5].answerType == 'check_code' ||
                                             listc5[fc5].answerType == 'nyr' ||
                                             listc5[fc5].answerType == 'nyr' ||
                                             listc5[fc5].answerType == 'dhwb' ||
                                             listc5[fc5].answerType == 'dhwb' ||
-                                            listc5[fc5].answerType == 'xm'
+                                            listc5[fc5].answerType == 'xm' ||
+                                            listc5[fc5].answerType == 'tel_confirm'
                                           ) {
                                           ) {
                                             formData.collectionAnswers.push({
                                             formData.collectionAnswers.push({
                                               collectionId: listc5[fc5].collectionId,
                                               collectionId: listc5[fc5].collectionId,
@@ -6179,6 +6289,34 @@ export default {
         }
         }
       );
       );
     },
     },
+    telConfirm(val) {
+      let item = '';
+      let answerValue = '';
+      if (val.collectionOptionList && val.collectionOptionList.length) {
+        answerValue = val.collectionOptionList[0].answerValue;
+        item = val.collectionOptionList[0];
+      } else {
+        answerValue = val.answerValue;
+        item = val;
+      }
+
+      if (!/^1[123456789]\d{9}$/.test(answerValue) || answerValue == '') {
+        this.$toast(val.collectionName + '格式错误');
+        return;
+      }
+      confirmPhone({
+        phone: answerValue, //	string	电话
+        visitId: this.visitId, //	Long	拜访id
+        taskId: this.taskId, //	Long	任务id
+        collectionId: item.collectionId, //	Long	采集项id
+      }).then((res) => {
+        if (res.code == 200) {
+          this.verificationPassedPhoneNum = answerValue;
+          this.confirmed = true;
+          this.$toast('发送成功');
+        }
+      });
+    },
     verification(item, collectionItems) {
     verification(item, collectionItems) {
       let answerValue = '';
       let answerValue = '';
       if (item.collectionOptionList && item.collectionOptionList.length) {
       if (item.collectionOptionList && item.collectionOptionList.length) {