This commit is contained in:
Taric Xin
2022-01-19 14:02:10 +08:00
parent d3246222f7
commit eb42a89f0f
6 changed files with 152 additions and 41 deletions

View File

@ -1,5 +1,5 @@
/*
* @Description :
* @Description :
* @Version : 1.0
* @Author : Shiming
* @Date : 2022-01-18 15:57:44
@ -53,7 +53,6 @@ export class FreightAccountService extends ShipperBaseService {
// 运营端获取账户余额交易明细
$api_get_account_blance = '/api/fcc/accountBalanceDetail/getAccountBalanceByPage';
// 查询费用单抬头
$api_get_cost_page = '/api/fcc/ficoFeeH/list/page';
// 根据费用头ID查询费用单及开票明细
@ -91,7 +90,46 @@ export class FreightAccountService extends ShipperBaseService {
// 收款单浏览表格明细
$api_get_ficoInpinvL_getListByBrmHid = '/api/fcc/ficoBrmYsk/getListByBrmHid';
constructor(public injector: Injector,public eaCacheSrv: EACacheService) {
// 下载银行回单请求
$api_download_receipt_apply = '/api/fcc/spd/callback/receiptApply';
constructor(public injector: Injector, public eaCacheSrv: EACacheService) {
super(injector, eaCacheSrv);
}
getReceiptUrl(url: string, params: any) {
if (url) {
this.reviewPDF(url);
} else {
this.request(this.$api_download_receipt_apply, { ...params }).subscribe(res => {
if (res?.receiptUrl) {
this.reviewPDF(res.receiptUrl);
} else {
this.msgSrv.warning(res.statusMsg || '获取回单失败');
}
});
}
}
reviewPDF(url: string) {
if (!url) {
return;
}
const uA = window.navigator.userAgent; // 判断浏览器内核
const isIE =
/msie\s|trident\/|edge\//i.test(uA) &&
!!('uniqueID' in document || 'documentMode' in document || 'ActiveXObject' in window || 'MSInputMethodContext' in window);
const objectUrl = url;
const a = document.createElement('a');
document.body.appendChild(a);
a.href = objectUrl;
a.download = '面单.pdf';
if (isIE) {
// 兼容IE11无法触发下载的问题
(navigator as any).msSaveBlob(url, a.download);
} else {
a.click();
}
a.remove();
}
}