修改下载发票失败的问题

This commit is contained in:
qiaomu 2024-09-10 16:40:29 +08:00
parent 86ca43d214
commit 5c971ef2e8

View File

@ -36,9 +36,9 @@ Page({
const that = this;
wx.showActionSheet({
itemList: ['发票XML文件下载', '发票PDF文件下载'],
async success(res) {
async success(sheetRes) {
loadingFunc(async () => {
const { code, message, data } = await downloadInvoice(that.data.id, res.tapIndex);
const { code, message, data } = await downloadInvoice(that.data.id, sheetRes.tapIndex);
if (code !== OK) {
alertInfo(message)
return;
@ -55,9 +55,10 @@ Page({
alertError("没有开票信息")
return;
}
console.log('res.tempFilePath', res.tempFilePath, sheetRes.tapIndex)
wx.openDocument({
filePath: res.tempFilePath,
fileType: [res.tapIndex === 0 ? 'xml' : "pdf"], // 3. 这个必须写合法类型,不然下载不了
fileType: [sheetRes.tapIndex === 0 ? 'xml' : "pdf"], // 3. 这个必须写合法类型,不然下载不了
success: function (res) {
},