Bladeren bron

Merge branch 'feature_20250827_地图添加搜索当前范围功能' into release

# Conflicts:
#	src/views/deviceOutside/rangeStore.vue
zhujindu 2 maanden geleden
bovenliggende
commit
b1b132568a
3 gewijzigde bestanden met toevoegingen van 62 en 40 verwijderingen
  1. BIN
      src/assets/mapLocation.png
  2. BIN
      src/assets/searchLocation.png
  3. 62 40
      src/views/deviceOutside/rangeStore.vue

BIN
src/assets/mapLocation.png


BIN
src/assets/searchLocation.png


+ 62 - 40
src/views/deviceOutside/rangeStore.vue

@@ -128,6 +128,16 @@
         @reload="reload"
         :key="baiduMapKey"
         ref="myMap">
+        <!-- 地图中心坐标 -->
+        <bm-marker
+          v-if="touchmoveTrue"
+          :position="{ lng: currentCenter.lng, lat: currentCenter.lat }"
+          class="aaaa"
+          :icon="{
+            url: require('@/assets/mapLocation.png'),
+            size: { width: 32, height: 60 },
+          }">
+        </bm-marker>
         <!--        :minClusterSize="minClusterSize"-->
         <bml-marker-clusterer :averageCenter="false" :styles="styless">
           <bm-marker
@@ -137,8 +147,6 @@
             @click="infoShow(marker, index)"
             :icon="{ url: mpFn(marker, 2), size: { width: 34, height: 40 } }"></bm-marker>
         </bml-marker-clusterer>
-        <bm-marker :position="{ lng: lonmy, lat: latmy }"></bm-marker>
-        <!--        +0.00003-->
         <bm-marker
           :position="{ lng: info.lon, lat: info.lat }"
           :top="true"
@@ -162,10 +170,15 @@
             lineHeight: '50px',
           }"
           :offset="{ width: -10, height: -10 }" />
-        <!--        <bm-geolocation @locationSuccess="locationSuccess" anchor="BMAP_ANCHOR_BOTTOM_RIGHT" :showAddressBar="true" :autoLocation="true" :offset="{width:5,height:280}"></bm-geolocation>-->
       </baidu-map>
-      <img src="./../../assets/list.png" @click="onClickLeft" class="mapimg" />
-      <img src="./../../assets/sbpm.png" @click="onMaps" class="mapimg" style="bottom: 286px" />
+      <img src="./../../assets/sbpm.png" @click="onMaps" class="mapimg" style="bottom: 340px" />
+      <img
+        src="./../../assets/list.png"
+        @click="onClickLeft"
+        class="mapimg"
+        style="bottom: 286px" />
+      <!-- 获取当前中心位置数据 -->
+      <img src="./../../assets/searchLocation.png" @click="getLocationData" class="mapimg" />
       <div v-if="show" class="mapStoreList">
         <van-icon
           name="close"
