Files
bbq/src/app/routes/financial-management/components/abnormal-gold/abnormal-gold.component.ts
Taric Xin a99a15e570 edit
2021-12-29 19:46:29 +08:00

195 lines
5.4 KiB
TypeScript

import { Component, OnInit, ViewChild } from '@angular/core';
import { Router } from '@angular/router';
import { STComponent, STColumn, STRequestOptions, STChange } from '@delon/abc/st';
import { SFComponent, SFSchema, SFDateWidgetSchema } from '@delon/form';
import { NzModalService } from 'ng-zorro-antd/modal';
import { FreightAccountService } from '../../services/freight-account.service';
import { ClearingModalComponent } from './clearing-modal/clearing-modal.component';
@Component({
selector: 'app-abnormal-gold',
templateUrl: './abnormal-gold.component.html',
styleUrls: ['./abnormal-gold.component.less']
})
export class AbnormalGoldComponent 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: FreightAccountService, private nzModalService: NzModalService, private router: Router) {}
ngOnInit(): void {}
beforeReq = (requestOptions: STRequestOptions) => {
if (this.sf) {
Object.assign(requestOptions.body, { ...this.sf.value });
}
return requestOptions;
};
refund(item: any) {
this.nzModalService.warning({
nzTitle: '确定要将该笔款项原路退回?',
nzOnOk: () => {}
});
}
clearingAction(item: any) {
const modal = this.nzModalService.create({
nzTitle: '清分',
nzContent: ClearingModalComponent,
nzOnOk: com => {
console.log(com.sf.value);
return false;
}
});
}
/**
* 重置表单
*/
resetSF() {
this.sf.reset();
this._$expand = false;
}
/**
* 伸缩查询条件
*/
expandToggle() {
this._$expand = !this._$expand;
this.sf?.setValue('/expand', this._$expand);
}
private initSF(): SFSchema {
return {
properties: {
expand: {
type: 'boolean',
ui: {
hidden: true
}
},
paySerialNumber: {
type: 'string',
title: '银行流水号',
ui: {
placeholder: '请输入'
}
},
ltdId: {
type: 'string',
title: '网络货运人',
ui: {
widget: 'select',
placeholder: '请选择',
allowClear: true,
asyncData: () => this.service.getNetworkFreightForwarder()
}
},
bankType: {
type: 'string',
title: '银行类型',
enum: [
{ label: '全部', value: '' },
{ label: '平安银行', value: '1' },
{ label: '浦发银行', value: '2' }
],
ui: {
widget: 'select',
placeholder: '请选择',
},
default: ''
},
transferBankAccount: {
type: 'string',
title: '付款账户',
ui: {
placeholder: '请输入',
visibleIf: {
expand: (value: boolean) => value
}
}
},
transferBankCardNumber: {
type: 'string',
title: '付款账号',
ui: {
placeholder: '请输入',
visibleIf: {
expand: (value: boolean) => value
}
}
},
transferBankOpenName: {
type: 'string',
title: '付款银行',
ui: {
placeholder: '请输入',
visibleIf: {
expand: (value: boolean) => value
}
}
},
transferDate: {
title: '转账时间',
type: 'string',
ui: {
widget: 'sl-from-to-search',
format: 'yyyy-MM-dd',
placeholder: '请选择',
nzShowTime: true,
visibleIf: {
expand: (value: boolean) => value
}
} as SFDateWidgetSchema
}
}
};
}
private initST(): STColumn[] {
return [
{ title: '银行流水号', index: 'paySerialNumber', width: 150 },
{ title: '网络货运人', index: 'ltdId', width: 120 },
{ title: '银行类型', index: 'callNo', width: 100, type: 'enum', enum: { 1: '平安银行', 2: '浦发银行' } },
{ title: '资金总账号', index: 'callNo', width: 120 },
{ title: '充值金额', index: 'rechargeAmount', width: 100 },
{ title: '付款账户', index: 'transferBankAccount', width: 100 },
{ title: '付款账号', index: 'transferBankCardNumber', width: 100 },
{ title: '付款银行', index: 'transferBankOpenName', width: 100 },
{ title: '转账时间', index: 'transferDate', type: 'date', width: 150 },
{ title: '转账备注', index: 'rechargeRemark', width: 100 },
{ title: '操作人', index: 'rechargeName', width: 90 },
{ title: '操作时间', index: 'callNo', type: 'date', width: 150 },
{ title: '状态', index: 'callNo', width: 90 },
{
title: '操作',
fixed: 'right',
className: 'text-center',
width: 120,
buttons: [
{
text: '清分',
click: item => this.clearingAction(item)
},
{
text: '退款',
click: item => this.refund(item)
},
{
text: '查看',
click: item => this.router.navigate(['/financial-management/withdrawals-record/detail/1'])
}
]
}
];
}
}