정산설정 수정 완료

This commit is contained in:
Park Byung Eun 2022-08-26 06:22:29 +00:00
parent 85f53c5d7d
commit 33c6cc553e
4 changed files with 134 additions and 52 deletions

View File

@ -245,7 +245,7 @@
<mat-select
id="state"
[formControlName]="'state'"
(selectionChange)="onSelectionChangeLanguage($event)"
(selectionChange)="onSelectionChangeState($event)"
>
<ng-container *ngFor="let info of memberStateOptions">
<mat-option [value]="info.value">
@ -254,14 +254,6 @@
</ng-container>
</mat-select>
</mat-form-field>
<mat-form-field class="w-1/3 pr-2">
<mat-label>환전금지</mat-label>
<mat-select [formControlName]="'isExcahngeMoney'">
<!-- <ng-container *ngFor="let vendor of vendors"> -->
<mat-option value="vendor.id"> vendor option </mat-option>
<!-- </ng-container> -->
</mat-select>
</mat-form-field>
</div>
<div class="flex">
@ -445,8 +437,9 @@
<mat-label>바카라 요율</mat-label>
<input
type="text"
maxlength="3"
matInput
[formControlName]="'bacaraRate'"
[formControlName]="'rateCasinoBacara'"
style="width: 40%"
/>
<div class="mt-1 text-md text-hint">
@ -458,7 +451,7 @@
<input
type="text"
matInput
[formControlName]="'rulletRate'"
[formControlName]="'rateCasinoRoulette'"
style="width: 40%"
/>
<div class="mt-1 text-md text-hint">
@ -470,7 +463,7 @@
<input
type="text"
matInput
[formControlName]="'dragonRate'"
[formControlName]="'rateCasinoDragonTiger'"
style="width: 40%"
/>
<div class="mt-1 text-md text-hint">
@ -485,7 +478,7 @@
<input
type="text"
matInput
[formControlName]="'etcRate'"
[formControlName]="'rateCasino'"
style="width: 40%"
/>
<div class="mt-1 text-md text-hint">
@ -497,7 +490,7 @@
<input
type="text"
matInput
[formControlName]="'slotRate'"
[formControlName]="'rateSlot'"
style="width: 40%"
/>
<div class="mt-1 text-md text-hint">
@ -509,7 +502,7 @@
<input
type="text"
matInput
[formControlName]="'casinoRusingRate'"
[formControlName]="'rateCasinoLoosing'"
style="width: 40%"
/>
<div class="mt-1 text-md text-hint">
@ -523,38 +516,64 @@
<input
type="text"
matInput
[formControlName]="'slotRusingRate'"
[formControlName]="'rateSlotLoosing'"
style="width: 40%"
/>
<div class="mt-1 text-md text-hint">
%(최소 0 ~ 최대 0.2)
</div>
</mat-form-field>
</div>
<div class="flex flex-col mt-8 gt-sm:mt-0 gt-sm:ml-16">
<mat-form-field class="w-1/3 pr-2">
<mat-label>환전금지설정</mat-label>
<mat-select [formControlName]="'canExchange'">
<mat-option value="true"></mat-option>
<mat-option value="false"> 아니오 </mat-option>
<!-- </ng-container> -->
</mat-select>
</mat-form-field>
</div>
<div class="flex flex-col mt-8 gt-sm:mt-0 gt-sm:ml-16">
<span class="font-semibold mb-2">콤프설정</span>
<span class="w-1/3 pr-2">
<mat-slide-toggle [color]="'primary'">
<mat-slide-toggle
[formControlName]="'canFirstChargeComp'"
[color]="'primary'"
>
첫충콤프
</mat-slide-toggle>
</span>
<span class="w-1/3 pr-2">
<mat-slide-toggle [color]="'primary'">
<mat-slide-toggle
[formControlName]="'canPerChargeComp'"
[color]="'primary'"
>
매충콤프
</mat-slide-toggle>
</span>
</div>
<div class="flex">
<span class="font-semibold mb-2">파트너수동지급</span>
<div class="flex flex-col mt-8 gt-sm:mt-0 gt-sm:ml-16">
<span class="font-semibold mb-2">파트너수동지급설정</span>
<mat-radio-group
class="flex flex-col w-1/3 pr-2"
[color]="'primary'"
[value]="'just-good'"
[formControlName]="'manualPaymentTypeForPartner'"
>
<mat-radio-button
class="mb-2"
[value]="ManualPaymentType.ALL_CHILD_PARTNER"
>
<mat-radio-button class="mb-2" [value]="'everything'">
하부파트너전체
</mat-radio-button>
<mat-radio-button class="mb-2" [value]="'just-good'">
<mat-radio-button
class="mb-2"
[value]="ManualPaymentType.ONLY_DIRECT_PARTNER"
>
직속파트너만
</mat-radio-button>
<mat-radio-button [value]="'no-push'">
<mat-radio-button [value]="ManualPaymentType.DISABLE">
사용안함
</mat-radio-button>
</mat-radio-group>
@ -652,7 +671,7 @@
</div>
<ng-template #commonButton>
<div class="flex items-center w-full border-t divide-x">
<div class="flex items-center w-full border-t divide-x mt-8">
<button
class="-ml-4"
mat-flat-button

