Explorar o código

feature_20251114_主管任务经销商单选&门店题型

sunny hai 2 semanas
pai
achega
551408c943
Modificáronse 2 ficheiros con 161 adicións e 23 borrados
  1. 18 9
      src/api/index.js
  2. 143 14
      src/views/week/VisitSummaryAdd.vue

+ 18 - 9
src/api/index.js

@@ -1018,6 +1018,15 @@ export function getMaterialHistory(query) {
     params: query,
   });
 }
+
+// 根据日报id查询汇报当天拜访照片base64格式
+export function imgToBase64(data) {
+  return request({
+    url: '/mobile/reportMobile/imgToBase64',
+    method: 'post',
+    data,
+  });
+}
 // 根据当前用户获取下级所有销售部接口
 export function getDeptsByUser(query) {
   return request({
@@ -1036,6 +1045,15 @@ export function chainsList(query) {
   });
 }
 
+// 获取门店列表接口
+export function storesList(query) {
+  return request({
+    url: '/mobile/store/list',
+    method: 'get',
+    params: query,
+  });
+}
+
 // 主管任务答案暂存接口(同主管任务答案保存接口一致,但是接口不校验答案是否必填)
 export function temporarilyCustomAnswer(data) {
   return request({
@@ -1053,15 +1071,6 @@ export function deleteSummaryMobile(query) {
   });
 }
 
-// 根据日报id查询汇报当天拜访照片base64格式
-export function imgToBase64(data) {
-  return request({
-    url: '/mobile/reportMobile/imgToBase64',
-    method: 'post',
-    data,
-  });
-}
-
 // sku识别信息接口
 export function getSkuDetailById(query) {
   return request({

+ 143 - 14
src/views/week/VisitSummaryAdd.vue

@@ -184,7 +184,7 @@
               :zRadiocolumns="item.customOptionList"
               @zSelectVal="zSelectVal"></z-radio>
           </div>
-          <div v-if="item.answerType == 'jxs'" class="formLabel z-cell">
+          <div v-if="item.answerType == 'jxs' || item.answerType == 'md'" class="formLabel z-cell">
             <van-cell>
               <template #title>
                 <span v-if="item.isMust == 0" class="van-f-red">*</span>
@@ -193,20 +193,33 @@
               </template>
             </van-cell>
             <div class="jxsBox">
-              <div class="jxsContent">
-                <div class="item" v-for="(val, index) in item.chainList">
+              <div class="jxsContent" v-if="item.answerType == 'jxs'">
+                <div class="item" v-for="(val, index) in item.chainList" :key="index">
                   <el-popover
                     placement="bottom"
                     trigger="click"
                     :content="val.chainName + '(' + val.chainCode + ')'">
                     <template slot="reference">
                       <div class="selectItem">{{ val.chainName }} &nbsp; ({{ val.chainCode }})</div>
-                      <van-icon name="clear" size="16" @click="closeJXS(item, index)" />
+                      <van-icon name="clear" size="16" @click="closeJXSorMD(item, index)" />
                     </template>
                   </el-popover>
                 </div>
               </div>
-              <div class="addJXS"><van-icon name="add-o" size="24" @click="addJXS(item.chainList,item.maxValue)" /></div>
+              <div class="jxsContent" v-if="item.answerType == 'md'">
+                <div class="item" v-for="(val, index) in item.storeList" :key="index">
+                  <el-popover
+                    placement="bottom"
+                    trigger="click"
+                    :content="val.storeName + '(' + val.storeCode + ')'">
+                    <template slot="reference">
+                      <div class="selectItem">{{ val.storeName }} &nbsp; ({{ val.storeCode }})</div>
+                      <van-icon name="clear" size="16" @click="closeJXSorMD(item, index)" />
+                    </template>
+                  </el-popover>
+                </div>
+              </div>
+              <div class="addJXS"><van-icon name="add-o" size="24" @click="addJXS(item)" /></div>
               <div class="tips">{{ item.remark }}</div>
             </div>
           </div>
@@ -294,6 +307,9 @@
           <div style="background-color: #0057ba; color: #fff">搜索</div>
         </van-col>
       </van-row>
+      <div class="tips">
+        <div><van-icon name="warning-o" />默认显示前100条,请输入关键词查询</div>
+      </div>
       <van-picker
         show-toolbar
         :columns="chainsData"
@@ -301,6 +317,35 @@
         @confirm="onConfirmChainsList"
         @cancel="moreTypeShow = false" />
     </van-popup>
+    <!-- 经销商 -->
+    <van-popup v-model="storeTypeShow" position="bottom">
+      <van-row style="background-color: #f5f5f5">
+        <van-col span="20">
+          <van-field
+            left-icon="search"
+            style="margin-top: 2px; border-radius: 6px; overflow: hidden"
+            v-model="agentValue"
+            label=""
+            placeholder="请输入关键词"
+            clearable />
+        </van-col>
+        <van-col
+          span="4"
+          style="text-align: center; line-height: 48px"
+          @click="getStoresList(agentValue)">
+          <div style="background-color: #0057ba; color: #fff">搜索</div>
+        </van-col>
+      </van-row>
+      <div class="tips">
+        <div><van-icon name="warning-o" />默认显示前100条,请输入关键词查询</div>
+      </div>
+      <van-picker
+        show-toolbar
+        :columns="storesData"
+        value-key="storeName"
+        @confirm="onConfirmStoresList"
+        @cancel="storeTypeShow = false" />
+    </van-popup>
   </div>
 </template>
 
@@ -313,6 +358,7 @@ import {
   getSummaryMobileDeptInfo,
   getDeptsByUser,
   chainsList,
+  storesList,
   temporarilyCustomAnswer,
 } from '@/api/index';
 import zRadio from '@/components/zRadio2';
@@ -380,8 +426,11 @@ export default {
       index: '',
       activaFlag: true,
       moreTypeShow: false,
+      storeTypeShow: false,
+      storeType: null,
       agentValue: '',
       chainsData: [],
+      storesData: [],
       chainName: '',
       chainCode: '',
       jxsList: [],
@@ -975,20 +1024,37 @@ export default {
       this.EndTimeShow = false;
     },
     // 添加经销商
-    addJXS(chainList,maxValue) {
-      let dataList = chainList ? chainList : [];
-      const isExceedLimit = dataList.length >= maxValue;
-      if (maxValue !== null && isExceedLimit) {
+    addJXS(val) {
+      let answerType = val.answerType;
+      let dataList =  [];
+      if(answerType == 'jxs'){
+          dataList = val.chainList ? val.chainList : [];
+      }else if(answerType == 'md'){
+          dataList = val.storeList ? val.storeList : [];
+      }
+      const isExceedLimit = dataList.length >= val.maxValue;
+      if (val.maxValue !== null && isExceedLimit) {
         this.$toast('选择经销商超过最大限制!');
       } else {
         this.agentValue = '';
-        this.moreTypeShow = true;
-        this.getChainsList();
+        if(answerType == 'jxs'){
+          this.moreTypeShow = true;
+          this.getChainsList();
+        }else if(answerType == 'md'){
+          this.storeTypeShow = true;
+          this.storeType = val.storeType;
+          this.getStoresList();
+        }
+        
       }
     },
-    // 删除经销商
-    closeJXS(item, index) {
-      item.chainList.splice(index, 1);
+    // 删除经销商或者门店
+    closeJXSorMD(item, index) {
+      if(item.answerType == 'jxs'){
+        item.chainList.splice(index, 1);
+      }else if(item.answerType == 'md'){
+        item.storeList.splice(index, 1);
+      }
     },
     getChainsList(value = '') {
       this.chainsData = [];
@@ -1008,6 +1074,25 @@ export default {
           this.chainsData = [];
         });
     },
+    getStoresList(value = '') {
+      this.storesData = [];
+      storesList({
+        storeCategoryList: this.storeType ? this.storeType.split(",") : [], //	门店类型数组
+        storeName: value, //	门店名称或者编号搜索,模糊搜索
+        pageNum: 1, //	int	    页码
+        PageSize: 100    // 每页数
+      })
+        .then((res) => {
+          if (res.code == 200 && res.rows) {
+            this.storesData = res.rows;
+          } else {
+            this.storesData = [];
+          }
+        })
+        .catch(() => {
+          this.storesData = [];
+        });
+    },
     onConfirmChainsList(value) {
       if (value && value.chainName != undefined) {
         let JXSSataList = this.collectionItemList.find((item) => item.answerType == 'jxs');
@@ -1026,6 +1111,24 @@ export default {
         }
       }
     },
+    onConfirmStoresList(value) {
+      if (value && value.storeName != undefined) {
+        let MDSataList = this.collectionItemList.find((item) => item.answerType == 'md');
+        if (!MDSataList.storeList) {
+          MDSataList.storeList = [];
+        }
+        let isFlag = MDSataList.storeList.find((val) => val.storeCode == value.storeCode);
+        if (!isFlag) {
+          MDSataList.storeList.push({
+            storeName: value.storeName,
+            storeCode: value.storeCode,
+          });
+          this.storeTypeShow = false;
+        } else {
+          this.$toast('当前门店已添加,不能重复添加!');
+        }
+      }
+    },
   },
 };
 </script>
@@ -1228,4 +1331,30 @@ export default {
     font-size: 14px;
   }
 }
+.VisitSummaryAdd {
+  .van-popup {
+    .tips {
+      width: 100%;
+      height: 40px;
+      display: flex;
+      align-items: center;
+      justify-content: center;
+      position: absolute;
+      top: 100px;
+      z-index: 999999;
+      div {
+        width: 80%;
+        height: 100%;
+        display: flex;
+        align-items: center;
+        justify-content: center;
+        text-align: center;
+        font-size: 15px;
+        background: rgba(225, 236, 250, 0.8);
+        border-radius: 6px;
+        color: #575656;
+      }
+    }
+  }
+}
 </style>