144 lines
		
	
	
		
			5.4 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			144 lines
		
	
	
		
			5.4 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| /*
 | |
|  * @Description  :
 | |
|  * @Version      : 1.0
 | |
|  * @Author       : Shiming
 | |
|  * @Date         : 2022-01-18 15:57:44
 | |
|  * @LastEditors  : Shiming
 | |
|  * @LastEditTime : 2022-01-18 19:05:23
 | |
|  * @FilePath     : \\tms-obc-web\\src\\app\\routes\\financial-management\\services\\freight-account.service.ts
 | |
|  * Copyright (C) 2022 huzhenhong. All rights reserved.
 | |
|  */
 | |
| import { Injectable, Injector } from '@angular/core';
 | |
| import { BaseService, EACacheService, ShipperBaseService } from '@shared';
 | |
| 
 | |
| @Injectable({
 | |
|   providedIn: 'root'
 | |
| })
 | |
| export class FreightAccountService extends ShipperBaseService {
 | |
|   $mock_url = '/rule?_allow_anonymous=true';
 | |
| 
 | |
|   // 运营端获取货主账户信息
 | |
|   $api_get_shipper_account_page = '/api/fcc/accountBalance/getShipperAccountBalanceByOperator';
 | |
|   // 运营端获取司机账户信息
 | |
|   $api_get_driver_account_page = '/api/fcc/accountBalance/getDriverAccountBalanceByOperator';
 | |
| 
 | |
|   // 运营端获取货主账户明细信息
 | |
|   $api_get_shipper_account_detail = '/api/fcc/accountBalanceDetail/getAccountBalanceShipperByOperatorPage';
 | |
|   // 运营端获取司机账户明细信息
 | |
|   $api_get_driver_account_detail = '/api/fcc/accountBalanceDetail/getAccountBalanceDriverByOperatorPage';
 | |
|   // 运营端端获取货主交易收入与支出金额
 | |
|   $api_get_shipper_account_balance_detail = '/api/fcc/accountBalanceDetail/getAccountBalanceShipperIncomeDetailByOperator';
 | |
|   // 运营端端获取司机交易收入与支出金额
 | |
|   $api_get_driver_account_balance_detail = '/api/fcc/accountBalanceDetail/getAccountBalanceDriverIncomeDetailByOperator';
 | |
| 
 | |
|   // 货主端获取账户余额交易明细
 | |
|   $api_get_balance_by_shipper = '/api/fcc/accountBalanceDetail/getAccountBalanceByShipperPage';
 | |
| 
 | |
|   // 查询订单支付申请表
 | |
|   $api_get_order_payment_page = '/api/fcc/billPaymentApplicationOBC/list/page';
 | |
| 
 | |
|   // 查询提现申请表
 | |
|   $api_get_refund_page = '/api/fcc/refundApplicationOBC/list/page';
 | |
|   // 获取提现申请表详情
 | |
|   $api_get_refund_detail = '/api/fcc/refundApplicationOBC/get';
 | |
|   // 同意提现
 | |
|   $api_agree_refund = '/api/fcc/refundApplicationOBC/agreeRefund';
 | |
|   // 拒绝提现
 | |
|   $api_disagree_refund = '/api/fcc/refundApplicationOBC/disagreeRefund';
 | |
| 
 | |
|   // 查询充值信息表
 | |
|   $api_get_recharge_page = '/api/fcc/rechargeInfo/list/getPageByOperator';
 | |
|   // 查询异常入金
 | |
|   $api_get_abnormal_gold_page = '/api/fcc/rechargeInfo/list/page';
 | |
|   // 运营端获取账户余额交易明细
 | |
|   $api_get_account_blance = '/api/fcc/accountBalanceDetail/getAccountBalanceByPage';
 | |
| 
 | |
|   // 查询费用单抬头
 | |
|   $api_get_cost_page = '/api/fcc/ficoFeeH/list/page';
 | |
|   // 根据费用头ID查询费用单及开票明细
 | |
|   $api_get_cost_detail = '/api/fcc/ficoFeeL/detail';
 | |
|   // 费用关联的应收核销明细
 | |
|   $api_get_cost_ahxl_detail = '/api/fcc/ficoAhxL/getListByFeeLId';
 | |
| 
 | |
|   // 查询应收核销抬头
 | |
|   $api_get_fico_page = '/api/fcc/ficoAhxH/list/page';
 | |
|   // 获取应收核销抬头
 | |
|   $api_get_fico_header = '/api/fcc/ficoAhxH/get';
 | |
|   // 查询应收核销明细
 | |
|   $api_get_fico_detail_header = '/api/fcc/ficoAhxL/list/page';
 | |
| 
 | |
|   // 查询应付核销抬头
 | |
|   $api_get_fico_ph_page = '/api/fcc/ficoPhxH/list/page';
 | |
|   // 获取应付核销抬头
 | |
|   $api_get_fico_ph_header = '/api/fcc/ficoPhxH/get';
 | |
|   // 查询应付核销明细
 | |
|   $api_get_fico_ph_detail_header = '/api/fcc/ficoPhxL/list/page';
 | |
| 
 | |
|   // 查询总账凭证表
 | |
|   $api_get_fico_vch_page = '/api/fcc/ficoVcH/list/page';
 | |
|   // 获取总账凭证表详情信息
 | |
|   $api_get_fico_vch__detail = '/api/fcc/ficoVcH/getDetail';
 | |
| 
 | |
|   // 查询付款单抬头
 | |
|   $api_get_payment_page = '/api/fcc/ficoPayH/listFicoPayHPage';
 | |
|   // 查询付款单明细
 | |
|   $api_get_payment_detail = '/api/fcc/ficoPayL/list/page';
 | |
|   // 付款单抬头信息
 | |
|   $api_get_payment_header = '/api/fcc/ficoPayH/getFicoPayHById';
 | |
| 
 | |
|   // 查询收款单抬头
 | |
|   $api_get_receipt_page = '/api/fcc/ficoBrmH/list/page';
 | |
|   // 收款单抬头信息
 | |
|   $api_get_receipt_header = '/api/fcc/ficoBrmH/getFicoPayHById';
 | |
|   // 获取收款单抬头
 | |
|   $api_get_receipt_detail = '/api/fcc/ficoBrmYsk/getListByBrmHid';
 | |
| 
 | |
|   // 收款单浏览抬头
 | |
|   $api_get_ficoInpinvL_page = '/api/fcc/ficoBrmH/get';
 | |
|   // 收款单浏览表格明细
 | |
|   $api_get_ficoInpinvL_getListByBrmHid = '/api/fcc/ficoBrmYsk/getListByBrmHid';
 | |
| 
 | |
|   // 下载银行回单请求
 | |
|   $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();
 | |
|   }
 | |
| }
 |