Commit 3d4f8be7 authored by 伊藤雄大's avatar 伊藤雄大

2024/08/13

既存定期券と連携するように修正
parent e0c2b6b1
...@@ -4,7 +4,7 @@ import { PreloadAllModules, RouterModule, Routes } from '@angular/router'; ...@@ -4,7 +4,7 @@ import { PreloadAllModules, RouterModule, Routes } from '@angular/router';
const routes: Routes = [ const routes: Routes = [
{ {
path: 'home', path: 'home',
loadChildren: () => import('./home/home.module').then( m => m.HomePageModule) loadChildren: () => import('./home/home.module').then(m => m.HomePageModule)
}, },
{ {
path: '', path: '',
...@@ -13,51 +13,39 @@ const routes: Routes = [ ...@@ -13,51 +13,39 @@ const routes: Routes = [
}, },
{ {
path: 'user-regist', path: 'user-regist',
loadChildren: () => import('./user-regist/user-regist.module').then( m => m.UserRegistPageModule) loadChildren: () => import('./user-regist/user-regist.module').then(m => m.UserRegistPageModule)
}, },
{ {
path: 'password-update', path: 'password-update',
loadChildren: () => import('./password-update/password-update.module').then( m => m.PasswordUpdatePageModule) loadChildren: () => import('./password-update/password-update.module').then(m => m.PasswordUpdatePageModule)
}, },
{ {
path: 'menu', path: 'menu',
loadChildren: () => import('./menu/menu.module').then( m => m.MenuPageModule) loadChildren: () => import('./menu/menu.module').then(m => m.MenuPageModule)
}, },
{ {
path: 'card-select', path: 'card-select',
loadChildren: () => import('./card-select/card-select.module').then( m => m.CardSelectPageModule) loadChildren: () => import('./card-select/card-select.module').then(m => m.CardSelectPageModule)
}, },
{ {
path: 'card-regist', path: 'card-regist',
loadChildren: () => import('./card-regist/card-regist.module').then( m => m.CardRegistPageModule) loadChildren: () => import('./card-regist/card-regist.module').then(m => m.CardRegistPageModule)
}, },
{ {
path: 'pass-select', path: 'pass-select',
loadChildren: () => import('./pass-select/pass-select.module').then( m => m.PassSelectPageModule) loadChildren: () => import('./pass-select/pass-select.module').then(m => m.PassSelectPageModule)
}, },
{ {
path: 'pass-regist', path: 'pass-regist',
loadChildren: () => import('./pass-regist/pass-regist.module').then( m => m.PassRegistPageModule) loadChildren: () => import('./pass-regist/pass-regist.module').then(m => m.PassRegistPageModule)
},
{
path: 'pass-change',
loadChildren: () => import('./pass-change/pass-change.module').then( m => m.PassChangePageModule)
},
{
path: 'pass-continue',
loadChildren: () => import('./pass-continue/pass-continue.module').then( m => m.PassContinuePageModule)
},
{
path: 'pass-refund',
loadChildren: () => import('./pass-refund/pass-refund.module').then( m => m.PassRefundPageModule)
}, },
{ {
path: 'history', path: 'history',
loadChildren: () => import('./history/history.module').then( m => m.HistoryPageModule) loadChildren: () => import('./history/history.module').then(m => m.HistoryPageModule)
}, },
{ {
path: 'deny-list', path: 'deny-list',
loadChildren: () => import('./deny-list/deny-list.module').then( m => m.DenyListPageModule) loadChildren: () => import('./deny-list/deny-list.module').then(m => m.DenyListPageModule)
}, },
]; ];
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
<ion-row> <ion-row>
<ion-col> <ion-col>
<ion-item> <ion-item>
<ion-input label="CVC" [value]="cvc"></ion-input> <ion-input label="CVV" [value]="cvc"></ion-input>
</ion-item> </ion-item>
</ion-col> </ion-col>
</ion-row> </ion-row>
......
...@@ -7,9 +7,9 @@ ...@@ -7,9 +7,9 @@
<ion-col style="width:75%;padding-top:8px;padding-left:10px;"> <ion-col style="width:75%;padding-top:8px;padding-left:10px;">
<ion-label>クレジットカード</ion-label> <ion-label>クレジットカード</ion-label>
</ion-col> </ion-col>
<!-- ion-col size="auto" style="padding-top:8px;"> <ion-col size="auto" style="padding-top:8px;">
<div class="common-link" (click)="onClickPass()">定期券</div> <div class="common-link" (click)="onClickPass()">定期券</div>
</ion-col --> </ion-col>
<ion-col size="auto" align="right" style="padding-top:10px;padding-right:10px;"> <ion-col size="auto" align="right" style="padding-top:10px;padding-right:10px;">
<ion-icon name="trash-outline"></ion-icon> <ion-icon name="trash-outline"></ion-icon>
</ion-col> </ion-col>
......
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { PassChangePage } from './pass-change.page';
const routes: Routes = [
{
path: '',
component: PassChangePage
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class PassChangePageRoutingModule {}
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular';
import { PassChangePageRoutingModule } from './pass-change-routing.module';
import { PassChangePage } from './pass-change.page';
import { HeaderComponent } from '../common/header/header.component';
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
PassChangePageRoutingModule,
HeaderComponent
],
declarations: [PassChangePage]
})
export class PassChangePageModule { }
<ion-header [translucent]="true">
<app-header [mode]="1" (clickClose)="onClickClose()"></app-header>
</ion-header>
<ion-content [fullscreen]="true">
<ion-grid class="ion-no-padding" style="margin-top:20px;">
<ion-row>
<ion-col style="margin-left:20px;">
<ion-label>路線</ion-label>&nbsp;
<ion-label>{{commuterPassModel?.routeName}}</ion-label>
</ion-col>
</ion-row>
<ion-row>
<ion-col style="margin-left:20px;margin-top:10px;">
<ion-label>使用期間</ion-label>
</ion-col>
<ion-col style="margin-top:10px;">
<ion-label>{{commuterPassModel?.useTermName}}</ion-label>
</ion-col>
</ion-row>
<ion-row>
<ion-col style="margin-left:20px;margin-top:10px;">
<ion-label>料金区分</ion-label>
</ion-col>
<ion-col style="margin-top:10px;">
<ion-label>{{commuterPassModel?.privateRangeName}}</ion-label>
</ion-col>
</ion-row>
<ion-row>
<ion-col style="margin-left:20px;margin-top:10px;">
<ion-label>使用開始日</ion-label>
</ion-col>
<ion-col style="margin-top:10px;">
<ion-label>{{commuterPassModel?.startDate}}</ion-label>
</ion-col>
</ion-row>
<ion-row>
<ion-col style="margin-left:20px;margin-top:10px;">
<ion-label>乗車区間(変更前)</ion-label>
</ion-col>
<ion-col style="margin-top:10px;">
<ion-label>{{commuterPassModel?.getonStopName}}~{{commuterPassModel?.getoffStopName}}</ion-label>
</ion-col>
</ion-row>
<ion-row>
<ion-col style="margin-top:10px;">
<ion-item>
<ion-select label="乗車停留所" [(ngModel)]="getonStopId" (ionChange)="onChangeGetOn($event)">
@for (kv of stopList|keyvalue;track kv.key) {
<ion-select-option [value]="kv.key">{{kv.value}}</ion-select-option>
}
</ion-select>
</ion-item>
</ion-col>
</ion-row>
<ion-row>
<ion-col style="margin-top:10px;">
<ion-item>
<ion-select label="区間" [(ngModel)]="getoffStopId" (ionChange)="onChangeGetOff($event)">
@for (kv of stopList|keyvalue;track kv.key) {
<ion-select-option [value]="kv.key">{{kv.value}}</ion-select-option>
}
</ion-select>
</ion-item>
</ion-col>
</ion-row>
<ion-row>
<ion-col style="margin-left:20px;margin-top:10px;">
<ion-label>購入金額</ion-label>
</ion-col>
<ion-col class="ion-text-right" style="margin-top:10px;">
<ion-label style="margin-right:20px;">{{purchasePrice|number}}円</ion-label>
</ion-col>
</ion-row>
<ion-row>
<ion-col style="margin-left:20px;margin-top:10px;">
<ion-label>払戻金額</ion-label>
</ion-col>
<ion-col class="ion-text-right" style="margin-top:10px;">
<ion-label style="margin-right:20px;">{{refundPrice|number}}円</ion-label>
</ion-col>
</ion-row>
<ion-row>
<ion-col class="ion-text-center" style="margin-top:20px;">
<ion-button id="change" class="common-button rounded">変更</ion-button>
<ion-alert trigger="change" header="選択されているクレジットカードで支払い、または、払い戻ししますが、よろしいですか?" [buttons]="confirmButtons"
(didDismiss)="onClickChange($event)"></ion-alert>
</ion-col>
</ion-row>
</ion-grid>
</ion-content>
\ No newline at end of file
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { PassChangePage } from './pass-change.page';
describe('PassChangePage', () => {
let component: PassChangePage;
let fixture: ComponentFixture<PassChangePage>;
beforeEach(() => {
fixture = TestBed.createComponent(PassChangePage);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, Input, OnInit } from '@angular/core';
import { CommuterPassModel } from '../model/commuter-pass.model';
import { RouteService } from '../services/route.service';
import { PassService } from '../services/pass.service';
/**
* 定期券区間変更画面
*/
@Component({
selector: 'app-pass-change',
templateUrl: './pass-change.page.html',
styleUrls: ['./pass-change.page.scss'],
})
export class PassChangePage implements OnInit {
public confirmButtons = [
{
text: 'いいえ',
role: 'cancel'
},
{
text: 'はい',
role: 'confirm'
},
];
//カード番号
cardNumber?: string;
//定期券情報
commuterPassModel?: CommuterPassModel;
//停留所一覧
stopList?: Map<string, string>;
//変更後乗車停留所ID
getonStopId?: string;
//変更後降車停留所ID
getoffStopId?: string;
//購入金額
purchasePrice: number = 0;
//払戻金額
refundPrice: number = 0;
/**
* コンストラクタ
* @param routeService 画面遷移サービス
* @param passService 定期券サービス
*/
constructor(private routeService: RouteService, private passService: PassService) {
this.cardNumber = routeService.cardNumber;
this.commuterPassModel = routeService.commuterPassModel;
}
/**
* 初期化
*/
ngOnInit(): void {
//停留所一覧
if (this.commuterPassModel) {
//this.stopList = this.passService.getStopList(this.commuterPassModel?.agencyId, this.commuterPassModel?.routeId);
this.passService.getStopList(this.commuterPassModel?.agencyId, this.commuterPassModel?.routeId).subscribe((ret: Map<string, string>) => {
this.stopList = ret;
})
this.getonStopId = this.commuterPassModel.getonStopId;
this.getoffStopId = this.commuterPassModel.getoffStopId;
this.purchasePrice = this.passService.calcPassAmount(this.commuterPassModel.agencyId, this.commuterPassModel.routeId, this.commuterPassModel.useTermId, this.commuterPassModel.priceRangeId, this.getonStopId, this.getoffStopId);
this.refundPrice = this.passService.calcRefundAmount(this.commuterPassModel.agencyId, this.commuterPassModel.routeId, this.commuterPassModel.startDate, this.commuterPassModel.useTermId, this.commuterPassModel.priceRangeId, this.commuterPassModel.getonStopId, this.commuterPassModel.getoffStopId, this.purchasePrice);
}
}
/**
* 閉じる
*/
onClickClose(): void {
this.routeService.navigatePassSelect(this.cardNumber);
}
/**
* 定期券区間変更
* @param event イベント情報
*/
onClickChange(event: any): void {
if (event.detail.role === 'confirm') {
//定期券区間変更
if (this.commuterPassModel) {
this.commuterPassModel.getonStopId = this.getonStopId ? this.getonStopId : "";
this.commuterPassModel.getoffStopId = this.getoffStopId ? this.getoffStopId : "";
this.passService.change(this.commuterPassModel);
}
}
this.routeService.navigatePassSelect(this.cardNumber);
}
/**
* 乗車停留所選択
* @param event イベント情報
*/
onChangeGetOn(event: any): void {
if (this.commuterPassModel) {
this.purchasePrice = this.passService.calcPassAmount(this.commuterPassModel.agencyId, this.commuterPassModel.routeId, this.commuterPassModel.useTermId, this.commuterPassModel.priceRangeId, event.target.value, this.getoffStopId);
}
}
/**
* 降車停留所選択
* @param event イベント情報
*/
onChangeGetOff(event: any): void {
if (this.commuterPassModel) {
this.purchasePrice = this.passService.calcPassAmount(this.commuterPassModel.agencyId, this.commuterPassModel.routeId, this.commuterPassModel.useTermId, this.commuterPassModel.priceRangeId, this.getonStopId, event.target.value);
}
}
}
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { PassContinuePage } from './pass-continue.page';
const routes: Routes = [
{
path: '',
component: PassContinuePage
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class PassContinuePageRoutingModule {}
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular';
import { PassContinuePageRoutingModule } from './pass-continue-routing.module';
import { PassContinuePage } from './pass-continue.page';
import { HeaderComponent } from '../common/header/header.component';
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
PassContinuePageRoutingModule,
HeaderComponent
],
declarations: [PassContinuePage]
})
export class PassContinuePageModule { }
<ion-header [translucent]="true">
<app-header [mode]="1" (clickClose)="onClickClose()"></app-header>
</ion-header>
<ion-content [fullscreen]="true">
<ion-grid class="ion-no-padding" style="margin-top:20px;">
<ion-row>
<ion-col style="margin-left:20px;">
<ion-label>路線</ion-label>&nbsp;
<ion-label>{{commuterPassModel?.routeName}}</ion-label>
</ion-col>
</ion-row>
<ion-row>
<ion-col style="margin-top:10px;">
<ion-item>
<ion-select label="使用期間" [(ngModel)]="useTermId" (ionChange)="onChangeTerm($event)">
@for (kv of useTermList|keyvalue;track kv.key) {
<ion-select-option [value]="kv.key">{{kv.value}}</ion-select-option>
}
</ion-select>
</ion-item>
</ion-col>
</ion-row>
<ion-row>
<ion-col style="margin-left:20px;margin-top:10px;">
<ion-label>料金区分</ion-label>
</ion-col>
<ion-col style="margin-top:10px;">
<ion-label>{{commuterPassModel?.privateRangeName}}</ion-label>
</ion-col>
</ion-row>
<ion-row>
<ion-col style="margin-left:20px;margin-top:15px;">
<ion-label>使用開始日</ion-label>
</ion-col>
<ion-col style="margin-top:10px;">
<ion-datetime-button datetime="datetime"></ion-datetime-button>
<ion-modal [keepContentsMounted]="true">
<ng-template>
<ion-datetime id="datetime" presentation="date" [(ngModel)]="startDate"></ion-datetime>
</ng-template>
</ion-modal>
</ion-col>
</ion-row>
<ion-row>
<ion-col style="margin-left:20px;margin-top:10px;">
<ion-label>乗車区間</ion-label>
</ion-col>
<ion-col style="margin-top:10px;">
<ion-label>{{commuterPassModel?.getonStopName}}~{{commuterPassModel?.getoffStopName}}</ion-label>
</ion-col>
</ion-row>
<ion-row>
<ion-col style="margin-left:20px;margin-top:10px;">
<ion-label>支払金額</ion-label>
</ion-col>
<ion-col class="ion-text-right" style="margin-right:20px;margin-top:10px;">
<ion-label>{{price|number}}円</ion-label>
</ion-col>
</ion-row>
<ion-row>
<ion-col class="ion-text-center" style="margin-top:20px;">
<ion-button id="continue" class="common-button rounded">継続</ion-button>
<ion-alert trigger="continue" header="選択されているクレジットカードで支払いをしてよろしいですか?" [buttons]="confirmButtons"
(didDismiss)="onClickContinue($event)"></ion-alert>
</ion-col>
</ion-row>
</ion-grid>
</ion-content>
\ No newline at end of file
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { PassContinuePage } from './pass-continue.page';
describe('PassContinuePage', () => {
let component: PassContinuePage;
let fixture: ComponentFixture<PassContinuePage>;
beforeEach(() => {
fixture = TestBed.createComponent(PassContinuePage);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
import { RouteService } from '../services/route.service';
import { CommuterPassModel } from '../model/commuter-pass.model';
import { PassService } from '../services/pass.service';
/**
* 定期券継続画面
*/
@Component({
selector: 'app-pass-continue',
templateUrl: './pass-continue.page.html',
styleUrls: ['./pass-continue.page.scss'],
})
export class PassContinuePage implements OnInit {
public confirmButtons = [
{
text: 'いいえ',
role: 'cancel'
},
{
text: 'はい',
role: 'confirm'
},
];
//カード番号
cardNumber?: string;
//定期券情報
commuterPassModel?: CommuterPassModel;
//使用期間一覧
useTermList?: Map<string, string>;
//使用期間ID
useTermId?: string;
//使用開始日
startDate?: string;
//金額
price: number = 0;
/**
* コンストラクタ
* @param routeService 画面遷移サービス
* @param passService 定期券サービス
*/
constructor(private routeService: RouteService, private passService: PassService) {
this.cardNumber = routeService.cardNumber;
this.commuterPassModel = routeService.commuterPassModel;
}
/**
* 初期化
*/
ngOnInit(): void {
//使用期間一覧
if (this.commuterPassModel) {
//this.useTermList = this.passService.getUseTermList(this.commuterPassModel?.agencyId);
this.passService.getUseTermList(this.commuterPassModel.agencyId).subscribe((ret: Map<string, string>) => {
this.useTermList = ret;
});
this.useTermId = this.commuterPassModel.useTermId;
this.price = this.passService.calcPassAmount(this.commuterPassModel.agencyId, this.commuterPassModel.routeId, this.useTermId, this.commuterPassModel.priceRangeId, this.commuterPassModel.getonStopId, this.commuterPassModel.getoffStopId);
}
}
/**
* 閉じる
*/
onClickClose(): void {
this.routeService.navigatePassSelect(this.cardNumber);
}
/**
* 定期券継続
* @param event イベント情報
*/
onClickContinue(event: any): void {
if (event.detail.role === 'confirm') {
//定期券継続
if (this.commuterPassModel) {
this.commuterPassModel.useTermId = this.useTermId ? this.useTermId : "";
this.commuterPassModel.startDate = this.startDate ? this.startDate : "";
this.passService.continue(this.commuterPassModel);
}
}
this.routeService.navigatePassSelect(this.cardNumber);
}
/**
* 使用期間選択
* @param event イベント情報
*/
onChangeTerm(event: any): void {
if (this.commuterPassModel) {
this.price = this.passService.calcPassAmount(this.commuterPassModel.agencyId, this.commuterPassModel.routeId, event.target.value, this.commuterPassModel.priceRangeId, this.commuterPassModel.getonStopId, this.commuterPassModel.getoffStopId);
}
}
}
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { PassRefundPage } from './pass-refund.page';
const routes: Routes = [
{
path: '',
component: PassRefundPage
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class PassRefundPageRoutingModule {}
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular';
import { PassRefundPageRoutingModule } from './pass-refund-routing.module';
import { PassRefundPage } from './pass-refund.page';
import { HeaderComponent } from '../common/header/header.component';
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
PassRefundPageRoutingModule,
HeaderComponent
],
declarations: [PassRefundPage]
})
export class PassRefundPageModule { }
<ion-header [translucent]="true">
<app-header [mode]="1" (clickClose)="onClickClose()"></app-header>
</ion-header>
<ion-content [fullscreen]="true">
<ion-grid class="ion-no-padding" style="margin-top:20px;">
<ion-row>
<ion-col style="margin-left:20px;">
<ion-label>乗車区間</ion-label>
</ion-col>
<ion-col>
<ion-label>{{commuterPassModel?.getonStopName}}~{{commuterPassModel?.getoffStopName}} </ion-label>
</ion-col>
</ion-row>
<ion-row>
<ion-col style="margin-left:20px;margin-top:10px;">
<ion-label>購入金額</ion-label>
</ion-col>
<ion-col class="ion-text-right" style="margin-right:20px;margin-top:10px;">
<ion-label>{{purchaseAmount|number}}円</ion-label>
</ion-col>
</ion-row>
<ion-row>
<ion-col style="margin-left:20px;margin-top:10px;">
<ion-label>普通運賃</ion-label>
</ion-col>
<ion-col class="ion-text-right" style="margin-right:20px;margin-top:10px;">
<ion-label>{{standardFare|number}}円</ion-label>
</ion-col>
</ion-row>
<ion-row>
<ion-col style="margin-left:20px;margin-top:10px;">
<ion-label>使用日数</ion-label>
</ion-col>
<ion-col class="ion-text-right" style="margin-right:20px;margin-top:10px;">
<ion-label>{{usedDays}}日</ion-label>
</ion-col>
</ion-row>
<ion-row>
<ion-col style="margin-left:20px;margin-top:10px;">
<ion-label>払戻手数料</ion-label>
</ion-col>
<ion-col class="ion-text-right" style="margin-right:20px;margin-top:10px;">
<ion-label>{{refundFee|number}}円</ion-label>
</ion-col>
</ion-row>
<ion-row>
<ion-col style="margin-left:20px;margin-top:10px;">
<ion-label>払戻金額</ion-label>
</ion-col>
<ion-col class="ion-text-right" style="margin-right:20px;margin-top:10px;">
<ion-label>{{refundAmount|number}}円</ion-label>
</ion-col>
</ion-row>
<ion-row>
<ion-col class="ion-text-center" style="margin-top:20px;">
<ion-button id="refund" class="common-button rounded">払戻</ion-button>
<ion-alert trigger="refund" header="選択されているクレジットカードで払い戻ししてよろしいですか?" [buttons]="confirmButtons"
(didDismiss)="onClickRefund($event)"></ion-alert>
</ion-col>
</ion-row>
</ion-grid>
</ion-content>
\ No newline at end of file
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { PassRefundPage } from './pass-refund.page';
describe('PassRefundPage', () => {
let component: PassRefundPage;
let fixture: ComponentFixture<PassRefundPage>;
beforeEach(() => {
fixture = TestBed.createComponent(PassRefundPage);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
import { CommuterPassModel } from '../model/commuter-pass.model';
import { RouteService } from '../services/route.service';
import { PassService } from '../services/pass.service';
import { RefundModel } from '../model/refund.model';
/**
* 定期券払戻画面
*/
@Component({
selector: 'app-pass-refund',
templateUrl: './pass-refund.page.html',
styleUrls: ['./pass-refund.page.scss'],
})
export class PassRefundPage implements OnInit {
public confirmButtons = [
{
text: 'いいえ',
role: 'cancel'
},
{
text: 'はい',
role: 'confirm'
},
];
//カード番号
cardNumber?: string;
//定期券情報
commuterPassModel?: CommuterPassModel;
//購入金額
purchaseAmount: number = 0;
//普通運賃
standardFare: number = 0;
//使用日数
usedDays: number = 0;
//払戻手数料
refundFee: number = 0;
//払戻金額
refundAmount: number = 0;
/**
* コンストラクタ
* @param routeService 画面遷移サービス
* @param passService 定期券サービス
*/
constructor(private routeService: RouteService, private passService: PassService) {
this.cardNumber = routeService.cardNumber;
this.commuterPassModel = routeService.commuterPassModel;
}
/**
* 初期化
*/
ngOnInit(): void {
if (this.commuterPassModel && this.commuterPassModel.commuterPassId) {
let model: RefundModel = this.passService.getRefund(this.commuterPassModel.commuterPassId);
this.purchaseAmount = model.purchaseAmount ? model.purchaseAmount : 0;
this.standardFare = model.standardFare ? model.standardFare : 0;
this.usedDays = model.usedDays ? model.usedDays : 0;
this.refundFee = model.refundFee ? model.refundFee : 0;
this.refundAmount = model.refundAmount ? model.refundAmount : 0;
}
}
/**
* 閉じる
*/
onClickClose(): void {
this.routeService.navigatePassSelect(this.cardNumber);
}
/**
* 払い戻し
* @param event イベント情報
*/
onClickRefund(event: any): void {
if (event.detail.role === 'confirm') {
//定期券払戻
if (this.commuterPassModel) {
this.passService.refund(this.commuterPassModel);
}
}
this.routeService.navigatePassSelect(this.cardNumber);
}
}
...@@ -9,6 +9,7 @@ import { PassRegistPageRoutingModule } from './pass-regist-routing.module'; ...@@ -9,6 +9,7 @@ import { PassRegistPageRoutingModule } from './pass-regist-routing.module';
import { PassRegistPage } from './pass-regist.page'; import { PassRegistPage } from './pass-regist.page';
import { HeaderComponent } from '../common/header/header.component'; import { HeaderComponent } from '../common/header/header.component';
import { PassInfoComponent } from '../pass-select/pass-info/pass-info.component';
@NgModule({ @NgModule({
imports: [ imports: [
...@@ -16,7 +17,8 @@ import { HeaderComponent } from '../common/header/header.component'; ...@@ -16,7 +17,8 @@ import { HeaderComponent } from '../common/header/header.component';
FormsModule, FormsModule,
IonicModule, IonicModule,
PassRegistPageRoutingModule, PassRegistPageRoutingModule,
HeaderComponent HeaderComponent,
PassInfoComponent
], ],
declarations: [PassRegistPage] declarations: [PassRegistPage]
}) })
......
...@@ -3,90 +3,14 @@ ...@@ -3,90 +3,14 @@
</ion-header> </ion-header>
<ion-content [fullscreen]="true"> <ion-content [fullscreen]="true">
<ion-grid> <div style="margin-left:10px;margin-right:10px;">
<ion-row> @for(model of commuterPassList;track model.routeId) {
<ion-col> <div style="margin-top:10px;">
<ion-item> <app-pass-info [mode]="1" [model]="model"></app-pass-info>
<ion-select label="路線" [(ngModel)]="routeId" (ionChange)="onChangeRoute($event)"> </div>
@for (kv of routeList|keyvalue;track kv.key) { }
<ion-select-option [value]="kv.key">{{kv.value}}</ion-select-option> </div>
} <div style="margin-top:20px;text-align:center;">
</ion-select> <ion-button class="common-button" style="margin-top:20px;" (click)="onClickAdd($event)">追加</ion-button>
</ion-item> </div>
</ion-col>
</ion-row>
<ion-row>
<ion-col>
<ion-item>
<ion-select label="使用期間" [(ngModel)]="useTermId" (ionChange)="onChangeTerm($event)">
@for (kv of useTermList|keyvalue;track kv.key) {
<ion-select-option [value]="kv.key">{{kv.value}}</ion-select-option>
}
</ion-select>
</ion-item>
</ion-col>
</ion-row>
<ion-row>
<ion-col>
<ion-item>
<ion-select label="料金区分" [(ngModel)]="priceRangeId" (ionChange)="onChangeRange($event)">
@for (kv of priceRangeList|keyvalue;track kv.key) {
<ion-select-option [value]="kv.key">{{kv.value}}</ion-select-option>
}
</ion-select>
</ion-item>
</ion-col>
</ion-row>
<ion-row>
<ion-col style="margin-left:16px;">
<ion-label>使用開始日</ion-label>
</ion-col>
<ion-col>
<ion-datetime-button datetime="datetime"></ion-datetime-button>
<ion-modal [keepContentsMounted]="true">
<ng-template>
<ion-datetime id="datetime" presentation="date" [(ngModel)]="startDate"
[showDefaultButtons]="true"></ion-datetime>
</ng-template>
</ion-modal>
</ion-col>
</ion-row>
<ion-row>
<ion-col>
<ion-item>
<ion-select label="乗車停留所" [(ngModel)]="getonStopId" (ionChange)="onChangeGetOn($event)">
@for (kv of stopList|keyvalue;track kv.key) {
<ion-select-option [value]="kv.key">{{kv.value}}</ion-select-option>
}
</ion-select>
</ion-item>
</ion-col>
</ion-row>
<ion-row>
<ion-col>
<ion-item>
<ion-select label="区間" [(ngModel)]="getoffStopId" (ionChange)="onChangeGetOff($event)">
@for (kv of stopList|keyvalue;track kv.key) {
<ion-select-option [value]="kv.key">{{kv.value}}</ion-select-option>
}
</ion-select>
</ion-item>
</ion-col>
</ion-row>
<ion-row>
<ion-col>
<ion-label style="margin-left:16px;">支払金額</ion-label>
</ion-col>
<ion-col class="ion-text-right">
<ion-label style="margin-right:20px;">{{price|number}}円</ion-label>
</ion-col>
</ion-row>
<ion-row>
<ion-col class="ion-text-center">
<ion-button id="addpass" class="common-button rounded" style="margin-top:20px;">追加</ion-button>
<ion-alert trigger="addpass" header="選択されているクレジットカードで支払いをしてよろしいですか?" [buttons]="confirmButtons"
(didDismiss)="onClickAdd($event)"></ion-alert>
</ion-col>
</ion-row>
</ion-grid>
</ion-content> </ion-content>
\ No newline at end of file
...@@ -12,43 +12,8 @@ import { PassService } from '../services/pass.service'; ...@@ -12,43 +12,8 @@ import { PassService } from '../services/pass.service';
styleUrls: ['./pass-regist.page.scss'], styleUrls: ['./pass-regist.page.scss'],
}) })
export class PassRegistPage implements OnInit { export class PassRegistPage implements OnInit {
public confirmButtons = [ //定期券一覧
{ commuterPassList?: CommuterPassModel[];
text: 'いいえ',
role: 'cancel'
},
{
text: 'はい',
role: 'confirm'
},
];
//路線一覧
routeList?: Map<string, string>;
//使用期間一覧
useTermList?: Map<string, string>;
//料金区分一覧
priceRangeList?: Map<string, string>;
//停留所一覧
stopList?: Map<string, string>;
//路線
routeId?: string;
//使用期間
useTermId?: string;
//料金区分
priceRangeId?: string;
//使用開始日
startDate?: string;
//乗車停留所
getonStopId?: string;
//区間
getoffStopId?: string;
//支払金額
price: number = 0;
//事業者ID
agencyId: string = "";
/** /**
* コンストラクタ * コンストラクタ
...@@ -61,90 +26,15 @@ export class PassRegistPage implements OnInit { ...@@ -61,90 +26,15 @@ export class PassRegistPage implements OnInit {
* 初期化 * 初期化
*/ */
ngOnInit(): void { ngOnInit(): void {
this.passService.getListNoCard().subscribe((ret: CommuterPassModel[]) => {
//路線一覧 this.commuterPassList = ret;
//TODO 事業者IDはどうやって決める?
//this.routeList = this.passService.getRouteList(this.agencyId);
//this.routeId = this.routeList.keys().next().value;
this.passService.getRouteList(this.agencyId).subscribe((ret: Map<string, string>) => {
this.routeList = ret;
this.routeId = ret.keys().next().value;
//停留所一覧
//this.stopList = this.passService.getStopList(this.agencyId, this.routeList.values().next().value);
//this.getonStopId = this.stopList.keys().next().value;
//this.getoffStopId = this.stopList.keys().next().value;
this.passService.getStopList(this.agencyId, ret.values().next().value).subscribe((stopList: Map<string, string>) => {
this.stopList = stopList;
this.getonStopId = stopList.keys().next().value;
this.getoffStopId = stopList.keys().next().value;
});
});
//使用期間一覧
//this.useTermList = this.passService.getUseTermList(this.agencyId);
//this.useTermId = this.useTermList.keys().next().value;
this.passService.getUseTermList(this.agencyId).subscribe((ret: Map<string, string>) => {
this.useTermList = ret;
this.useTermId = ret.keys().next().value;
})
//料金区分一覧
//this.priceRangeList = this.passService.getPriceRangeList(this.agencyId);
//this.priceRangeId = this.priceRangeList.keys().next().value;
this.passService.getPriceRangeList(this.agencyId).subscribe((ret: Map<string, string>) => {
this.priceRangeList = ret;
this.priceRangeId = ret.keys().next().value;
})
}
/**
* 路線選択
* @param event イベント情報
*/
onChangeRoute(event: any): void {
//this.stopList = this.passService.getStopList(this.agencyId, event.target.value);
this.passService.getStopList(this.agencyId, event.target.value).subscribe((ret: Map<string, string>) => {
this.stopList = ret;
}); });
this.price = this.passService.calcPassAmount(this.agencyId, event.target.value, this.useTermId, this.priceRangeId, this.getonStopId, this.getoffStopId);
}
/**
* 使用期間選択
* @param event イベント情報
*/
onChangeTerm(event: any): void {
this.price = this.passService.calcPassAmount(this.agencyId, this.routeId, event.target.value, this.priceRangeId, this.getonStopId, this.getoffStopId);
} }
/** /**
* 料金区分選択 * 閉じる
* @param event イベント情報 */
*/
onChangeRange(event: any): void {
this.price = this.passService.calcPassAmount(this.agencyId, this.routeId, this.useTermId, event.target.value, this.getonStopId, this.getoffStopId);
}
/**
* 乗車停留所選択
* @param event イベント情報
*/
onChangeGetOn(event: any): void {
this.price = this.passService.calcPassAmount(this.agencyId, this.routeId, this.useTermId, this.priceRangeId, event.target.value, this.getoffStopId);
}
/**
* 降車停留所選択
* @param event イベント情報
*/
onChangeGetOff(event: any): void {
this.price = this.passService.calcPassAmount(this.agencyId, this.routeId, this.useTermId, this.priceRangeId, this.getonStopId, event.target.value);
}
/**
* 閉じる
*/
onClickClose(): void { onClickClose(): void {
this.routeService.navigatePassSelect(this.routeService.cardNumber); this.routeService.navigatePassSelect(this.routeService.cardNumber);
} }
...@@ -154,18 +44,6 @@ export class PassRegistPage implements OnInit { ...@@ -154,18 +44,6 @@ export class PassRegistPage implements OnInit {
* @param event イベント情報 * @param event イベント情報
*/ */
onClickAdd(event: any): void { onClickAdd(event: any): void {
if (event.detail.role === 'confirm') {
//定期券登録
let model: CommuterPassModel = new CommuterPassModel();
model.tokenId = this.routeService.tokenId;
model.routeId = this.routeId ? this.routeId : "";
model.startDate = this.startDate ? this.startDate : "";
model.useTermId = this.useTermId ? this.useTermId : "";
model.priceRangeId = this.priceRangeId ? this.priceRangeId : "";
model.getonStopId = this.getonStopId ? this.getonStopId : "";
model.getoffStopId = this.getoffStopId ? this.getoffStopId : "";
this.passService.regist(model);
}
this.routeService.navigatePassSelect(this.routeService.cardNumber); this.routeService.navigatePassSelect(this.routeService.cardNumber);
} }
} }
<div class="rounded border"> <div class="rounded border">
<ion-grid class="ion-no-padding"> <ion-grid class="ion-no-padding">
<ion-row> <ion-row>
@if (mode === 1) {
<ion-col size="auto">
<ion-checkbox class="form-check-input" style="margin-top:80px;margin-left:10px;margin-right:10px;"
(change)="onChangeSelect($event)"></ion-checkbox>
</ion-col>
}
<ion-col> <ion-col>
<ion-grid class="ion-no-padding"> <ion-grid class="ion-no-padding">
<ion-row> <ion-row>
...@@ -42,17 +48,18 @@ ...@@ -42,17 +48,18 @@
</ion-row> </ion-row>
</ion-grid> </ion-grid>
</ion-col> </ion-col>
@if (mode === 0) {
<ion-col style="vertical-align: top;padding-top:20px;padding-right:10px;" size="auto"> <ion-col style="vertical-align: top;padding-top:20px;padding-right:10px;" size="auto">
<ion-grid class="ion-no-padding"> <ion-grid class="ion-no-padding">
<ion-row> <ion-row>
<ion-col size="auto"> <ion-col size="auto">
<div class="common-link" (click)="onClickChange()">変更</div> <div class="common-link" (click)="onClickCancel()">解除</div>
<div class="common-link" (click)="onClickContinue()">継続</div>
<div class="common-link" (click)="onClickRefund()">払戻</div>
</ion-col> </ion-col>
</ion-row> </ion-row>
</ion-grid> </ion-grid>
</ion-col> </ion-col>
}
</ion-row> </ion-row>
</ion-grid> </ion-grid>
</div> </div>
\ No newline at end of file
...@@ -16,9 +16,8 @@ import { CommuterPassModel } from 'src/app/model/commuter-pass.model'; ...@@ -16,9 +16,8 @@ import { CommuterPassModel } from 'src/app/model/commuter-pass.model';
}) })
export class PassInfoComponent { export class PassInfoComponent {
@Input() model?: CommuterPassModel; @Input() model?: CommuterPassModel;
@Output() clickChange: EventEmitter<void> = new EventEmitter(); @Input() mode?: number;
@Output() clickContinue: EventEmitter<void> = new EventEmitter(); @Output() clickCancel: EventEmitter<void> = new EventEmitter();
@Output() clickRefund: EventEmitter<void> = new EventEmitter();
/** /**
* コンストラクタ * コンストラクタ
...@@ -26,23 +25,13 @@ export class PassInfoComponent { ...@@ -26,23 +25,13 @@ export class PassInfoComponent {
constructor() { } constructor() { }
/** /**
* 変更 * 解除
*/ */
onClickChange(): void { onClickCancel(): void {
this.clickChange.emit(); this.clickCancel.emit();
} }
/** onChangeSelect(event: any): void {
* 継続
*/
onClickContinue(): void {
this.clickContinue.emit();
}
/**
* 払戻
*/
onClickRefund(): void {
this.clickRefund.emit();
} }
} }
...@@ -17,8 +17,7 @@ ...@@ -17,8 +17,7 @@
<div style="margin-left:10px;margin-right:10px;"> <div style="margin-left:10px;margin-right:10px;">
@for(model of commuterPassList;track model.routeId) { @for(model of commuterPassList;track model.routeId) {
<div style="margin-top:10px;"> <div style="margin-top:10px;">
<app-pass-info [model]="model" (clickChange)="onClickChange(model)" (clickContinue)="onClickContinue(model)" <app-pass-info [mode]="0" [model]="model" (clickCancel)="onClickCancel(model)"></app-pass-info>
(clickRefund)="onClickRefund(model)"></app-pass-info>
</div> </div>
} }
</div> </div>
......
...@@ -45,28 +45,12 @@ export class PassSelectPage implements OnInit { ...@@ -45,28 +45,12 @@ export class PassSelectPage implements OnInit {
this.routeService.navigateCardSelect(); this.routeService.navigateCardSelect();
} }
/**
* 定期券区間変更
* @param model 定期券情報
*/
onClickChange(model: CommuterPassModel): void {
this.routeService.navigatePassChange(model);
}
/**
* 定期券継続
* @param model 定期券情報
*/
onClickContinue(model: CommuterPassModel): void {
this.routeService.navigatePassContinue(model);
}
/** /**
* 定期券払戻 * 定期券払戻
* @param model 定期券情報 * @param model 定期券情報
*/ */
onClickRefund(model: CommuterPassModel): void { onClickCancel(model: CommuterPassModel): void {
this.routeService.navigatePassRefund(model);
} }
/** /**
......
...@@ -47,229 +47,41 @@ export class PassService { ...@@ -47,229 +47,41 @@ export class PassService {
} }
/** /**
* 定期券登録 * 定期一覧取得
* @param model 定期券情報 * @return 定期一覧
*/
regist(model: CommuterPassModel): void {
//TODO
}
/**
* 定期券区間変更
* @param model 定期券情報
*/
change(model: CommuterPassModel): void {
//TODO
}
/**
* 定期券継続
* @param model 定期券情報
*/
continue(model: CommuterPassModel): void {
//TODO
}
/**
* 定期券払戻
* @param model 定期券情報
*/ */
refund(model: CommuterPassModel): void { getListNoCard(): Observable<CommuterPassModel[]> {
//TODO //TODO
} let commuterPassList = new Array();
for (let i = 0; i < 2; i++) {
/** let model: CommuterPassModel = new CommuterPassModel();
* 路線一覧取得 model.commuterPassId = String(i + 1);
* @param agencyId 事業者ID model.routeId = "00000" + String(i);
* @returns 路線一覧 model.routeName = "【◯◯◯系統】XXXXX→XXXXX行き";
*/ model.startDate = "2024/07/01";
getRouteList(agencyId: string): Observable<Map<string, string>> { model.useTermId = "3";
//路線一覧 model.useTermName = "3ヶ月";
let routeList = new Map(); model.priceRangeId = "1";
for (let i = 0; i < 5; i++) { model.privateRangeName = "大人";
let str = String(i + 1); model.getonStopId = "1";
routeList.set(str, "路線" + str); model.getonStopName = "停留所1";
} model.getoffStopId = "5";
//return routeList; model.getoffStopName = "停留所5";
return new Observable<Map<string, string>>(o => { commuterPassList.push(model);
o.next(routeList);
})
}
/**
* 使用期間一覧取得
* @param agencyId 事業者ID
* @returns 使用期間一覧
*/
getUseTermList(agencyId: string): Observable<Map<string, string>> {
let useTermList = new Map();
useTermList.set("1", "1ヶ月");
useTermList.set("3", "3ヶ月");
useTermList.set("6", "6ヶ月");
//return useTermList;
return new Observable<Map<string, string>>(o => {
o.next(useTermList);
})
}
/**
* 料金区分一覧取得
* @param agencyId 事業者ID
* @returns 料金区分一覧
*/
getPriceRangeList(agencyId: string): Observable<Map<string, string>> {
let priceRangeList = new Map();
priceRangeList.set("1", "大人");
priceRangeList.set("2", "小児");
priceRangeList.set("3", "学生");
//return priceRangeList;
return new Observable<Map<string, string>>(o => {
o.next(priceRangeList);
})
}
/**
* 停留所一覧取得
* @param agencyId 事業者ID
* @param routeId 路線ID
* @returns 停留所一覧
*/
getStopList(agencyId: string, routeId: string): Observable<Map<string, string>> {
let stopList = new Map();
for (let i = 0; i < 5; i++) {
let str = String(i + 1);
stopList.set(str, "停留所" + str);
} }
//return stopList; //return commuterPassList;
return new Observable<Map<string, string>>(o => { return new Observable<CommuterPassModel[]>(o => {
o.next(stopList); o.next(commuterPassList);
}) });
} }
/**
* 定期券料金計算
*
* @param agencyId 事業者ID
* @param routeId 路線ID
* @param useTermId 使用期間
* @param priceRangeId 料金区分
* @param getonStopId 乗車停留所
* @param getoffStopId 降車停留所
*/
calcPassAmount(agencyId: string, routeId?: string, useTermId?: string, priceRangeId?: string, getonStopId?: string, getoffStopId?: string): number {
//TODO
//以下はダミー
//通常運賃
let getonStop = Number(getonStopId);
let getoffStop = Number(getoffStopId);
let unit = (getoffStop - getonStop) >= 0 ? (getoffStop - getonStop) : (getonStop - getoffStop);
unit = unit * 100;
let one = unit * 30 * 0.75;
let three = one * 3 * 0.95;
let six = one * 6 * 0.9;
let ret = 0;
if (useTermId == "1") {
ret = one;
} else if (useTermId == "2") {
ret = three;
} else {
ret = six;
}
if (priceRangeId == "2") {
ret = ret * 0.5;
} else if (priceRangeId == "3") {
ret = ret * 0.6;
}
return Math.floor(ret);
}
/** /**
* 定期券払戻料金計算 * 定期券登録
* @param agencyId 事業者ID * @param model 定期券情報
* @param routeId 路線ID
* @param startDate 使用開始日
* @param useTermId 使用期間
* @param priceRangeId 料金区分
* @param getonStopId 乗車停留所ID
* @param getoffStopId 降車停留所ID
*/ */
calcRefundAmount(agencyId: string, routeId?: string, startDate?: string, useTermId?: string, priceRangeId?: string, getonStopId?: string, getoffStopId?: string, purchaseAmount?: number): number { regist(model: CommuterPassModel): void {
//TODO //TODO
//以下はダミー
//通常運賃
let getonStop = Number(getonStopId);
let getoffStop = Number(getoffStopId);
let unit = (getoffStop - getonStop) >= 0 ? (getoffStop - getonStop) : (getonStop - getoffStop);
unit = unit * 100;
if (priceRangeId == "2") {
unit = unit * 0.5;
} else if (priceRangeId == "3") {
unit = unit * 0.6;
}
//残日数計算
let termDay = 0;
let now = new Date();
if (startDate) {
let start = new Date(startDate);
termDay = (now.getTime() - start.getTime()) / 86400000;
}
if (useTermId == "1") {
termDay = 30 - termDay;
} else if (useTermId == "3") {
termDay = 90 - termDay;
} else if (useTermId == "6") {
termDay = 180 - termDay;
}
let amount = 0;
if (purchaseAmount) {
amount = purchaseAmount - (termDay * unit) - 500;
}
amount = amount < 0 ? 0 : amount;
return Math.floor(amount);
} }
/**
* 払戻情報取得
* @param commuterPassId 定期券ID
*/
getRefund(commuterPassId: string): RefundModel {
//TODO
//↓以下はダミー
let ret = new RefundModel();
ret.purchaseAmount = this.calcPassAmount("", "", "3", "1", "1", "5");
//通常運賃
let getonStop = 1;
let getoffStop = 5;
let unit = (getoffStop - getonStop) >= 0 ? (getoffStop - getonStop) : (getonStop - getoffStop);
ret.standardFare = unit * 100;
//使用日数計算
let now = new Date();
let start = new Date("2024/07/01");
ret.usedDays = Math.floor((now.getTime() - start.getTime()) / 86400000);
//残日数
let termDay = 90 - ret.usedDays;
//払戻手数料
ret.refundFee = 500;
let amount = ret.purchaseAmount - (termDay * ret.standardFare) - ret.refundFee;
amount = amount < 0 ? 0 : amount;
ret.refundAmount = Math.floor(amount);
return ret;
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment