This commit is contained in:
Taric Xin
2022-03-29 10:54:38 +08:00
parent aed0d157f1
commit 9e306ab949

View File

@ -12,6 +12,7 @@ import { NzModalService } from 'ng-zorro-antd/modal';
import { TicketService } from '../../services/ticket.service'; import { TicketService } from '../../services/ticket.service';
import { PrintOrderModalComponent } from './print-order-modal/print-order-modal.component'; import { PrintOrderModalComponent } from './print-order-modal/print-order-modal.component';
import { RequestedInvoiceModalComponent } from './requested-invoice-modal/requested-invoice-modal.component'; import { RequestedInvoiceModalComponent } from './requested-invoice-modal/requested-invoice-modal.component';
import { UpdateAddressModalComponent } from './update-address-modal/update-address-modal.component';
@Component({ @Component({
selector: 'app-invoice-requested', selector: 'app-invoice-requested',
@ -33,12 +34,9 @@ export class InvoiceRequestedComponent {
totalCallNo = 0; totalCallNo = 0;
selectedRows: any[] = []; selectedRows: any[] = [];
constructor(
public service: TicketService, rejectReason = '';
private nzModalService: NzModalService, constructor(public service: TicketService, private nzModalService: NzModalService, private router: Router) {}
private router: Router,
public shipperservice: ShipperBaseService
) {}
beforeReq = (requestOptions: STRequestOptions) => { beforeReq = (requestOptions: STRequestOptions) => {
if (this.resourceStatus) { if (this.resourceStatus) {
@ -57,6 +55,8 @@ export class InvoiceRequestedComponent {
}; };
afterRes = (data: any[], rawData?: any) => { afterRes = (data: any[], rawData?: any) => {
this.totalCallNo = 0;
this.selectedRows = [];
return data.map(item => ({ return data.map(item => ({
...item, ...item,
disabled: item.expressHSts disabled: item.expressHSts
@ -73,54 +73,84 @@ export class InvoiceRequestedComponent {
} }
rejectAction(item: any[]) { rejectAction(item: any[]) {
this.rejectReason = '';
if (item.length <= 0) {
this.service.msgSrv.warning('请选择开票申请');
return;
}
if (item.find(item => item.sts !== '1')) {
this.service.msgSrv.warning('请勿选择非待处理订单');
return;
}
const modal = this.nzModalService.create({ const modal = this.nzModalService.create({
nzTitle: '驳回', nzTitle: '驳回',
nzContent: this.rejectModal, nzContent: this.rejectModal,
nzFooter: [ nzOkLoading: this.service.http.loading,
{ nzOnOk: () => {
label: '拒绝', if (!this.rejectReason) {
type: 'default', this.service.msgSrv.warning('请填写驳回原因');
onClick: () => { return false;
modal.destroy();
} }
}, let ids = item.map(row => row.id);
{ this.service.request(this.service.$api_reject_invoice, { id: ids, rejectContent: this.rejectReason }).subscribe(res => {
label: '通过', if (res) {
type: 'primary', this.service.msgSrv.success('驳回成功');
onClick: () => { modal.destroy(true);
modal.destroy();
} }
});
return false;
} }
]
}); });
modal.afterClose.subscribe(res => { modal.afterClose.subscribe(res => {
if (res) {
this.st.load(); this.st.load();
}
}); });
} }
changePice(item: any[]) { /**
* 修改地址
* @param item
*/
changeAddress(item: any[]) {
this.rejectReason = '';
if (item.length <= 0) {
this.service.msgSrv.warning('请选择开票申请');
return;
}
if (item.find(item => item.sts !== '1')) {
this.service.msgSrv.warning('请勿选择非待处理订单');
return;
}
const modal = this.nzModalService.create({ const modal = this.nzModalService.create({
nzTitle: '驳回', nzTitle: '修改地址',
nzContent: this.rejectModal, nzContent: UpdateAddressModalComponent,
nzFooter: [ nzOkLoading: this.service.http.loading,
{ nzOnOk: component => {
label: '拒绝', if (!component.sf.valid) {
type: 'default', this.service.msgSrv.warning('表单校验错误');
onClick: () => { return false;
modal.destroy();
} }
}, this.service
{ .request(this.service.$api_update_invoice_address, {
label: '通过', ...component.sf.value,
type: 'primary', ids: item.map(i => i.id)
onClick: () => { })
modal.destroy(); .subscribe(res => {
if (res) {
this.service.msgSrv.success('修改成功');
modal.destroy(true);
} }
});
return false;
} }
]
}); });
modal.afterClose.subscribe(res => { modal.afterClose.subscribe(res => {
if (res) {
this.st.load(); this.st.load();
}
}); });
} }
@ -216,7 +246,7 @@ export class InvoiceRequestedComponent {
requestedInvoiceAction(item: any) { requestedInvoiceAction(item: any) {
const modal = this.nzModalService.create({ const modal = this.nzModalService.create({
nzTitle: '开票', nzTitle: '开票受理',
nzContent: RequestedInvoiceModalComponent, nzContent: RequestedInvoiceModalComponent,
nzWidth: 1200, nzWidth: 1200,
nzComponentParams: { nzComponentParams: {
@ -357,12 +387,14 @@ export class InvoiceRequestedComponent {
title: '货主名称', title: '货主名称',
ui: { ui: {
widget: 'select', widget: 'select',
placeholder: '请选择', serverSearch: true,
searchDebounceTime: 300,
searchLoadingText: '搜索中...',
allowClear: true, allowClear: true,
onSearch: (q: any) => this.service.getEnterpriceList({ enterpriseName: q }),
visibleIf: { visibleIf: {
expand: (value: boolean) => value expand: (value: boolean) => value
}, }
asyncData: () => this.shipperservice.getCRM()
} }
} }
} }
@ -406,7 +438,10 @@ export class InvoiceRequestedComponent {
width: 150, width: 150,
type: 'widget', type: 'widget',
className: 'text-right', className: 'text-right',
widget: { type: 'currency-chy', params: ({ record }) => ({ value: record.invoicedMoney }) } widget: {
type: 'currency-chy',
params: ({ record }) => ({ value: record.invoicedMoney })
}
}, },
{ title: '开户行', index: 'bankName', width: 160 }, { title: '开户行', index: 'bankName', width: 160 },
{ title: '银行账户', index: 'bankAccount', width: 140 }, { title: '银行账户', index: 'bankAccount', width: 140 },
@ -440,14 +475,15 @@ export class InvoiceRequestedComponent {
buttons: [ buttons: [
{ type: 'divider' }, { type: 'divider' },
{ {
text: '开票<br/>', text: '开票受理<br/>',
click: item => this.requestedInvoiceAction(item), click: item => this.requestedInvoiceAction(item),
iif: item => item.sts === '1' iif: item => item.sts === '1'
}, },
// { {
// text: '驳回<br/>', text: '驳回申请<br/>',
// click: item => this.rejectAction([item]) click: item => this.rejectAction([item]),
// }, iif: item => item.sts === '1'
},
{ {
text: '订单明细<br/>', text: '订单明细<br/>',
click: item => this.router.navigate([`/ticket/invoice-requested/detail/${item?.id}`], { queryParams: { sts: item.sts } }) click: item => this.router.navigate([`/ticket/invoice-requested/detail/${item?.id}`], { queryParams: { sts: item.sts } })