This commit is contained in:
Taric Xin
2022-01-11 16:42:26 +08:00
parent eeb23fb975
commit 8e93a648a2
21 changed files with 778 additions and 45 deletions

View File

@ -0,0 +1,48 @@
<div nz-row class="statistics-box">
<div nz-col nzSpan="24" se-container [labelWidth]="100" col="1">
<se label="打印发票" required>
<nz-radio-group [(ngModel)]="type">
<label nz-radio [nzValue]="1">分批下单</label>
<label nz-radio [nzValue]="2">汇总下单</label>
</nz-radio-group>
</se>
<se>
{{type===1?'分批下单系统会根据网络货运人、货主以及收件地址自动拆分成多个包裹下单':'汇总下单系统会将所选申请单汇总成一个包裹下单'}}
</se>
<ng-container *ngIf="type===2">
<se label="收件地址" required>
<nz-select [(ngModel)]="data.rcontactInfo" [nzCustomTemplate]="rcontactInfosData">
<nz-option [nzValue]="item" nzLabel="Jack" *ngFor="let item of rcontactInfos"
[nzCustomContent]="true">
{{item.contact}} &nbsp; &nbsp;&nbsp; {{item.tel}}<br />
{{item.province}} {{item.city}} {{item.county}} {{item.address}}
</nz-option>
</nz-select>
<ng-template #rcontactInfosData>
{{data.rcontactInfo.contact}} &nbsp; &nbsp;&nbsp; {{data.rcontactInfo.tel}}<br />
{{data.rcontactInfo.province}} {{data.rcontactInfo.city}} {{data.rcontactInfo.county}}
{{data.rcontactInfo.address}}
</ng-template>
</se>
<se label="寄件地址" required>
<nz-select [(ngModel)]="data.scontactInfo" [nzCustomTemplate]="scontactInfosData">
<nz-option [nzValue]="item" nzLabel="Jack" *ngFor="let item of scontactInfos"
[nzCustomContent]="true">
{{item.contact}} &nbsp; &nbsp;&nbsp; {{item.tel}}<br />
{{item.province}} {{item.city}} {{item.county}} {{item.address}}
</nz-option>
</nz-select>
<ng-template #scontactInfosData>
{{data.scontactInfo.contact}} &nbsp; &nbsp;&nbsp; {{data.scontactInfo.tel}}<br />
{{data.scontactInfo.province}} {{data.scontactInfo.city}} {{data.scontactInfo.county}}
{{data.scontactInfo.address}}
</ng-template>
</se>
</ng-container>
</div>
</div>
<div class="modal-footer">
<button nz-button type="button" (click)="close()">取消</button>
<button nz-button type="button" nzType="primary" (click)="sure()">保存</button>
</div>

View File

@ -0,0 +1,7 @@
nz-select-top-control {
height: 65px !important;
}
cdk-virtual-scroll-viewport {
height: 100px !important;
}

View File

@ -0,0 +1,76 @@
import { Component, Input, OnInit, ViewChild, ViewEncapsulation } from '@angular/core';
import { SFComponent, SFSchema, SFUISchema } from '@delon/form';
import { NzMessageService } from 'ng-zorro-antd/message';
import { NzModalRef } from 'ng-zorro-antd/modal';
import { map } from 'rxjs/operators';
import { TicketService } from '../../../services/ticket.service';
@Component({
selector: 'app-print-order-modal',
templateUrl: './print-order-modal.component.html',
styleUrls: ['./print-order-modal.component.less'],
encapsulation: ViewEncapsulation.None
})
export class PrintOrderModalComponent implements OnInit {
data: any = {};
type = 1;
rcontactInfos: any[] = [];
scontactInfos: any[] = [];
@Input()
vatappcodes: string[] = [];
constructor(private modal: NzModalRef, public msgSrv: NzMessageService, public service: TicketService) {}
ngOnInit(): void {
this.loadAddress();
}
loadAddress() {
this.service.request(this.service.$api_get_order_summary_path, this.vatappcodes).subscribe(res => {
if (res) {
this.rcontactInfos = res.rcontactInfos || [];
this.scontactInfos = res.scontactInfos || [];
}
});
}
sure() {
console.log(this.data);
if (this.type === 1) {
this.service.request(this.service.$api_create_express, this.vatappcodes).subscribe(res => {
if (res) {
this.service.msgSrv.success('操作成功');
this.modal.destroy(true);
}
});
} else {
if (!this.data.rcontactInfo || !this.data.scontactInfo) {
this.service.msgSrv.warning('请选择收件地址和寄件地');
return;
}
const params = {
rcontactInfo: this.data.rcontactInfo,
ltdId: this.data.scontactInfo.ltdId,
shipperId: this.data.scontactInfo.shipperId,
vatappcodes: this.vatappcodes,
scontactInfo: this.data.scontactInfo
};
delete this.data.scontactInfo.ltdId;
delete this.data.scontactInfo.shipperId;
delete this.data.scontactInfo.id;
this.service.request(this.service.$api_get_order_summary, params).subscribe(res => {
if (res) {
this.service.msgSrv.success('操作成功');
this.modal.destroy(true);
}
});
}
}
close() {
this.modal.destroy();
}
}