feat(user): identity gate for wallet/gift card and custom nav icons

This commit is contained in:
2026-10-20 09:10:03 +03:30
parent 5e181fdae9
commit 7626453def
14 changed files with 104 additions and 3 deletions
@@ -6,6 +6,8 @@ import {
type CustomerGiftCardItem,
} from '@/api/giftCard'
import { message } from 'ant-design-vue'
import { useUserStore } from '@/store/userStore'
import { isCustomerIdentityVerified } from '@/utils/customerIdentity'
export interface GiftCardPageContext {
form: Ref<{ code: string }>
@@ -17,6 +19,7 @@ export interface GiftCardPageContext {
listLoading: Ref<boolean>
loadMyGiftCards: () => Promise<void>
fillCode: (code: string) => void
identityRequiredVisible: Ref<boolean>
}
export const GIFT_CARD_PAGE_CONTEXT_KEY: InjectionKey<GiftCardPageContext> =
@@ -29,6 +32,8 @@ export function useGiftCardPage() {
const available = ref<CustomerGiftCardItem[]>([])
const history = ref<CustomerGiftCardItem[]>([])
const listLoading = ref(false)
const identityRequiredVisible = ref(false)
const userStore = useUserStore()
const disableButton = computed(() => {
if (!loading.value) {
@@ -56,6 +61,10 @@ export function useGiftCardPage() {
}
async function registerGiftCard() {
if (!isCustomerIdentityVerified(userStore.userInfo?.is_legal)) {
identityRequiredVisible.value = true
return
}
const code = form.value.code.trim()
if (!code) return
@@ -94,6 +103,7 @@ export function useGiftCardPage() {
listLoading,
loadMyGiftCards,
fillCode,
identityRequiredVisible,
}
provide(GIFT_CARD_PAGE_CONTEXT_KEY, context)
+3 -1
View File
@@ -2,6 +2,7 @@
<div class="gift-card-page-root">
<DesktopGiftCardView v-show="isDesktop" />
<MobileGiftCardView v-show="!isDesktop" />
<IdentityRequiredDialog v-model:show="identityRequiredVisible" action="ثبت کد هدیه" />
</div>
</template>
@@ -10,10 +11,11 @@ import { useDesktopBreakpoint } from '@/layouts/composables/useAppLayout'
import { useGiftCardPage } from './composables/useGiftCardPage'
import DesktopGiftCardView from './desktop/DesktopGiftCardView.vue'
import MobileGiftCardView from './mobile/MobileGiftCardView.vue'
import IdentityRequiredDialog from '@/components/IdentityRequiredDialog.vue'
const isDesktop = useDesktopBreakpoint()
useGiftCardPage()
const { identityRequiredVisible } = useGiftCardPage()
</script>
<style scoped>