changes of boursecu

This commit is contained in:
2026-06-29 11:20:02 +02:00
parent 809bd69068
commit 2583becda7
21 changed files with 748 additions and 261 deletions
@@ -0,0 +1,99 @@
<template>
<div class="boursecu-bank-option" :class="{ 'boursecu-bank-option--compact': compact }">
<div class="boursecu-bank-option__logo" :style="{ backgroundColor: accentColor }">
<span>{{ monogram }}</span>
</div>
<div class="boursecu-bank-option__content">
<div class="boursecu-bank-option__title">{{ card.bank_name || 'بانک' }}</div>
<div class="boursecu-bank-option__sheba">{{ shebaText }}</div>
</div>
</div>
</template>
<script setup lang="ts">
import { computed } from 'vue'
import type { Card } from '@/models/wallet'
import {
formatShebaForDisplay,
getBankAccentColor,
getBankMonogram,
} from '@/utils/bankBranding'
const props = withDefaults(
defineProps<{
card: Card
compact?: boolean
}>(),
{ compact: false },
)
const accentColor = computed(() => getBankAccentColor(props.card.bank_name))
const monogram = computed(() => getBankMonogram(props.card.bank_name))
const shebaText = computed(() => formatShebaForDisplay(props.card.shaba_number))
</script>
<style scoped lang="less">
.boursecu-bank-option {
display: flex;
align-items: center;
gap: 12px;
width: 100%;
min-width: 0;
}
.boursecu-bank-option__logo {
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
width: 42px;
height: 42px;
border-radius: 12px;
color: #fff;
font-size: 0.72rem;
font-weight: 800;
line-height: 1.1;
text-align: center;
padding: 4px;
}
.boursecu-bank-option--compact .boursecu-bank-option__logo {
width: 38px;
height: 38px;
}
.boursecu-bank-option__content {
min-width: 0;
flex: 1;
text-align: right;
}
.boursecu-bank-option__title {
font-size: 0.95rem;
font-weight: 700;
color: #111827;
line-height: 1.3;
}
.boursecu-bank-option--compact .boursecu-bank-option__title {
font-size: 0.875rem;
}
.boursecu-bank-option__sheba {
margin-top: 4px;
font-size: 1rem;
font-weight: 700;
color: #111827;
direction: ltr;
text-align: right;
letter-spacing: 0.01em;
font-variant-numeric: tabular-nums;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.boursecu-bank-option--compact .boursecu-bank-option__sheba {
font-size: 0.92rem;
}
</style>
@@ -0,0 +1,189 @@
<template>
<div ref="rootRef" class="boursecu-bank-picker">
<div class="boursecu-bank-picker__header">
<span class="boursecu-bank-picker__heading">واریز به</span>
<button type="button" class="boursecu-bank-picker__add" @click="$emit('add-account')">
+ افزودن شبا
</button>
</div>
<button
type="button"
class="boursecu-bank-picker__trigger"
:disabled="!items.length"
@click="toggleOpen"
>
<template v-if="selectedCard">
<BoursecuBankAccountOption :card="selectedCard" compact />
<BasicIcon
icon="vuesax-linear:arrow-down"
size="18"
class="boursecu-bank-picker__chevron"
:class="{ 'boursecu-bank-picker__chevron--open': isOpen }"
/>
</template>
<span v-else class="boursecu-bank-picker__empty">حساب بانکی ثبت نشده است</span>
</button>
<div v-if="isOpen && items.length" class="boursecu-bank-picker__dropdown">
<button
v-for="card in items"
:key="card.id"
type="button"
class="boursecu-bank-picker__option"
:class="{ 'boursecu-bank-picker__option--active': card.id === selectedId }"
@click="selectCard(card.id)"
>
<BoursecuBankAccountOption :card="card" />
</button>
</div>
</div>
</template>
<script setup lang="ts">
import { computed, ref } from 'vue'
import { onClickOutside } from '@vueuse/core'
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
import type { Card } from '@/models/wallet'
import BoursecuBankAccountOption from './BoursecuBankAccountOption.vue'
const props = defineProps<{
items: Card[]
id?: number | string
}>()
const emit = defineEmits<{
'update:id': [value: number | string | undefined]
'add-account': []
}>()
const rootRef = ref<HTMLElement | null>(null)
const isOpen = ref(false)
const selectedId = computed({
get: () => props.id,
set: (value) => emit('update:id', value),
})
const selectedCard = computed(() =>
props.items.find((item) => item.id === selectedId.value) ?? props.items[0],
)
function toggleOpen() {
if (!props.items.length) {
return
}
isOpen.value = !isOpen.value
}
function selectCard(cardId?: number) {
selectedId.value = cardId
isOpen.value = false
}
onClickOutside(rootRef, () => {
isOpen.value = false
})
</script>
<style scoped lang="less">
.boursecu-bank-picker {
position: relative;
display: flex;
flex-direction: column;
gap: 10px;
z-index: 1;
}
.boursecu-bank-picker__header {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
}
.boursecu-bank-picker__heading {
font-size: 0.875rem;
font-weight: 600;
color: #6b7280;
}
.boursecu-bank-picker__add {
appearance: none;
border: none;
background: transparent;
padding: 0;
font-size: 0.875rem;
font-weight: 700;
color: #2563eb;
cursor: pointer;
}
.boursecu-bank-picker__trigger {
appearance: none;
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
padding: 12px 14px;
border: none;
border-radius: 14px;
background: #eceff1;
cursor: pointer;
text-align: right;
}
.boursecu-bank-picker__trigger:disabled {
cursor: default;
}
.boursecu-bank-picker__chevron {
flex-shrink: 0;
color: #6b7280;
transition: transform 0.2s ease;
}
.boursecu-bank-picker__chevron--open {
transform: rotate(180deg);
}
.boursecu-bank-picker__empty {
width: 100%;
text-align: center;
font-size: 0.875rem;
color: #6b7280;
}
.boursecu-bank-picker__dropdown {
position: absolute;
top: calc(100% + 8px);
right: 0;
left: 0;
z-index: 30;
display: flex;
flex-direction: column;
gap: 4px;
padding: 8px;
border-radius: 16px;
background: #fff;
box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14);
}
.boursecu-bank-picker__option {
appearance: none;
width: 100%;
border: none;
border-radius: 12px;
background: transparent;
padding: 10px 12px;
cursor: pointer;
text-align: right;
transition: background-color 0.15s ease;
}
.boursecu-bank-picker__option--active,
.boursecu-bank-picker__option:hover {
background: #eceff1;
}
</style>
@@ -0,0 +1,106 @@
<template>
<section class="boursecu-withdraw-guide">
<div class="boursecu-withdraw-guide__minimum">
<span class="boursecu-withdraw-guide__minimum-label">حداقل مقدار برداشت</span>
<div class="boursecu-withdraw-guide__minimum-value">
<span class="boursecu-withdraw-guide__minimum-amount">20,000</span>
<span class="boursecu-withdraw-guide__minimum-unit">تومان</span>
</div>
</div>
<p class="boursecu-withdraw-guide__intro">
درخواست‌های برداشت ثبت‌شده، وارد صف سیکل‌های پایا شده و در اولین سیکل یا در برخی موارد تا ۴۸ ساعت تسویه خواهد شد.
</p>
<div class="boursecu-withdraw-guide__section">
<h3 class="boursecu-withdraw-guide__section-title">سیکل‌های پایا (روزهای غیر تعطیل)</h3>
<ul class="boursecu-withdraw-guide__list">
<li>ثبت پیش از ۱۲ ظهر ----&gt; ساعت ۱۲:۴۵ همان روز</li>
<li>ثبت پیش از ۱۸ عصر ----&gt; ساعت ۱۸:۴۵ همان روز</li>
<li>ثبت پس از ساعت ۱۸ عصر ----&gt; ساعت ۱۲:۴۵ روز کاری بعد</li>
</ul>
</div>
<div class="boursecu-withdraw-guide__section">
<h3 class="boursecu-withdraw-guide__section-title">سیکل‌های پایا (روزهای تعطیل)</h3>
<p class="boursecu-withdraw-guide__holiday">ساعت ۱۲:۴۵ روز کاری بعد</p>
</div>
</section>
</template>
<style scoped lang="less">
.boursecu-withdraw-guide {
margin-top: 0;
color: #4b5563;
line-height: 1.8;
}
.boursecu-withdraw-guide__minimum {
display: flex;
flex-direction: column;
align-items: center;
gap: 0.35rem;
margin-bottom: 1rem;
text-align: center;
}
.boursecu-withdraw-guide__minimum-label {
font-size: 0.875rem;
font-weight: 600;
color: #6b7280;
}
.boursecu-withdraw-guide__minimum-value {
display: flex;
align-items: baseline;
justify-content: center;
gap: 0.35rem;
}
.boursecu-withdraw-guide__minimum-amount {
font-size: 1.75rem;
font-weight: 800;
color: #111827;
direction: ltr;
font-variant-numeric: tabular-nums;
}
.boursecu-withdraw-guide__minimum-unit {
font-size: 0.95rem;
font-weight: 600;
color: #6b7280;
}
.boursecu-withdraw-guide__intro {
margin: 0 0 1rem;
font-size: 0.8125rem;
text-align: justify;
}
.boursecu-withdraw-guide__section {
margin-bottom: 0.85rem;
}
.boursecu-withdraw-guide__section-title {
margin: 0 0 0.35rem;
font-size: 0.8125rem;
font-weight: 700;
color: #374151;
}
.boursecu-withdraw-guide__list {
margin: 0;
padding: 0 1rem 0 0;
font-size: 0.8125rem;
}
.boursecu-withdraw-guide__list li + li {
margin-top: 0.15rem;
}
.boursecu-withdraw-guide__holiday {
margin: 0;
padding-right: 0.25rem;
font-size: 0.8125rem;
}
</style>