From 074093760e1b0e1ebb9bded8c3259fccec42ed0a Mon Sep 17 00:00:00 2001 From: Taric Xin Date: Thu, 13 Jan 2022 15:10:02 +0800 Subject: [PATCH] edit --- src/app/app.module.ts | 5 ++- .../freight-account.component.ts | 38 ++++++++++++++++--- .../account-detail.component.html | 6 +++ .../account-detail.component.ts | 28 ++++++++++++++ src/app/shared/shared.module.ts | 5 ++- 5 files changed, 73 insertions(+), 9 deletions(-) create mode 100644 src/app/shared/components/account-detail/account-detail.component.html create mode 100644 src/app/shared/components/account-detail/account-detail.component.ts diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 4cba8984..2c30b188 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -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 diff --git a/src/app/routes/financial-management/components/freight-account/freight-account.component.ts b/src/app/routes/financial-management/components/freight-account/freight-account.component.ts index cf0093f5..77aa78e9 100644 --- a/src/app/routes/financial-management/components/freight-account/freight-account.component.ts +++ b/src/app/routes/financial-management/components/freight-account/freight-account.component.ts @@ -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: '状态', diff --git a/src/app/shared/components/account-detail/account-detail.component.html b/src/app/shared/components/account-detail/account-detail.component.html new file mode 100644 index 00000000..c17b5a4c --- /dev/null +++ b/src/app/shared/components/account-detail/account-detail.component.html @@ -0,0 +1,6 @@ + + \ No newline at end of file diff --git a/src/app/shared/components/account-detail/account-detail.component.ts b/src/app/shared/components/account-detail/account-detail.component.ts new file mode 100644 index 00000000..e9b5be0f --- /dev/null +++ b/src/app/shared/components/account-detail/account-detail.component.ts @@ -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; + }; +} diff --git a/src/app/shared/shared.module.ts b/src/app/shared/shared.module.ts index 7cd39308..acc0ede9 100644 --- a/src/app/shared/shared.module.ts +++ b/src/app/shared/shared.module.ts @@ -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: [