Procházet zdrojové kódy

地图搜索范围由字典配置

zhujindu před 1 rokem
rodič
revize
0733cee24c
2 změnil soubory, kde provedl 36 přidání a 4 odebrání
  1. 8 0
      src/api/index.js
  2. 28 4
      src/views/deviceOutside/rangeStore.vue

+ 8 - 0
src/api/index.js

@@ -852,3 +852,11 @@ export function storeApprovaHistory(query) {
     params: query,
   });
 }
+// 获取字典
+export function getDictOption(query, dictTypr) {
+  return request({
+    url: '/mobile/storeGroup/' + dictTypr,
+    method: 'get',
+    params: query,
+  });
+}

+ 28 - 4
src/views/deviceOutside/rangeStore.vue

@@ -594,6 +594,7 @@ import {
   ProductItemImge,
   storeList,
   storeMyList,
+  getDictOption,
 } from '@/api';
 import axios from 'axios';
 import ordernum from '@/assets/ordernum.png';
@@ -729,6 +730,7 @@ export default {
       CustomerName: '',
       listpoint: [],
       heifhgts: '200px',
+      mapRange: [], //地图范围
     };
   },
   created() {
@@ -743,6 +745,8 @@ export default {
     }
   },
   activated() {
+    // 获取地图范围 字典
+    this.getMapRange();
     this.resultmap = [];
     this.tabVal = this.$route.query.tabVal;
     this.customerVisits = localStorage.getItem('customerVisits');
@@ -776,6 +780,26 @@ export default {
     });
   },
   methods: {
+    async getMapRange() {
+      let mapRangeOption = await getDictOption({}, 'out_plan_map_range');
+      this.mapRange = mapRangeOption.data || [];
+      // dictValue
+    },
+    // 设置地图获取范围提示文字
+    setMapRangeTitle(total) {
+      let leftRange = this.mapRange[0] ? (this.mapRange[0].dictValue / 1000).toFixed(1) : '10';
+      let rightRange = this.mapRange[1] ? (this.mapRange[1].dictValue / 1000).toFixed(1) : '5';
+      let msg =
+        '当前区域' +
+        leftRange +
+        '公里内共' +
+        total +
+        '家门店,展示附近' +
+        rightRange +
+        '公里的门店';
+      console.log(msg);
+      return msg;
+    },
     closeFn() {
       this.show = false;
       // this.info.lon=0
@@ -1363,7 +1387,7 @@ export default {
               this.show = false;
             }
             if (res.total > 50) {
-              this.msg = '当前区域10公里内共' + res.total + '家门店,展示附近5公里的门店';
+              this.msg = this.setMapRangeTitle(res.total);
               this.msgshow = true;
               this.show = false;
             }
@@ -1405,7 +1429,7 @@ export default {
               this.show = false;
             }
             if (res.total > 50) {
-              this.msg = '当前区域10公里内共' + res.total + '家门店,展示附近5公里的门店';
+              this.msg = this.setMapRangeTitle(res.total);
               this.msgshow = true;
               this.show = false;
             }
@@ -1447,7 +1471,7 @@ export default {
               this.show = false;
             }
             if (res.total > 50) {
-              this.msg = '当前区域10公里内共' + res.total + '家门店,展示附近5公里的门店';
+              this.msg = this.setMapRangeTitle(res.total);
               this.msgshow = true;
               this.show = false;
             }
@@ -1529,7 +1553,7 @@ export default {
               this.show = false;
             }
             if (res.total > 50) {
-              this.msg = '当前区域10公里内共' + res.total + '家门店,展示附近5公里的门店';
+              this.msg = this.setMapRangeTitle(res.total);
               this.msgshow = true;
               this.show = false;
             }