diff --git a/App.vue b/App.vue
index 8a946134..c068c0a1 100644
--- a/App.vue
+++ b/App.vue
@@ -2822,8 +2822,11 @@
},
// 获取用户当前位置
- get_user_location() {
- if(this.data.get_user_location_status == 1) {
+ // object 回调对象
+ // method 回调方法
+ // is_force 强制获取位置
+ get_user_location(object = null, method = null, is_force = false) {
+ if(this.data.get_user_location_status == 1 || is_force) {
var cache_key = this.data.cache_userlocation_key;
var result = uni.getStorageSync(cache_key) || null;
if(result == null) {
@@ -2873,13 +2876,17 @@
uni.getLocation({
type: 'wgs84',
success: function (res) {
- uni.setStorageSync(cache_key, {
+ var address = {
name: i18n.t('shopxo-uniapp.app.tghyu3'),
address: '',
latitude: res.latitude || null,
longitude: res.longitude || null,
status: 1,
- });
+ };
+ uni.setStorageSync(cache_key, address);
+ if (typeof object === 'object' && (method || null) != null) {
+ object[method](address);
+ }
}
});
clearInterval(self.data.get_user_location_timer);
diff --git a/pages/plugins/realstore/index/index.vue b/pages/plugins/realstore/index/index.vue
index 3e5571c8..b291e7b7 100644
--- a/pages/plugins/realstore/index/index.vue
+++ b/pages/plugins/realstore/index/index.vue
@@ -24,9 +24,9 @@
-
-
- {{ user_choice_realstore.alias }}
+
+
+ {{ user_choice_realstore.alias }}
{{ user_choice_realstore.name }}
@@ -296,22 +296,30 @@
});
}
- // 自动选择第一个门店、不存在已选择的门店、非首次
- if(this.is_first == 1 && (this.user_choice_realstore || null) == null && this.data_list.length > 0 && this.is_force_choice_realstore == 1 && this.is_force_auto_choice_realstore == 1) {
- var status = true;
- var temp_realstore = this.data_list[0];
- // 最低条件,自动选择第一个最低距离设置、不存在门店位置数据 或 位置值大于最低值则不选择
- if(this.force_auto_choice_realstore_distance > 0) {
- if(temp_realstore.distance_value === undefined || temp_realstore.distance_value > this.force_auto_choice_realstore_distance) {
- status = false;
- }
+ // 非首次
+ if(this.is_first == 1) {
+ // 是否自动获取用户当前位置、如果系统已经开启获取位置则这里不调用
+ if(app.globalData.data.get_user_location_status != 1 && parseInt(this.data_base.is_home_auto_user_location || 0) == 1) {
+ app.globalData.get_user_location(this, 'user_back_choice_location', true);
}
- if(status) {
- // 自动进入门店则不显示提示位置选择弹窗
- this.setData({
- location_tips_close_status: false
- });
- app.globalData.url_open(temp_realstore.url);
+
+ // 自动选择第一个门店、不存在已选择的门店
+ if((this.user_choice_realstore || null) == null && this.data_list.length > 0 && this.is_force_choice_realstore == 1 && this.is_force_auto_choice_realstore == 1) {
+ var status = true;
+ var temp_realstore = this.data_list[0];
+ // 最低条件,自动选择第一个最低距离设置、不存在门店位置数据 或 位置值大于最低值则不选择
+ if(this.force_auto_choice_realstore_distance > 0) {
+ if(temp_realstore.distance_value === undefined || temp_realstore.distance_value > this.force_auto_choice_realstore_distance) {
+ status = false;
+ }
+ }
+ if(status) {
+ // 自动进入门店则不显示提示位置选择弹窗
+ this.setData({
+ location_tips_close_status: false
+ });
+ app.globalData.url_open(temp_realstore.url);
+ }
}
}
}
@@ -355,10 +363,16 @@
// 选择用户地理位置回调
user_back_choice_location(e) {
+ // 设置数据
this.setData({
user_location: e,
location_tips_close_status: e.status != 1
});
+ // 位置数据更新
+ if ((this.$refs.choice_location || null) != null) {
+ this.$refs.choice_location.init();
+ }
+ // 重新获取数据
this.get_data();
},