충전내역 연동 완료
This commit is contained in:
parent
bd7a3fc739
commit
63ee6c23b2
|
@ -6,7 +6,7 @@ import {
|
||||||
RouterStateSnapshot,
|
RouterStateSnapshot,
|
||||||
} from '@angular/router';
|
} from '@angular/router';
|
||||||
import { MemberBankDepositService } from 'app/modules/polyglot/member_bank_deposit/services/member_bank_deposit.service';
|
import { MemberBankDepositService } from 'app/modules/polyglot/member_bank_deposit/services/member_bank_deposit.service';
|
||||||
import { ListMemberBankDepositsResponse } from 'app/modules/proto/c2se/member_bank_deposit_pb';
|
import { ListMemberBankDepositsRequest, ListMemberBankDepositsResponse } from 'app/modules/proto/c2se/member_bank_deposit_pb';
|
||||||
import { catchError, Observable, throwError } from 'rxjs';
|
import { catchError, Observable, throwError } from 'rxjs';
|
||||||
|
|
||||||
import { Deposit } from '../models/deposit';
|
import { Deposit } from '../models/deposit';
|
||||||
|
@ -114,6 +114,7 @@ export class BankDepositResolver implements Resolve<any> {
|
||||||
| Observable<ListMemberBankDepositsResponse.Result>
|
| Observable<ListMemberBankDepositsResponse.Result>
|
||||||
| Promise<ListMemberBankDepositsResponse.Result>
|
| Promise<ListMemberBankDepositsResponse.Result>
|
||||||
| ListMemberBankDepositsResponse.Result {
|
| ListMemberBankDepositsResponse.Result {
|
||||||
return this._bankDepositService.listMemberBankDeposits();
|
const req = new ListMemberBankDepositsRequest();
|
||||||
|
return this._bankDepositService.listMemberBankDeposits(req);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,6 +52,9 @@
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<ng-container
|
||||||
|
*ngIf="depositHistoryDataSource.data.length > 0; else noDeposit"
|
||||||
|
>
|
||||||
<div class="flex flex-col flex-auto mt-2">
|
<div class="flex flex-col flex-auto mt-2">
|
||||||
<table
|
<table
|
||||||
class="overflow-y-visible"
|
class="overflow-y-visible"
|
||||||
|
@ -71,21 +74,23 @@
|
||||||
<!-- Expenses amount -->
|
<!-- Expenses amount -->
|
||||||
<ng-container matColumnDef="amount">
|
<ng-container matColumnDef="amount">
|
||||||
<th mat-header-cell *matHeaderCellDef>충전금액</th>
|
<th mat-header-cell *matHeaderCellDef>충전금액</th>
|
||||||
<td mat-cell *matCellDef="let info">{{ info.amount }}</td>
|
<td mat-cell *matCellDef="let info">
|
||||||
|
{{ info.getAmount() }}
|
||||||
|
</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<!-- Expenses amount -->
|
<!-- Expenses amount -->
|
||||||
<ng-container matColumnDef="createAt">
|
<ng-container matColumnDef="createAt">
|
||||||
<th mat-header-cell *matHeaderCellDef>신청일자</th>
|
<th mat-header-cell *matHeaderCellDef>신청일자</th>
|
||||||
<td mat-cell *matCellDef="let info">
|
<td mat-cell *matCellDef="let info">
|
||||||
{{ info.createAt }}
|
{{ info.getCreatedAt() | date: "MMM dd, h:mm a" }}
|
||||||
</td>
|
</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<ng-container matColumnDef="state">
|
<ng-container matColumnDef="state">
|
||||||
<th mat-header-cell *matHeaderCellDef>결과</th>
|
<th mat-header-cell *matHeaderCellDef>결과</th>
|
||||||
<td mat-cell *matCellDef="let info">
|
<td mat-cell *matCellDef="let info">
|
||||||
{{ info.state }}
|
{{ __getDepositState(info) }}
|
||||||
</td>
|
</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
|
@ -103,6 +108,14 @@
|
||||||
aria-label="Select page of users"
|
aria-label="Select page of users"
|
||||||
></mat-paginator>
|
></mat-paginator>
|
||||||
</div>
|
</div>
|
||||||
|
</ng-container>
|
||||||
|
<ng-template #noDeposit>
|
||||||
|
<div
|
||||||
|
class="p-8 sm:p-16 border-t text-4xl font-semibold tracking-tight text-center"
|
||||||
|
>
|
||||||
|
There are no data!
|
||||||
|
</div>
|
||||||
|
</ng-template>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -3,6 +3,7 @@ import {
|
||||||
ChangeDetectionStrategy,
|
ChangeDetectionStrategy,
|
||||||
ChangeDetectorRef,
|
ChangeDetectorRef,
|
||||||
Component,
|
Component,
|
||||||
|
Input,
|
||||||
OnDestroy,
|
OnDestroy,
|
||||||
OnInit,
|
OnInit,
|
||||||
ViewChild,
|
ViewChild,
|
||||||
|
@ -11,6 +12,13 @@ import {
|
||||||
import { MatPaginator } from '@angular/material/paginator';
|
import { MatPaginator } from '@angular/material/paginator';
|
||||||
import { MatTableDataSource } from '@angular/material/table';
|
import { MatTableDataSource } from '@angular/material/table';
|
||||||
import { fuseAnimations } from '@fuse/animations';
|
import { fuseAnimations } from '@fuse/animations';
|
||||||
|
import { MemberBankDepositService } from 'app/modules/polyglot/member_bank_deposit/services/member_bank_deposit.service';
|
||||||
|
import { ListMemberBankDepositsRequest } from 'app/modules/proto/c2se/member_bank_deposit_pb';
|
||||||
|
import {
|
||||||
|
MemberBankDepositModel,
|
||||||
|
MemberBankDepositState,
|
||||||
|
} from 'app/modules/proto/models/member_bank_deposit_pb';
|
||||||
|
import { MemberModel } from 'app/modules/proto/models/member_pb';
|
||||||
import { Subject } from 'rxjs';
|
import { Subject } from 'rxjs';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -43,20 +51,26 @@ import { Subject } from 'rxjs';
|
||||||
export class DepositHistoryComponent
|
export class DepositHistoryComponent
|
||||||
implements OnInit, AfterViewInit, OnDestroy
|
implements OnInit, AfterViewInit, OnDestroy
|
||||||
{
|
{
|
||||||
|
@Input()
|
||||||
|
member!: MemberModel | undefined;
|
||||||
|
|
||||||
@ViewChild(MatPaginator) private _paginator!: MatPaginator;
|
@ViewChild(MatPaginator) private _paginator!: MatPaginator;
|
||||||
|
|
||||||
private _unsubscribeAll: Subject<any> = new Subject<any>();
|
private _unsubscribeAll: Subject<any> = new Subject<any>();
|
||||||
|
|
||||||
depositHistoryTableColumns: string[] = ['no', 'amount', 'createAt', 'state'];
|
depositHistoryTableColumns: string[] = ['no', 'amount', 'createAt', 'state'];
|
||||||
|
|
||||||
depositHistoryDataSource: MatTableDataSource<TempDeposit> =
|
depositHistoryDataSource: MatTableDataSource<MemberBankDepositModel> =
|
||||||
new MatTableDataSource();
|
new MatTableDataSource();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
constructor(private _changeDetectorRef: ChangeDetectorRef) {
|
constructor(
|
||||||
this.depositHistoryDataSource.data = DEPOSIT_HISTORY_DATA;
|
private _changeDetectorRef: ChangeDetectorRef,
|
||||||
|
private _memberBankDepositService: MemberBankDepositService
|
||||||
|
) {
|
||||||
|
/* this.depositHistoryDataSource.data = DEPOSIT_HISTORY_DATA; */
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
@ -66,7 +80,22 @@ export class DepositHistoryComponent
|
||||||
/**
|
/**
|
||||||
* On init
|
* On init
|
||||||
*/
|
*/
|
||||||
ngOnInit(): void {}
|
ngOnInit(): void {
|
||||||
|
const req = new ListMemberBankDepositsRequest();
|
||||||
|
req.setSearch();
|
||||||
|
const search = new ListMemberBankDepositsRequest.Search();
|
||||||
|
search.setMemberId(this.member!.getId());
|
||||||
|
req.setSearch(search);
|
||||||
|
|
||||||
|
this._memberBankDepositService
|
||||||
|
.listMemberBankDeposits(req)
|
||||||
|
.then((result) => {
|
||||||
|
const memberBankDepositList = result.getMemberBankDepositsList();
|
||||||
|
this.depositHistoryDataSource.data = memberBankDepositList;
|
||||||
|
|
||||||
|
this._changeDetectorRef.markForCheck();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* After view init
|
* After view init
|
||||||
|
@ -111,21 +140,25 @@ export class DepositHistoryComponent
|
||||||
__trackByFn(index: number, item: any): any {
|
__trackByFn(index: number, item: any): any {
|
||||||
return item.id || index;
|
return item.id || index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__getDepositState(deposit: MemberBankDepositModel): string | undefined {
|
||||||
|
const state = deposit.getState();
|
||||||
|
let result: string = '';
|
||||||
|
|
||||||
|
switch (state) {
|
||||||
|
case MemberBankDepositState.APPLICATION:
|
||||||
|
result = '신청';
|
||||||
|
break;
|
||||||
|
case MemberBankDepositState.PENDING:
|
||||||
|
result = '대기';
|
||||||
|
break;
|
||||||
|
case MemberBankDepositState.COMPLETE:
|
||||||
|
result = '완료';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TempDeposit {
|
return result;
|
||||||
amount: string;
|
}
|
||||||
createAt: string;
|
|
||||||
state: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const DEPOSIT_HISTORY_DATA: TempDeposit[] = [
|
|
||||||
{ amount: '100,000', createAt: '2022-08-20 12:40', state: '완료' },
|
|
||||||
{ amount: '100,000', createAt: '2022-08-20 12:40', state: '완료' },
|
|
||||||
{ amount: '100,000', createAt: '2022-08-20 12:40', state: '완료' },
|
|
||||||
{ amount: '100,000', createAt: '2022-08-20 12:40', state: '완료' },
|
|
||||||
{ amount: '100,000', createAt: '2022-08-20 12:40', state: '완료' },
|
|
||||||
{ amount: '100,000', createAt: '2022-08-20 12:40', state: '완료' },
|
|
||||||
{ amount: '100,000', createAt: '2022-08-20 12:40', state: '완료' },
|
|
||||||
{ amount: '100,000', createAt: '2022-08-20 12:40', state: '완료' },
|
|
||||||
];
|
|
||||||
|
|
|
@ -655,7 +655,9 @@
|
||||||
<mat-tab-group [animationDuration]="'0ms'">
|
<mat-tab-group [animationDuration]="'0ms'">
|
||||||
<mat-tab label="충전내역" class="bg-gray-200">
|
<mat-tab label="충전내역" class="bg-gray-200">
|
||||||
<ng-template matTabContent>
|
<ng-template matTabContent>
|
||||||
<deposit-history></deposit-history>
|
<deposit-history
|
||||||
|
[member]="currentMember"
|
||||||
|
></deposit-history>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</mat-tab>
|
</mat-tab>
|
||||||
|
|
||||||
|
|
|
@ -198,7 +198,7 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||||
coupon: [''],
|
coupon: [''],
|
||||||
recommender: [{ value: '', disabled: true }],
|
recommender: [{ value: '', disabled: true }],
|
||||||
siteUrl: [''],
|
siteUrl: [''],
|
||||||
recommendCount: [''],
|
recommendCount: [{ value: 0, disabled: true }],
|
||||||
hodingGameMoney: [{ value: '0', disabled: true }],
|
hodingGameMoney: [{ value: '0', disabled: true }],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -333,6 +333,9 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||||
state: this.currentMember?.getState(),
|
state: this.currentMember?.getState(),
|
||||||
nickname: this.currentMember?.getNickname(),
|
nickname: this.currentMember?.getNickname(),
|
||||||
siteUrl: this.currentMember?.getSite()?.getUrl(),
|
siteUrl: this.currentMember?.getSite()?.getUrl(),
|
||||||
|
recommender: this.currentMember?.getParentMember()?.getUsername(),
|
||||||
|
recommendCount: this.currentMember?.getChildMemberCount(),
|
||||||
|
ownCash: 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
this.memberBankForm.patchValue({
|
this.memberBankForm.patchValue({
|
||||||
|
|
|
@ -67,11 +67,11 @@ export class MemberBankDepositService {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
listMemberBankDeposits(): Promise<ListMemberBankDepositsResponse.Result> {
|
listMemberBankDeposits(
|
||||||
|
req: ListMemberBankDepositsRequest
|
||||||
|
): Promise<ListMemberBankDepositsResponse.Result> {
|
||||||
return new Promise<ListMemberBankDepositsResponse.Result>(
|
return new Promise<ListMemberBankDepositsResponse.Result>(
|
||||||
(resolve, reject) => {
|
(resolve, reject) => {
|
||||||
let req = new ListMemberBankDepositsRequest();
|
|
||||||
|
|
||||||
this.__natsService
|
this.__natsService
|
||||||
.request<ListMemberBankDepositsResponse.Result>(
|
.request<ListMemberBankDepositsResponse.Result>(
|
||||||
SUBJECT_LIST_MEMBER_BANK_DEPOSITS,
|
SUBJECT_LIST_MEMBER_BANK_DEPOSITS,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user