This commit is contained in:
Taric Xin
2021-12-23 17:07:57 +08:00
parent eb432e521f
commit 37daa23ae1
3 changed files with 140 additions and 143 deletions

View File

@ -24,48 +24,32 @@
<nz-card class="content-box" nzBordered> <nz-card class="content-box" nzBordered>
<div class="d-flex align-items-center mb-md"> <div class="d-flex align-items-center mb-md">
<button nz-button (click)="this.editInvoice(null)">填写物流</button> <button nz-button (click)="this.deletedInvoice()">作废发票</button>
<button nz-button (click)="this.editInvoice(null)">作废发票</button> <button nz-button (click)="this.invoiceHongChong()">发票红冲</button>
<div class="ml-md"> <div class="ml-md">
已选择 已选择
<strong class="text-primary">{{ selectedRows.length }}</strong> 条数据&nbsp;&nbsp; 开票金额总计 <strong>{{ <strong class="text-red">{{ selectedRows.length }}</strong> 条数据&nbsp;&nbsp; 开票金额总计 <strong class="text-red">{{
totalCallNo }}</strong> totalCallNo }}</strong>
<a *ngIf="totalCallNo > 0" (click)="st.clearCheck()" class="ml-lg">清空</a> <a *ngIf="totalCallNo > 0" (click)="st.clearCheck()" class="ml-lg">清空</a>
</div> </div>
</div> </div>
<st #st [data]="url" [columns]="columns" <st #st [data]="service.$mock_url" [columns]="columns"
[req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, params: reqParams }" [req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, params: reqParams, process: beforeReq }"
[res]="{ reName: { list: 'data.records', total: 'data.total' } }" [res]="{ reName: { list: 'data.records', total: 'data.total' } }"
[page]="{ show: true, showSize: true, pageSizes: [10, 20, 30, 50, 100, 200, 300, 500, 1000] }" [page]="{ show: true, showSize: true, pageSizes: [10, 20, 30, 50, 100, 200, 300, 500, 1000] }"
[loading]="service.http.loading" [scroll]="{ x:'1200px',y: '370px' }" (change)="stChange($event)"> [loading]="service.http.loading" [scroll]="{ x:'1200px',y: '370px' }" (change)="stChange($event)">
<ng-template st-row="logostics" let-item let-index="index"> <ng-template st-row="no" let-item let-index="index">
{{item.callNo}} {{item.no}}
<a (click)="showlogosticsLogs(item)">查看物流</a> <a>预览发票</a>
</ng-template> </ng-template>
</st> </st>
</nz-card> </nz-card>
<ng-template #logosticsModal>
<div nz-row nzGutter="8">
<div nz-col nzSpan="24" se-container [labelWidth]="120">
<se [col]="1" label="快递公司">
<nz-select nzPlaceHolder="请选择">
<nz-option nzValue="jack" nzLabel="Jack"></nz-option>
<nz-option nzValue="lucy" nzLabel="Lucy"></nz-option>
</nz-select>
</se>
<se [col]="1" label="物流单号">
<input nz-input placeholder="请输入" />
</se>
</div>
</div>
</ng-template>
<ng-template #logosticsLogsModal> <ng-template #logosticsLogsModal>
<p class="mb-xl"> <p class="mb-xl">
顺丰快递SF123456789 顺丰快递: SF123456789
<nz-tag [nzColor]="'#2db7f5'" class="ml-md">已签收</nz-tag> <nz-tag [nzColor]="'#2db7f5'" class="ml-md">已签收</nz-tag>
</p> </p>
<app-logistics-time-line></app-logistics-time-line> <app-logistics-time-line></app-logistics-time-line>

View File