View File

@ -65,8 +65,13 @@ import { ListSitesResponse } from 'app/modules/proto/c2se/site_pb';
import {
GetMemberSettlementSettingResponse,
ListMemberSettlementSettingsResponse,
UpdateMemberSettlementSettingRequest,
} from 'app/modules/proto/c2se/member_settlement_setting_pb';
import { MemberSettlementSetting } from 'app/modules/proto/models/member_settlement_setting_pb';
import {
ManualPaymentType,
MemberSettlementSetting,
} from 'app/modules/proto/models/member_settlement_setting_pb';
import { MemberSettlementSettingService } from 'app/modules/polyglot/member_settlement_setting/services/member_settlement_setting.service';
@Component({
selector: 'user-view',
@ -151,6 +156,7 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
banks!: Bank[];
sites!: Site[];
ManualPaymentType = ManualPaymentType;
alertConfig: { type: FuseAlertType; message: string } = {
type: 'success',
@ -170,12 +176,9 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
private _fuseConfirmationService: FuseConfirmationService,
private _fuseMediaWatcherService: FuseMediaWatcherService,
private _formBuilder: FormBuilder,
private _userService: UserService,
private _memberService: MemberService,
private _memberLevelService: MemberLevelService,
private _bankService: BankService,
private _siteService: SiteService,
private _memberBankAccountService: MemberBankAccountService
private _memberBankAccountService: MemberBankAccountService,
private _memberSettlementSettingService: MemberSettlementSettingService
) {}
// -----------------------------------------------------------------------------------------------------
@ -196,7 +199,6 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
mobilePhoneNumber: [''],
levelName: [''],
state: [''],
isExcahngeMoney: [''],
comp: [''],
coupon: [''],
recommender: [{ value: '', disabled: true }],
@ -215,13 +217,17 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
});
this.memberSettleForm = this._formBuilder.group({
bacaraRate: [],
rulletRate: [],
dragonRate: [],
etcRate: [],
slotRate: [],
casinoRusingRate: [],
slotRusingRate: [],
rateCasinoBacara: ['', [Validators.required]],
rateCasinoRoulette: ['', [Validators.required]],
rateCasinoDragonTiger: ['', [Validators.required]],
rateCasino: ['', [Validators.required]],
rateSlot: ['', [Validators.required]],
rateCasinoLoosing: ['', [Validators.required]],
rateSlotLoosing: ['', [Validators.required]],
canFirstChargeComp: [],
canPerChargeComp: [],
canExchange: [],
manualPaymentTypeForPartner: ['', [Validators.required]],
});
this.memberGameSettingForm = this._formBuilder.group({});
@ -314,14 +320,7 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
let listSitesResult: ListSitesResponse.Result = data['listSites'];
this.sites = listSitesResult.getSitesList();
let memberSettlementResult: GetMemberSettlementSettingResponse.Result =
data['memberSettlement'];
const memberSettlement =
memberSettlementResult.getMemberSettlementSetting();
if (!!memberSettlement) {
this.memberSettlement = memberSettlement;
}
const memberSettlement = this.currentMember?.getMemberSettlementSetting();
this.memberDefaultForm.patchValue({
username: this.currentMember?.getUsername(),
@ -341,6 +340,23 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
description: this.currentMember?.getBankAccount()?.getMemo(),
});
console.log('canExchange: ', memberSettlement?.getCanExchange());
this.memberSettleForm.patchValue({
rateCasinoBacara: memberSettlement?.getRateCasinoBacara(),
rateCasinoRoulette: memberSettlement?.getRateCasinoRoulette(),
rateCasinoDragonTiger: memberSettlement?.getRateCasinoDragonTiger(),
rateCasino: memberSettlement?.getRateCasino(),
rateSlot: memberSettlement?.getRateSlot(),
rateCasinoLoosing: memberSettlement?.getRateCasinoLoosing(),
rateSlotLoosing: memberSettlement?.getRateSlotLoosing(),
canFirstChargeComp: memberSettlement?.getCanFirstChargeComp(),
canPerChargeComp: memberSettlement?.getCanPerChargeComp(),
canExchange: !!memberSettlement?.getCanExchange() ? 'true' : 'false',
manualPaymentTypeForPartner:
memberSettlement?.getManualPaymentTypeForPartner(),
});
// Mark for check
this._changeDetectorRef.markForCheck();
});
@ -408,6 +424,8 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
break;
case 'settleInfo':
this.modifyMemberSttlemtSettingInfo();
break;
case 'gameInfo':
break;
@ -503,6 +521,53 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
})
.finally(() => this.closeChangePasswordAlert());
}
private modifyMemberSttlemtSettingInfo(): void {
if (!this.memberSettleForm.valid) {
return;
}
const {
rateCasinoBacara,
rateCasinoRoulette,
rateCasinoDragonTiger,
rateCasino,
rateSlot,
rateCasinoLoosing,
rateSlotLoosing,
canFirstChargeComp,
canPerChargeComp,
canExchange,
manualPaymentTypeForPartner,
} = this.memberSettleForm.value;
const updateSSReq = new UpdateMemberSettlementSettingRequest();
updateSSReq.setId(
this.currentMember?.getMemberSettlementSetting()?.getId()!
);
updateSSReq.setRateCasinoBacara(rateCasinoBacara);
updateSSReq.setRateCasinoRoulette(rateCasinoRoulette);
updateSSReq.setRateCasinoDragonTiger(rateCasinoDragonTiger);
updateSSReq.setRateCasino(rateCasino);
updateSSReq.setRateSlot(rateSlot);
updateSSReq.setRateCasinoLoosing(rateCasinoLoosing);
updateSSReq.setRateSlotLoosing(rateSlotLoosing);
updateSSReq.setCanFirstChargeComp(canFirstChargeComp);
updateSSReq.setCanPerChargeComp(canPerChargeComp);
updateSSReq.setCanExchange(canExchange);
updateSSReq.setManualPaymentTypeForPartner(manualPaymentTypeForPartner);
this._memberSettlementSettingService
.updateMemberSettlementSetting(updateSSReq)
.then((result) => {
this.showAlert('success', '수정이 완료되었습니다.');
})
.catch((reson) => {
this.showAlert('error', '수정 실패 잠시 후 다시 시도하세요.');
})
.finally(() => this.closeChangePasswordAlert());
}
/**
* Navigate to the panel
*
@ -624,7 +689,7 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
});
}
onSelectionChangeLanguage(event: MatSelectChange) {
onSelectionChangeState(event: MatSelectChange) {
const state = event.value;
if (!state) {

View File

@ -29,8 +29,6 @@ export const userRoutes: Route[] = [
listMemberLevels: ListMemberLevelsResolver,
listMemberBanks: ListMemberBanksResolver,
listSites: SiteResolver,
memberSettlement: MemberSettlementResolver,
// memberGame: MemberGameSettingResolver,
},
},
];

View File

@ -117,11 +117,11 @@ export class MemberSettlementSettingService {
);
}
updateMemberSettlementSetting(): Promise<UpdateMemberSettlementSettingResponse.Result> {
updateMemberSettlementSetting(
req: UpdateMemberSettlementSettingRequest
): Promise<UpdateMemberSettlementSettingResponse.Result> {
return new Promise<UpdateMemberSettlementSettingResponse.Result>(
(resolve, reject) => {
let req = new UpdateMemberSettlementSettingRequest();
this.__natsService
.request<UpdateMemberSettlementSettingResponse.Result>(
SUBJECT_UPDATE_MEMBER_SETTLEMENT_SETTING,