基础库版本 1.1.0 开始支持,低版本需做兼容处理
调起用户编辑收货地址原生界面,并在编辑完成后返回用户选择的地址。
object参数说明:
参数 | 类型 | 必填 | 返回 |
---|---|---|---|
success | function | 否 | 返回用户选择的收货地址信息 |
fail | function | 否 | 接口调用失败的回调函数 |
complete | function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
success返回参数说明:
参数 | 类型 | 说明 |
---|---|---|
errmsg | string | 调用结果 |
username | string | 收货人姓名 |
postalcode | string | 邮编 |
provincename | string | 国标收货地址第一级地址 |
cityname | string | 国标收货地址第二级地址 |
countyname | string | 国标收货地址第三级地址 |
detailinfo | string | 详细收货地址信息 |
nationalcode | string | 收货地址国家码 |
telnumber | string | 收货人手机号码 |
示例代码:
wx.chooseaddress({
success: function (res) {
console.log(res.username)
console.log(res.postalcode)
console.log(res.provincename)
console.log(res.cityname)
console.log(res.countyname)
console.log(res.detailinfo)
console.log(res.nationalcode)
console.log(res.telnumber)
}
})
tip
:wx.chooseaddress
接口需要用户授权,请兼容用户拒绝授权的场景。