我的地址管理优化
parent
274ce484cd
commit
f9f1fa2bd8
23
App.vue
23
App.vue
|
|
@ -547,8 +547,9 @@
|
|||
}
|
||||
return s_x;
|
||||
},
|
||||
|
||||
url_value_handle(url) {
|
||||
|
||||
// url主要部分
|
||||
get_url_main_part(url) {
|
||||
if (url.indexOf("?") == -1) {
|
||||
var value = url;
|
||||
} else {
|
||||
|
|
@ -562,7 +563,7 @@
|
|||
* 当前地址是否存在tabbar中
|
||||
*/
|
||||
is_tabbar_pages(url) {
|
||||
var value = this.url_value_handle(url);
|
||||
var value = this.get_url_main_part(url);
|
||||
if ((value || null) == null) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -711,9 +712,7 @@
|
|||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* url参数转json对象
|
||||
*/
|
||||
// url参数转json对象
|
||||
url_params_to_json(url_params) {
|
||||
var json = new Object();
|
||||
if ((url_params || null) != null) {
|
||||
|
|
@ -724,6 +723,18 @@
|
|||
}
|
||||
}
|
||||
return json;
|
||||
},
|
||||
|
||||
// json对象转url请求参数
|
||||
json_to_url_params(data) {
|
||||
var str = '';
|
||||
for(var i in data) {
|
||||
if(str != '') {
|
||||
str += '&';
|
||||
}
|
||||
str += i+'='+data[i];
|
||||
}
|
||||
return str;
|
||||
},
|
||||
|
||||
// 拨打电话
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
</view>
|
||||
|
||||
<view class="form-gorup">
|
||||
<block v-if="is_user_address_location_discern_forbid_region == 0">
|
||||
<block v-if="is_user_address_forbid_choice_region == 0">
|
||||
<view class="br-b padding-bottom-xs margin-bottom-lg">
|
||||
<view class="form-gorup-title">省市区<text class="form-group-tips-must">必选</text></view>
|
||||
<view class="select-address oh">
|
||||
|
|
@ -135,7 +135,7 @@
|
|||
home_user_address_idcard_status: 0,
|
||||
is_user_address_discern: 0,
|
||||
is_user_address_location_discern: 0,
|
||||
is_user_address_location_discern_forbid_region: 0
|
||||
is_user_address_forbid_choice_region: 0
|
||||
};
|
||||
},
|
||||
|
||||
|
|
@ -179,7 +179,7 @@
|
|||
home_user_address_idcard_status: app.globalData.get_config('config.home_user_address_idcard_status'),
|
||||
is_user_address_discern: app.globalData.get_config('plugins_base.intellectstools.data.is_user_address_discern', 0),
|
||||
is_user_address_location_discern: app.globalData.get_config('plugins_base.intellectstools.data.is_user_address_location_discern', 0),
|
||||
is_user_address_location_discern_forbid_region: app.globalData.get_config('plugins_base.intellectstools.data.is_user_address_location_discern_forbid_region', 0)
|
||||
is_user_address_forbid_choice_region: app.globalData.get_config('plugins_base.intellectstools.data.is_user_address_forbid_choice_region', 0)
|
||||
});
|
||||
} else {
|
||||
app.globalData.is_config(this, 'init_config');
|
||||
|
|
@ -656,8 +656,10 @@
|
|||
// 数据提交
|
||||
form_submit(e) {
|
||||
// 表单数据
|
||||
var form_data = e.detail.value;
|
||||
|
||||
var form_data = e.detail.value;
|
||||
// 加入页面请求参数
|
||||
form_data['params'] = this.params;
|
||||
|
||||
// 数据校验
|
||||
var validation = [
|
||||
{ fields: "name", msg: "请填写联系人" },
|
||||
|
|
@ -667,13 +669,13 @@
|
|||
{ fields: "county", msg: "请选择区县" },
|
||||
{ fields: "address", msg: "请填写详细地址" }
|
||||
];
|
||||
|
||||
|
||||
// 是否开启了地理位置选择
|
||||
if (this.home_user_address_map_status == 1) {
|
||||
validation.push({ fields: "lng", msg: "请选择地理位置" });
|
||||
validation.push({ fields: "lat", msg: "请选择地理位置" });
|
||||
}
|
||||
|
||||
|
||||
// 是否开启了用户身份证信息
|
||||
if (this.home_user_address_idcard_status == 1) {
|
||||
// 验证
|
||||
|
|
@ -705,7 +707,7 @@
|
|||
}
|
||||
form_data['lng'] = lng;
|
||||
form_data['lat'] = lat;
|
||||
|
||||
|
||||
// 验证提交表单
|
||||
if (app.globalData.fields_check(form_data, validation)) {
|
||||
// 数据保存
|
||||
|
|
|
|||
|
|
@ -381,9 +381,12 @@
|
|||
},
|
||||
|
||||
// 添加地址事件
|
||||
address_add_event(e) {
|
||||
address_add_event(e) {
|
||||
var temp_params = this.params;
|
||||
temp_params['id'] = 0;
|
||||
var query = app.globalData.json_to_url_params(temp_params);
|
||||
uni.navigateTo({
|
||||
url: '/pages/user-address-save/user-address-save'
|
||||
url: '/pages/user-address-save/user-address-save?' + query
|
||||
});
|
||||
},
|
||||
|
||||
|
|
@ -395,10 +398,13 @@
|
|||
app.globalData.showToast("地址有误");
|
||||
return false;
|
||||
}
|
||||
|
||||
// 进入编辑页面
|
||||
|
||||
// 进入编辑页面
|
||||
var temp_params = this.params;
|
||||
temp_params['id'] = data.id;
|
||||
var query = app.globalData.json_to_url_params(temp_params);
|
||||
uni.navigateTo({
|
||||
url: '/pages/user-address-save/user-address-save?id=' + data.id
|
||||
url: '/pages/user-address-save/user-address-save?' + query
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -79,13 +79,13 @@
|
|||
|
||||
<!-- 清除缓存 -->
|
||||
<view class="nav-item padding-main fl tc cp" @tap="logout_event">
|
||||
<!-- #ifndef MP -->
|
||||
<image :src="common_static_url+'logout-icon.png'" class="item-icon" mode="widthFix"></image>
|
||||
<view class="item-name single-text cr-base">退出登录</view>
|
||||
<!-- #endif -->
|
||||
<!-- #ifdef MP -->
|
||||
<image :src="common_static_url+'cache-icon.png'" class="item-icon" mode="widthFix"></image>
|
||||
<view class="item-name single-text cr-base">清除缓存</view>
|
||||
<!-- #ifndef MP -->
|
||||
<image :src="common_static_url+'logout-icon.png'" class="item-icon" mode="widthFix"></image>
|
||||
<view class="item-name single-text cr-base">退出登录</view>
|
||||
<!-- #endif -->
|
||||
<!-- #ifdef MP -->
|
||||
<image :src="common_static_url+'cache-icon.png'" class="item-icon" mode="widthFix"></image>
|
||||
<view class="item-name single-text cr-base">清除缓存</view>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
|
||||
|
|
@ -290,7 +290,7 @@
|
|||
var temp_nav_order = null;
|
||||
if(upd_data.navigation.length > 0) {
|
||||
for(var i in upd_data.navigation) {
|
||||
var url = app.globalData.url_value_handle(upd_data.navigation[i]['event_value']);
|
||||
var url = app.globalData.get_url_main_part(upd_data.navigation[i]['event_value']);
|
||||
if(url == '/pages/user-order/user-order') {
|
||||
temp_nav_order = upd_data.navigation[i];
|
||||
upd_data.navigation.splice(i, 1);
|
||||
|
|
@ -335,25 +335,25 @@
|
|||
},
|
||||
|
||||
// 退出
|
||||
logout_event(e) {
|
||||
// 用户登录缓存
|
||||
uni.removeStorageSync(app.globalData.data.cache_user_login_key);
|
||||
// 用户信息缓存
|
||||
uni.removeStorageSync(app.globalData.data.cache_user_info_key);
|
||||
|
||||
// #ifdef MP
|
||||
// 小程序提示缓存清除成功
|
||||
app.globalData.showToast("清除成功", "success");
|
||||
// #endif
|
||||
|
||||
// #ifndef MP
|
||||
// 非小程序则两秒后回到首页
|
||||
app.globalData.showToast("退出成功", "success");
|
||||
setTimeout(function() {
|
||||
uni.switchTab({
|
||||
url: app.globalData.data.tabbar_pages[0]
|
||||
});
|
||||
}, 2000);
|
||||
logout_event(e) {
|
||||
// 用户登录缓存
|
||||
uni.removeStorageSync(app.globalData.data.cache_user_login_key);
|
||||
// 用户信息缓存
|
||||
uni.removeStorageSync(app.globalData.data.cache_user_info_key);
|
||||
|
||||
// #ifdef MP
|
||||
// 小程序提示缓存清除成功
|
||||
app.globalData.showToast("清除成功", "success");
|
||||
// #endif
|
||||
|
||||
// #ifndef MP
|
||||
// 非小程序则两秒后回到首页
|
||||
app.globalData.showToast("退出成功", "success");
|
||||
setTimeout(function() {
|
||||
uni.switchTab({
|
||||
url: app.globalData.data.tabbar_pages[0]
|
||||
});
|
||||
}, 2000);
|
||||
// #endif
|
||||
},
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue