jsapi获取用户抬头,可以到选择抬头的页面,但是选择后不执行回调(调用jsapi失败的情况下可以执行回调),搞不懂了,求大神帮忙,是在vue2环境下,代码:
wxconfig(){
var se=this;
wx.config({
debug: false,
appId: se.wx.appId,
timestamp: se.wx.timestamp,
nonceStr: se.wx.nonceStr,
signature: se.wx.signature,
beta: true,
jsApiList: [
"chooseInvoiceTitle",//获取发票用户抬头
]
});
wx.ready(function () {
wx.checkJsApi({
jsApiList: [
"chooseInvoiceTitle"
], 2,
success: function (res) {
}
});
wx.invoke('chooseInvoiceTitle',{
"scene":"1"
},function(res) {
alert('11111');//这里不执行
se.callback(res);
});
});
wx.error(function (res) {
alert(res.errMsg);
});
},
callback(res){
alert('2222');
var se=this;
alert(JSON.stringify(res));
var re = res.choose_invoice_title_info;
alert(JSON.stringify(re));
se.pname=re.title;
se.pno=re.taxNumber;
se.paddr=re.companyAddress;
se.pphone=re.telephone;
se.pbank=re.bankName;
se.paccount=re.bankAccount
},
太坑了,我用的是苹果手机,alert啥都不跳出来,于是我才以为是回调函数没执行,最后拿同事安卓手机试,发现都能跳出来,是执行了的,只是res.choose_invoice_title_info是字符串,要转成对象以后使用。
...... var re = JSON.parse(res.choose_invoice_title_info); se.pname=re.title; ......
我这边企业微信升了级后也遇到了这个问题,在发送小程序到对话框时,能正常发送小程序,但是不会进入回调函数。@企业微信运营专员-千夜