Prechádzať zdrojové kódy

Merge branch 'feature_20251114_主管任务经销商单选&门店题型' into uat(dev)

sunny 1 týždeň pred
rodič
commit
a1fa1569b4

+ 23 - 0
src/views/week/SUPTaskApproval/detailItem.vue

@@ -161,6 +161,29 @@
             </div>
           </div>
         </div>
+        <div v-if="item.answerType == 'md'" class="formLabel z-cell">
+          <van-cell>
+            <template #title>
+              <span v-if="item.isMust == 0" class="van-f-red">*</span>
+              {{ 1 + index + '.' }}
+              {{ item.customName }}
+            </template>
+          </van-cell>
+          <div class="jxsBox">
+            <div class="jxsContent">
+              <div class="item" v-for="(val, index) in item.storeList">
+                <el-popover
+                  placement="bottom"
+                  trigger="click"
+                  :content="val.storeName + '(' + val.storeCode + ')'">
+                  <template slot="reference">
+                    <div class="selectItem">{{ val.storeName }} &nbsp; ({{ val.storeCode }})</div>
+                  </template>
+                </el-popover>
+              </div>
+            </div>
+          </div>
+        </div>
         <br />
       </div>
     </van-form>

+ 1 - 1
src/views/week/VisitSummaryAdd.vue

@@ -326,7 +326,7 @@
             style="margin-top: 2px; border-radius: 6px; overflow: hidden"
             v-model="agentValue"
             label=""
-            placeholder="请输入关键词"
+            placeholder="请输入门店名称/编号/地址搜索"
             clearable />
         </van-col>
         <van-col

+ 109 - 10
src/views/week/allowWriteAgainSummary.vue

@@ -166,14 +166,14 @@
                     <van-icon
                       name="clear"
                       size="16"
-                      @click="closeJXS(item, index)"
+                      @click="closeJXSorMD(item, index)"
                       v-if="item.allowWriteAgain" />
                   </template>
                 </el-popover>
               </div>
             </div>
             <div class="addJXS">
-              <van-icon name="add-o" size="24" @click="addJXS" v-if="item.allowWriteAgain" />
+              <van-icon name="add-o" size="24" @click="addJXSorMD(item)" v-if="item.allowWriteAgain" />
             </div>
             <div class="tips" v-if="item.allowWriteAgain">{{ item.remark }}</div>
           </div>
@@ -195,10 +195,19 @@
                   :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)"
+                      v-if="item.allowWriteAgain" />
                   </template>
                 </el-popover>
               </div>
             </div>
+            <div class="addJXS">
+              <van-icon name="add-o" size="24" @click="addJXSorMD(item)" v-if="item.allowWriteAgain" />
+            </div>
+            <div class="tips" v-if="item.allowWriteAgain">{{ item.remark }}</div>
           </div>
         </div>
         <br />
@@ -284,6 +293,32 @@
         @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>
+      <van-picker
+        show-toolbar
+        :columns="storesData"
+        value-key="storeName"
+        @confirm="onConfirmStoresList"
+        @cancel="storeTypeShow = false" />
+    </van-popup>
   </div>
 </template>
 
@@ -293,6 +328,7 @@ import {
   getSummaryMobileDeptInfo,
   getDeptsByUser,
   chainsList,
+  storesList
 } from '@/api/index';
 import zRadio from '@/components/zRadio2';
 import zCheckbox from '@/components/zCheckbox2';
@@ -365,8 +401,11 @@ export default {
       index: '',
       activaFlag: true,
       moreTypeShow: false,
+      storeTypeShow: false,
+      storeType: null,
       agentValue: '',
       chainsData: [],
+      storesData: [],
       chainName: '',
       chainCode: '',
       jxsList: [],
@@ -817,15 +856,38 @@ export default {
       this.formData.pageNum = 1;
       this.EndTimeShow = false;
     },
-    // 添加经销商
-    addJXS() {
-      this.agentValue = '';
-      this.moreTypeShow = true;
-      this.getChainsList();
+    // 添加经销商或者门店
+    addJXSorMD(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 = '';
+        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 = [];
@@ -845,6 +907,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');
@@ -863,6 +944,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>