Split desktop and mobile layouts with shared page data so APIs fetch once per context.
Add layout shells, desktop views, module-level page caches, and UI fixes for auth, home, wallet, transactions, address, and related pages. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,192 @@
|
||||
<template>
|
||||
<div class="dwallet">
|
||||
<div class="dwallet__container">
|
||||
<header class="dwallet-topbar">
|
||||
<p class="dwallet-topbar__eyebrow">مالی</p>
|
||||
<h1 class="dwallet-topbar__title">کیف پول</h1>
|
||||
<p class="dwallet-topbar__subtitle">واریز و برداشت وجه از کیف پول خود</p>
|
||||
</header>
|
||||
|
||||
<div class="dwallet-toolbar">
|
||||
<div class="dwallet-toggle">
|
||||
<button
|
||||
type="button"
|
||||
class="dwallet-toggle__btn"
|
||||
:class="{ 'dwallet-toggle__btn--active': isDeposit }"
|
||||
@click="setIsDeposit(true)"
|
||||
>
|
||||
واریز
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="dwallet-toggle__btn"
|
||||
:class="{ 'dwallet-toggle__btn--active': !isDeposit }"
|
||||
@click="setIsDeposit(false)"
|
||||
>
|
||||
برداشت
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="dwallet-balance-pill">
|
||||
<span class="dwallet-balance-pill__label">موجودی کیف پول</span>
|
||||
<span class="dwallet-balance-pill__value number-ltr">
|
||||
{{ usePriceWithoutType(walletStore?.walletInfo?.cash ?? 0) }}
|
||||
<span>ریال</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="dwallet-grid">
|
||||
<section class="dwallet-surface dwallet-form">
|
||||
<h2 class="dwallet-form__title">{{ isDeposit ? 'واریز به کیف پول' : 'برداشت از کیف پول' }}</h2>
|
||||
|
||||
<a-form :model="form" name="wallet-desktop" @finish="ok()">
|
||||
<a-form-item :rules="[required()]">
|
||||
<BasicInput
|
||||
v-model:value="form.value"
|
||||
addon-before="ریال"
|
||||
:addon-bg-color="useConfigStore().config.color"
|
||||
addon-text-color="white"
|
||||
place-holder="مبلغ"
|
||||
size="large"
|
||||
type="price"
|
||||
/>
|
||||
</a-form-item>
|
||||
|
||||
<Transition mode="out-in" name="fade">
|
||||
<div v-if="!isDeposit" key="withdraw" class="dwallet-form__extras">
|
||||
<p class="dwallet-form__hint dwallet-form__hint--warn">
|
||||
حداقل مبلغ برداشتی 100 هزار تومان می باشد.
|
||||
</p>
|
||||
<p class="dwallet-form__balance-text">
|
||||
{{ formatCashWalletBalanceText(usePriceWithoutType(walletStore?.walletInfo?.cash ?? 0)) }}
|
||||
</p>
|
||||
<a-form-item v-if="walletStore?.walletInfo" class="!mt-3">
|
||||
<a-slider
|
||||
v-model:value="form.percentWallet"
|
||||
:disabled="walletStore?.walletInfo?.cash <= 0"
|
||||
:max="100"
|
||||
:min="0"
|
||||
:step="10"
|
||||
:tip-formatter="formatter"
|
||||
@change="percentChange"
|
||||
/>
|
||||
</a-form-item>
|
||||
</div>
|
||||
<div v-else key="deposit" class="dwallet-form__extras">
|
||||
<p v-if="!isBazretalaProject()" class="dwallet-form__hint dwallet-form__hint--warn">
|
||||
حداقل مبلغ واریزی 100 هزار تومان می باشد.
|
||||
</p>
|
||||
<div class="dwallet-quick-amounts">
|
||||
<button type="button" class="dwallet-quick-amounts__btn" @click="form.value = 10000000">
|
||||
{{ usePriceWithoutType(10000000) }}
|
||||
</button>
|
||||
<button type="button" class="dwallet-quick-amounts__btn" @click="form.value = 50000000">
|
||||
{{ usePriceWithoutType(50000000) }}
|
||||
</button>
|
||||
<button type="button" class="dwallet-quick-amounts__btn" @click="form.value = 100000000">
|
||||
{{ usePriceWithoutType(100000000) }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</Transition>
|
||||
|
||||
<BasicButton
|
||||
:disabled="disableButton"
|
||||
class="dwallet-form__submit"
|
||||
html-type="submit"
|
||||
type="primary"
|
||||
>
|
||||
<a-spin v-if="loading" size="small" />
|
||||
<span v-else>{{ isDeposit ? 'واریز' : 'برداشت' }}</span>
|
||||
</BasicButton>
|
||||
</a-form>
|
||||
</section>
|
||||
|
||||
<section class="dwallet-surface dwallet-side">
|
||||
<template v-if="isDeposit">
|
||||
<div class="dwallet-side__header">
|
||||
<h3 class="dwallet-side__title">تاریخچه واریز</h3>
|
||||
</div>
|
||||
<div
|
||||
:ref="(node) => { desktopDepositScrollEl = (node as HTMLElement | null) }"
|
||||
class="dwallet-side__scroll"
|
||||
>
|
||||
<list-anim v-if="!loading" :numberItemsAnim="4">
|
||||
<Item v-for="item in depositItems" :key="item.id" :item="item" />
|
||||
<TransactionSkeleton v-if="loadingMore" class="mt-1 mb-4" />
|
||||
</list-anim>
|
||||
<div v-else class="dwallet-side__skeletons">
|
||||
<TransactionSkeleton v-for="i in 6" :key="i" class="mt-1" />
|
||||
</div>
|
||||
<p v-if="!loading && !depositItems.length" class="dwallet-side__empty">
|
||||
تراکنش واریزی ثبت نشده است.
|
||||
</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template v-else>
|
||||
<div class="dwallet-side__header">
|
||||
<h3 class="dwallet-side__title">کارتهای بانکی</h3>
|
||||
<button type="button" class="dwallet-side__add-btn" @click="showAddCard = true">
|
||||
<BasicIcon icon="vuesax-linear:add" size="16" />
|
||||
<span>افزودن کارت</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div v-if="!loading && cardItems.length === 0" class="dwallet-side__empty dwallet-side__empty--cards">
|
||||
<BasicIcon icon="vuesax-linear:card" size="32" />
|
||||
<p>هیچ کارتی یافت نشد</p>
|
||||
<button type="button" class="dwallet-side__add-btn dwallet-side__add-btn--primary" @click="showAddCard = true">
|
||||
افزودن کارت جدید
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div v-else-if="cardItems.length > 0" class="dwallet-cards">
|
||||
<CardSlider
|
||||
v-model:id="form.card_id"
|
||||
:items="cardItems"
|
||||
class="dwallet-cards__slider"
|
||||
@cardDeleted="getCards"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
|
||||
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
|
||||
import BasicInput from '@/components/BasicPacks/BasicInput.vue'
|
||||
import ListAnim from '@/components/ListAnim.vue'
|
||||
import TransactionSkeleton from '@/components/TransactionSkeleton.vue'
|
||||
import { useConfigStore } from '@/store/configStore'
|
||||
import { required } from '@/utils/inputRules'
|
||||
import CardSlider from '../components/UISlider/index.vue'
|
||||
import Item from '../components/Item.vue'
|
||||
import { useWalletPageContext } from '../composables/useWalletPage'
|
||||
|
||||
const {
|
||||
isDeposit,
|
||||
walletStore,
|
||||
showAddCard,
|
||||
form,
|
||||
disableButton,
|
||||
cardItems,
|
||||
depositItems,
|
||||
loading,
|
||||
loadingMore,
|
||||
desktopDepositScrollEl,
|
||||
isBazretalaProject,
|
||||
usePriceWithoutType,
|
||||
formatCashWalletBalanceText,
|
||||
setIsDeposit,
|
||||
formatter,
|
||||
percentChange,
|
||||
ok,
|
||||
getCards,
|
||||
} = useWalletPageContext()
|
||||
</script>
|
||||
@@ -0,0 +1,296 @@
|
||||
/* Premium desktop wallet page */
|
||||
|
||||
.dwallet {
|
||||
min-height: 100%;
|
||||
background: #f6f7f9;
|
||||
color: #111827;
|
||||
}
|
||||
|
||||
.dwallet__container {
|
||||
max-width: 1180px;
|
||||
margin: 0 auto;
|
||||
padding: 28px 36px 40px;
|
||||
}
|
||||
|
||||
.dwallet-topbar {
|
||||
margin-bottom: 24px;
|
||||
padding-bottom: 24px;
|
||||
border-bottom: 1px solid rgba(15, 23, 42, 0.06);
|
||||
|
||||
&__eyebrow {
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
color: #9ca3af;
|
||||
margin: 0 0 4px;
|
||||
}
|
||||
|
||||
&__title {
|
||||
font-size: 26px;
|
||||
font-weight: 600;
|
||||
letter-spacing: -0.03em;
|
||||
color: #111827;
|
||||
margin: 0 0 6px;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
&__subtitle {
|
||||
font-size: 14px;
|
||||
color: #6b7280;
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.dwallet-toolbar {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
.dwallet-toggle {
|
||||
display: inline-flex;
|
||||
gap: 4px;
|
||||
padding: 4px;
|
||||
background: #f3f4f6;
|
||||
border-radius: 12px;
|
||||
|
||||
&__btn {
|
||||
min-width: 96px;
|
||||
padding: 10px 18px;
|
||||
border: none;
|
||||
border-radius: 10px;
|
||||
background: transparent;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: #6b7280;
|
||||
font-family: inherit;
|
||||
cursor: pointer;
|
||||
transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
|
||||
|
||||
&:hover {
|
||||
color: #374151;
|
||||
}
|
||||
|
||||
&--active {
|
||||
background: #fff;
|
||||
color: @App-primary-color;
|
||||
box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.dwallet-balance-pill {
|
||||
display: inline-flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-end;
|
||||
gap: 2px;
|
||||
padding: 10px 16px;
|
||||
background: #fff;
|
||||
border: 1px solid #e5e7eb;
|
||||
border-radius: 12px;
|
||||
|
||||
&__label {
|
||||
font-size: 12px;
|
||||
color: #9ca3af;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
&__value {
|
||||
font-size: 16px;
|
||||
font-weight: 700;
|
||||
color: #111827;
|
||||
gap: 4px;
|
||||
|
||||
span {
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
color: #6b7280;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.dwallet-grid {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
|
||||
gap: 20px;
|
||||
align-items: start;
|
||||
}
|
||||
|
||||
.dwallet-surface {
|
||||
background: #fff;
|
||||
border: 1px solid rgba(15, 23, 42, 0.06);
|
||||
border-radius: 16px;
|
||||
box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
|
||||
}
|
||||
|
||||
.dwallet-form {
|
||||
padding: 24px;
|
||||
|
||||
&__title {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: #111827;
|
||||
margin: 0 0 20px;
|
||||
}
|
||||
|
||||
&__extras {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
&__hint {
|
||||
font-size: 12px;
|
||||
margin: 0 0 10px;
|
||||
line-height: 1.5;
|
||||
|
||||
&--warn {
|
||||
color: #dc2626;
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
|
||||
&__balance-text {
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: #374151;
|
||||
margin: 0 0 8px;
|
||||
}
|
||||
|
||||
&__submit {
|
||||
width: 100%;
|
||||
margin-top: 16px;
|
||||
min-height: 44px;
|
||||
}
|
||||
}
|
||||
|
||||
.dwallet-quick-amounts {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
gap: 8px;
|
||||
|
||||
&__btn {
|
||||
padding: 10px 8px;
|
||||
border: 1px solid #e5e7eb;
|
||||
border-radius: 10px;
|
||||
background: #f9fafb;
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
color: #374151;
|
||||
font-family: inherit;
|
||||
cursor: pointer;
|
||||
transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
|
||||
|
||||
&:hover {
|
||||
border-color: @App-primary-color;
|
||||
color: @App-primary-color;
|
||||
background: #fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.dwallet-side {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 420px;
|
||||
overflow: hidden;
|
||||
|
||||
&__header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
padding: 20px 24px 0;
|
||||
}
|
||||
|
||||
&__title {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: #111827;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
&__scroll {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
padding: 16px 24px 24px;
|
||||
max-height: 520px;
|
||||
}
|
||||
|
||||
&__skeletons {
|
||||
padding: 16px 24px 24px;
|
||||
}
|
||||
|
||||
&__empty {
|
||||
text-align: center;
|
||||
color: #9ca3af;
|
||||
font-size: 14px;
|
||||
padding: 32px 24px;
|
||||
|
||||
&--cards {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 12px;
|
||||
flex: 1;
|
||||
min-height: 280px;
|
||||
color: #6b7280;
|
||||
}
|
||||
}
|
||||
|
||||
&__add-btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
border: 1px solid #e5e7eb;
|
||||
border-radius: 10px;
|
||||
background: #fff;
|
||||
color: #374151;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
font-family: inherit;
|
||||
padding: 8px 12px;
|
||||
cursor: pointer;
|
||||
transition: border-color 0.15s ease, color 0.15s ease;
|
||||
|
||||
&:hover {
|
||||
border-color: @App-primary-color;
|
||||
color: @App-primary-color;
|
||||
}
|
||||
|
||||
&--primary {
|
||||
background: @App-primary-color;
|
||||
border-color: @App-primary-color;
|
||||
color: #fff;
|
||||
padding: 10px 16px;
|
||||
|
||||
&:hover {
|
||||
opacity: 0.92;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.dwallet-cards {
|
||||
padding: 8px 24px 24px;
|
||||
|
||||
&__slider {
|
||||
height: 240px !important;
|
||||
|
||||
:deep(.h-\[28vh\]) {
|
||||
height: 240px !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 1023.98px) {
|
||||
.dwallet-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.dwallet-side {
|
||||
min-height: 320px;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user