@@ -859,6 +872,11 @@ export default {
       baiduMapKey: new Date().getTime(),
       isCompetingStores: true,
       postType: '',
+      currentCenter: {
+        lng: '',
+        lat: '',
+      }, //地图中心位置
+      touchmoveTrue: false, //移动后在线式中心图标
     };
   },
   created() {
@@ -874,6 +892,7 @@ export default {
   },
   activated() {
     this.postType = localStorage.getItem('postType');
+    this.touchmoveTrue = false;
     this.listData = [];
     this.baiduMapKey = new Date().getTime();
     this.closeFn();
@@ -981,6 +1000,16 @@ export default {
       // this.mapk.clearOverlays()
       this.getposition();
     },
+    getLocationData() {
+      // let currentCenter = this.CJ02BD(34.62200241805427, 112.45384320079718);
+      // this.lon = currentCenter.lon;
+      // this.lat = currentCenter.lat;
+
+      this.lon = this.currentCenter.lng;
+      this.lat = this.currentCenter.lat;
+      console.log(this.lon, this.lat);
+      this.getUserOutPlaList();
+    },
     getStoreTypeList() {
       getStoreTypeListlp({}).then((res) => {
         this.storeTypeLists = res.data;
@@ -1096,9 +1125,7 @@ export default {
         this.listData = this.list;
       }
     },
-    reload() {
-      debugger;
-    },
+    reload() {},
     handler({ BMap, map }) {
       this.mapk = map;
       this.mapks = BMap;
@@ -1123,18 +1150,21 @@ export default {
       this.geocoder = new TMap.service.Geocoder();
     },
     dragend(e) {
-      this.getMapposition(e, '2', this.$route.query.tabVal);
+      this.touchmoveTrue = true;
+      // const currentCenter = this.mapk.getCenter();
+      // console.log(`当前中心点纬度: ${currentCenter.lat}, 经度: ${currentCenter.lng}`);
+      // this.getMapposition(e, '2', this.$route.query.tabVal);
+      var input = [e.target.re.lat, e.target.re.lng];
+      this.currentCenter = new TMap.LatLng(Number(input[0]), Number(input[1]));
+      console.log(e);
+      console.log(`当前中心点纬度: ${this.currentCenter.lat}, 经度: ${this.currentCenter.lng}`);
     },
     zoomend(e) {
       this.getMapposition(e, '1', this.$route.query.tabVal);
     },
     getMapposition(e, type, listType) {
-      debugger;
       var that = this;
       var typeList = -1;
-      var input = [e.target.re.lat, e.target.re.lng];
-      var location = new TMap.LatLng(Number(input[0]), Number(input[1]));
-
       var Zoom = e.target.getZoom();
       if (listType == 1) {
         typeList = 1;
@@ -1159,11 +1189,11 @@ export default {
         var PointSum = that.twoPointSum(lat, lon, that.latsave, that.lonsave).toFixed(2);
         this.lon = this.mapk.getCenter().lng;
         this.lat = this.mapk.getCenter().lat;
-        if (PointSum > 3000) {
-          setTimeout(() => {
-            this.getUserOutPlaList();
-          }, 1000);
-        }
+        // if (PointSum > 3000) {
+        //   setTimeout(() => {
+        //     this.getUserOutPlaList();
+        //   }, 1000);
+        // }
       }
     },
     getStoreMapInfo(val) {
@@ -1336,6 +1366,8 @@ export default {
                   that.lon1 = location.lon;
                   that.latmy = location.lat;
                   that.lonmy = location.lon;
+                  that.currentCenter.lat = that.latmy;
+                  that.currentCenter.lng = that.lonmy;
                   that.mapk.centerAndZoom(new BMap.Point(location.lon, location.lat), 18);
                   that.onSearch();
                   // that.getUserOutPlaList('2');
@@ -1385,7 +1417,6 @@ export default {
       this.getpointList(row);
     },
     getpointList(val) {
-      debugger;
       var that = this;
       let loading3 = this.$toast.loading({
         duration: 0,
@@ -1556,11 +1587,9 @@ export default {
               this.$toast('附近无客户信息');
               this.show = false;
             }
-            if (res.total > 50) {
-              this.msg = this.setMapRangeTitle(res.total);
-              this.msgshow = true;
-              this.show = false;
-            }
+            this.msg = this.setMapRangeTitle(res.total);
+            this.msgshow = true;
+            this.show = false;
             if (this.first < 2) {
               this.zoom = 18;
               this.first = 2;
@@ -1598,11 +1627,9 @@ export default {
               this.$toast('附近无客户信息');
               this.show = false;
             }
-            if (res.total > 50) {
-              this.msg = this.setMapRangeTitle(res.total);
-              this.msgshow = true;
-              this.show = false;
-            }
+            this.msg = this.setMapRangeTitle(res.total);
+            this.msgshow = true;
+            this.show = false;
             if (this.first < 2) {
               this.zoom = 18;
               this.first = 2;
@@ -1640,11 +1667,9 @@ export default {
               this.$toast('附近无客户信息');
               this.show = false;
             }
-            if (res.total > 50) {
-              this.msg = this.setMapRangeTitle(res.total);
-              this.msgshow = true;
-              this.show = false;
-            }
+            this.msg = this.setMapRangeTitle(res.total);
+            this.msgshow = true;
+            this.show = false;
             if (this.first < 2) {
               this.zoom = 18;
               this.first = 2;
@@ -1690,7 +1715,6 @@ export default {
           }
         });
       } else {
-        debugger;
         getUserOrgStoreList({
           type: 2,
           lon: this.lon,
@@ -1723,11 +1747,9 @@ export default {
               this.$toast('附近无客户信息');
               this.show = false;
             }
-            if (res.total > 50) {
-              this.msg = this.setMapRangeTitle(res.total);
-              this.msgshow = true;
-              this.show = false;
-            }
+            this.msg = this.setMapRangeTitle(res.total);
+            this.msgshow = true;
+            this.show = false;
             if (this.first < 2) {
               this.zoom = 18;
               this.first = 2;