根据维信电子发票,小程序获取授权页链接的文档(https://developers.weixin.qq.com/doc/offiaccount/WeChat_Invoice/E_Invoice/Vendor_API_List.html#2),其中的 appId 是调用获取授权页链接返回来的,
请求方式
请求URL:https://api.weixin.qq.com/card/invoice/getauthurl?access_token={access_token}
如果是小程序,返回:
{
"errcode": 0,
"errmsg": "ok",
"auth_url": "auth_url"
"appid": "appid"
}
然后,使用接口返回的 appId 调用
wx.navigateToMiniProgram({
appId: '{appid}',
path: '{auth_url}',
success(res) {
console.log('navigateToMiniProgram success:', res)
},
fail(error){
console.log('navigateToMiniProgram fail:', error)
},
complete(res){
console.log('navigateToMiniProgram complete:', res)
}
})
报错
navigateToMiniProgram fail: {errMsg: "navigateToMiniProgram:fail appId "wx9db2c16d0633c2e7" is not in navigateToMiniProgramAppIdList"}
你需要在app.json 里面添加配置
navigateToMiniProgramAppIdList:[跳转小程序对应的appId]
https://developers.weixin.qq.com/miniprogram/dev/api/open-api/miniprogram-navigate/wx.navigateToMiniProgram.html