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