获取发票信息
const getInvoice = () => {
uni.authorize({
scope: "scope.invoiceTitle",
success() {
uni.chooseInvoiceTitle({
success(res) {
console.log("发票选择成功", res);
uni.showModal({
title: "发票信息",
content: JSON.stringify(res),
});
},
fail(err) {
console.log("发票选择失败", err);
},
});
},
fail() {
// 用户拒绝授权
uni.showModal({
title: "提示",
content: "请开启发票权限以使用该功能",
success(res) {
if (res.confirm) {
uni.openSetting();
}
},
});
},
});
};