Obtain WeChat delivery address
Use uniapp or native WeChat applet to get WeChat delivery address
1. You need to apply for permission on the development platform
Apply for this permission in [Development] - [Development Management] - [Interface Settings] - [Get User Shipping Address], and it can be used only after approval.
2. Add configuration to the source code
2.1 Development and configuration on uniapp Open manifest.json, click the source code view, search and find "mp-weixin", add "requiredPrivateInfos"
under this object : ["chooseAddress"]
2.2 In the native WeChat development configuration,
find app.json and directly add this property
3. Directly upload the code
<template>
<view class="content">
<button @click="getAddressList">获取微信收货地址</button>
<view class="" v-if="addressInfo.userName">
{
{
addressInfo.userName}}--{
{
addressInfo.provinceName}}--{
{
addressInfo.telNumber}}
</view>
</view>
</template>
<script>
export default {
data() {
return {
addressInfo:{
}
}
},
methods:{
getAddressList(){
wx.chooseAddress({
success:(res)=> {
this.addressInfo=res;
}
})
}
}
</script>
Return result description: You can get the parameters you need according to the parameter description
Return result:
1. View on the developer, there is no mobile phone number.
2. Checking on the mobile phone will directly jump to the delivery address of WeChat, and all parameter values can be obtained.