계좌정보 수정
This commit is contained in:
parent
fcfae3d496
commit
41dc0c9452
|
@ -356,7 +356,7 @@
|
|||
<ng-container *ngSwitchCase="'bankInfo'">
|
||||
<form class="flex flex-col w-full" [formGroup]="memberBankForm">
|
||||
<div class="flex">
|
||||
<mat-form-field class="w-1/2 pr-2">
|
||||
<mat-form-field class="w-1/3 pr-2">
|
||||
<mat-label>환전 비밀번호</mat-label>
|
||||
<input
|
||||
id="exchangePw"
|
||||
|
@ -364,16 +364,35 @@
|
|||
[formControlName]="'exchangePw'"
|
||||
/>
|
||||
</mat-form-field>
|
||||
<mat-form-field class="w-1/2 pr-2">
|
||||
<mat-form-field class="w-1/3 pr-2">
|
||||
<mat-label>환전 비밀번호 확인</mat-label>
|
||||
<input
|
||||
id="exchangePwConfirm"
|
||||
matInput
|
||||
[formControlName]="'exchangePwConfirm'"
|
||||
/>
|
||||
</mat-form-field>
|
||||
<div class="w-1/3 pr-2 mt-8">
|
||||
<button
|
||||
mat-flat-button
|
||||
[color]="'primary'"
|
||||
(click)="__changeExcahngePassword()"
|
||||
>
|
||||
비밀번호 수정
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex">
|
||||
<mat-form-field class="w-1/3 pr-2">
|
||||
<mat-label>은행명</mat-label>
|
||||
|
||||
<mat-select
|
||||
[formControlName]="'bankId'"
|
||||
[formControlName]="'bankName'"
|
||||
placeholder="은행 선택"
|
||||
>
|
||||
<mat-option
|
||||
*ngFor="let bank of banks"
|
||||
[value]="bank.getId()"
|
||||
[value]="bank.getName()"
|
||||
>
|
||||
{{ bank.getName() }}
|
||||
</mat-option>
|
||||
|
@ -387,9 +406,7 @@
|
|||
은행명은 필수 입력입니다.
|
||||
</mat-error> -->
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="flex">
|
||||
<mat-form-field class="w-1/2 pr-2">
|
||||
<mat-form-field class="w-1/3 pr-2">
|
||||
<mat-label>계좌번호</mat-label>
|
||||
<input
|
||||
type="text"
|
||||
|
@ -397,7 +414,7 @@
|
|||
[formControlName]="'accountNumber'"
|
||||
/>
|
||||
</mat-form-field>
|
||||
<mat-form-field class="w-1/2 pr-2">
|
||||
<mat-form-field class="w-1/3 pr-2">
|
||||
<mat-label>예금주</mat-label>
|
||||
<input
|
||||
id="accountHolder"
|
||||
|
|
|
@ -53,6 +53,11 @@ import { MatDrawer } from '@angular/material/sidenav';
|
|||
import { FuseMediaWatcherService } from '@fuse/services/media-watcher';
|
||||
import { FuseAlertType } from '@fuse/components/alert';
|
||||
import { MatSelectChange } from '@angular/material/select';
|
||||
import {
|
||||
UpdateMemberBankAccountForExchangePasswordRequest,
|
||||
UpdateMemberBankAccountRequest,
|
||||
} from 'app/modules/proto/c2se/member_bank_account_pb';
|
||||
import { MemberBankAccountService } from 'app/modules/polyglot/member_bank_account/services/member_bank_account.service';
|
||||
|
||||
@Component({
|
||||
selector: 'user-view',
|
||||
|
@ -158,7 +163,8 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||
private _memberService: MemberService,
|
||||
private _memberLevelService: MemberLevelService,
|
||||
private _bankService: BankService,
|
||||
private _siteService: SiteService
|
||||
private _siteService: SiteService,
|
||||
private _memberBankAccountService: MemberBankAccountService
|
||||
) {}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
|
@ -189,10 +195,11 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||
});
|
||||
|
||||
this.memberBankForm = this._formBuilder.group({
|
||||
bankId: [''],
|
||||
bankName: [''],
|
||||
accountNumber: [''],
|
||||
accountHolder: [''],
|
||||
exchangePw: [''],
|
||||
exchangePwConfirm: [''],
|
||||
description: [''],
|
||||
});
|
||||
|
||||
|
@ -301,9 +308,20 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||
?.setValue(this.currentMember?.getMemberLevel()?.getName());
|
||||
this._changeDetectorRef.markForCheck();
|
||||
});
|
||||
this._bankService
|
||||
.listBanks()
|
||||
.then((result) => (this.banks = result.getBanksList()));
|
||||
this._bankService.listBanks().then((result) => {
|
||||
this.memberBankForm.get('bankName')?.value;
|
||||
|
||||
this.memberBankForm.patchValue({
|
||||
bankName: this.currentMember?.getBankAccount()?.getBank()?.getName(),
|
||||
accountNumber: this.currentMember?.getBankAccount()?.getAccountNumber(),
|
||||
accountHolder: this.currentMember?.getBankAccount()?.getName(),
|
||||
description: this.currentMember?.getBankAccount()?.getMemo(),
|
||||
});
|
||||
|
||||
this._changeDetectorRef.markForCheck();
|
||||
|
||||
this.banks = result.getBanksList();
|
||||
});
|
||||
|
||||
this._activatedRoute.data.subscribe((data) => {
|
||||
let member: GetMemberResponse.Result = data['member'];
|
||||
|
@ -318,10 +336,9 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||
signinPw: '',
|
||||
exchangePw: '',
|
||||
mobilePhoneNumber: this.currentMember?.getMobilePhoneNumber(),
|
||||
levelName: this.currentMember?.getMemberLevel()?.getId(),
|
||||
levelName: this.currentMember?.getMemberLevel()?.getName(),
|
||||
state: this.currentMember?.getState(),
|
||||
nickname: this.currentMember?.getNickname(),
|
||||
bankId: this.currentMember?.getBankAccount()?.getId(),
|
||||
});
|
||||
// Mark for check
|
||||
this._changeDetectorRef.markForCheck();
|
||||
|
@ -382,7 +399,32 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||
|
||||
switch (this.selectedPanel) {
|
||||
case 'accountInfo':
|
||||
{
|
||||
this.modifyMemberDefaultInfo();
|
||||
|
||||
break;
|
||||
case 'bankInfo':
|
||||
this.modifyMemberBankAccountInfo();
|
||||
|
||||
break;
|
||||
case 'settleInfo':
|
||||
break;
|
||||
case 'gameInfo':
|
||||
break;
|
||||
case 'historyInfo':
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private modifyMemberDefaultInfo(): void {
|
||||
if (!this.currentMember?.getId()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const req = new UpdateMemberRequest();
|
||||
req.setId(this.currentMember?.getId());
|
||||
|
||||
const {
|
||||
username,
|
||||
signinPw,
|
||||
|
@ -399,9 +441,7 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||
} = this.memberDefaultForm.value;
|
||||
|
||||
if (!!levelName && levelName !== '') {
|
||||
const level = this.memberLevels.find(
|
||||
(v) => v.getName() === levelName
|
||||
);
|
||||
const level = this.memberLevels.find((v) => v.getName() === levelName);
|
||||
if (!!level) req.setMemberLevelId(level?.getId());
|
||||
}
|
||||
if (!!mobilePhoneNumber && mobilePhoneNumber !== '') {
|
||||
|
@ -411,42 +451,57 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||
const site = this.sites.find((v) => v.getUrl() === siteUrl);
|
||||
if (!!site) req.setSiteId(site.getId());
|
||||
}
|
||||
|
||||
this._memberService
|
||||
.updateMember(req)
|
||||
.then((result) => {
|
||||
console.log(result);
|
||||
this.showAlert('success', '수정이 완료되었습니다.');
|
||||
})
|
||||
.catch((resson) => {
|
||||
this.showAlert('error', '수정 실패 잠시 후 다시 시도하세요.');
|
||||
})
|
||||
.finally(() => this.closeChangePasswordAlert());
|
||||
}
|
||||
|
||||
break;
|
||||
case 'bankInfo':
|
||||
{
|
||||
private modifyMemberBankAccountInfo(): void {
|
||||
if (!this.memberBankForm.valid) {
|
||||
return;
|
||||
}
|
||||
const { exchangePw, accountHolder, accountNumber, description } =
|
||||
this.memberBankForm.value;
|
||||
const {
|
||||
exchangePw,
|
||||
exchangePwConfirm,
|
||||
bankName,
|
||||
accountHolder,
|
||||
accountNumber,
|
||||
description,
|
||||
} = this.memberBankForm.value;
|
||||
|
||||
const bank = new UpdateMemberRequest.BankAccount();
|
||||
const bankId = this.currentMember?.getBankAccount()?.getId();
|
||||
if (!!bankId) {
|
||||
bank.setId(bankId);
|
||||
bank.setAccountNumber(accountNumber);
|
||||
bank.setName(accountHolder);
|
||||
}
|
||||
req.setBankAccount(bank);
|
||||
const bankReq = new UpdateMemberBankAccountRequest();
|
||||
const bankFind = this.banks.find((v) => v.getName() === bankName);
|
||||
|
||||
if (!bankId || !bankFind) {
|
||||
console.log('Error bankId undefined or bankFind undefined');
|
||||
return;
|
||||
}
|
||||
|
||||
break;
|
||||
case 'settleInfo':
|
||||
break;
|
||||
case 'gameInfo':
|
||||
break;
|
||||
case 'historyInfo':
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
this._memberService.updateMember(req).then((result) => {
|
||||
console.log(result);
|
||||
});
|
||||
}
|
||||
bankReq.setAccountNumber(accountNumber);
|
||||
bankReq.setBankId(bankFind?.getId());
|
||||
bankReq.setId(bankId);
|
||||
bankReq.setMemo(description);
|
||||
bankReq.setName(accountHolder);
|
||||
|
||||
this._memberBankAccountService
|
||||
.updateMemberBankAccount(bankReq)
|
||||
.then((result) => {
|
||||
this.showAlert('success', '수정이 완료되었습니다.');
|
||||
})
|
||||
.catch((reson) => {
|
||||
this.showAlert('error', '수정 실패 잠시 후 다시 시도하세요.');
|
||||
})
|
||||
.finally(() => this.closeChangePasswordAlert());
|
||||
}
|
||||
/**
|
||||
* Navigate to the panel
|
||||
*
|
||||
|
@ -525,6 +580,49 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||
});
|
||||
}
|
||||
|
||||
__changeExcahngePassword(): void {
|
||||
const password = this.memberBankForm.get('exchangePw')?.value as string;
|
||||
const passwordConfirm = this.memberBankForm.get('exchangePwConfirm')
|
||||
?.value as string;
|
||||
|
||||
if (!password || !passwordConfirm) {
|
||||
this.showAlert('error', '비밀번호를 입력하세요.');
|
||||
this.closeChangePasswordAlert();
|
||||
return;
|
||||
}
|
||||
|
||||
if (password !== passwordConfirm) {
|
||||
this.showAlert('error', '비밀번호가 일치하지 않습니다.');
|
||||
|
||||
this.closeChangePasswordAlert();
|
||||
return;
|
||||
}
|
||||
|
||||
const dialogRef = this._fuseConfirmationService.open(
|
||||
this.passwordConfirmConfigForm.value
|
||||
);
|
||||
|
||||
/* const dialogRef = this._matDialog.open(AddComposeComponent); */
|
||||
|
||||
dialogRef.afterClosed().subscribe((result) => {
|
||||
if (result === 'confirmed') {
|
||||
const req = new UpdateMemberBankAccountForExchangePasswordRequest();
|
||||
req.setExchangePassword(password);
|
||||
req.setId(this.currentMember!.getId());
|
||||
|
||||
this._memberBankAccountService
|
||||
.updateMemberBankAccountForExchangePassword(req)
|
||||
.then((result) => {
|
||||
this.showAlert('success', '비밀번호가 수정 되었습니다.');
|
||||
})
|
||||
.catch((reson) => {
|
||||
this.showAlert('error', '패스워드 변경이 실패하였습니다.');
|
||||
})
|
||||
.finally(() => this.closeChangePasswordAlert());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
onSelectionChangeLanguage(event: MatSelectChange) {
|
||||
const state = event.value;
|
||||
|
||||
|
@ -561,6 +659,7 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||
type,
|
||||
message,
|
||||
};
|
||||
this._changeDetectorRef.markForCheck();
|
||||
}
|
||||
|
||||
private closeChangePasswordAlert(): void {
|
||||
|
|
|
@ -16,6 +16,7 @@ import {
|
|||
GetMemberBankAccountResponse,
|
||||
GetMemberBankAccountRequest,
|
||||
UpdateMemberBankAccountForExchangePasswordResponse,
|
||||
UpdateMemberBankAccountForExchangePasswordRequest,
|
||||
} from 'app/modules/proto/c2se/member_bank_account_pb';
|
||||
import {
|
||||
SUBJECT_LIST_MEMBER_BANK_ACCOUNTS,
|
||||
|
@ -112,11 +113,11 @@ export class MemberBankAccountService {
|
|||
);
|
||||
}
|
||||
|
||||
updateMemberBankAccount(): Promise<UpdateMemberBankAccountResponse.Result> {
|
||||
updateMemberBankAccount(
|
||||
req: UpdateMemberBankAccountRequest
|
||||
): Promise<UpdateMemberBankAccountResponse.Result> {
|
||||
return new Promise<UpdateMemberBankAccountResponse.Result>(
|
||||
(resolve, reject) => {
|
||||
let req = new UpdateMemberBankAccountRequest();
|
||||
|
||||
this.__natsService
|
||||
.request<UpdateMemberBankAccountResponse.Result>(
|
||||
SUBJECT_UPDATE_MEMBER_BANK_ACCOUNT,
|
||||
|
@ -135,11 +136,11 @@ export class MemberBankAccountService {
|
|||
);
|
||||
}
|
||||
|
||||
updateMemberBankAccountForExchangePassword(): Promise<UpdateMemberBankAccountForExchangePasswordResponse.Result> {
|
||||
updateMemberBankAccountForExchangePassword(
|
||||
req: UpdateMemberBankAccountForExchangePasswordRequest
|
||||
): Promise<UpdateMemberBankAccountForExchangePasswordResponse.Result> {
|
||||
return new Promise<UpdateMemberBankAccountForExchangePasswordResponse.Result>(
|
||||
(resolve, reject) => {
|
||||
let req = new UpdateMemberBankAccountForExchangePasswordResponse();
|
||||
|
||||
this.__natsService
|
||||
.request<UpdateMemberBankAccountForExchangePasswordResponse.Result>(
|
||||
SUBJECT_UPDATE_MEMBER_BANK_ACCOUNT_FOR_EXCHANGE_PASSWORD,
|
||||
|
|
Loading…
Reference in New Issue
Block a user