This commit is contained in:
Taric Xin
2022-01-13 15:10:02 +08:00
parent 6d8cf857fb
commit 074093760e
5 changed files with 73 additions and 9 deletions

View File

@ -2,7 +2,7 @@
/* eslint-disable import/no-duplicates */
import { HttpClientModule } from '@angular/common/http';
import { default as ngLang } from '@angular/common/locales/zh';
import { APP_INITIALIZER, LOCALE_ID, NgModule, Type } from '@angular/core';
import { APP_INITIALIZER, DEFAULT_CURRENCY_CODE, LOCALE_ID, NgModule, Type } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { SimpleInterceptor } from '@delon/auth';
@ -40,7 +40,8 @@ const APPINIT_PROVIDES = [
useFactory: StartupServiceFactory,
deps: [StartupService],
multi: true
}
},
{ provide: DEFAULT_CURRENCY_CODE, useValue: '¥' }
];
// #endregion

View File

@ -1,10 +1,14 @@
import { CurrencyPipe } from '@angular/common';
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 } from '@delon/form';
import { CurrencyService } from '@delon/util';
import { CurrencyCNYPipe } from '@delon/util/pipes/currency/cny.pipe';
import { ShipperBaseService } from '@shared';
import { NzModalService } from 'ng-zorro-antd/modal';
import { SystemService } from 'src/app/routes/sys-setting/services/system.service';
import { AccountDetailComponent } from 'src/app/shared/components/account-detail/account-detail.component';
import { FreightAccountService } from '../../services/freight-account.service';
@Component({
@ -24,7 +28,12 @@ export class FreightAccountComponent implements OnInit {
_$expand = false;
constructor(public service: FreightAccountService, private router: Router) {}
constructor(
public service: FreightAccountService,
private router: Router,
private modal: NzModalService,
private currencyService: CurrencyService
) {}
ngOnInit(): void {}
@ -36,6 +45,15 @@ export class FreightAccountComponent implements OnInit {
return requestOptions;
};
showAccountDetail(item: any) {
this.modal.create({
nzTitle: '账户明细',
nzContent: AccountDetailComponent,
nzComponentParams: {},
nzFooter: null
});
}
/**
* 重置表单
*/
@ -146,10 +164,20 @@ export class FreightAccountComponent implements OnInit {
{ title: '网络货运人', index: 'ltdName' },
{ title: '银行类型', index: 'bankTypeLabel' },
{ title: '虚拟账户', index: 'virtualAccount' },
{ title: '可用余额', index: 'availableBalance' },
{ title: '冻结余额', index: 'freezeBalance' },
{ title: '累计消费金额', index: 'description' },
{ title: '账户总余额', render: 'description' },
{
title: '可用余额',
index: 'availableBalance',
type: 'currency',
format: item => `${this.currencyService.format(item.availableBalance)}`
},
{ title: '冻结余额', index: 'freezeBalance', type: 'currency' },
{
title: '账户总余额',
render: 'description',
type: 'link',
format: item => `${new CurrencyPipe('cny').transform(item.availableBalance)}`,
click: item => this.showAccountDetail(item)
},
{ title: '创建时间', index: 'createTime', type: 'date', width: 150 },
{
title: '状态',

View File

@ -0,0 +1,6 @@
<st #st [data]="url" [columns]="columns"
[req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, process: beforeReq }"
[res]="{ reName: { list: 'data.records', total: 'data.total' } }"
[page]="{ show: true, showSize: true, pageSizes: [10, 20, 30, 50, 100, 200, 300, 500, 1000] }"
[loading]="service.http.loading" [scroll]="{ y: '370px' }">
</st>

View File

@ -0,0 +1,28 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { STComponent, STColumn, STRequestOptions } from '@delon/abc/st';
import { BaseService } from '../../services';
@Component({
selector: 'app-account-detail',
templateUrl: './account-detail.component.html'
})
export class AccountDetailComponent implements OnInit {
@ViewChild('st', { static: true })
st!: STComponent;
columns: STColumn[] = [
{ title: '网络货运人', index: 'phone' },
{ title: '平安账户余额', index: 'ltdName' },
{ title: '浦发账户余额', index: 'bankTypeLabel' }
];
url = '';
isCanCreate = false;
constructor(public service: BaseService) {}
ngOnInit(): void {}
beforeReq = (requestOptions: STRequestOptions) => {
return requestOptions;
};
}

View File

@ -26,6 +26,7 @@ import { AmapModule } from './components/amap/amap.module';
import { ImageListModule } from './components/imagelist';
import { DictSelectComponent } from './components/dict-select';
import { PipeModule } from './pipes';
import { AccountDetailComponent } from './components/account-detail/account-detail.component';
const MODULES = [
AddressModule,
@ -44,7 +45,7 @@ const MODULES = [
];
// #endregion
const SHAREDCOMPONENTS = [LogisticsTimeLineComponent, DictSelectComponent];
const SHAREDCOMPONENTS = [LogisticsTimeLineComponent, DictSelectComponent, AccountDetailComponent];
@NgModule({
imports: [
@ -57,7 +58,7 @@ const SHAREDCOMPONENTS = [LogisticsTimeLineComponent, DictSelectComponent];
DelonFormModule,
...SHARED_DELON_MODULES,
...SHARED_ZORRO_MODULES,
...MODULES,
...MODULES
// third libs
],
exports: [