@ -15,6 +15,9 @@
width: 100%; width: 100%;
} }
.text-truncate {
white-space: normal;
}
} }
.expend-options { .expend-options {

View File

@ -1,6 +1,6 @@
import { Component, OnInit, ViewChild } from '@angular/core'; import { Component, OnInit, ViewChild } from '@angular/core';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { STComponent, STColumn, STChange } from '@delon/abc/st'; import { STComponent, STColumn, STChange, STRequestOptions } from '@delon/abc/st';
import { SFComponent, SFSchema, SFDateWidgetSchema } from '@delon/form'; import { SFComponent, SFSchema, SFDateWidgetSchema } from '@delon/form';
import { NzModalService } from 'ng-zorro-antd/modal'; import { NzModalService } from 'ng-zorro-antd/modal';
import { TicketService } from '../../services/ticket.service'; import { TicketService } from '../../services/ticket.service';
@ -20,36 +20,90 @@ export class InvoicedListComponent implements OnInit {
logosticsModal!: any; logosticsModal!: any;
@ViewChild('logosticsLogsModal', { static: false }) @ViewChild('logosticsLogsModal', { static: false })
logosticsLogsModal!: any; logosticsLogsModal!: any;
columns: STColumn[] = [ columns: STColumn[] = this.initST();
{ title: '', index: 'key', type: 'checkbox' }, searchSchema: SFSchema = this.initSF();
{ title: '发票号码', index: 'no' },
{ title: '申请编号', index: 'callNo' }, reqParams = {};
{ title: '托运人', index: 'callNo' },
{ title: '无车承运人', index: 'callNo' }, _$expand = false;
{ title: '运单数', index: 'callNo' },
{ title: '开票金额', index: 'callNo' }, selectedRows: any[] = [];
{ title: '税价合计', index: 'callNo' }, totalCallNo = 0;
{ title: '开票日期', index: 'updatedAt', type: 'date' }, constructor(public service: TicketService, private nzModalService: NzModalService, private router: Router) {}
{ title: '快递信息', render: 'logostics' },
{ ngOnInit(): void {}
title: '操作',
buttons: [ beforeReq = (requestOptions: STRequestOptions) => {
{ if (this.sf) {
text: '作废发票', this.reqParams = { ...this.sf.value };
click: item => this.deletedInvoice(item)
},
{
text: '预览发票',
click: item => this.routeTo(item)
},
{
text: '填写物流',
click: item => this.editInvoice(item)
} }
] return requestOptions;
};
stChange(e: STChange): void {
switch (e.type) {
case 'checkbox':
this.selectedRows = e.checkbox!;
this.totalCallNo = this.selectedRows.reduce((total, cv) => total + cv.callNo, 0);
break;
} }
]; }
searchSchema: SFSchema = {
approval(): void {}
add(): void {}
deletedInvoice() {
if (this.selectedRows?.length <= 0) {
this.service.msgSrv.warning('请选择发票');
return;
}
this.nzModalService.warning({
nzTitle: '确定将所选发票作废?',
nzCancelText: '取消',
nzOnOk: () => {}
});
}
invoiceHongChong() {
if (this.selectedRows?.length <= 0) {
this.service.msgSrv.warning('请选择发票');
return;
}
this.nzModalService.warning({
nzTitle: '确定将所选发票红冲?',
nzCancelText: '取消',
nzOnOk: () => {}
});
}
showlogosticsLogs(item: any) {
this.nzModalService.create({
nzTitle: '查看物流',
nzWidth: 600,
nzContent: this.logosticsLogsModal,
nzFooter: []
});
}
/**
* 重置表单
*/
resetSF() {
this.sf.reset();
this._$expand = false;
}
/**
* 伸缩查询条件
*/
expandToggle() {
this._$expand = !this._$expand;
this.sf?.setValue('/expand', this._$expand);
}
private initSF(): SFSchema {
return {
properties: { properties: {
expand: { expand: {
type: 'boolean', type: 'boolean',
@ -82,15 +136,11 @@ export class InvoicedListComponent implements OnInit {
}, },
receiveName: { receiveName: {
type: 'string', type: 'string',
title: '托运人', title: '购买人',
enum: [{ label: '全部', value: '全部' }], enum: [{ label: '全部', value: '全部' }],
ui: { ui: {
widget: 'select', widget: 'select',
placeholder: '请选择', placeholder: '请选择',
change: (i: any) => {
this.sf.value.receiveName = i;
this.sf?.setValue('/receiveName', i);
},
visibleIf: { visibleIf: {
expand: (value: boolean) => value expand: (value: boolean) => value
} }
@ -98,15 +148,11 @@ export class InvoicedListComponent implements OnInit {
}, },
receiveName2: { receiveName2: {
type: 'string', type: 'string',
title: '无车承运人', title: '网络货运人',
enum: [{ label: '全部', value: '全部' }], enum: [{ label: '全部', value: '全部' }],
ui: { ui: {
widget: 'select', widget: 'select',
placeholder: '请选择', placeholder: '请选择',
change: (i: any) => {
this.sf.value.receiveName2 = i;
this.sf?.setValue('/receiveName2', i);
},
visibleIf: { visibleIf: {
expand: (value: boolean) => value expand: (value: boolean) => value
} }
@ -114,82 +160,46 @@ export class InvoicedListComponent implements OnInit {
} }
} }
}; };
reqParams = {};
_$expand = false;
selectedRows: any[] = [];
totalCallNo = 0;
constructor(public service: TicketService, private nzModalService: NzModalService, private router: Router) {}
ngOnInit(): void {}
stChange(e: STChange): void {
switch (e.type) {
case 'checkbox':
this.selectedRows = e.checkbox!;
this.totalCallNo = this.selectedRows.reduce((total, cv) => total + cv.callNo, 0);
break;
case 'filter':
this.st.load();
break;
}
} }
approval(): void {} private initST(): STColumn[] {
return [
add(): void {} { title: '', index: 'key', type: 'checkbox' },
{ title: '发票号码', index: 'no', width: 150 },
routeTo(item: any) { { title: '申请编号', index: 'callNo', width: 150 },
this.router.navigate(['/ticket/invoice-list-detail/1']); { title: '申请时间', index: 'updatedAt', type: 'date', width: 150 },
{ title: '发票类型', index: 'callNo', width: 100 },
{ title: '网络货运人', index: 'callNo', width: 120 },
{ title: '购买人', index: 'callNo', width: 90 },
{ title: '订单数', index: 'callNo', width: 90 },
{ title: '价税合计', index: 'callNo', width: 100 },
{ title: '金额', index: 'callNo', width: 90 },
{ title: '税率', index: 'callNo', width: 90 },
{ title: '税额', index: 'callNo', width: 90 },
{ title: '开票日期', index: 'updatedAt', type: 'date', width: 150 },
{
title: '快递信息',
render: 'logostics',
width: 120,
format: item => `顺丰快递</br>6202110012313`
},
{ title: '状态', render: 'logostics', width: 90 },
{
title: '操作',
fixed: 'right',
className: 'text-center',
width: 110,
buttons: [
{
text: '查看明细',
click: item => this.router.navigate(['/ticket/invoice-list/detail/1'])
},
{
text: '查看物流',
click: item => this.showlogosticsLogs(item)
} }
]
delete(item: any) {
this.st.removeRow(item);
} }
];
editInvoice(item: any) {
const modal = this.nzModalService.create({
nzTitle: '填写物流/修改物流',
nzContent: this.logosticsModal,
nzOnOk: () => {}
});
modal.afterClose.subscribe(res => {
this.st.load();
});
}
deletedInvoice(item: any) {
this.nzModalService.warning({
nzTitle: '确定将所选发票作废?',
nzCancelText: '取消',
nzOnOk: () => {}
});
}
showlogosticsLogs(item: any) {
this.nzModalService.create({
nzTitle: '查看物流',
nzWidth: 600,
nzContent: this.logosticsLogsModal,
nzFooter: []
});
}
/**
* 重置表单
*/
resetSF() {
this.sf.reset();
this._$expand = false;
}
/**
* 伸缩查询条件
*/
expandToggle() {
this._$expand = !this._$expand;
this.sf?.setValue('/expand', this._$expand);
} }
} }