小程序自提地址选择 bug 修

This commit is contained in:
devil 2020-02-21 14:10:16 +08:00
parent 9b7c7e8fd4
commit 698724e1ba
6 changed files with 111 additions and 68 deletions

View File

@ -117,6 +117,9 @@ class Site extends Common
*/
public function Save()
{
// 参数
$params = $_POST;
// 导航
$nav_type = input('nav_type', 'base');
@ -150,6 +153,25 @@ class Site extends Common
case 'imagesverify' :
$field_list[] = 'common_images_verify_rules';
break;
// 站点类型
case 'sitetype' :
// 自提地址处理
if(!empty($params['common_self_extraction_address']))
{
if(!is_array($params['common_self_extraction_address']))
{
$address = json_decode($params['common_self_extraction_address'], true);
} else {
$address = $params['common_self_extraction_address'];
}
foreach($address as $k=>$v)
{
$address[$k]['id'] = $k;
}
$params['common_self_extraction_address'] = json_encode($address, JSON_UNESCAPED_UNICODE);
}
break;
}
// 开始处理空值
@ -157,15 +179,15 @@ class Site extends Common
{
foreach($field_list as $field)
{
if(!isset($_POST[$field]))
if(!isset($params[$field]))
{
$_POST[$field] = '';
$params[$field] = '';
}
}
}
// 基础配置
$ret = ConfigService::ConfigSave($_POST);
$ret = ConfigService::ConfigSave($params);
// 清除缓存
if($ret['code'] == 0)

View File

@ -78,7 +78,7 @@ Page({
{
this.setData({
address: cache_address.data,
address_id: cache_address.data.id || 0,
address_id: cache_address.id,
});
}
}
@ -135,7 +135,7 @@ Page({
// 地址
this.setData({
address: data.base.address || null,
address_id: ((data.base.address || null) != null && (data.base.address.id || null) != null) ? data.base.address.id : null,
address_id: ((data.base.address || null) != null) ? data.base.address.id : null,
});
my.setStorage({
key: app.data.cache_buy_user_address_select_key,
@ -303,11 +303,14 @@ Page({
// 销售+自提 模式选择事件
buy_header_nav_event(e) {
var value = e.currentTarget.dataset.value || 0;
if (value != this.data.site_model)
{
// 数据设置
this.setData({
address: null,
address_id: null,
site_model: e.currentTarget.dataset.value || 0,
site_model: value,
});
// 删除地址缓存
@ -315,5 +318,6 @@ Page({
// 数据初始化
this.init();
}
},
});

View File

@ -63,7 +63,7 @@ Page({
if ((cache_address || null) != null) {
this.setData({
address: cache_address,
address_id: cache_address.id || null
address_id: cache_address.id,
});
}
}
@ -116,7 +116,7 @@ Page({
// 地址
this.setData({
address: data.base.address || null,
address_id: (data.base.address || null) != null && (data.base.address.id || null) != null ? data.base.address.id : null
address_id: ((data.base.address || null) != null) ? data.base.address.id : null
});
swan.setStorage({
key: app.data.cache_buy_user_address_select_key,
@ -280,11 +280,14 @@ Page({
// 销售+自提 模式选择事件
buy_header_nav_event(e) {
var value = e.currentTarget.dataset.value || 0;
if (value != this.data.site_model)
{
// 数据设置
this.setData({
address: null,
address_id: null,
site_model: e.currentTarget.dataset.value || 0,
site_model: value,
});
// 删除地址缓存
@ -292,5 +295,6 @@ Page({
// 数据初始化
this.init();
}
},
});

View File

@ -66,7 +66,7 @@ Page({
{
this.setData({
address: cache_address,
address_id: cache_address.id || null,
address_id: cache_address.id,
});
}
}
@ -122,7 +122,7 @@ Page({
// 地址
this.setData({
address: data.base.address || null,
address_id: ((data.base.address || null) != null && (data.base.address.id || null) != null) ? data.base.address.id : null,
address_id: ((data.base.address || null) != null) ? data.base.address.id : null,
});
qq.setStorage({
key: app.data.cache_buy_user_address_select_key,
@ -289,11 +289,14 @@ Page({
// 销售+自提 模式选择事件
buy_header_nav_event(e) {
var value = e.currentTarget.dataset.value || 0;
if (value != this.data.site_model)
{
// 数据设置
this.setData({
address: null,
address_id: null,
site_model: e.currentTarget.dataset.value || 0,
site_model: value,
});
// 删除地址缓存
@ -301,5 +304,6 @@ Page({
// 数据初始化
this.init();
}
},
});

View File

@ -66,7 +66,7 @@ Page({
{
this.setData({
address: cache_address,
address_id: cache_address.id || null,
address_id: cache_address.id,
});
}
}
@ -122,7 +122,7 @@ Page({
// 地址
this.setData({
address: data.base.address || null,
address_id: ((data.base.address || null) != null && (data.base.address.id || null) != null) ? data.base.address.id : null,
address_id: ((data.base.address || null) != null) ? data.base.address.id : null,
});
tt.setStorage({
key: app.data.cache_buy_user_address_select_key,
@ -289,11 +289,14 @@ Page({
// 销售+自提 模式选择事件
buy_header_nav_event(e) {
var value = e.currentTarget.dataset.value || 0;
if (value != this.data.site_model)
{
// 数据设置
this.setData({
address: null,
address_id: null,
site_model: e.currentTarget.dataset.value || 0,
site_model: value,
});
// 删除地址缓存
@ -301,5 +304,6 @@ Page({
// 数据初始化
this.init();
}
},
});

View File

@ -66,7 +66,7 @@ Page({
{
this.setData({
address: cache_address,
address_id: cache_address.id || null,
address_id: cache_address.id,
});
}
}
@ -122,7 +122,7 @@ Page({
// 地址
this.setData({
address: data.base.address || null,
address_id: ((data.base.address || null) != null && (data.base.address.id || null) != null) ? data.base.address.id : null,
address_id: ((data.base.address || null) != null) ? data.base.address.id : null,
});
wx.setStorage({
key: app.data.cache_buy_user_address_select_key,
@ -184,6 +184,7 @@ Page({
if (this.data.common_order_is_booking != 1) {
validation.push({ fields: 'payment_id', msg: '请选择支付方式' });
}
if (app.fields_check(data, validation)) {
// 加载loding
wx.showLoading({title: '提交中...'});
@ -289,11 +290,14 @@ Page({
// 销售+自提 模式选择事件
buy_header_nav_event(e) {
var value = e.currentTarget.dataset.value || 0;
if (value != this.data.site_model)
{
// 数据设置
this.setData({
address: null,
address_id: null,
site_model: e.currentTarget.dataset.value || 0,
site_model: value,
});
// 删除地址缓存
@ -301,5 +305,6 @@ Page({
// 数据初始化
this.init();
}
},
});