From b9981b5fb1a6feab41935489a4b661b26502cae6 Mon Sep 17 00:00:00 2001 From: Taric Xin Date: Wed, 23 Feb 2022 16:44:27 +0800 Subject: [PATCH] edit --- .../cancellation-invoice.component.html | 12 ++-- .../cancellation-invoice.component.ts | 63 ++++++++++++++++--- .../services/ticket.service.ts | 4 ++ 3 files changed, 64 insertions(+), 15 deletions(-) diff --git a/src/app/routes/ticket-management/components/cancellation-invoice/cancellation-invoice.component.html b/src/app/routes/ticket-management/components/cancellation-invoice/cancellation-invoice.component.html index 66b83b7c..460bd272 100644 --- a/src/app/routes/ticket-management/components/cancellation-invoice/cancellation-invoice.component.html +++ b/src/app/routes/ticket-management/components/cancellation-invoice/cancellation-invoice.component.html @@ -36,16 +36,18 @@ {{totalCallNo }} 清空 - - - + + - + [req]="{process: beforeReq }" [res]="{process:afterRes }" [loading]="service.http.loading" + (change)="stChange($event)"> {{ item.vatinvcode }}
diff --git a/src/app/routes/ticket-management/components/cancellation-invoice/cancellation-invoice.component.ts b/src/app/routes/ticket-management/components/cancellation-invoice/cancellation-invoice.component.ts index 8bc8f0f2..e147631c 100644 --- a/src/app/routes/ticket-management/components/cancellation-invoice/cancellation-invoice.component.ts +++ b/src/app/routes/ticket-management/components/cancellation-invoice/cancellation-invoice.component.ts @@ -23,7 +23,7 @@ export class CancellationInvoiceComponent implements OnInit { requestedModal!: any; columns: STColumn[] = this.initST(); searchSchema: SFSchema = this.initSF(); - resourceStatus = ''; + resourceStatus: any = ''; _$expand = false; selectedRows: any[] = []; @@ -56,6 +56,15 @@ export class CancellationInvoiceComponent implements OnInit { return data.map(node => ({ ...node, disabled: node.sts === '3' })); }; + stChange(e: STChange): void { + switch (e.type) { + case 'checkbox': + this.selectedRows = e.checkbox!; + this.totalCallNo = this.selectedRows.reduce((total, cv) => total + cv.vatmoney, 0).toFixed(2); + break; + } + } + selectChange(e: any) { this.resourceStatus = e; this.initST(); @@ -103,17 +112,51 @@ export class CancellationInvoiceComponent implements OnInit { /** * 批量推送发票 - * @param item */ - batchPush(item?: any) { - if (this.selectedRows?.length <= 0 && !item) { + batchPush() { + if (this.selectedRows?.length <= 0) { this.service.msgSrv.warning('请选择开票申请'); return; } + if (this.selectedRows.find(item => item.sts !== '1')) { + this.service.msgSrv.warning('请勿选择非待处理申请'); + return; + } this.nzModalService.warning({ nzTitle: '确定将所选待处理开票申请推送开票?', nzContent: '推送开票后发票信息不可修改,待系统开票完成后会自动返回开票结果', - nzOnOk: () => {} + nzOnOk: () => { + this.service + .request( + this.service.$api_batch_push_invoic, + this.selectedRows.map(row => row.id) + ) + .subscribe(res => { + if (res) { + this.service.msgSrv.success('推送开票成功'); + this.st.load(1); + } + }); + } + }); + } + + /** + * 推送发票 + * @param item + */ + pushInvoice(item: any) { + this.nzModalService.warning({ + nzTitle: '确定将所选待处理开票申请推送开票?', + nzContent: '推送开票后发票信息不可修改,待系统开票完成后会自动返回开票结果', + nzOnOk: () => { + this.service.request(this.service.$api_push_invoic, { id: item.id }).subscribe(res => { + if (res) { + this.service.msgSrv.success('推送开票成功'); + this.st.load(1); + } + }); + } }); } @@ -327,11 +370,11 @@ export class CancellationInvoiceComponent implements OnInit { iif: item => item.sts != '3', click: item => this.requestedAction(item) }, - // { - // text: '推送开票', - // iif: item => item.sts != '3', - // click: item => this.pushInvoiceAction(item) - // }, + { + text: '推送开票', + iif: item => item.sts === '1', + click: item => this.pushInvoice(item) + }, // { // text: '移除', // click: item => this.batchRemove(item) diff --git a/src/app/routes/ticket-management/services/ticket.service.ts b/src/app/routes/ticket-management/services/ticket.service.ts index 14778143..a7cc8425 100644 --- a/src/app/routes/ticket-management/services/ticket.service.ts +++ b/src/app/routes/ticket-management/services/ticket.service.ts @@ -34,6 +34,10 @@ export class TicketService extends ShipperBaseService { $api_apply_fico = '/api/fcc/ficoVatinvH/crmPushInvo'; // 运营端手工开票/确认/E税云开票成功后的回调 $api_apply_fico_invoic = '/api/fcc/ficoVatinvH/operateAffirmVatinv'; + // 运营端推送开票-E税云开票 + $api_push_invoic = '/api/fcc/ficoVatinvH/crmPushInvo'; + // 运营端批量推送开票-E税云开票 + $api_batch_push_invoic = '/api/fcc/ficoVatinvH/crmPushInvoBath'; // 获取汇总下单路径 $api_get_order_summary_path = '/api/fcc/ficoExpressH/getSummaryOrderAddress';