Files
bbq/src/app/routes/ticket-management/components/billing-order/billing-order.component.ts
2022-04-26 19:51:28 +08:00

280 lines
9.0 KiB
TypeScript

import { Component, OnInit, ViewChild } from '@angular/core';
import { Router } from '@angular/router';
import { STComponent, STColumn, STChange, STRequestOptions } from '@delon/abc/st';
import { SFComponent, SFSchema, SFDateWidgetSchema, SFSelectWidgetSchema } from '@delon/form';
import { NzModalService } from 'ng-zorro-antd/modal';
import { TicketService } from '../../services/ticket.service';
@Component({
selector: 'app-billing-order',
templateUrl: './billing-order.component.html',
styleUrls: ['../../../commom/less/box.less', '../../../commom/less/expend-but.less']
})
export class BillingOrderComponent implements OnInit {
@ViewChild('st', { static: true })
st!: STComponent;
@ViewChild('sf', { static: false })
sf!: SFComponent;
columns: STColumn[] = this.initST();
searchSchema: SFSchema = this.initSF();
_$expand = false;
constructor(public service: TicketService, private nzModalService: NzModalService, private router: Router) { }
ngOnInit(): void { }
beforeReq = (requestOptions: STRequestOptions) => {
if (this.sf) {
Object.assign(requestOptions.body, {
...this.sf.value,
});
}
return requestOptions;
};
routeTo(item: any) {
return;
this.router.navigate(['/ticket/invoice-requested-detail/1']);
}
/**
* 重置表单
*/
resetSF() {
this.sf.reset();
this._$expand = false;
}
/**
* 伸缩查询条件
*/
expandToggle() {
this._$expand = !this._$expand;
this.sf?.setValue('/expand', this._$expand);
}
exportList() {
const params = { listSource: 1, pageSize: -1 };
if (this.sf) {
Object.assign(params, {
...this.sf.value
});
}
this.service.downloadFile(this.service.$api_export_invoice_logs_page, params);
}
private initSF(): SFSchema {
return {
properties: {
expand: {
type: 'boolean',
ui: {
hidden: true
}
},
billCode: {
type: 'string',
title: '订单号',
ui: {
placeholder: '请输入'
}
},
serviceType: {
title: '服务类型',
type: 'string',
ui: {
widget: 'dict-select',
params: { dictKey: 'service:type' },
containsAllLabel: true,
visibleIf: {
_$expand: (value: boolean) => value
}
} as SFSelectWidgetSchema
},
shipperAppUserName: {
type: 'string',
title: '货主名称',
ui: {
placeholder: '请输入',
}
},
vatappcode: {
type: 'string',
title: '申请编号',
ui: {
autocomplete: 'off',
visibleIf: {
expand: (value: boolean) => value
}
}
},
vatinvcode: {
type: 'string',
title: '分票编号',
ui: {
placeholder: '请输入',
visibleIf: {
expand: (value: boolean) => value
}
}
},
vatappdate: {
title: '申请时间',
type: 'string',
ui: {
widget: 'sl-from-to',
type: 'date',
format: 'yyyy-MM-dd',
visibleIf: {
expand: (value: boolean) => value
}
} as SFDateWidgetSchema
},
sts: {
type: 'string',
title: '开票状态',
ui: {
widget: 'dict-select',
params: { dictKey: 'etc:invoicing:status' },
placeholder: '请选择',
visibleIf: {
expand: (value: boolean) => value
}
}
},
invoiceno: {
type: 'string',
title: '发票号码',
ui: {
placeholder: '请输入',
autocomplete: 'off',
visibleIf: {
expand: (value: boolean) => value
}
}
},
invoicedate: {
title: '开票日期',
type: 'string',
ui: {
widget: 'sl-from-to',
type: 'date',
format: 'yyyy-MM-dd',
visibleIf: {
expand: (value: boolean) => value
}
} as SFDateWidgetSchema
},
enterpriseInfoId: {
type: 'string',
title: '网络货运人',
ui: {
widget: 'select',
placeholder: '请选择',
allowClear: true,
visibleIf: {
expand: (value: boolean) => value
},
asyncData: () => this.service.getNetworkFreightForwarder()
}
}
}
};
}
private initST(): STColumn[] {
return [
{ title: '订单号', index: 'billCode', className: 'text-center', width: 180 },
{ title: '运单号', index: 'wayBillCode', width: 180,className: 'text-center'},
{ title: '银行类型', index: 'bankType', width: 100,className: 'text-center' },
{ title: '网络货运人', index: 'enterpriseInfoName', width: 220,className: 'text-center' },
{
title: '开票金额', // TODO
index: 'vatmoney',
width: 120,
type: 'widget',
className: 'text-center',
widget: { type: 'currency-chy', params: ({ record }) => ({ value: record.invoiceAmount }) }
},
{
title: '总费用',
index: 'totalAmount',
width: 120,
type: 'widget',
className: 'text-center',
widget: { type: 'currency-chy', params: ({ record }) => ({ value: record.totalAmount }) }
},
{
title: '运输费',
index: 'price',
width: 120,
type: 'widget',
className: 'text-center',
widget: { type: 'currency-chy', params: ({ record }) => ({ value: record.shippingFee }) }
},
{
title: '技术服务费',
index: 'insurancePremium',
width: 120,
type: 'widget',
className: 'text-center',
widget: { type: 'currency-chy', params: ({ record }) => ({ value: record.invoiceAmount }) }
},
{
title: '附加费',
index: 'surcharge',
width: 120,
type: 'widget',
className: 'text-center',
widget: { type: 'currency-chy', params: ({ record }) => ({ value: record.aliasFee }) }
},
{
title: '附加费率',
className: 'text-center',
index: 'paymentMethodRate',
width: 130,
format: record => `${record.paymentMethodRate}%`
},
{ title: '货主名称', index: 'shipperAppUserName',width: '180px', className: 'text-center' },
{ title: '所属项目', index: 'enterpriseProjectName',width: '180px', className: 'text-center', },
{
title: '服务类型',
index: 'serviceType',
width: '180px',
className: 'text-center'
},
{ title: '装货地', index: 'consignor',width: '180px', className: 'text-center' },
{ title: '卸货地', index: 'consignee',width: '180px', className: 'text-center' },
{ title: '货物信息', index: 'goodsName', className: 'text-center',width: '180px' },
{ title: '车牌号', index: 'carNo',className: 'text-center',width: '180px' },
{
title: '承运司机',
className: 'text-center',
width: '180px',
},
{
title: '车队长',
className: 'text-center',
width: '180px',
index: 'carCaptainName',
},
{ title: '业务员', width: '100px', index: 'salesmanName', className: 'text-center', },
// { title: '录单时间', index: 'recordTime', type: 'date', className: 'text-center', width: '150px' }, //TODO
{ title: '装货时间', index: 'loadTime', type: 'date', width: '150px', className: 'text-center', },
{ title: '卸货时间', index: 'unloadTime', type: 'date', width: '150px', className: 'text-center', },
{ title: '订单完成时间', index: 'orderReceivingTime', type: 'date', width: 150, className: 'text-center', },
{ title: '支付完成时间', index: 'overallPaymentTime', type: 'date', width: 150, className: 'text-center', },
{ title: '开票状态', index: 'sts', render: 'sts', className: 'text-center', width: 180 },
{ title: '申请开票时间', index: 'vatappdate', type: 'date', className: 'text-center', width: 180 },
{ title: '申请开票编号', index: 'vatappcode', className: 'text-center', width: 180 },
{ title: '分票编号', index: 'vatinvcode',width: '180px', className: 'text-center', },
{ title: '发票号码', index: 'invoiceno', width: 100, className: 'text-center', },
{ title: '发票代码', index: 'invoiceno2', width: 130,className: 'text-center' },
{ title: '开票日期', index: 'invoicedate', type: 'date', width: 150,className: 'text-center' },
// { title: '作废日期', index: 'invalidTime', type: 'date', width: 150 }, // TODO
{ title: 'ETC开票金额', render: 'vatmoney', className: 'text-center', width: 200 }
];
}
}