wx.config({
appId: "<?php echo $addressData['appId'];?>",
timestamp: <?php echo $addressData['timestamp'];?>,
nonceStr: "<?php echo $addressData['nonceStr'];?>",
signature: "<?php echo $addressData['signature'];?>",
jsApiList: [
'checkJsApi',
'openAddress',
'closeWindow'
]
});
wx.ready(function () {
wx.checkJsApi({
jsApiList: [
'openAddress',
],
success: function (res) {
}
});
});
wx.openAddress({
trigger: function (res) {
},
success: function (res) {
if (res.errMsg == 'openAddress:ok') {
var username = res.userName;
var provice = res.provinceName;
var city = res.cityName;
var counties = res.countryName;
var detail = res.detailInfo;
var phone = res.telNumber;
var html = '<p>收货人 :<span>' + username + '</span></p><p>联系电话:<span>' + phone + '</span></p><p>地区信息:<span>' + provice + ' ' + city + ' ' + counties + '</span></p><p>详细地址:<span>' + detail + '</span></p><span class="goto">›</span>';
$(".addr").html(html);
$("#pay").show();
}
},
cancel: function (res) {
},
fail: function (res) {
}
});