首页 > 代码库 > 微擎自动获取地址

微擎自动获取地址

mobile/commom/footer_new

chooseWXPay后面加上openAddress

jssdkconfig.jsApiList = [‘checkJsApi‘,‘onMenuShareTimeline‘,‘onMenuShareAppMessage‘,‘onMenuShareQQ‘,‘onMenuShareWeibo‘,‘showOptionMenu‘,‘scanQRCode‘,‘chooseWXPay‘];

wx.onMenuShareWeibo(window.shareData);
后面加上这段代码

把微信获取到的地址的返回值提交到shop/address

存进数据表sz_yi_member_address

 

wx.ready(function () {
wx.openAddress({
success: function (res) {

core.json(‘shop/address‘, {‘op‘: ‘new1‘,address:res}, function(res) {


if (res.status == 1) {

location.href = "http://www.mamicode.com/{php echo $this->createMobileUrl(‘order/confirm‘)}&id={$_GPC[‘id‘]}&optionid=" +"{$_GPC[‘optionid‘]}" + "&total=" + "{$_GPC[‘total‘]}"+‘&number=123‘;

alert(‘获取地址成功‘);
}else{
alert(‘获取地址失败‘);
}

}, true, true);

}
})
});

 

点击事件点击获取微信收货地址才获取微信收货地址

mobile/confirm.html

选择地址的js那里换成点击address_new才往下执行

加载尾部{template ‘common/footer_new‘}

微擎自动获取地址