修改发票下载查询和发票信息修改
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { getInvoiceInfoDetail, downloadInvoice } from "../../service/invoice";
|
||||
import { alertInfo, loadingFunc } from "../../utils/index";
|
||||
import { alertError, alertInfo, loadingFunc } from "../../utils/index";
|
||||
import request from '../../utils/request'
|
||||
const { OK } = request;
|
||||
// pages/invoiceInfo/index.js
|
||||
@@ -43,22 +43,34 @@ Page({
|
||||
alertInfo(message)
|
||||
return;
|
||||
}
|
||||
if (!data) {
|
||||
alertInfo("暂无文档信息")
|
||||
return
|
||||
}
|
||||
wx.downloadFile({
|
||||
url: data,
|
||||
success(res) {
|
||||
if (res.statusCode === 200) {
|
||||
if (!res.tempFilePath) {
|
||||
alertError("没有开票信息")
|
||||
return;
|
||||
}
|
||||
wx.openDocument({
|
||||
filePath: res.tempFilePath,
|
||||
fileType: [res.tapIndex === 0 ? 'xml' : "pdf"], // 3. 这个必须写合法类型,不然下载不了 !!!
|
||||
success: function (res) {
|
||||
|
||||
|
||||
},
|
||||
fail: function (e) {
|
||||
|
||||
alertError("打开失败")
|
||||
console.log('打开失败错误为', e)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
},
|
||||
fail: (e) => {
|
||||
console.log('e', e)
|
||||
alertInfo("下载文件失败")
|
||||
}
|
||||
})
|
||||
})
|
||||
|
Reference in New Issue
Block a user