Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
contactless-ionic
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
creditcard
contactless-ionic
Commits
223f3a8c
Commit
223f3a8c
authored
Jul 12, 2024
by
伊藤雄大
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2024/07/12
乗降履歴変更、他
parent
e86b0c0f
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
360 additions
and
49 deletions
+360
-49
history.page.html
src/app/history/history.page.html
+17
-0
history.page.ts
src/app/history/history.page.ts
+53
-1
commuter-pass.model.ts
src/app/model/commuter-pass.model.ts
+2
-0
refund.model.ts
src/app/model/refund.model.ts
+20
-0
pass-change.page.html
src/app/pass-change/pass-change.page.html
+8
-8
pass-change.page.ts
src/app/pass-change/pass-change.page.ts
+24
-0
pass-continue.page.html
src/app/pass-continue/pass-continue.page.html
+3
-3
pass-continue.page.ts
src/app/pass-continue/pass-continue.page.ts
+12
-0
pass-refund.page.html
src/app/pass-refund/pass-refund.page.html
+4
-4
pass-refund.page.ts
src/app/pass-refund/pass-refund.page.ts
+13
-9
pass-regist.page.html
src/app/pass-regist/pass-regist.page.html
+15
-15
pass-regist.page.ts
src/app/pass-regist/pass-regist.page.ts
+38
-1
history.service.ts
src/app/services/history.service.ts
+14
-3
pass.service.ts
src/app/services/pass.service.ts
+137
-5
No files found.
src/app/history/history.page.html
View file @
223f3a8c
...
...
@@ -4,6 +4,23 @@
<ion-content
[
fullscreen
]="
true
"
>
<ion-grid
style=
"margin-top:20px;"
>
<ion-row>
<ion-col
class=
"ion-text-right"
style=
"padding-top:10px;"
>
<ion-label
(
click
)="
onClickBefore
()"
>
<
</ion-label>
</ion-col>
<ion-col>
<ion-datetime-button
style=
"width:160px;"
datetime=
"datetime"
></ion-datetime-button>
<ion-modal
[
keepContentsMounted
]="
true
"
>
<ng-template>
<ion-datetime
id=
"datetime"
presentation=
"date"
[(
ngModel
)]="
searchDate
"
[
showDefaultButtons
]="
true
"
(
ionChange
)="
onChangeDate
($
event
)"
></ion-datetime>
</ng-template>
</ion-modal>
</ion-col>
<ion-col
style=
"padding-top:10px;"
>
<ion-label
(
click
)="
onClickAfter
()"
>
>
</ion-label>
</ion-col>
</ion-row>
@for (history of historyList;track history.getonoffDt) {
<ion-row>
<ion-col
size=
"auto"
>
...
...
src/app/history/history.page.ts
View file @
223f3a8c
...
...
@@ -12,6 +12,7 @@ import { HistoryService } from '../services/history.service';
styleUrls
:
[
'./history.page.scss'
],
})
export
class
HistoryPage
implements
OnInit
{
searchDate
?:
string
;
//乗車履歴
historyList
?:
HistoryModel
[];
...
...
@@ -27,8 +28,13 @@ export class HistoryPage implements OnInit {
* 初期化
*/
ngOnInit
()
{
this
.
searchDate
=
(
new
Date
()).
toLocaleDateString
(
"ja-JP"
,
{
year
:
"numeric"
,
month
:
"2-digit"
,
day
:
"2-digit"
,
}).
split
(
"/"
).
join
(
"-"
);
if
(
this
.
routeService
.
customerId
)
{
this
.
historyList
=
this
.
historyService
.
getHistoryList
(
this
.
routeService
.
customerId
);
this
.
historyList
=
this
.
historyService
.
getHistoryList
(
this
.
routeService
.
customerId
,
this
.
searchDate
);
}
}
...
...
@@ -40,4 +46,50 @@ export class HistoryPage implements OnInit {
this
.
routeService
.
navigateMenu
(
this
.
routeService
.
customerId
);
}
}
/**
* 前日へ
*/
onClickBefore
()
{
if
(
this
.
searchDate
)
{
let
date
=
new
Date
(
this
.
searchDate
);
date
.
setDate
(
date
.
getDate
()
-
1
);
this
.
searchDate
=
date
.
toLocaleDateString
(
"ja-JP"
,
{
year
:
"numeric"
,
month
:
"2-digit"
,
day
:
"2-digit"
,
}).
split
(
"/"
).
join
(
"-"
);
if
(
this
.
routeService
.
customerId
)
{
this
.
historyList
=
this
.
historyService
.
getHistoryList
(
this
.
routeService
.
customerId
,
this
.
searchDate
);
}
}
}
/**
* 翌日へ
*/
onClickAfter
()
{
if
(
this
.
searchDate
)
{
let
date
=
new
Date
(
this
.
searchDate
);
date
.
setDate
(
date
.
getDate
()
+
1
);
this
.
searchDate
=
date
.
toLocaleDateString
(
"ja-JP"
,
{
year
:
"numeric"
,
month
:
"2-digit"
,
day
:
"2-digit"
,
}).
split
(
"/"
).
join
(
"-"
);
if
(
this
.
routeService
.
customerId
)
{
this
.
historyList
=
this
.
historyService
.
getHistoryList
(
this
.
routeService
.
customerId
,
this
.
searchDate
);
}
}
}
/**
* 日付指定
* @param event イベント情報
*/
onChangeDate
(
event
:
any
):
void
{
if
(
this
.
routeService
.
customerId
)
{
this
.
historyList
=
this
.
historyService
.
getHistoryList
(
this
.
routeService
.
customerId
,
event
.
target
.
value
);
}
}
}
src/app/model/commuter-pass.model.ts
View file @
223f3a8c
...
...
@@ -4,6 +4,8 @@
export
class
CommuterPassModel
{
//トークンID
tokenId
?:
string
;
//定期券ID
commuterPassId
?:
string
;
//事業者ID
agencyId
:
string
=
""
;
//経路ID
...
...
src/app/model/refund.model.ts
0 → 100644
View file @
223f3a8c
/**
* 払戻情報
*/
export
class
RefundModel
{
//乗車停留所
getonStopId
?:
string
;
//降車停留所
getoffStopId
?:
string
;
//購入金額
purchaseAmount
?:
number
;
//通常運賃
standardFare
?:
number
;
//使用日数
usedDays
?:
number
;
//払戻手数料
refundFee
?:
number
;
//払戻額
refundAmount
?:
number
;
}
\ No newline at end of file
src/app/pass-change/pass-change.page.html
View file @
223f3a8c
...
...
@@ -45,9 +45,9 @@
<ion-row>
<ion-col>
<ion-item>
<ion-select
label=
"乗車停留所"
[
value
]="
getonStopId
"
>
<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-option
[
value
]
="
kv
.
key
"
>
{{kv.value}}
</ion-select-option>
}
</ion-select>
</ion-item>
...
...
@@ -56,9 +56,9 @@
<ion-row>
<ion-col>
<ion-item>
<ion-select
label=
"区間"
[
value
]="
getoffStopId
"
>
<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-option
[
value
]
="
kv
.
key
"
>
{{kv.value}}
</ion-select-option>
}
</ion-select>
</ion-item>
...
...
@@ -68,16 +68,16 @@
<ion-col
style=
"margin-left:20px;"
>
<ion-label>
購入金額
</ion-label>
</ion-col>
<ion-col
class=
"ion-text-
center
"
>
<ion-label>
{{purchasePrice|number}}円
</ion-label>
<ion-col
class=
"ion-text-
right
"
>
<ion-label
style=
"margin-right:20px;"
>
{{purchasePrice|number}}円
</ion-label>
</ion-col>
</ion-row>
<ion-row>
<ion-col
style=
"margin-left:20px;"
>
<ion-label>
払戻金額
</ion-label>
</ion-col>
<ion-col
class=
"ion-text-
center
"
>
<ion-label>
{{refundPrice|number}}円
</ion-label>
<ion-col
class=
"ion-text-
right
"
>
<ion-label
style=
"margin-right:20px;"
>
{{refundPrice|number}}円
</ion-label>
</ion-col>
</ion-row>
<ion-row>
...
...
src/app/pass-change/pass-change.page.ts
View file @
223f3a8c
...
...
@@ -54,6 +54,10 @@ export class PassChangePage implements OnInit {
//停留所一覧
if
(
this
.
commuterPassModel
)
{
this
.
stopList
=
this
.
passService
.
getStopList
(
this
.
commuterPassModel
?.
agencyId
,
this
.
commuterPassModel
?.
routeId
);
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
);
}
}
...
...
@@ -78,4 +82,24 @@ export class PassChangePage implements OnInit {
}
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
);
}
}
}
src/app/pass-continue/pass-continue.page.html
View file @
223f3a8c
...
...
@@ -13,9 +13,9 @@
<ion-row>
<ion-col>
<ion-item>
<ion-select
label=
"使用期間"
[
value
]="
useTermId
"
>
<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-option
[
value
]
="
kv
.
key
"
>
{{kv.value}}
</ion-select-option>
}
</ion-select>
</ion-item>
...
...
@@ -37,7 +37,7 @@
<ion-datetime-button
datetime=
"datetime"
></ion-datetime-button>
<ion-modal
[
keepContentsMounted
]="
true
"
>
<ng-template>
<ion-datetime
id=
"datetime"
presentation=
"date"
[
value
]="
startDate
"
></ion-datetime>
<ion-datetime
id=
"datetime"
presentation=
"date"
[
(
ngModel
)
]="
startDate
"
></ion-datetime>
</ng-template>
</ion-modal>
</ion-col>
...
...
src/app/pass-continue/pass-continue.page.ts
View file @
223f3a8c
...
...
@@ -52,6 +52,8 @@ export class PassContinuePage implements OnInit {
//使用期間一覧
if
(
this
.
commuterPassModel
)
{
this
.
useTermList
=
this
.
passService
.
getUseTermList
(
this
.
commuterPassModel
?.
agencyId
);
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
);
}
}
...
...
@@ -76,4 +78,14 @@ export class PassContinuePage implements OnInit {
}
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
);
}
}
}
src/app/pass-refund/pass-refund.page.html
View file @
223f3a8c
...
...
@@ -17,7 +17,7 @@
<ion-label>
購入金額
</ion-label>
</ion-col>
<ion-col
class=
"ion-text-right"
style=
"margin-right:20px;"
>
<ion-label>
{{purchase
Price
|number}}円
</ion-label>
<ion-label>
{{purchase
Amount
|number}}円
</ion-label>
</ion-col>
</ion-row>
<ion-row>
...
...
@@ -25,7 +25,7 @@
<ion-label>
普通運賃
</ion-label>
</ion-col>
<ion-col
class=
"ion-text-right"
style=
"margin-right:20px;"
>
<ion-label>
{{
normal
Fare|number}}円
</ion-label>
<ion-label>
{{
standard
Fare|number}}円
</ion-label>
</ion-col>
</ion-row>
<ion-row>
...
...
@@ -33,7 +33,7 @@
<ion-label>
使用日数
</ion-label>
</ion-col>
<ion-col
class=
"ion-text-right"
style=
"margin-right:20px;"
>
<ion-label>
{{useDays}}日
</ion-label>
<ion-label>
{{use
d
Days}}日
</ion-label>
</ion-col>
</ion-row>
<ion-row>
...
...
@@ -49,7 +49,7 @@
<ion-label>
払戻金額
</ion-label>
</ion-col>
<ion-col
class=
"ion-text-right"
style=
"margin-right:20px;"
>
<ion-label>
{{refund
Price
|number}}円
</ion-label>
<ion-label>
{{refund
Amount
|number}}円
</ion-label>
</ion-col>
</ion-row>
<ion-row>
...
...
src/app/pass-refund/pass-refund.page.ts
View file @
223f3a8c
...
...
@@ -2,6 +2,7 @@ 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'
;
/**
* 定期券払戻画面
...
...
@@ -27,15 +28,15 @@ export class PassRefundPage implements OnInit {
//定期券情報
commuterPassModel
?:
CommuterPassModel
;
//購入金額
purchase
Price
:
number
=
0
;
purchase
Amount
:
number
=
0
;
//普通運賃
normal
Fare
:
number
=
0
;
standard
Fare
:
number
=
0
;
//使用日数
useDays
:
number
=
0
;
use
d
Days
:
number
=
0
;
//払戻手数料
refundFee
:
number
=
0
;
//払戻金額
refund
Price
:
number
=
0
;
refund
Amount
:
number
=
0
;
/**
* コンストラクタ
...
...
@@ -51,11 +52,14 @@ export class PassRefundPage implements OnInit {
* 初期化
*/
ngOnInit
():
void
{
this
.
purchasePrice
=
40000
;
this
.
normalFare
=
200
;
this
.
useDays
=
30
;
this
.
refundFee
=
500
;
this
.
refundPrice
=
10500
;
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
;
}
}
/**
...
...
src/app/pass-regist/pass-regist.page.html
View file @
223f3a8c
...
...
@@ -7,9 +7,9 @@
<ion-row>
<ion-col>
<ion-item>
<ion-select
label=
"路線"
[
value
]="
routeId
"
(
c
hange
)="
onChangeRoute
($
event
)"
>
<ion-select
label=
"路線"
[
(
ngModel
)]="
routeId
"
(
ionC
hange
)="
onChangeRoute
($
event
)"
>
@for (kv of routeList|keyvalue;track kv.key) {
<ion-select-option
value
=
"kv.key"
>
{{kv.value}}
</ion-select-option>
<ion-select-option
[
value
]
="
kv
.
key
"
>
{{kv.value}}
</ion-select-option>
}
</ion-select>
</ion-item>
...
...
@@ -18,9 +18,9 @@
<ion-row>
<ion-col>
<ion-item>
<ion-select
label=
"使用期間"
[
value
]="
useTermId
"
>
<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-option
[
value
]
="
kv
.
key
"
>
{{kv.value}}
</ion-select-option>
}
</ion-select>
</ion-item>
...
...
@@ -29,9 +29,9 @@
<ion-row>
<ion-col>
<ion-item>
<ion-select
label=
"料金区分"
[
value
]="
priceRangeId
"
>
<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-option
[
value
]
="
kv
.
key
"
>
{{kv.value}}
</ion-select-option>
}
</ion-select>
</ion-item>
...
...
@@ -45,7 +45,7 @@
<ion-datetime-button
datetime=
"datetime"
></ion-datetime-button>
<ion-modal
[
keepContentsMounted
]="
true
"
>
<ng-template>
<ion-datetime
id=
"datetime"
presentation=
"date"
[
value
]="
startDate
"
></ion-datetime>
<ion-datetime
id=
"datetime"
presentation=
"date"
[
(
ngModel
)
]="
startDate
"
></ion-datetime>
</ng-template>
</ion-modal>
</ion-col>
...
...
@@ -53,9 +53,9 @@
<ion-row>
<ion-col>
<ion-item>
<ion-select
label=
"乗車停留所"
[
value
]="
getonStopId
"
>
<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-option
[
value
]
="
kv
.
key
"
>
{{kv.value}}
</ion-select-option>
}
</ion-select>
</ion-item>
...
...
@@ -64,20 +64,20 @@
<ion-row>
<ion-col>
<ion-item>
<ion-select
label=
"区間"
[
value
]="
getoffStopId
"
>
<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-option
[
value
]
="
kv
.
key
"
>
{{kv.value}}
</ion-select-option>
}
</ion-select>
</ion-item>
</ion-col>
</ion-row>
<ion-row>
<ion-col
class=
"ion-text-center"
>
<ion-label>
支払金額
</ion-label>
<ion-col>
<ion-label
style=
"margin-left:16px;"
>
支払金額
</ion-label>
</ion-col>
<ion-col
class=
"ion-text-
center
"
>
<ion-label>
{{price|number}}円
</ion-label>
<ion-col
class=
"ion-text-
right
"
>
<ion-label
style=
"margin-right:20px;"
>
{{price|number}}円
</ion-label>
</ion-col>
</ion-row>
<ion-row>
...
...
src/app/pass-regist/pass-regist.page.ts
View file @
223f3a8c
import
{
KeyValue
}
from
'@angular/common'
;
import
{
Component
,
OnInit
}
from
'@angular/core'
;
import
{
RouteService
}
from
'../services/route.service'
;
import
{
CommuterPassModel
}
from
'../model/commuter-pass.model'
;
...
...
@@ -66,15 +65,20 @@ export class PassRegistPage implements OnInit {
//路線一覧
//TODO 事業者IDはどうやって決める?
this
.
routeList
=
this
.
passService
.
getRouteList
(
this
.
agencyId
);
this
.
routeId
=
this
.
routeList
.
keys
().
next
().
value
;
//使用期間一覧
this
.
useTermList
=
this
.
passService
.
getUseTermList
(
this
.
agencyId
);
this
.
useTermId
=
this
.
useTermList
.
keys
().
next
().
value
;
//料金区分一覧
this
.
priceRangeList
=
this
.
passService
.
getPriceRangeList
(
this
.
agencyId
);
this
.
priceRangeId
=
this
.
priceRangeList
.
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
;
}
/**
...
...
@@ -83,6 +87,39 @@ export class PassRegistPage implements OnInit {
*/
onChangeRoute
(
event
:
any
):
void
{
this
.
stopList
=
this
.
passService
.
getStopList
(
this
.
agencyId
,
event
.
target
.
value
);
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
);
}
/**
...
...
src/app/services/history.service.ts
View file @
223f3a8c
...
...
@@ -16,15 +16,21 @@ export class HistoryService {
/**
* 乗降履歴一覧取得
* @param customerId 利用者ID
* @param searchDate 検索対象日
* @returns 乗降履歴一覧
*/
getHistoryList
(
customerId
:
string
):
HistoryModel
[]
{
getHistoryList
(
customerId
:
string
,
searchDate
?:
string
):
HistoryModel
[]
{
//TODO
let
historyList
=
new
Array
();
for
(
let
i
=
0
;
i
<
10
;
i
++
)
{
let
historyModel
:
HistoryModel
=
new
HistoryModel
();
let
str
=
String
(
i
);
historyModel
.
getonoffDt
=
"2024/06/19 17:08:1"
+
str
;
if
(
searchDate
)
{
let
ymd
:
string
[]
=
searchDate
?.
split
(
"-"
);
historyModel
.
getonoffDt
=
ymd
[
0
]
+
"/"
+
ymd
[
1
]
+
"/"
+
ymd
[
2
]
+
" 17:08:1"
+
str
;
}
else
{
historyModel
.
getonoffDt
=
"2024/07/01 17:08:1"
+
str
;
}
historyModel
.
stopId
=
str
;
if
(
i
%
2
==
0
)
{
historyModel
.
kind
=
"1"
;
...
...
@@ -39,7 +45,12 @@ export class HistoryService {
historyList
.
push
(
historyModel
);
}
let
historyModel
:
HistoryModel
=
new
HistoryModel
();
historyModel
.
getonoffDt
=
"2024/06/19 17:10:10"
;
if
(
searchDate
)
{
let
ymd
:
string
[]
=
searchDate
?.
split
(
"-"
);
historyModel
.
getonoffDt
=
ymd
[
0
]
+
"/"
+
ymd
[
1
]
+
"/"
+
ymd
[
2
]
+
" 17:10:10"
;
}
else
{
historyModel
.
getonoffDt
=
"2024/07/01 17:10:10"
;
}
historyModel
.
kind
=
"1"
;
historyModel
.
stopName
=
"XXXX停留所"
;
historyModel
.
status
=
0
;
...
...
src/app/services/pass.service.ts
View file @
223f3a8c
import
{
Injectable
}
from
'@angular/core'
;
import
{
CommuterPassModel
}
from
'../model/commuter-pass.model'
;
import
{
RefundModel
}
from
'../model/refund.model'
;
/**
* 定期券サービス
...
...
@@ -21,15 +22,19 @@ export class PassService {
let
commuterPassList
=
new
Array
();
for
(
let
i
=
0
;
i
<
2
;
i
++
)
{
let
model
:
CommuterPassModel
=
new
CommuterPassModel
();
model
.
tokenId
=
tokenId
;
model
.
commuterPassId
=
String
(
i
+
1
);
model
.
routeId
=
"00000"
+
String
(
i
);
model
.
routeName
=
"【◯◯◯系統】XXXXX→XXXXX行き"
;
model
.
startDate
=
"2024/07/01"
;
model
.
useTermId
=
"
2
"
;
model
.
useTermId
=
"
3
"
;
model
.
useTermName
=
"3ヶ月"
;
model
.
priceRangeId
=
"
0
"
;
model
.
priceRangeId
=
"
1
"
;
model
.
privateRangeName
=
"大人"
;
model
.
getonStopName
=
"XXXXX"
;
model
.
getoffStopName
=
"XXXXX"
;
model
.
getonStopId
=
"1"
;
model
.
getonStopName
=
"停留所1"
;
model
.
getoffStopId
=
"5"
;
model
.
getoffStopName
=
"停留所5"
;
commuterPassList
.
push
(
model
);
}
return
commuterPassList
;
...
...
@@ -90,7 +95,7 @@ export class PassService {
getUseTermList
(
agencyId
:
string
):
Map
<
string
,
string
>
{
let
useTermList
=
new
Map
();
useTermList
.
set
(
"1"
,
"1ヶ月"
);
useTermList
.
set
(
"
2
"
,
"3ヶ月"
);
useTermList
.
set
(
"
3
"
,
"3ヶ月"
);
useTermList
.
set
(
"6"
,
"6ヶ月"
);
return
useTermList
;
...
...
@@ -123,4 +128,131 @@ export class PassService {
}
return
stopList
;
}
/**
* 定期券料金計算
*
* @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 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
{
//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
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment