Skip to content

Commit 1a542bb

Browse files
committed
feat: membershipページの表示ロジックを実装
1 parent 01feaff commit 1a542bb

File tree

1 file changed

+54
-18
lines changed

1 file changed

+54
-18
lines changed

src/pages/membership/MembershipPage.vue

Lines changed: 54 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,31 +8,67 @@ import MembershipPageLoginLink from './MembershipPageLoginLink.vue'
88
99
const route = useRoute()
1010
11+
const isUserTypeNew = computed(() => route.query.user_type === 'new')
12+
const isUserTypeRejoin = computed(() => route.query.user_type === 'rejoin')
13+
const isUserTypeActive = computed(() => route.query.user_type === 'active')
14+
const isUserTypeQueryValid = computed(
15+
() => isUserTypeNew.value || isUserTypeRejoin.value || isUserTypeActive.value,
16+
)
17+
1118
const isLoggedIn = ref(false)
12-
const hasIsctAddress = ref(false)
19+
const hasVerifiedMailAddress = ref(false)
1320
const hasCustomerObjectOnTraqId = ref(false)
14-
const isUserTypeActive = computed(() => route.query.user_type === 'active')
21+
const shouldShowUserTypeSelector = computed(() => !isLoggedIn.value)
22+
const needUserTypeSelect = computed(() => !isLoggedIn.value && !isUserTypeQueryValid.value)
23+
const needMailAddressInput = computed(
24+
() =>
25+
(isLoggedIn.value && !hasCustomerObjectOnTraqId.value && !hasVerifiedMailAddress.value) ||
26+
(!isLoggedIn.value &&
27+
(isUserTypeNew.value || isUserTypeRejoin.value) &&
28+
!hasVerifiedMailAddress.value),
29+
)
30+
const needLogin = computed(() => isUserTypeActive.value && !isLoggedIn.value)
31+
32+
const hasCustomerObjectOnMailAddress = ref(false)
33+
const hasTraQIdOnCustomerObject = ref(false)
34+
const hasCustomerObject = computed(
35+
() => hasCustomerObjectOnMailAddress.value || hasCustomerObjectOnTraqId.value,
36+
)
37+
const canShowInvoiceForm = computed(
38+
() =>
39+
(isLoggedIn.value && (hasCustomerObjectOnTraqId.value || hasVerifiedMailAddress.value)) ||
40+
(!isLoggedIn.value &&
41+
(isUserTypeNew.value || isUserTypeRejoin.value) &&
42+
hasVerifiedMailAddress.value),
43+
)
44+
const needTraqIdInput = computed(
45+
() =>
46+
isUserTypeRejoin.value &&
47+
(!hasCustomerObjectOnMailAddress.value || !hasTraQIdOnCustomerObject.value),
48+
)
49+
const needNameInput = computed(() => !hasCustomerObject.value)
50+
const hasValidTraqId = computed(() => !needTraqIdInput.value && false)
51+
const hasName = computed(() => !needNameInput.value && false)
52+
const canShowInvoiceInfoConfirm = computed(
53+
() => needNameInput.value && hasValidTraqId.value && hasName.value,
54+
)
1555
</script>
1656

1757
<template>
1858
<div class="flex flex-col gap-2">
19-
<div v-if="isLoggedIn">
20-
<div v-if="!hasCustomerObjectOnTraqId && !hasIsctAddress">
21-
isct アドレスの認証が必要です
22-
<MemberShipPageVerifyEmailLink />
23-
</div>
24-
<div v-else>請求書情報入力へ</div>
25-
</div>
26-
<div v-else>
59+
<div v-if="shouldShowUserTypeSelector">
2760
<MemberShipPageUserTypeSelector />
28-
<div v-if="isUserTypeActive">
29-
ログインが必要です
30-
<MembershipPageLoginLink />
31-
</div>
32-
<div v-else-if="!hasIsctAddress">
33-
isct アドレスの認証が必要です <MemberShipPageVerifyEmailLink />
34-
</div>
35-
<div v-else>請求書情報入力へ</div>
3661
</div>
62+
<div v-if="needUserTypeSelect">新規入部、再入部、継続所属のいずれかを選択してください</div>
63+
<div v-if="needMailAddressInput">
64+
isct アドレスの認証が必要です <MemberShipPageVerifyEmailLink />
65+
</div>
66+
<div v-if="needLogin">
67+
ログインが必要です
68+
<MembershipPageLoginLink />
69+
</div>
70+
<div v-if="canShowInvoiceForm && needTraqIdInput">traQ ID を入力してください</div>
71+
<div v-if="canShowInvoiceForm && needNameInput">名前を入力してください</div>
72+
<div v-if="canShowInvoiceInfoConfirm">請求書発行のための情報を確認してください</div>
3773
</div>
3874
</template>

0 commit comments

Comments
 (0)