Browse Source

修改客户信息编辑页面定位问题

zhujindu 1 year ago
parent
commit
b5529912df
1 changed files with 27 additions and 18 deletions
  1. 27 18
      src/views/storeManagement/storeEdit.vue

+ 27 - 18
src/views/storeManagement/storeEdit.vue

@@ -657,8 +657,8 @@ export default {
       },
       },
       img: "https://svs-test.oss-cn-shanghai.aliyuncs.com/1647398239620微信截图_20220315112921.png",
       img: "https://svs-test.oss-cn-shanghai.aliyuncs.com/1647398239620微信截图_20220315112921.png",
       location: {
       location: {
-        lat: "34.616712",
-        lon: "112.440816",
+        lat: "",
+        lon: "",
       },
       },
       checkboxGroup: [],
       checkboxGroup: [],
       radio: "",
       radio: "",
@@ -709,7 +709,7 @@ export default {
       pLot: "",
       pLot: "",
     };
     };
   },
   },
-  created() {
+  activated() {
     this.getTCFXList();
     this.getTCFXList();
     this.getSJSList();
     this.getSJSList();
     this.getQGJZist();
     this.getQGJZist();
@@ -726,7 +726,8 @@ export default {
   watch: {
   watch: {
     $route(to, from) {
     $route(to, from) {
       if (to.path == "/storeEdit" && from.path == "/storeDetail") {
       if (to.path == "/storeEdit" && from.path == "/storeDetail") {
-        this.getDetail();
+        console.log("storeEditstoreEditstoreEdit");
+        // this.getDetail();
         this.showmap = false;
         this.showmap = false;
       }
       }
     },
     },
@@ -801,14 +802,18 @@ export default {
     },
     },
     confirmMap() {
     confirmMap() {
       if (this.addresssb > -1) {
       if (this.addresssb > -1) {
-        this.fromValue.addressLine = this.maplist[this.addresssb].address;
+        let checkedPoint = this.maplist[this.addresssb];
+        // 坐标转换
+        let TXisBD = this.CJ02BD(checkedPoint.location.lat, checkedPoint.location.lng);
+        this.fromValue.addressLine = checkedPoint.address;
         var location = this.CJ02BD(this.pLat, this.pLot);
         var location = this.CJ02BD(this.pLat, this.pLot);
         this.fromValue.lat = location.lat;
         this.fromValue.lat = location.lat;
         this.fromValue.lon = location.lon;
         this.fromValue.lon = location.lon;
-        this.fromValue.poiAddress = this.maplist[this.addresssb].address;
-        this.fromValue.poiLat = this.maplist[this.addresssb].location.lat;
-        this.fromValue.poiLon = this.maplist[this.addresssb].location.lng;
-        this.fromValue.poiId = this.maplist[this.addresssb].id;
+        this.fromValue.poiAddress = checkedPoint.address;
+        this.fromValue.poiLat = TXisBD.lat;
+        this.fromValue.poiLon = TXisBD.lon;
+        this.fromValue.poiId = checkedPoint.id;
+        this.fromValue.poiName = checkedPoint.title;
       }
       }
       this.showmap = false;
       this.showmap = false;
     },
     },
@@ -1422,7 +1427,6 @@ export default {
               this.cont--;
               this.cont--;
               if (this.cont == "0") {
               if (this.cont == "0") {
                 if (flat) {
                 if (flat) {
-                  loading1.clear();
                   clearInterval(times);
                   clearInterval(times);
                   that.$dialog
                   that.$dialog
                     .alert({
                     .alert({
@@ -1450,6 +1454,7 @@ export default {
               that.wx.getLocation({
               that.wx.getLocation({
                 type: "gcj02",
                 type: "gcj02",
                 success: function (res) {
                 success: function (res) {
+                  console.log("定位成功");
                   flat = false;
                   flat = false;
                   var location = that.CJ02BD(res.latitude, res.longitude);
                   var location = that.CJ02BD(res.latitude, res.longitude);
                   that.location = location;
                   that.location = location;
@@ -1457,27 +1462,27 @@ export default {
                   that.fromValue.lon = that.location.lon;
                   that.fromValue.lon = that.location.lon;
                 },
                 },
                 fail: function () {
                 fail: function () {
+                  flat = false;
                   that.$dialog
                   that.$dialog
                     .confirm({
                     .confirm({
-                      confirmButtonText: "取消",
-                      cancelButtonText: "重新定位",
+                      confirmButtonText: "重新定位",
+                      showCancelButton: false,
+                      // cancelButtonText: "重新定位",
                       title: "系统提示",
                       title: "系统提示",
                       message: "GPS未开启",
                       message: "GPS未开启",
                     })
                     })
                     .then(() => {
                     .then(() => {
-                      console.log("取消");
-                    })
-                    .catch(() => {
+                      console.log("重新定位");
                       that.getLocation();
                       that.getLocation();
                     });
                     });
                 },
                 },
               });
               });
             });
             });
             that.wx.error(function (res) {
             that.wx.error(function (res) {
-              this.$toast.fail("定位失败");
+              that.$toast.fail("定位失败");
             });
             });
           } else {
           } else {
-            this.$toast.fail("接口异常");
+            that.$toast.fail("接口异常");
           }
           }
         });
         });
     },
     },
@@ -1835,7 +1840,11 @@ export default {
       });
       });
     },
     },
     onClickLeft() {
     onClickLeft() {
-      this.$router.go(-1);
+      this.$router.replace({
+        path: "/storeDetail",
+        query: { id: this.$route.query.id },
+      });
+      // this.$router.go(-1);
     },
     },
     phoneCheck() {
     phoneCheck() {
       if (this.fromValue.ifJzStoreType != 1) {
       if (this.fromValue.ifJzStoreType != 1) {