Files
bbq/src/app/routes/ticket-management/components/billing-order/billing-order.component.ts
Taric Xin 1851f9e6d8 UI
2022-05-06 14:24:12 +08:00

268 lines
8.7 KiB
TypeScript

import { Component, OnInit, ViewChild } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { STComponent, STColumn, STChange, STRequestOptions } from '@delon/abc/st';
import { SFComponent, SFSchema, SFDateWidgetSchema, SFSelectWidgetSchema } from '@delon/form';
import { SearchDrawerService } from '@shared';
import { NzModalService } from 'ng-zorro-antd/modal';
import { BasicTableComponent } from 'src/app/routes/commom';
import { TicketService } from '../../services/ticket.service';
@Component({
selector: 'app-billing-order',
templateUrl: './billing-order.component.html',
styleUrls: ['../../../commom/less/commom-table.less']
})
export class BillingOrderComponent extends BasicTableComponent {
@ViewChild('st', { static: true })
st!: STComponent;
columns: STColumn[] = this.initST();
schema: SFSchema = this.initSF();
constructor(public service: TicketService, private router: Router, public searchDrawerService: SearchDrawerService) {
super(searchDrawerService);
}
search() {
this.st?.load(1);
}
beforeReq = (requestOptions: STRequestOptions) => {
if (this.sf) {
Object.assign(requestOptions.body, {
...this.sf?.value
});
}
return requestOptions;
};
routeTo(item: any) {
// return;
this.router.navigateByUrl(`/order-management/vehicle/vehicle-detail/${item.billId}`);
}
export() {
this.service.exportStart({ ...this.sf?.value, pageSize: -1 }, this.service.$api_export_InvoicedBillInfoPage);
}
private initSF(): SFSchema {
return {
properties: {
expand: {
type: 'boolean',
ui: {
hidden: true
}
},
billCode: {
type: 'string',
title: '订单号',
ui: {
placeholder: '请输入'
}
},
serviceType: {
title: '服务类型',
type: 'string',
enum: [
{
label: '全部',
value: ''
},
{
label: '整车抢单',
value: 1
},
{
label: '整车指派',
value: 2
},
{
label: '大宗抢单',
value: 3
},
{
label: '大宗指派',
value: 4
},
{
label: '结算单',
value: 5
}
],
ui: {
widget: 'select'
}
},
shipperAppUserName: {
type: 'string',
title: '货主名称',
ui: {
placeholder: '请输入'
}
},
vatappcode: {
type: 'string',
title: '申请编号',
ui: {
autocomplete: 'off'
}
},
vatinvcode: {
type: 'string',
title: '分票编号',
ui: {
placeholder: '请输入'
}
},
vatappdate: {
title: '申请时间',
type: 'string',
ui: {
widget: 'sl-from-to',
type: 'date',
format: 'yyyy-MM-dd HH:mm:ss'
} as SFDateWidgetSchema
},
sts: {
type: 'string',
title: '开票状态',
ui: {
widget: 'dict-select',
params: { dictKey: 'etc:invoicing:status' },
placeholder: '请选择'
}
},
invoiceno: {
type: 'string',
title: '发票号码',
ui: {
placeholder: '请输入',
autocomplete: 'off'
}
},
invoicedate: {
title: '开票日期',
type: 'string',
ui: {
widget: 'sl-from-to',
type: 'date',
format: 'yyyy-MM-dd'
} as SFDateWidgetSchema
},
enterpriseInfoId: {
type: 'string',
title: '网络货运人',
ui: {
widget: 'select',
placeholder: '请选择',
allowClear: true,
asyncData: () => this.service.getNetworkFreightForwarder()
}
}
}
};
}
private initST(): STColumn[] {
return [
{ title: '订单号', index: 'billCode', type: 'link', className: 'text-center', width: 180, click: _record => this.routeTo(_record) },
{ title: '运单号', index: 'wayBillCode', width: 180, className: 'text-center' },
{ title: '银行类型', index: 'bankTypeLabel', render: '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.vatmoney }) }
},
{
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.price }) }
},
{
title: '技术服务费',
index: 'insurancePremium',
width: 120,
type: 'widget',
className: 'text-center',
widget: { type: 'currency-chy', params: ({ record }) => ({ value: record.insurancePremium }) }
},
{
title: '附加费',
index: 'surcharge',
width: 120,
type: 'widget',
className: 'text-center',
widget: { type: 'currency-chy', params: ({ record }) => ({ value: record.surcharge }) }
},
{
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: '服务类型',
render: 'serviceType',
width: '120px',
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: '140px' },
{ title: '车牌号', index: 'carNo', className: 'text-center', width: '120px' },
{
title: '承运司机',
index: 'driverName',
className: 'text-center',
width: '120px'
},
{
title: '车队长',
className: 'text-center',
width: '120px',
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: 120 },
{ title: '申请开票时间', index: 'vatappdate', type: 'date', className: 'text-center', width: 180 },
{ title: '申请开票编号', index: 'vatappcode', className: 'text-center', width: 190 },
{ title: '分票编号', index: 'vatinvcode', width: '200px', className: 'text-center' },
{ title: '发票号码', index: 'invoiceno', width: 130, 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开票金额',
index: 'etcInvoiceMoney',
className: 'text-center',
width: 120,
type: 'widget',
widget: { type: 'currency-chy', params: ({ record }) => ({ value: record.etcInvoiceMoney }) }
}
];
}
}