Browse Source

no message

zhujindu 8 months ago
parent
commit
cd75236ca6
1 changed files with 102 additions and 97 deletions
  1. 102 97
      src/views/deviceOutside/suishenbangOutstoreVisit.vue

+ 102 - 97
src/views/deviceOutside/suishenbangOutstoreVisit.vue

@@ -439,105 +439,110 @@ export default {
       markers.setGeometries([]);
       markers.setGeometries([]);
       var input = [that.urlParameter.marklat, that.urlParameter.marklon];
       var input = [that.urlParameter.marklat, that.urlParameter.marklon];
       var location = new TMap.LatLng(Number(input[0]), Number(input[1]));
       var location = new TMap.LatLng(Number(input[0]), Number(input[1]));
-      geocoder.getAddress({ location: location }).then(
-        function (result) {
-          var addresses = result.result.formatted_addresses;
-          let address_component = result.result.address_component;
-          let province = address_component.province;
-          let city = address_component.city;
-          let district = address_component.district;
-          console.log('province=' + province);
-          console.log('city=' + city);
-          console.log('district=' + district);
-          var params = {
-            storeId: that.storeId,
-            storeCode: that.storeCode,
-            visitEntry: visitEntry,
-            lat: that.urlParameter.latNew,
-            lon: that.urlParameter.lonNew,
-            visitModel: that.visitModel,
-            routeDetailsId: that.rdId,
-            visitSource: '1',
-            locationCity: '',
-            locationRemark: addresses.recommend,
-            locationAccuracy: that.urlParameter.PointSum,
-            province: address_component.province,
-            city: address_component.city,
-            district: address_component.district,
-          };
-          that.locationAccuracy = that.urlParameter.PointSum;
-          that.city = '';
-          that.address = addresses.recommend;
-          localStorage.setItem('address', '');
-          if (that.visitId != null) {
-            params.id = that.visitId;
-          }
-          let loading2 = that.$toast.loading({
-            duration: 0,
-            message: '加载中...',
-            forbidClick: true,
-          });
-          getStoreGroupTask(params).then((res) => {
-            loading2.clear();
-            if (res.code == 200) {
-              localStorage.setItem('visitId', res.data.visitId);
-              that.notes = res.data.notes;
-              that.visitId = res.data.visitId;
-              that.list = res.data.sfaTaskList;
-              that.storeGroupId = res.data.storeGroupId;
-              that.showOrderButton = res.data.showOrderButton;
-              that.startTime = res.data.startTime;
-              that.timeN = setInterval(that.animation, 16);
-              that.visitsRemarks = res.data.visitsRemarks;
-            } else {
-              that.$toast(res.msg);
+      geocoder
+        .getAddress({ location: location })
+        .then(
+          function (result) {
+            var addresses = result.result.formatted_addresses;
+            let address_component = result.result.address_component;
+            let province = address_component.province;
+            let city = address_component.city;
+            let district = address_component.district;
+            console.log('province=' + province);
+            console.log('city=' + city);
+            console.log('district=' + district);
+            var params = {
+              storeId: that.storeId,
+              storeCode: that.storeCode,
+              visitEntry: visitEntry,
+              lat: that.urlParameter.latNew,
+              lon: that.urlParameter.lonNew,
+              visitModel: that.visitModel,
+              routeDetailsId: that.rdId,
+              visitSource: '1',
+              locationCity: '',
+              locationRemark: addresses.recommend || '',
+              locationAccuracy: that.urlParameter.PointSum,
+              province: address_component.province,
+              city: address_component.city,
+              district: address_component.district,
+            };
+            that.locationAccuracy = that.urlParameter.PointSum;
+            that.city = '';
+            that.address = addresses.recommend || '';
+            localStorage.setItem('address', '');
+            if (that.visitId != null) {
+              params.id = that.visitId;
             }
             }
-          });
-        },
-        function (err) {
-          var params = {
-            storeId: that.storeId,
-            storeCode: that.storeCode,
-            visitEntry: visitEntry,
-            lat: that.urlParameter.latNew,
-            lon: that.urlParameter.lonNew,
-            visitModel: that.visitModel,
-            routeDetailsId: that.rdId,
-            visitSource: '1',
-            locationCity: '',
-            locationRemark: '',
-            locationAccuracy: that.urlParameter.PointSum,
-          };
-          that.locationAccuracy = that.urlParameter.PointSum;
-          that.city = '';
-          that.address = '';
-          localStorage.setItem('address', '');
-          if (that.visitId != null) {
-            params.id = that.visitId;
-          }
-          let loading2 = that.$toast.loading({
-            duration: 0,
-            message: '加载中...',
-            forbidClick: true,
-          });
-          getStoreGroupTask(params).then((res) => {
-            loading2.clear();
-            if (res.code == 200) {
-              localStorage.setItem('visitId', res.data.visitId);
-              that.notes = res.data.notes;
-              that.visitId = res.data.visitId;
-              that.list = res.data.sfaTaskList;
-              that.storeGroupId = res.data.storeGroupId;
-              that.showOrderButton = res.data.showOrderButton;
-              that.startTime = res.data.startTime;
-              that.timeN = setInterval(that.animation, 16);
-              that.visitsRemarks = res.data.visitsRemarks;
-            } else {
-              that.$toast(res.msg);
+            let loading2 = that.$toast.loading({
+              duration: 0,
+              message: '加载中...',
+              forbidClick: true,
+            });
+            getStoreGroupTask(params).then((res) => {
+              loading2.clear();
+              if (res.code == 200) {
+                localStorage.setItem('visitId', res.data.visitId);
+                that.notes = res.data.notes;
+                that.visitId = res.data.visitId;
+                that.list = res.data.sfaTaskList;
+                that.storeGroupId = res.data.storeGroupId;
+                that.showOrderButton = res.data.showOrderButton;
+                that.startTime = res.data.startTime;
+                that.timeN = setInterval(that.animation, 16);
+                that.visitsRemarks = res.data.visitsRemarks;
+              } else {
+                that.$toast(res.msg);
+              }
+            });
+          },
+          function (err) {
+            var params = {
+              storeId: that.storeId,
+              storeCode: that.storeCode,
+              visitEntry: visitEntry,
+              lat: that.urlParameter.latNew,
+              lon: that.urlParameter.lonNew,
+              visitModel: that.visitModel,
+              routeDetailsId: that.rdId,
+              visitSource: '1',
+              locationCity: '',
+              locationRemark: '',
+              locationAccuracy: that.urlParameter.PointSum,
+            };
+            that.locationAccuracy = that.urlParameter.PointSum;
+            that.city = '';
+            that.address = '';
+            localStorage.setItem('address', '');
+            if (that.visitId != null) {
+              params.id = that.visitId;
             }
             }
-          });
-        }
-      );
+            let loading2 = that.$toast.loading({
+              duration: 0,
+              message: '加载中...',
+              forbidClick: true,
+            });
+            getStoreGroupTask(params).then((res) => {
+              loading2.clear();
+              if (res.code == 200) {
+                localStorage.setItem('visitId', res.data.visitId);
+                that.notes = res.data.notes;
+                that.visitId = res.data.visitId;
+                that.list = res.data.sfaTaskList;
+                that.storeGroupId = res.data.storeGroupId;
+                that.showOrderButton = res.data.showOrderButton;
+                that.startTime = res.data.startTime;
+                that.timeN = setInterval(that.animation, 16);
+                that.visitsRemarks = res.data.visitsRemarks;
+              } else {
+                that.$toast(res.msg);
+              }
+            });
+          }
+        )
+        .catch(function (err) {
+          console.log(err);
+        });
     },
     },
     addStoreVisit(val, index) {
     addStoreVisit(val, index) {
       this.$router.push({
       this.$router.push({