Compare commits
6
Commits
be17631109
...
main-test
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
04dad5cce0 | ||
|
|
f797f5616c | ||
|
|
3a3a55287b | ||
|
|
c3aaeaf91a | ||
|
|
4fa2c0d57d | ||
|
|
8b855e5ee4 |
-36
@@ -123,39 +123,6 @@
|
|||||||
transform: rotate(360deg);
|
transform: rotate(360deg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#whatsapp-button {
|
|
||||||
position: fixed;
|
|
||||||
bottom: 90px;
|
|
||||||
right: 20px;
|
|
||||||
width: 60px;
|
|
||||||
height: 60px;
|
|
||||||
background-color: #ffffff;
|
|
||||||
border-radius: 50%;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
box-shadow: 0 4px 10px rgba(0,0,0,0.3);
|
|
||||||
cursor: grab;
|
|
||||||
user-select: none;
|
|
||||||
transition: transform 0.2s ease, box-shadow 0.2s ease;
|
|
||||||
z-index: 9999;
|
|
||||||
}
|
|
||||||
|
|
||||||
#whatsapp-button:hover:not(.is-dragging) {
|
|
||||||
transform: scale(1.1);
|
|
||||||
box-shadow: 0 6px 14px rgba(0,0,0,0.3);
|
|
||||||
}
|
|
||||||
|
|
||||||
#whatsapp-button.is-dragging {
|
|
||||||
cursor: grabbing;
|
|
||||||
transform: none;
|
|
||||||
box-shadow: 0 8px 18px rgba(0,0,0,0.22);
|
|
||||||
}
|
|
||||||
|
|
||||||
#whatsapp-button img {
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@@ -725,8 +692,5 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="module" src="/src/main.ts"></script>
|
<script type="module" src="/src/main.ts"></script>
|
||||||
<a href="#" target="_blank" id="whatsapp-button">
|
|
||||||
<img class="p-2" src="/src/assets/img/rubika.webp" alt="" />
|
|
||||||
</a>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
+181
-39
@@ -1,60 +1,77 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="desktopConfig w-full right-0 left-0 absolute">
|
<div class="desktopConfig w-full right-0 left-0">
|
||||||
<div v-if="popVisible" class="top-0 bottom-0 wrap-fix bg-primary z-100 opacity-60">
|
|
||||||
<div class="absolute right-0 left-0 bottom-10vh flex flex-col items-center">
|
|
||||||
<div><BasicButton>درباره ما</BasicButton></div>
|
|
||||||
<div></div>
|
|
||||||
<div></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<transition mode="out-in" name="fade">
|
<transition mode="out-in" name="fade">
|
||||||
<AConfigProvider
|
<AConfigProvider
|
||||||
v-if="!showSplash"
|
v-if="!showSplash"
|
||||||
:theme="{
|
:theme="{
|
||||||
token: {
|
token: {
|
||||||
colorPrimary: colors.primary,
|
colorPrimary: primaryColor,
|
||||||
colorLink: colors.primary,
|
colorLink: primaryColor,
|
||||||
colorLinkActive: colors.primary,
|
colorLinkActive: primaryColor,
|
||||||
colorLinkHover: colors['primary-rgba']
|
colorLinkHover: primaryColor
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
direction="rtl"
|
direction="rtl"
|
||||||
>
|
>
|
||||||
<router-view v-slot="{ Component, route }">
|
<router-view v-slot="{ Component, route }">
|
||||||
<!-- Use any custom transition and to `fade` -->
|
|
||||||
<transition :name="route.meta.transition || 'fade'">
|
<transition :name="route.meta.transition || 'fade'">
|
||||||
<div>
|
<!--
|
||||||
<component :is="Component" />
|
Key only the top-level matched route (e.g. main vs login), not fullPath.
|
||||||
</div>
|
Using fullPath remounted the whole AppLayoutShell (sidebar/bottom nav)
|
||||||
|
on every page change and reloaded the menu logo each time.
|
||||||
|
-->
|
||||||
|
<component
|
||||||
|
:is="Component"
|
||||||
|
:key="route.matched[0]?.name ?? route.name"
|
||||||
|
class="app-main"
|
||||||
|
/>
|
||||||
</transition>
|
</transition>
|
||||||
</router-view>
|
</router-view>
|
||||||
</AConfigProvider>
|
</AConfigProvider>
|
||||||
|
|
||||||
<div v-else class="flex bottom-0 wrap-fix top-0 bg-white z-1000000000000 justify-center">
|
<div v-else class="app-splash-screen flex items-center justify-center bg-white">
|
||||||
<div class="top-0 wrap-fix h-1/3 w-screen flex">
|
<div class="app-splash-screen__gradient app-splash-screen__gradient--top h-1/3 flex">
|
||||||
<img :src="img_topGradiant" alt="" class="absolute z-10 w-screen h-full object-cover" />
|
<img :src="img_topGradiant" alt="" class="absolute z-10 w-full h-full object-cover" />
|
||||||
<img :src="img_pattern" alt="" class="absolute w-screen h-full object-none" />
|
<img :src="img_pattern" alt="" class="absolute w-full h-full object-none" />
|
||||||
</div>
|
</div>
|
||||||
<div class="wrap-fix bottom-0 h-1/3 w-screen">
|
<div class="app-splash-screen__gradient app-splash-screen__gradient--bottom h-1/3">
|
||||||
<img
|
<img
|
||||||
:src="img_bottomGradiant"
|
:src="img_bottomGradiant"
|
||||||
alt=""
|
alt=""
|
||||||
class="absolute z-10 w-screen h-full object-cover"
|
class="absolute z-10 w-full h-full object-cover"
|
||||||
/>
|
/>
|
||||||
<img :src="img_pattern" alt="" class="absolute w-screen h-full object-none" />
|
<img :src="img_pattern" alt="" class="absolute w-full h-full object-none" />
|
||||||
</div>
|
</div>
|
||||||
<div class="self-center splash_appear_fade_in">
|
<div class="splash_appear_fade_in relative z-10">
|
||||||
<img :src="logoFull" class="h-[20vh]">
|
<img :src="logoFull" class="h-[20vh] max-h-[180px] w-auto object-contain" alt="" />
|
||||||
<!-- <img :src="logo" alt="" class="z-100 bg-primary rounded-full w-full aspect-square self-center h-40" />-->
|
|
||||||
</div>
|
</div>
|
||||||
<div class="fixed w-full bottom-5 home_appear_fade_in_up">
|
<div class="app-splash-screen__version home_appear_fade_in_up">
|
||||||
<div class="text-center text-xs">نسخه: {{ pkg.version }}</div>
|
<div class="text-center text-xs">نسخه: {{ displayVersion }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="absolute bottom-10">
|
<div class="app-splash-screen__spinner">
|
||||||
<a-spin :indicator="indicator" size="small" />
|
<a-spin :indicator="indicator" size="small" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</transition>
|
</transition>
|
||||||
|
|
||||||
|
<div
|
||||||
|
v-if="showSupportButton && !showSplash"
|
||||||
|
id="support-button"
|
||||||
|
class="draggable-support-button"
|
||||||
|
:class="{ 'is-dragging': supportDragging }"
|
||||||
|
:style="supportButtonStyle"
|
||||||
|
title="پشتیبانی"
|
||||||
|
@pointerdown="onSupportPointerDown"
|
||||||
|
@pointermove="onSupportPointerMove"
|
||||||
|
@pointerup="handleSupportPointerUp"
|
||||||
|
@pointercancel="onSupportPointerCancel"
|
||||||
|
>
|
||||||
|
<div class="support-button-inner" :style="{ '--support-accent': supportAccentColor }">
|
||||||
|
<BasicIcon :icon="supportIcon" size="18" class="support-button-icon" />
|
||||||
|
<span class="support-button-label">پشتیبانی</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<VersionUpdateModal />
|
<VersionUpdateModal />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -62,14 +79,26 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { colors } from './themeConfig'
|
import { colors } from './themeConfig'
|
||||||
import pkg from '../package.json'
|
import pkg from '../package.json'
|
||||||
import { defineAsyncComponent, h, onMounted, ref } from 'vue'
|
import { getDisplayAppVersion } from '@/config/config-cache'
|
||||||
|
import { getAppPrimaryColor } from '@/config/brand-theme'
|
||||||
|
import { computed, defineAsyncComponent, h, onMounted, ref } from 'vue'
|
||||||
import img_topGradiant from '@/views/login/assets/img/gr_top_white.svg'
|
import img_topGradiant from '@/views/login/assets/img/gr_top_white.svg'
|
||||||
import img_pattern from '@/views/login/assets/img/pattern.svg'
|
import img_pattern from '@/views/login/assets/img/pattern.svg'
|
||||||
import { LoadingOutlined } from '@ant-design/icons-vue'
|
import { LoadingOutlined } from '@ant-design/icons-vue'
|
||||||
|
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
|
||||||
|
import {
|
||||||
|
buildSupportMessengerUrl,
|
||||||
|
loadSupportMessengerFromSettings,
|
||||||
|
supportMessengerSettings,
|
||||||
|
} from '@/utils/supportMessenger'
|
||||||
|
import { useDraggableFloatingButton } from '@/utils/useDraggableFloatingButton'
|
||||||
|
import { useApplyDesktopLayoutClass } from '@/layouts/composables/useAppLayout'
|
||||||
|
|
||||||
|
import { getAppLogoFullUrl } from '@/config/brand-assets'
|
||||||
|
|
||||||
import img_bottomGradiant from '@/views/login/assets/img/gr_bottom_white.svg'
|
import img_bottomGradiant from '@/views/login/assets/img/gr_bottom_white.svg'
|
||||||
import logoFull from '@/assets/img/logo_full_.png'
|
|
||||||
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
|
const logoFull = getAppLogoFullUrl()
|
||||||
|
|
||||||
const VersionUpdateModal = defineAsyncComponent(
|
const VersionUpdateModal = defineAsyncComponent(
|
||||||
() => import('@/modules/version/VersionUpdateModal.vue')
|
() => import('@/modules/version/VersionUpdateModal.vue')
|
||||||
@@ -81,9 +110,82 @@ const indicator = h(LoadingOutlined, {
|
|||||||
},
|
},
|
||||||
spin: true
|
spin: true
|
||||||
})
|
})
|
||||||
|
const displayVersion = getDisplayAppVersion(pkg.version)
|
||||||
const showSplash = ref(true)
|
const showSplash = ref(true)
|
||||||
|
const primaryColor = getAppPrimaryColor(colors.primary || '#000000')
|
||||||
|
|
||||||
onMounted(() => {
|
useApplyDesktopLayoutClass()
|
||||||
|
|
||||||
|
const supportLink = computed(() =>
|
||||||
|
buildSupportMessengerUrl(
|
||||||
|
supportMessengerSettings.value.messenger,
|
||||||
|
supportMessengerSettings.value.messengerId
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
const showSupportButton = computed(() => !!supportLink.value)
|
||||||
|
|
||||||
|
const supportIcon = computed(() => {
|
||||||
|
const messenger = (supportMessengerSettings.value.messenger ?? '').toLowerCase()
|
||||||
|
switch (messenger) {
|
||||||
|
case 'whatsapp':
|
||||||
|
return 'vuesax-linear:whatsapp'
|
||||||
|
case 'telegram':
|
||||||
|
return 'vuesax-linear:send-2'
|
||||||
|
case 'bale':
|
||||||
|
return 'vuesax-linear:messages-2'
|
||||||
|
default:
|
||||||
|
return 'vuesax-linear:messages-2'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const supportAccentColor = computed(() => {
|
||||||
|
const messenger = (supportMessengerSettings.value.messenger ?? '').toLowerCase()
|
||||||
|
switch (messenger) {
|
||||||
|
case 'whatsapp':
|
||||||
|
return '#22c55e'
|
||||||
|
case 'telegram':
|
||||||
|
return '#0ea5e9'
|
||||||
|
case 'bale':
|
||||||
|
return '#16a34a'
|
||||||
|
case 'rubika':
|
||||||
|
return '#7c3aed'
|
||||||
|
case 'eitaa':
|
||||||
|
return '#f59e0b'
|
||||||
|
case 'soroush':
|
||||||
|
return '#2563eb'
|
||||||
|
default:
|
||||||
|
return primaryColor || '#334155'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const {
|
||||||
|
dragging: supportDragging,
|
||||||
|
fabStyle: supportButtonStyle,
|
||||||
|
handlePointerDown: onSupportPointerDown,
|
||||||
|
handlePointerMove: onSupportPointerMove,
|
||||||
|
handlePointerUp: supportPointerUp,
|
||||||
|
handlePointerCancel: onSupportPointerCancel,
|
||||||
|
} = useDraggableFloatingButton('ghatreh_support_button_position_v1', {
|
||||||
|
width: 118,
|
||||||
|
height: 42,
|
||||||
|
defaultBottomGap: 12,
|
||||||
|
defaultRightOffset: 16,
|
||||||
|
})
|
||||||
|
|
||||||
|
function openSupportLink() {
|
||||||
|
if (!supportLink.value) return
|
||||||
|
window.open(supportLink.value, '_blank', 'noopener,noreferrer')
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleSupportPointerUp(event: PointerEvent) {
|
||||||
|
if (supportPointerUp(event)) {
|
||||||
|
openSupportLink()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
await loadSupportMessengerFromSettings()
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
showSplash.value = false
|
showSplash.value = false
|
||||||
}, 2000)
|
}, 2000)
|
||||||
@@ -93,15 +195,55 @@ onMounted(() => {
|
|||||||
|
|
||||||
<style lang="less">
|
<style lang="less">
|
||||||
.updateButton .van-dialog__confirm .van-button__text {
|
.updateButton .van-dialog__confirm .van-button__text {
|
||||||
color: @primary-color !important;
|
color: var(--app-primary-color, #a72b77) !important;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (min-width: 426px) {
|
#support-button {
|
||||||
.desktopConfig {
|
position: fixed;
|
||||||
width: 426px;
|
z-index: 5100;
|
||||||
position: relative !important;
|
cursor: grab;
|
||||||
|
user-select: none;
|
||||||
|
border-radius: 9999px;
|
||||||
|
|
||||||
|
&.is-dragging {
|
||||||
|
cursor: grabbing;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.support-button-inner {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
padding: 9px 14px 9px 12px;
|
||||||
|
background: #ffffff;
|
||||||
|
border: 1px solid rgba(15, 23, 42, 0.08);
|
||||||
|
border-radius: 9999px;
|
||||||
|
box-shadow: 0 6px 20px rgba(15, 23, 42, 0.14);
|
||||||
|
color: #1e293b;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 600;
|
||||||
|
line-height: 1;
|
||||||
|
direction: rtl;
|
||||||
|
transition: box-shadow 0.2s ease, transform 0.2s ease;
|
||||||
|
|
||||||
|
.support-button-icon {
|
||||||
|
color: var(--support-accent, #334155);
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.support-button-label {
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#support-button:not(.is-dragging):hover .support-button-inner {
|
||||||
|
transform: translateY(-1px);
|
||||||
|
box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
|
||||||
|
}
|
||||||
|
|
||||||
|
#support-button.is-dragging .support-button-inner {
|
||||||
|
box-shadow: 0 10px 28px rgba(15, 23, 42, 0.22);
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
+2
-2
@@ -4,10 +4,10 @@ import type { PWallet, Wallet } from '@/models/wallet'
|
|||||||
|
|
||||||
|
|
||||||
export const getProducts = async (): Promise<any> => {
|
export const getProducts = async (): Promise<any> => {
|
||||||
return await useAxios.get<Product[]>(`/customer/product/list`)
|
return await useAxios.get<Product[]>(`/customer/product/list`, { timeout: 15000 })
|
||||||
}
|
}
|
||||||
export const getProductById = async ( id:number|null): Promise<any> => {
|
export const getProductById = async ( id:number|null): Promise<any> => {
|
||||||
return await useAxios.get<Product[]>(`/customer/product/list/${id}`)
|
return await useAxios.get<Product[]>(`/customer/product/list/${id}`, { timeout: 15000 })
|
||||||
}
|
}
|
||||||
export const getProductInventory = async (): Promise<any> => {
|
export const getProductInventory = async (): Promise<any> => {
|
||||||
return await useAxios.post<PInventory[]>(`/customer/wallet/product/table`)
|
return await useAxios.post<PInventory[]>(`/customer/wallet/product/table`)
|
||||||
|
|||||||
@@ -1,9 +1,13 @@
|
|||||||
import useAxios from '@/utils/useAxios'
|
import useAxios from '@/utils/useAxios'
|
||||||
import type { Card, Wallet } from '@/models/wallet'
|
import type { Card, Wallet } from '@/models/wallet'
|
||||||
|
import type { WalletAssetsSummary } from '@/models/walletAssets'
|
||||||
import type {Transaction} from '@/models/transaction'
|
import type {Transaction} from '@/models/transaction'
|
||||||
|
|
||||||
export const getWallet = async () => await useAxios.get<Wallet>(`/customer/wallet/me`)
|
export const getWallet = async () => await useAxios.get<Wallet>(`/customer/wallet/me`)
|
||||||
|
|
||||||
|
export const getWalletAssets = async () =>
|
||||||
|
await useAxios.get<WalletAssetsSummary>(`/customer/wallet/assets`)
|
||||||
|
|
||||||
export const withdraw = async (obj: Transaction): Promise<any> => {
|
export const withdraw = async (obj: Transaction): Promise<any> => {
|
||||||
return await useAxios.post<Transaction>(`/customer/wallet/withdraw`, obj)
|
return await useAxios.post<Transaction>(`/customer/wallet/withdraw`, obj)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { createVueApp } from '@/app/createApp'
|
|||||||
import { setupRouterGuards } from '@/app/setupRouter'
|
import { setupRouterGuards } from '@/app/setupRouter'
|
||||||
import { useSettingsStore } from '@/store/settingsStore'
|
import { useSettingsStore } from '@/store/settingsStore'
|
||||||
import { initPriceRealtimeChannel } from '@/utils/priceSocket'
|
import { initPriceRealtimeChannel } from '@/utils/priceSocket'
|
||||||
|
import { initMobileScrollRestoration } from '@/layouts/composables/useMobileScrollReset'
|
||||||
|
|
||||||
type BootWindow = Window & {
|
type BootWindow = Window & {
|
||||||
__BOOT_TIMEOUT__?: number
|
__BOOT_TIMEOUT__?: number
|
||||||
@@ -74,6 +75,7 @@ export async function bootstrapApp() {
|
|||||||
await withTimeout(settingsStore.fetchSettings(), 45000, 'Settings loading timeout')
|
await withTimeout(settingsStore.fetchSettings(), 45000, 'Settings loading timeout')
|
||||||
initPriceRealtimeChannel((key) => settingsStore.getSettingByKey(key))
|
initPriceRealtimeChannel((key) => settingsStore.getSettingByKey(key))
|
||||||
|
|
||||||
|
initMobileScrollRestoration()
|
||||||
setupRouterGuards()
|
setupRouterGuards()
|
||||||
|
|
||||||
app.mount('#app')
|
app.mount('#app')
|
||||||
|
|||||||
+81
-14
@@ -3,7 +3,6 @@ import router from '@/router'
|
|||||||
import { authenticateWithFingerprint, getToken, isIphone, removeToken } from '@/utils'
|
import { authenticateWithFingerprint, getToken, isIphone, removeToken } from '@/utils'
|
||||||
import { useUserStore } from '@/store/userStore'
|
import { useUserStore } from '@/store/userStore'
|
||||||
import { useWalletStore } from '@/store/walletStore'
|
import { useWalletStore } from '@/store/walletStore'
|
||||||
import { useFundUserStore } from '@/store/fundStore'
|
|
||||||
import type { NavigationGuardNext, RouteLocationNormalized } from 'vue-router'
|
import type { NavigationGuardNext, RouteLocationNormalized } from 'vue-router'
|
||||||
import { useAuthStore } from '@/store/useAuthStore'
|
import { useAuthStore } from '@/store/useAuthStore'
|
||||||
import {
|
import {
|
||||||
@@ -14,11 +13,49 @@ import {
|
|||||||
setFingerTimeOut,
|
setFingerTimeOut,
|
||||||
setHasFingerPrint
|
setHasFingerPrint
|
||||||
} from '@/app/authBoot'
|
} from '@/app/authBoot'
|
||||||
|
import { recoverMobileViewportAfterAuth } from '@/layouts/composables/useMobileScrollReset'
|
||||||
|
import {
|
||||||
|
getDefaultLandingRoute,
|
||||||
|
hasAbshodeTrading,
|
||||||
|
hasHomePage,
|
||||||
|
hasProductShop,
|
||||||
|
} from '@/config/project-profile'
|
||||||
|
|
||||||
|
const GUEST_PUBLIC_ROUTES = ['login', '404', 'about', 'cart'] as const
|
||||||
|
|
||||||
|
function getGuestPublicRoutes(): string[] {
|
||||||
|
const routes: string[] = [...GUEST_PUBLIC_ROUTES]
|
||||||
|
if (hasProductShop()) {
|
||||||
|
routes.push('buyProduct', 'productDetail')
|
||||||
|
}
|
||||||
|
return routes
|
||||||
|
}
|
||||||
|
|
||||||
|
function enforceProjectRouteAccess(
|
||||||
|
to: RouteLocationNormalized,
|
||||||
|
next: NavigationGuardNext
|
||||||
|
): boolean {
|
||||||
|
if (!hasHomePage() && to.name === 'home') {
|
||||||
|
next({ name: getDefaultLandingRoute() })
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!hasAbshodeTrading() && to.name === 'gold') {
|
||||||
|
next({ name: getDefaultLandingRoute() })
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!hasProductShop() && (to.name === 'buyProduct' || to.name === 'productDetail')) {
|
||||||
|
next({ name: getDefaultLandingRoute() })
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
export function setupRouterGuards() {
|
export function setupRouterGuards() {
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
const walletStore = useWalletStore()
|
const walletStore = useWalletStore()
|
||||||
const fundStore = useFundUserStore()
|
|
||||||
const authStore = useAuthStore()
|
const authStore = useAuthStore()
|
||||||
|
|
||||||
const isApple: boolean = isIphone()
|
const isApple: boolean = isIphone()
|
||||||
@@ -27,15 +64,24 @@ export function setupRouterGuards() {
|
|||||||
const currentRoute = computed(() => router.currentRoute.value.fullPath)
|
const currentRoute = computed(() => router.currentRoute.value.fullPath)
|
||||||
|
|
||||||
async function start() {
|
async function start() {
|
||||||
if (getToken()) {
|
if (!getToken()) {
|
||||||
await walletStore.getLimitedPrice()
|
return
|
||||||
await walletStore.getLimitedBuyGold()
|
|
||||||
await fundStore.getMyFund()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const tasks: Promise<unknown>[] = [
|
||||||
|
walletStore.getLimitedPrice(),
|
||||||
|
walletStore.getLimitedBuyGold(),
|
||||||
|
]
|
||||||
|
|
||||||
|
if (!userStore.userInfo) {
|
||||||
|
tasks.push(userStore.getMyInfo())
|
||||||
|
}
|
||||||
|
|
||||||
|
await Promise.all(tasks)
|
||||||
}
|
}
|
||||||
|
|
||||||
function goToLogin(to: RouteLocationNormalized, next: NavigationGuardNext) {
|
function goToLogin(to: RouteLocationNormalized, next: NavigationGuardNext) {
|
||||||
if (to.name === 'buyProduct' || to.name === 'productDetail' || to.name === 'about' || to.name === 'cart') {
|
if (getGuestPublicRoutes().includes(to.name as string)) {
|
||||||
return next()
|
return next()
|
||||||
}
|
}
|
||||||
if (to.name !== 'login') {
|
if (to.name !== 'login') {
|
||||||
@@ -44,9 +90,10 @@ export function setupRouterGuards() {
|
|||||||
return next()
|
return next()
|
||||||
}
|
}
|
||||||
|
|
||||||
function goToHome(to: RouteLocationNormalized, next: NavigationGuardNext) {
|
function goToLanding(to: RouteLocationNormalized, next: NavigationGuardNext) {
|
||||||
if (to.name !== 'buyProduct') {
|
const landing = getDefaultLandingRoute()
|
||||||
return next({ name: 'buyProduct' })
|
if (to.name !== landing) {
|
||||||
|
return next({ name: landing })
|
||||||
}
|
}
|
||||||
return next()
|
return next()
|
||||||
}
|
}
|
||||||
@@ -56,6 +103,10 @@ export function setupRouterGuards() {
|
|||||||
clearFingerTimeout()
|
clearFingerTimeout()
|
||||||
setFingerTimeOut(to)
|
setFingerTimeOut(to)
|
||||||
|
|
||||||
|
if (enforceProjectRouteAccess(to, next)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (isFirst) {
|
if (isFirst) {
|
||||||
isFirst = false
|
isFirst = false
|
||||||
|
|
||||||
@@ -75,12 +126,15 @@ export function setupRouterGuards() {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (to.name == 'login') {
|
if (to.name == 'login') {
|
||||||
goToHome(to, next)
|
return goToLanding(to, next)
|
||||||
|
}
|
||||||
|
if (enforceProjectRouteAccess(to, next)) {
|
||||||
|
return
|
||||||
}
|
}
|
||||||
return next()
|
return next()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (['login', '404', 'buyProduct', 'productDetail', 'about', 'cart'].includes(to.name as string)) {
|
if (getGuestPublicRoutes().includes(to.name as string)) {
|
||||||
return next()
|
return next()
|
||||||
}
|
}
|
||||||
goToLogin(to, next)
|
goToLogin(to, next)
|
||||||
@@ -89,18 +143,24 @@ export function setupRouterGuards() {
|
|||||||
if (getFingerPosition()) {
|
if (getFingerPosition()) {
|
||||||
if (getToken()) {
|
if (getToken()) {
|
||||||
if (to.name === 'login') {
|
if (to.name === 'login') {
|
||||||
return next({ name: from.name || 'buyProduct' })
|
return next({ name: (from.name as string) || getDefaultLandingRoute() })
|
||||||
|
}
|
||||||
|
if (enforceProjectRouteAccess(to, next)) {
|
||||||
|
return
|
||||||
}
|
}
|
||||||
return next()
|
return next()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (['login', '404', 'buyProduct', 'productDetail', 'about', 'cart'].includes(to.name as string)) {
|
if (getGuestPublicRoutes().includes(to.name as string)) {
|
||||||
return next()
|
return next()
|
||||||
}
|
}
|
||||||
return next({ name: 'login' })
|
return next({ name: 'login' })
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getToken() && !getHasFingerPrint()) {
|
if (getToken() && !getHasFingerPrint()) {
|
||||||
|
if (enforceProjectRouteAccess(to, next)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
next()
|
next()
|
||||||
} else {
|
} else {
|
||||||
goToLogin(to, next)
|
goToLogin(to, next)
|
||||||
@@ -108,5 +168,12 @@ export function setupRouterGuards() {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
router.afterEach((to, from) => {
|
||||||
|
if (document.documentElement.classList.contains('app-layout--desktop')) return
|
||||||
|
if (from.name === 'login') {
|
||||||
|
recoverMobileViewportAfterAuth()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
watch(currentRoute, async () => (userStore.userInfo ? '' : await start()))
|
watch(currentRoute, async () => (userStore.userInfo ? '' : await start()))
|
||||||
}
|
}
|
||||||
|
|||||||
+75
-13
@@ -1,5 +1,16 @@
|
|||||||
@import (less) './var.less';
|
@import (less) './var.less';
|
||||||
@import (less) './fonts.less';
|
@import (less) './fonts.less';
|
||||||
|
@import (less) '../../layouts/styles/desktop-shell.less';
|
||||||
|
@import (less) '../../layouts/styles/mobile-frame.less';
|
||||||
|
@import (less) '../../layouts/styles/mobile-page-common.less';
|
||||||
|
@import (less) '../../layouts/desktop/styles/desktop-page-common.less';
|
||||||
|
@import (less) '../../views/base/fund/desktop/styles/desktop-fund.less';
|
||||||
|
@import (less) '../../views/base/transactions/desktop/styles/desktop-transactions.less';
|
||||||
|
@import (less) '../../views/base/wallet/desktop/styles/desktop-wallet.less';
|
||||||
|
@import (less) '../../views/base/user/desktop/styles/desktop-user.less';
|
||||||
|
@import (less) '../../views/base/priceTrigger/desktop/styles/desktop-price-trigger.less';
|
||||||
|
@import (less) '../../views/base/home/desktop/styles/desktop-home.less';
|
||||||
|
@import (less) '../../layouts/desktop/styles/desktop-inner-pages.less';
|
||||||
|
|
||||||
html {
|
html {
|
||||||
scroll-behavior: smooth;
|
scroll-behavior: smooth;
|
||||||
@@ -50,6 +61,27 @@ body {
|
|||||||
|
|
||||||
:root {
|
:root {
|
||||||
color-scheme: only light;
|
color-scheme: only light;
|
||||||
|
--app-primary-color: #a72b77;
|
||||||
|
--app-secondary-color: #a72b77;
|
||||||
|
--app-tertiary-color: #e0be7f;
|
||||||
|
--app-background-color: #ffffff;
|
||||||
|
--app-primary-dark: #711d4d;
|
||||||
|
--app-primary-light: #c45f9a;
|
||||||
|
--app-safe-top: env(safe-area-inset-top, 0px);
|
||||||
|
--app-safe-bottom: env(safe-area-inset-bottom, 0px);
|
||||||
|
--app-credit-bar-inner: 0px;
|
||||||
|
--app-home-header-offset: calc(4.25rem + var(--app-safe-top));
|
||||||
|
--app-credit-footer-offset: var(--app-safe-bottom);
|
||||||
|
--app-nav-height: 80px;
|
||||||
|
--app-bottom-chrome-height: calc(var(--app-nav-height) + var(--app-safe-bottom));
|
||||||
|
--app-add-card-height: 88px;
|
||||||
|
--wallet-card-dock-overlap: 52px;
|
||||||
|
--app-z-nav: 5000;
|
||||||
|
--app-z-wallet-dock: 4490;
|
||||||
|
--app-z-wallet-add-bar: 4510;
|
||||||
|
--app-z-action-sheet: 5200;
|
||||||
|
--app-z-dialog: 5300;
|
||||||
|
--app-z-modal: 5500;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ant-form-item {
|
.ant-form-item {
|
||||||
@@ -74,18 +106,23 @@ body {
|
|||||||
opacity: 0;
|
opacity: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*.van-action-sheet{
|
.van-action-sheet{
|
||||||
z-index: 2001 !important;
|
z-index: 5001 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.van-overlay{
|
//.van-overlay{
|
||||||
z-index: 2000 !important;
|
// z-index: 2000 !important;
|
||||||
}*/
|
//}
|
||||||
|
|
||||||
.color-transition {
|
.color-transition {
|
||||||
transition: color 0.3s ease;
|
transition: color 0.3s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.app-main {
|
||||||
|
width: 100%;
|
||||||
|
min-height: 100vh;
|
||||||
|
}
|
||||||
|
|
||||||
.background-color-transition {
|
.background-color-transition {
|
||||||
transition: background-color 0.3s ease;
|
transition: background-color 0.3s ease;
|
||||||
}
|
}
|
||||||
@@ -133,7 +170,7 @@ body {
|
|||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
//display: none;
|
//display: none;
|
||||||
outline: none;
|
outline: none;
|
||||||
border: 1px solid #a72b77 !important;
|
border: 1px solid var(--app-primary-color, #a72b77) !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -331,24 +368,49 @@ body {
|
|||||||
}
|
}
|
||||||
.ant-radio-group-solid
|
.ant-radio-group-solid
|
||||||
.ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled):hover{
|
.ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled):hover{
|
||||||
color: #a72b77 !important;
|
color: var(--app-primary-color, #a72b77) !important;
|
||||||
}
|
}
|
||||||
.ant-input-group-addon{
|
.ant-input-group-addon{
|
||||||
background-color: #a72b77 !important;
|
background-color: var(--app-primary-color, #a72b77) !important;
|
||||||
color: #e0be7f !important;
|
color: var(--app-tertiary-color, #e0be7f) !important;
|
||||||
}
|
}
|
||||||
.ant-slider-track{
|
.ant-slider-track{
|
||||||
background-color: #a72b77 !important;
|
background-color: var(--app-primary-color, #a72b77) !important;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
.ant-radio-checked .ant-radio-inner,.ant-radio-group-solid .ant-radio-button-wrapper-checked {
|
||||||
|
border-color: var(--app-primary-color)!important;
|
||||||
|
background-color: var(--app-primary-color)!important
|
||||||
|
}
|
||||||
|
|
||||||
|
.ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled):hover:before {
|
||||||
|
background-color: var(--app-primary-color)!important
|
||||||
|
}
|
||||||
|
|
||||||
.ant-slider-handle {
|
.ant-slider-handle {
|
||||||
background-color: #a72b77 !important;
|
background-color: var(--app-primary-color, #a72b77) !important;
|
||||||
|
border-color: var(--app-tertiary-color, #e0be7f) !important;
|
||||||
|
}
|
||||||
|
.ant-btn-primary{
|
||||||
|
background-color: var(--app-primary-color, #a72b77) !important;
|
||||||
|
color: var(--app-tertiary-color, #ffffff) !important;
|
||||||
|
border-color: var(--app-primary-color, #a72b77) !important;;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ant-drawer-body{
|
.ant-drawer-body{
|
||||||
padding: 0px !important;
|
padding: 0px !important;
|
||||||
}
|
}
|
||||||
.ant-radio-group-solid .ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled):hover{
|
.ant-radio-group-solid .ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled):hover{
|
||||||
color: white !important;
|
color: white !important;
|
||||||
}
|
}
|
||||||
|
.ant-spin{
|
||||||
|
color: var(--app-tertiary-color, #000000) !important;
|
||||||
|
}
|
||||||
|
.ant-spin-dot-item{
|
||||||
|
background-color: var(--app-tertiary-color, #a72b77) !important;
|
||||||
|
|
||||||
|
}
|
||||||
|
.ant-btn:hover{
|
||||||
|
color: var(--app-primary-color, #a72b77) !important;
|
||||||
|
border-color: var(--app-primary-color, #a72b77) !important;;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
@prefixCls: 'noname';
|
@prefixCls: 'noname';
|
||||||
|
|
||||||
|
/* مقادیر ثابت برای Ant Design Less (fade و توابع رنگ). تم واقعی در runtime با --app-primary-color ست میشود. */
|
||||||
@primary-color: #a72b77;
|
@primary-color: #a72b77;
|
||||||
@secondary-color: #a72b77;
|
@secondary-color: #a72b77;
|
||||||
|
@App-primary-color: #a72b77;
|
||||||
@prefixCls-font-family: 'iran-sans';
|
@prefixCls-font-family: 'iran-sans';
|
||||||
@prefixCls-background-color: #fff;
|
@prefixCls-background-color: #fff;
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<AButton :disabled="props.disabledB" :type="props.type" :size="props.size" :class="[prefixCls, _class]" :loading="props.loading">
|
<AButton :disabled="props.disabledB" :type="props.type" :size="props.size" :class="[prefixCls, _class]" :loading="props.loading">
|
||||||
<!-- py-1 px-2-->
|
<!-- py-1 px-2-->
|
||||||
<div
|
<div
|
||||||
class="flex items-center gap-1 justify-center flex-row-reverse gap-2 py-1 px-2"
|
class="flex items-center gap-1 justify-center flex-row-reverse gap-2 px-2"
|
||||||
:class="[{ 'flex-row-reverse': suffixIcon }]"
|
:class="[{ 'flex-row-reverse': suffixIcon }]"
|
||||||
>
|
>
|
||||||
<slot v-if="$slots.default"></slot>
|
<slot v-if="$slots.default"></slot>
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
import icons from '@/components/BasicPacks/tools/icons/icons.json'
|
import icons from '@/components/BasicPacks/tools/icons/icons.json'
|
||||||
import {usePrefix} from "@/utils/usePrefix";
|
import {usePrefix} from "@/utils/usePrefix";
|
||||||
import {computed, onMounted, ref, withDefaults, defineProps} from "vue";
|
import {computed, onMounted, ref, withDefaults, defineProps} from "vue";
|
||||||
|
import { getAppPrimaryColor } from '@/config/brand-theme'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
icon: string
|
icon: string
|
||||||
@@ -28,6 +29,11 @@ const tempIcon = ref<string>()
|
|||||||
const refIcon = ref<HTMLDivElement>()
|
const refIcon = ref<HTMLDivElement>()
|
||||||
tempIcon.value = icons[`${props.icon}`] as string
|
tempIcon.value = icons[`${props.icon}`] as string
|
||||||
const color = computed(() => {
|
const color = computed(() => {
|
||||||
|
if (!props.color) return props.color
|
||||||
|
const raw = String(props.color).trim()
|
||||||
|
if (raw.includes('--app-primary-color') || raw === 'primary') {
|
||||||
|
return getAppPrimaryColor()
|
||||||
|
}
|
||||||
return props.color
|
return props.color
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,8 @@
|
|||||||
import {usePrefix} from "@/utils/usePrefix";
|
import {usePrefix} from "@/utils/usePrefix";
|
||||||
import {computed} from "vue";
|
import {computed} from "vue";
|
||||||
import {usePrice} from "@/components/BasicPacks/BasicPriceInput/src/utils/usePrice";
|
import {usePrice} from "@/components/BasicPacks/BasicPriceInput/src/utils/usePrice";
|
||||||
|
import {persianToEnglishDigits, shouldNormalizeInputDigits} from '@/utils/persianDigits';
|
||||||
|
import { getAppPrimaryColor } from '@/config/brand-theme'
|
||||||
|
|
||||||
//Props
|
//Props
|
||||||
interface Prop {
|
interface Prop {
|
||||||
@@ -54,31 +56,54 @@ interface Prop {
|
|||||||
placeHolder?: String
|
placeHolder?: String
|
||||||
}
|
}
|
||||||
|
|
||||||
const addonBgColor = computed(() => props.addonBgColor)
|
function resolveCssColor(value?: String | string | null) {
|
||||||
const addonTextColor = computed(() => props.addonTextColor)
|
if (!value) return value
|
||||||
//emits
|
const raw = String(value).trim()
|
||||||
const localValue = computed({
|
if (raw.includes('--app-primary-color') || raw === 'primary') {
|
||||||
set(value) {
|
return getAppPrimaryColor()
|
||||||
// console.log(value?.toString().replaceAll(',', ''))
|
}
|
||||||
props.type === 'price' ? emits('update:value', value?.toString().replaceAll(',', '')) : emits('update:value', value)
|
return raw
|
||||||
},
|
}
|
||||||
get() {
|
|
||||||
let a = props.type === 'price' ? props.value ? usePrice(props.value as number, true, '').trim() : '' : props.value
|
|
||||||
// console.log(props.value)
|
|
||||||
return a
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
const props = withDefaults(defineProps<Prop>(), {
|
const props = withDefaults(defineProps<Prop>(), {
|
||||||
isPassword: false
|
isPassword: false
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const addonBgColorResolved = computed(() => resolveCssColor(props.addonBgColor) || getAppPrimaryColor())
|
||||||
|
const addonTextColorResolved = computed(() => resolveCssColor(props.addonTextColor) || 'white')
|
||||||
|
|
||||||
const emits = defineEmits(['update:value', 'onchange'])
|
const emits = defineEmits(['update:value', 'onchange'])
|
||||||
|
|
||||||
|
const localValue = computed({
|
||||||
|
set(value) {
|
||||||
|
emits('update:value', normalizeValue(value))
|
||||||
|
},
|
||||||
|
get() {
|
||||||
|
return props.type === 'price'
|
||||||
|
? props.value ? usePrice(props.value as number, true, '').trim() : ''
|
||||||
|
: props.value
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
function normalizeValue(value: unknown) {
|
||||||
|
if (value == null || value === '') {
|
||||||
|
return value
|
||||||
|
}
|
||||||
|
|
||||||
|
let normalized = String(value)
|
||||||
|
if (shouldNormalizeInputDigits(props)) {
|
||||||
|
normalized = persianToEnglishDigits(normalized)
|
||||||
|
}
|
||||||
|
if (props.type === 'price') {
|
||||||
|
normalized = normalized.replaceAll(',', '')
|
||||||
|
}
|
||||||
|
return normalized
|
||||||
|
}
|
||||||
|
|
||||||
const handlerChange = (e: any) => {
|
const handlerChange = (e: any) => {
|
||||||
// emits('onchange', e.target.value)
|
const normalized = normalizeValue(e.target.value)
|
||||||
props.type === 'price' ? emits('update:value', e.target.value?.toString().replaceAll(',', '')) : emits('update:value', e.target.value)
|
emits('update:value', normalized)
|
||||||
props.type === 'price' ? emits('onchange', e.target.value?.toString().replaceAll(',', '')) : emits('onchange', e.target.value)
|
emits('onchange', normalized)
|
||||||
// console.log('sas')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//css style
|
//css style
|
||||||
@@ -89,11 +114,6 @@ const {prefixCls} = usePrefix('input')
|
|||||||
@prefix: ~'@{prefixCls}-input';
|
@prefix: ~'@{prefixCls}-input';
|
||||||
|
|
||||||
.@{prefix} {
|
.@{prefix} {
|
||||||
/* .ant-input-group-addon:first-child {
|
|
||||||
!* border: #d9d9d9 1px solid;
|
|
||||||
border-radius: 0 6px 6px 0;*!
|
|
||||||
}*/
|
|
||||||
|
|
||||||
.ant-input-group {
|
.ant-input-group {
|
||||||
direction: ltr;
|
direction: ltr;
|
||||||
}
|
}
|
||||||
@@ -109,8 +129,8 @@ const {prefixCls} = usePrefix('input')
|
|||||||
}
|
}
|
||||||
|
|
||||||
.ant-input-group-addon {
|
.ant-input-group-addon {
|
||||||
background-color: v-bind(addonBgColor);
|
background-color: v-bind(addonBgColorResolved);
|
||||||
color: v-bind(addonTextColor);
|
color: v-bind(addonTextColorResolved);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<BasicInput v-model:value="_val">
|
<BasicInput v-model:value="_val" type="price">
|
||||||
<template v-for="(_, slotKey) in $slots" #[slotKey]="data">
|
<template v-for="(_, slotKey) in $slots" #[slotKey]="data">
|
||||||
<slot :name="slotKey" v-bind="data || {}"></slot>
|
<slot :name="slotKey" v-bind="data || {}"></slot>
|
||||||
</template>
|
</template>
|
||||||
@@ -10,6 +10,7 @@
|
|||||||
import {usePrice} from './utils/usePrice'
|
import {usePrice} from './utils/usePrice'
|
||||||
import {computed} from "vue";
|
import {computed} from "vue";
|
||||||
import BasicInput from "../../BasicInput.vue";
|
import BasicInput from "../../BasicInput.vue";
|
||||||
|
import {persianToEnglishDigits} from '@/utils/persianDigits'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
value?: string | number
|
value?: string | number
|
||||||
@@ -23,9 +24,7 @@ const props = withDefaults(defineProps<Props>(), {})
|
|||||||
|
|
||||||
const _val = computed({
|
const _val = computed({
|
||||||
set(val: string) {
|
set(val: string) {
|
||||||
// const temp = val.toString().replaceAll(',', '')
|
emit('update:value', persianToEnglishDigits(val).replaceAll(',', ''))
|
||||||
const temp = val.toString().replaceAll(',', '')
|
|
||||||
emit('update:value', temp)
|
|
||||||
},
|
},
|
||||||
get() {
|
get() {
|
||||||
return props.value ? usePrice(props.value as number, true, '').trim() : ''
|
return props.value ? usePrice(props.value as number, true, '').trim() : ''
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="w-full">
|
<div class="w-full">
|
||||||
<div>
|
<div>
|
||||||
{{ props.title }}
|
{{ props.title }}
|
||||||
@@ -105,7 +105,7 @@ const handleChange = (e: any) => {
|
|||||||
//padding: 5px;
|
//padding: 5px;
|
||||||
/* .ant-select {
|
/* .ant-select {
|
||||||
.ant-select-selector {
|
.ant-select-selector {
|
||||||
border-color: @primary-color;
|
border-color: var(--app-primary-color, #a72b77);
|
||||||
border-radius: @border-radius-base;
|
border-radius: @border-radius-base;
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
import { ref } from 'vue'
|
||||||
|
import { getProducts } from '@/api/products'
|
||||||
|
import type { Product } from '@/models/products'
|
||||||
|
import { getLastStreamProductsList } from '@/utils/productStreamBridge'
|
||||||
|
|
||||||
|
/** کش مشترک لیست محصولات — dedupe درخواستهای polling */
|
||||||
|
const catalogProducts = ref<Product[]>([])
|
||||||
|
let catalogPromise: Promise<Product[]> | null = null
|
||||||
|
|
||||||
|
export function getProductsCatalogRef() {
|
||||||
|
return catalogProducts
|
||||||
|
}
|
||||||
|
|
||||||
|
export function findProductInCatalog(id: number): Product | undefined {
|
||||||
|
const cached = catalogProducts.value.find((p) => p.id === id)
|
||||||
|
if (cached) {
|
||||||
|
return cached
|
||||||
|
}
|
||||||
|
|
||||||
|
return getLastStreamProductsList()?.find((p) => p.id === id)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getProductsCatalog(force = false): Promise<Product[]> {
|
||||||
|
if (!force) {
|
||||||
|
const streamed = getLastStreamProductsList()
|
||||||
|
if (streamed?.length) {
|
||||||
|
catalogProducts.value = streamed
|
||||||
|
return Promise.resolve(streamed)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (catalogProducts.value.length > 0) {
|
||||||
|
return Promise.resolve(catalogProducts.value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!force && catalogPromise) {
|
||||||
|
return catalogPromise
|
||||||
|
}
|
||||||
|
|
||||||
|
catalogPromise = getProducts()
|
||||||
|
.then((products) => {
|
||||||
|
catalogProducts.value = products ?? []
|
||||||
|
return catalogProducts.value
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
catalogPromise = null
|
||||||
|
})
|
||||||
|
|
||||||
|
return catalogPromise
|
||||||
|
}
|
||||||
|
|
||||||
|
export function clearProductsCatalog() {
|
||||||
|
catalogProducts.value = []
|
||||||
|
catalogPromise = null
|
||||||
|
}
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
import { ref } from 'vue'
|
||||||
|
import { getWalletAssets } from '@/api/wallet'
|
||||||
|
import { getProductsCatalog, getProductsCatalogRef } from '@/composables/useProductsCatalog'
|
||||||
|
import { useWalletStore } from '@/store/walletStore'
|
||||||
|
import type { WalletAssetsSummary } from '@/models/walletAssets'
|
||||||
|
import { enrichInventoryCardsWithCatalog } from '@/utils/productAssets'
|
||||||
|
|
||||||
|
const assetsSummary = ref<WalletAssetsSummary | null>(null)
|
||||||
|
let assetsPromise: Promise<WalletAssetsSummary> | null = null
|
||||||
|
|
||||||
|
function enrichAssetsSummary(data: WalletAssetsSummary): WalletAssetsSummary {
|
||||||
|
const catalog = getProductsCatalogRef().value
|
||||||
|
|
||||||
|
return {
|
||||||
|
...data,
|
||||||
|
inventory_cards: enrichInventoryCardsWithCatalog(data.inventory_cards ?? [], catalog ?? []),
|
||||||
|
count_products: enrichInventoryCardsWithCatalog(data.count_products ?? [], catalog ?? []),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function syncWalletStoreFromAssets(data: WalletAssetsSummary) {
|
||||||
|
const walletStore = useWalletStore()
|
||||||
|
if (!walletStore.walletInfo) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const goldMetal = data.metal_totals?.find((metal) => metal.metal_id === 1) ?? data.metal_totals?.[0]
|
||||||
|
|
||||||
|
walletStore.walletInfo.cash = data.cash_wallet ?? walletStore.walletInfo.cash
|
||||||
|
|
||||||
|
if (goldMetal) {
|
||||||
|
walletStore.walletInfo.gold = goldMetal.melted_weight ?? walletStore.walletInfo.gold
|
||||||
|
walletStore.walletInfo.gold_sum = goldMetal.total_weight ?? walletStore.walletInfo.gold_sum
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useWalletAssets() {
|
||||||
|
async function loadWalletAssets(force = false) {
|
||||||
|
if (!force && assetsSummary.value) {
|
||||||
|
return assetsSummary.value
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!force && assetsPromise) {
|
||||||
|
return assetsPromise
|
||||||
|
}
|
||||||
|
|
||||||
|
assetsPromise = Promise.all([getWalletAssets(), getProductsCatalog(force)])
|
||||||
|
.then(([data]) => {
|
||||||
|
assetsSummary.value = enrichAssetsSummary(data)
|
||||||
|
syncWalletStoreFromAssets(assetsSummary.value)
|
||||||
|
return assetsSummary.value
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
assetsPromise = null
|
||||||
|
})
|
||||||
|
|
||||||
|
return assetsPromise
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearWalletAssets() {
|
||||||
|
assetsSummary.value = null
|
||||||
|
assetsPromise = null
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
assetsSummary,
|
||||||
|
loadWalletAssets,
|
||||||
|
clearWalletAssets,
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,11 @@
|
|||||||
import { getConfig } from '@/config/app-config'
|
import { getConfig } from '@/config/app-config'
|
||||||
|
import { getAppIconUrl, resolveConfigAssetUrl } from '@/config/brand-assets'
|
||||||
|
import { applyBrandTheme } from '@/config/brand-theme'
|
||||||
import { isPwaManifestReady } from '@/modules/pwa/manifest'
|
import { isPwaManifestReady } from '@/modules/pwa/manifest'
|
||||||
|
|
||||||
export function applyAppConfig() {
|
export function applyAppConfig() {
|
||||||
|
applyBrandTheme()
|
||||||
|
|
||||||
if (isPwaManifestReady()) return
|
if (isPwaManifestReady()) return
|
||||||
|
|
||||||
setTitle()
|
setTitle()
|
||||||
@@ -13,10 +17,6 @@ function setTitle() {
|
|||||||
document.title = getConfig('name_fa', 'در حال بارگذاری...')
|
document.title = getConfig('name_fa', 'در حال بارگذاری...')
|
||||||
}
|
}
|
||||||
|
|
||||||
function getLogoUrl() {
|
|
||||||
return getConfig<string>('avatar') || '/favicon.png'
|
|
||||||
}
|
|
||||||
|
|
||||||
function setFavicon() {
|
function setFavicon() {
|
||||||
let faviconLink =
|
let faviconLink =
|
||||||
document.querySelector<HTMLLinkElement>("link[rel='icon']") ||
|
document.querySelector<HTMLLinkElement>("link[rel='icon']") ||
|
||||||
@@ -28,14 +28,14 @@ function setFavicon() {
|
|||||||
document.head.appendChild(faviconLink)
|
document.head.appendChild(faviconLink)
|
||||||
}
|
}
|
||||||
|
|
||||||
const logoUrl = getLogoUrl()
|
const logoUrl = getAppIconUrl()
|
||||||
|
|
||||||
faviconLink.type = 'image/png'
|
faviconLink.type = 'image/png'
|
||||||
faviconLink.href = logoUrl.startsWith('http') ? logoUrl : resolveRemoteLogo(logoUrl)
|
faviconLink.href = logoUrl
|
||||||
}
|
}
|
||||||
|
|
||||||
function setAppleTouchIconFallback() {
|
function setAppleTouchIconFallback() {
|
||||||
const logoUrl = getLogoUrl()
|
const logoUrl = getAppIconUrl()
|
||||||
|
|
||||||
if (!logoUrl) return
|
if (!logoUrl) return
|
||||||
|
|
||||||
@@ -57,7 +57,7 @@ function setAppleTouchIconFallback() {
|
|||||||
document.head.appendChild(link)
|
document.head.appendChild(link)
|
||||||
}
|
}
|
||||||
|
|
||||||
link.href = logoUrl.startsWith('http') ? logoUrl : resolveRemoteLogo(logoUrl)
|
link.href = logoUrl
|
||||||
})
|
})
|
||||||
|
|
||||||
let appleTitle = document.querySelector<HTMLMetaElement>("meta[name='apple-mobile-web-app-title']")
|
let appleTitle = document.querySelector<HTMLMetaElement>("meta[name='apple-mobile-web-app-title']")
|
||||||
@@ -71,13 +71,4 @@ function setAppleTouchIconFallback() {
|
|||||||
appleTitle.content = getConfig('name_fa', 'اپ مشتری')
|
appleTitle.content = getConfig('name_fa', 'اپ مشتری')
|
||||||
}
|
}
|
||||||
|
|
||||||
function resolveRemoteLogo(path: string) {
|
export { resolveConfigAssetUrl }
|
||||||
if (/^(https?:\/\/|data:|blob:)/i.test(path)) return path
|
|
||||||
|
|
||||||
const lastSuccess = localStorage.getItem('CONFIG_Success_URL')
|
|
||||||
const base = lastSuccess
|
|
||||||
? lastSuccess.replace(/\/get_user\/?$/i, '').replace(/\/+$/, '')
|
|
||||||
: 'https://nerkh.gold'
|
|
||||||
|
|
||||||
return `${base}/${path.replace(/^\/+/, '')}`
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
import { getConfig } from '@/config/app-config'
|
||||||
|
|
||||||
|
const CONFIG_SUCCESS_URL_KEY = 'CONFIG_Success_URL'
|
||||||
|
|
||||||
|
const DEFAULT_ICON = '/favicon.png'
|
||||||
|
const DEFAULT_LOGO = '/logo.png'
|
||||||
|
const DEFAULT_LOGO_FULL = '/logo_full_.png'
|
||||||
|
|
||||||
|
export function resolveConfigAssetUrl(path?: string | null): string {
|
||||||
|
if (!path) return ''
|
||||||
|
|
||||||
|
if (/^(https?:\/\/|data:|blob:)/i.test(path)) return path
|
||||||
|
|
||||||
|
const lastSuccess = localStorage.getItem(CONFIG_SUCCESS_URL_KEY)
|
||||||
|
const base = lastSuccess
|
||||||
|
? lastSuccess.replace(/\/get_user\/?$/i, '').replace(/\/+$/, '')
|
||||||
|
: 'https://nerkh.gold'
|
||||||
|
|
||||||
|
return `${base}/${path.replace(/^\/+/, '')}`
|
||||||
|
}
|
||||||
|
|
||||||
|
function pickConfigAsset(...keys: string[]): string {
|
||||||
|
for (const key of keys) {
|
||||||
|
const value = getConfig<string>(key)
|
||||||
|
if (value) return resolveConfigAssetUrl(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
|
||||||
|
/** آیکون کوچک اپ — معمولاً فیلد avatar در get_user */
|
||||||
|
export function getAppIconUrl(fallback = DEFAULT_ICON): string {
|
||||||
|
return pickConfigAsset('avatar', 'icon') || fallback
|
||||||
|
}
|
||||||
|
|
||||||
|
/** لوگوی فشرده — برای هدر و FAB */
|
||||||
|
export function getAppLogoUrl(fallback = DEFAULT_LOGO): string {
|
||||||
|
return pickConfigAsset('logo', 'avatar') || fallback
|
||||||
|
}
|
||||||
|
|
||||||
|
/** لوگوی کامل — برای اسپلش، لاگین و سایدبار */
|
||||||
|
export function getAppLogoFullUrl(fallback = DEFAULT_LOGO_FULL): string {
|
||||||
|
return pickConfigAsset('logo_full', 'logo', 'avatar') || fallback
|
||||||
|
}
|
||||||
@@ -0,0 +1,133 @@
|
|||||||
|
import { getConfig } from '@/config/app-config'
|
||||||
|
import { colors } from '@/themeConfig'
|
||||||
|
|
||||||
|
export const DEFAULT_PRIMARY_COLOR = '#a72b77'
|
||||||
|
export const DEFAULT_SECONDARY_COLOR = '#a72b77'
|
||||||
|
export const DEFAULT_TERTIARY_COLOR = '#e0be7f'
|
||||||
|
export const DEFAULT_BACKGROUND_COLOR = '#ffffff'
|
||||||
|
|
||||||
|
function normalizeHex(value: unknown): string | null {
|
||||||
|
if (typeof value !== 'string') return null
|
||||||
|
|
||||||
|
const trimmed = value.trim()
|
||||||
|
if (!trimmed) return null
|
||||||
|
|
||||||
|
const withHash = trimmed.startsWith('#') ? trimmed : `#${trimmed}`
|
||||||
|
|
||||||
|
if (!/^#[0-9a-fA-F]{6}$/.test(withHash) && !/^#[0-9a-fA-F]{3}$/.test(withHash)) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
if (withHash.length === 4) {
|
||||||
|
const [, r, g, b] = withHash
|
||||||
|
return `#${r}${r}${g}${g}${b}${b}`.toLowerCase()
|
||||||
|
}
|
||||||
|
|
||||||
|
return withHash.toLowerCase()
|
||||||
|
}
|
||||||
|
|
||||||
|
function lightenHex(hex: string, amount = 0.22): string {
|
||||||
|
const normalized = normalizeHex(hex)
|
||||||
|
if (!normalized) return hex
|
||||||
|
|
||||||
|
const num = parseInt(normalized.slice(1), 16)
|
||||||
|
const r = (num >> 16) & 255
|
||||||
|
const g = (num >> 8) & 255
|
||||||
|
const b = num & 255
|
||||||
|
|
||||||
|
const mix = (channel: number) => Math.round(channel + (255 - channel) * amount)
|
||||||
|
|
||||||
|
return `#${[mix(r), mix(g), mix(b)]
|
||||||
|
.map((channel) => channel.toString(16).padStart(2, '0'))
|
||||||
|
.join('')}`
|
||||||
|
}
|
||||||
|
|
||||||
|
function darkenHex(hex: string, amount = 0.22): string {
|
||||||
|
const normalized = normalizeHex(hex)
|
||||||
|
if (!normalized) return hex
|
||||||
|
|
||||||
|
const num = parseInt(normalized.slice(1), 16)
|
||||||
|
const r = Math.round(((num >> 16) & 255) * (1 - amount))
|
||||||
|
const g = Math.round(((num >> 8) & 255) * (1 - amount))
|
||||||
|
const b = Math.round((num & 255) * (1 - amount))
|
||||||
|
|
||||||
|
return `#${[r, g, b].map((channel) => channel.toString(16).padStart(2, '0')).join('')}`
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getAppPrimaryColor(fallback = DEFAULT_PRIMARY_COLOR): string {
|
||||||
|
return (
|
||||||
|
normalizeHex(getConfig('color')) ||
|
||||||
|
normalizeHex(getConfig('primary_color')) ||
|
||||||
|
normalizeHex(getConfig('primary')) ||
|
||||||
|
fallback
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getAppSecondaryColor(fallback = DEFAULT_SECONDARY_COLOR): string {
|
||||||
|
return (
|
||||||
|
normalizeHex(getConfig('secondary_color')) ||
|
||||||
|
normalizeHex(getConfig('secondary')) ||
|
||||||
|
getAppPrimaryColor(fallback)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getAppTertiaryColor(fallback = DEFAULT_TERTIARY_COLOR): string {
|
||||||
|
return (
|
||||||
|
normalizeHex(getConfig('tertiary_color')) ||
|
||||||
|
normalizeHex(getConfig('tertiary')) ||
|
||||||
|
fallback
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getAppBackgroundColor(fallback = DEFAULT_BACKGROUND_COLOR): string {
|
||||||
|
return (
|
||||||
|
normalizeHex(getConfig('background_color')) ||
|
||||||
|
normalizeHex(getConfig('background')) ||
|
||||||
|
fallback
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getAppPrimaryDark(fallback = '#711d4d'): string {
|
||||||
|
return darkenHex(getAppPrimaryColor(), 0.22) || fallback
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getAppPrimaryLight(fallback = '#c45f9a'): string {
|
||||||
|
return lightenHex(getAppPrimaryColor(), 0.22) || fallback
|
||||||
|
}
|
||||||
|
|
||||||
|
function setCssVar(name: string, value: string) {
|
||||||
|
document.documentElement.style.setProperty(name, value)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function applyBrandTheme() {
|
||||||
|
const primary = getAppPrimaryColor()
|
||||||
|
const secondary = getAppSecondaryColor()
|
||||||
|
const tertiary = getAppTertiaryColor()
|
||||||
|
const background = getAppBackgroundColor()
|
||||||
|
const primaryDark = getAppPrimaryDark()
|
||||||
|
const primaryLight = getAppPrimaryLight()
|
||||||
|
|
||||||
|
setCssVar('--app-primary-color', primary)
|
||||||
|
setCssVar('--app-secondary-color', secondary)
|
||||||
|
setCssVar('--app-tertiary-color', tertiary)
|
||||||
|
setCssVar('--app-background-color', background)
|
||||||
|
setCssVar('--app-primary-dark', primaryDark)
|
||||||
|
setCssVar('--app-primary-light', primaryLight)
|
||||||
|
|
||||||
|
colors.primary = primary
|
||||||
|
colors['primary-rgba'] = primary
|
||||||
|
colors.secondary = secondary
|
||||||
|
colors['secondary-rgba'] = secondary
|
||||||
|
colors.tertiary = tertiary
|
||||||
|
colors['tertiary-rgba'] = tertiary
|
||||||
|
|
||||||
|
const themeMeta = document.querySelector<HTMLMetaElement>('meta[name="theme-color"]')
|
||||||
|
if (themeMeta) {
|
||||||
|
themeMeta.content = primary
|
||||||
|
} else {
|
||||||
|
const meta = document.createElement('meta')
|
||||||
|
meta.name = 'theme-color'
|
||||||
|
meta.content = primary
|
||||||
|
document.head.appendChild(meta)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -91,6 +91,10 @@ export function getStoredAppVersion() {
|
|||||||
return localStorage.getItem(VERSION_STORAGE_KEY)
|
return localStorage.getItem(VERSION_STORAGE_KEY)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getDisplayAppVersion(fallbackVersion: string) {
|
||||||
|
return getStoredAppVersion() || fallbackVersion
|
||||||
|
}
|
||||||
|
|
||||||
export function writeStoredAppVersion(version: string) {
|
export function writeStoredAppVersion(version: string) {
|
||||||
localStorage.setItem(VERSION_STORAGE_KEY, String(version).trim())
|
localStorage.setItem(VERSION_STORAGE_KEY, String(version).trim())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,123 @@
|
|||||||
|
import { getConfig } from '@/config/app-config'
|
||||||
|
|
||||||
|
export type ProjectProfileId = 'ghatre' | 'kashkool' | 'boursecu' | 'default'
|
||||||
|
|
||||||
|
export interface ProjectFeatures {
|
||||||
|
id: ProjectProfileId
|
||||||
|
hasHomePage: boolean
|
||||||
|
hasAbshodeTrading: boolean
|
||||||
|
hasProductShop: boolean
|
||||||
|
landingRoute: 'home' | 'buyProduct'
|
||||||
|
}
|
||||||
|
|
||||||
|
const PROFILE_FEATURES: Record<ProjectProfileId, ProjectFeatures> = {
|
||||||
|
ghatre: {
|
||||||
|
id: 'ghatre',
|
||||||
|
hasHomePage: false,
|
||||||
|
hasAbshodeTrading: false,
|
||||||
|
hasProductShop: true,
|
||||||
|
landingRoute: 'buyProduct',
|
||||||
|
},
|
||||||
|
kashkool: {
|
||||||
|
id: 'kashkool',
|
||||||
|
hasHomePage: true,
|
||||||
|
hasAbshodeTrading: true,
|
||||||
|
hasProductShop: true,
|
||||||
|
landingRoute: 'home',
|
||||||
|
},
|
||||||
|
boursecu: {
|
||||||
|
id: 'boursecu',
|
||||||
|
hasHomePage: true,
|
||||||
|
hasAbshodeTrading: true,
|
||||||
|
hasProductShop: true,
|
||||||
|
landingRoute: 'home',
|
||||||
|
},
|
||||||
|
default: {
|
||||||
|
id: 'default',
|
||||||
|
hasHomePage: true,
|
||||||
|
hasAbshodeTrading: true,
|
||||||
|
hasProductShop: true,
|
||||||
|
landingRoute: 'home',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
function normalizeSlug(value: unknown): string {
|
||||||
|
return String(value ?? '').toLowerCase().trim()
|
||||||
|
}
|
||||||
|
|
||||||
|
function matchesAny(haystack: string, needles: string[]): boolean {
|
||||||
|
return needles.some((needle) => haystack.includes(needle))
|
||||||
|
}
|
||||||
|
|
||||||
|
export function resolveProjectProfileId(): ProjectProfileId {
|
||||||
|
const name = normalizeSlug(getConfig('name'))
|
||||||
|
const nameFa = String(getConfig('name_fa') ?? '')
|
||||||
|
const mode = normalizeSlug(getConfig('mode'))
|
||||||
|
|
||||||
|
if (
|
||||||
|
matchesAny(name, ['ghatre', 'ghatreh', 'qatre']) ||
|
||||||
|
nameFa.includes('قطره')
|
||||||
|
) {
|
||||||
|
return 'ghatre'
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
matchesAny(name, ['boursecu', 'bourse', 'bours']) ||
|
||||||
|
nameFa.includes('بورس')
|
||||||
|
) {
|
||||||
|
return 'boursecu'
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
matchesAny(name, ['kashkool', 'kashkol', 'kashkoolgold']) ||
|
||||||
|
nameFa.includes('کشکول')
|
||||||
|
) {
|
||||||
|
return 'kashkool'
|
||||||
|
}
|
||||||
|
|
||||||
|
if (matchesAny(mode, ['ghatre', 'ghatreh', 'qatre'])) return 'ghatre'
|
||||||
|
if (matchesAny(mode, ['boursecu', 'bourse'])) return 'boursecu'
|
||||||
|
if (matchesAny(mode, ['kashkool', 'kashkol'])) return 'kashkool'
|
||||||
|
|
||||||
|
return 'default'
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getProjectProfile(): ProjectFeatures {
|
||||||
|
return PROFILE_FEATURES[resolveProjectProfileId()]
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getProjectProfileId(): ProjectProfileId {
|
||||||
|
return resolveProjectProfileId()
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getProjectDisplayName(fallback = 'اپ مشتری'): string {
|
||||||
|
return getConfig('name_fa') || getConfig('name') || fallback
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getDefaultLandingRoute(): 'home' | 'buyProduct' {
|
||||||
|
return getProjectProfile().landingRoute
|
||||||
|
}
|
||||||
|
|
||||||
|
export function hasHomePage(): boolean {
|
||||||
|
return getProjectProfile().hasHomePage
|
||||||
|
}
|
||||||
|
|
||||||
|
export function hasAbshodeTrading(): boolean {
|
||||||
|
return getProjectProfile().hasAbshodeTrading
|
||||||
|
}
|
||||||
|
|
||||||
|
export function hasProductShop(): boolean {
|
||||||
|
return getProjectProfile().hasProductShop
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isGhatreProject(): boolean {
|
||||||
|
return resolveProjectProfileId() === 'ghatre'
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isKashkoolProject(): boolean {
|
||||||
|
return resolveProjectProfileId() === 'kashkool'
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isBoursecuProject(): boolean {
|
||||||
|
return resolveProjectProfileId() === 'boursecu'
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
<template>
|
||||||
|
<DesktopAppLayout v-if="isDesktopLayout" />
|
||||||
|
<MobileAppLayout v-else />
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { useDesktopBreakpoint } from './composables/useAppLayout'
|
||||||
|
import DesktopAppLayout from './desktop/DesktopAppLayout.vue'
|
||||||
|
import MobileAppLayout from './mobile/MobileAppLayout.vue'
|
||||||
|
|
||||||
|
const isDesktopLayout = useDesktopBreakpoint()
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
<template>
|
||||||
|
<div class="dpage">
|
||||||
|
<header v-if="title" class="dpage-topbar">
|
||||||
|
<div>
|
||||||
|
<h1 class="dpage-topbar__title">{{ title }}</h1>
|
||||||
|
<p v-if="subtitle" class="dpage-topbar__subtitle">{{ subtitle }}</p>
|
||||||
|
</div>
|
||||||
|
<slot name="actions" />
|
||||||
|
</header>
|
||||||
|
<slot />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
defineProps<{
|
||||||
|
title?: string
|
||||||
|
subtitle?: string
|
||||||
|
}>()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.dpage-topbar__subtitle {
|
||||||
|
font-size: 14px;
|
||||||
|
color: #6b7280;
|
||||||
|
margin: 6px 0 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
<template>
|
||||||
|
<header class="dpage-topbar" :class="{ 'dpage-topbar--sticky': sticky }">
|
||||||
|
<button
|
||||||
|
v-if="showBack"
|
||||||
|
type="button"
|
||||||
|
class="dpage-topbar__back"
|
||||||
|
@click="handleBack"
|
||||||
|
>
|
||||||
|
<BasicIcon icon="vuesax-linear:arrow-right-1" size="16" />
|
||||||
|
<span>بازگشت</span>
|
||||||
|
</button>
|
||||||
|
<div class="dpage-topbar__meta">
|
||||||
|
<p v-if="eyebrow" class="dpage-topbar__eyebrow">{{ eyebrow }}</p>
|
||||||
|
<h1 class="dpage-topbar__title">{{ title }}</h1>
|
||||||
|
<p v-if="subtitle" class="dpage-topbar__subtitle">{{ subtitle }}</p>
|
||||||
|
</div>
|
||||||
|
<div v-if="$slots.trailing">
|
||||||
|
<slot name="trailing" />
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
|
||||||
|
import router from '@/router'
|
||||||
|
|
||||||
|
withDefaults(
|
||||||
|
defineProps<{
|
||||||
|
title: string
|
||||||
|
eyebrow?: string
|
||||||
|
subtitle?: string
|
||||||
|
showBack?: boolean
|
||||||
|
sticky?: boolean
|
||||||
|
}>(),
|
||||||
|
{
|
||||||
|
showBack: false,
|
||||||
|
sticky: true,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
function handleBack() {
|
||||||
|
router.back()
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
<template>
|
||||||
|
<div class="mpage-header wrap-fix">
|
||||||
|
<button
|
||||||
|
v-if="showBack"
|
||||||
|
type="button"
|
||||||
|
class="mpage-header__back"
|
||||||
|
@click="handleBack"
|
||||||
|
>
|
||||||
|
<BasicIcon icon="vuesax-linear:arrow-right-1" />
|
||||||
|
</button>
|
||||||
|
<div class="mpage-header__title">{{ title }}</div>
|
||||||
|
<div v-if="$slots.trailing" class="mpage-header__trailing">
|
||||||
|
<slot name="trailing" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
|
||||||
|
import router from '@/router'
|
||||||
|
|
||||||
|
withDefaults(
|
||||||
|
defineProps<{
|
||||||
|
title: string
|
||||||
|
showBack?: boolean
|
||||||
|
}>(),
|
||||||
|
{
|
||||||
|
showBack: false,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
function handleBack() {
|
||||||
|
router.back()
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
<template>
|
||||||
|
<div class="responsive-view-pair">
|
||||||
|
<div v-show="!isDesktop" class="responsive-view-pair__pane">
|
||||||
|
<slot name="mobile" />
|
||||||
|
</div>
|
||||||
|
<div v-show="isDesktop" class="responsive-view-pair__pane">
|
||||||
|
<slot name="desktop" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { useDesktopBreakpoint } from '../composables/useResponsiveLayout'
|
||||||
|
|
||||||
|
const isDesktop = useDesktopBreakpoint()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.responsive-view-pair {
|
||||||
|
min-height: 0;
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
max-width: 100%;
|
||||||
|
min-width: 0;
|
||||||
|
overflow-x: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.responsive-view-pair__pane {
|
||||||
|
min-height: 0;
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
max-width: 100%;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
import { useMediaQuery } from '@vueuse/core'
|
||||||
|
import { onUnmounted, watch } from 'vue'
|
||||||
|
import { DESKTOP_LAYOUT_MIN_WIDTH } from '../constants'
|
||||||
|
|
||||||
|
const DESKTOP_LAYOUT_CLASS = 'app-layout--desktop'
|
||||||
|
|
||||||
|
export function useDesktopBreakpoint() {
|
||||||
|
return useMediaQuery(`(min-width: ${DESKTOP_LAYOUT_MIN_WIDTH}px)`)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useApplyDesktopLayoutClass() {
|
||||||
|
const isDesktopLayout = useDesktopBreakpoint()
|
||||||
|
|
||||||
|
const stop = watch(
|
||||||
|
isDesktopLayout,
|
||||||
|
(desktop) => {
|
||||||
|
document.documentElement.classList.toggle(DESKTOP_LAYOUT_CLASS, desktop)
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
)
|
||||||
|
|
||||||
|
onUnmounted(() => {
|
||||||
|
stop()
|
||||||
|
document.documentElement.classList.remove(DESKTOP_LAYOUT_CLASS)
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
import { computed, ref } from 'vue'
|
||||||
|
import { useRoute, useRouter } from 'vue-router'
|
||||||
|
|
||||||
|
export function useAppNavigation() {
|
||||||
|
const router = useRouter()
|
||||||
|
const route = useRoute()
|
||||||
|
|
||||||
|
const popVisible = ref(false)
|
||||||
|
const currentRoute = computed(() => route.name)
|
||||||
|
const hideMenu = computed(() => !!route.meta.hideMenu)
|
||||||
|
|
||||||
|
function isNavActive(routeName: string) {
|
||||||
|
return currentRoute.value === routeName
|
||||||
|
}
|
||||||
|
|
||||||
|
function navItemClass(routeName: string) {
|
||||||
|
return isNavActive(routeName) ? 'text-primary' : 'text-gray-400'
|
||||||
|
}
|
||||||
|
|
||||||
|
function navigateTo(routeName: string) {
|
||||||
|
popVisible.value = false
|
||||||
|
router.push({ name: routeName })
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleOverflowMenu() {
|
||||||
|
popVisible.value = !popVisible.value
|
||||||
|
}
|
||||||
|
|
||||||
|
function closeOverflowMenu() {
|
||||||
|
popVisible.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
popVisible,
|
||||||
|
currentRoute,
|
||||||
|
hideMenu,
|
||||||
|
isNavActive,
|
||||||
|
navItemClass,
|
||||||
|
navigateTo,
|
||||||
|
toggleOverflowMenu,
|
||||||
|
closeOverflowMenu,
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,125 @@
|
|||||||
|
import { nextTick } from 'vue'
|
||||||
|
import router from '@/router'
|
||||||
|
|
||||||
|
let recoveryTimers: ReturnType<typeof setTimeout>[] = []
|
||||||
|
|
||||||
|
function clearRecoveryTimers() {
|
||||||
|
recoveryTimers.forEach(clearTimeout)
|
||||||
|
recoveryTimers = []
|
||||||
|
}
|
||||||
|
|
||||||
|
function blurFocusedField() {
|
||||||
|
const active = document.activeElement
|
||||||
|
if (active instanceof HTMLElement && active !== document.body) {
|
||||||
|
active.blur()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearBodyScrollLock() {
|
||||||
|
document.body.classList.remove('van-overflow-hidden')
|
||||||
|
document.body.style.removeProperty('position')
|
||||||
|
document.body.style.removeProperty('top')
|
||||||
|
document.body.style.removeProperty('left')
|
||||||
|
document.body.style.removeProperty('right')
|
||||||
|
document.body.style.removeProperty('width')
|
||||||
|
document.body.style.removeProperty('height')
|
||||||
|
document.body.style.removeProperty('min-height')
|
||||||
|
document.body.style.removeProperty('overflow')
|
||||||
|
document.body.style.removeProperty('transform')
|
||||||
|
document.documentElement.style.removeProperty('overflow')
|
||||||
|
document.documentElement.style.removeProperty('height')
|
||||||
|
document.documentElement.style.removeProperty('transform')
|
||||||
|
|
||||||
|
const appRoot = document.getElementById('app')
|
||||||
|
if (appRoot) {
|
||||||
|
appRoot.style.removeProperty('position')
|
||||||
|
appRoot.style.removeProperty('top')
|
||||||
|
appRoot.style.removeProperty('height')
|
||||||
|
appRoot.style.removeProperty('min-height')
|
||||||
|
appRoot.style.removeProperty('overflow')
|
||||||
|
appRoot.style.removeProperty('transform')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function resetAllScrollPositions() {
|
||||||
|
window.scrollTo(0, 0)
|
||||||
|
document.documentElement.scrollTop = 0
|
||||||
|
document.body.scrollTop = 0
|
||||||
|
|
||||||
|
document
|
||||||
|
.querySelectorAll('.main-with-bottom-chrome-inner, .login-page, .login-page-root')
|
||||||
|
.forEach((node) => {
|
||||||
|
if (node instanceof HTMLElement) {
|
||||||
|
node.scrollTop = 0
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function kickViewportReflow() {
|
||||||
|
window.dispatchEvent(new Event('resize'))
|
||||||
|
|
||||||
|
if (window.visualViewport) {
|
||||||
|
window.scrollTo(0, 0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function runViewportRecovery() {
|
||||||
|
clearBodyScrollLock()
|
||||||
|
resetAllScrollPositions()
|
||||||
|
kickViewportReflow()
|
||||||
|
}
|
||||||
|
|
||||||
|
function scheduleViewportRecovery() {
|
||||||
|
clearRecoveryTimers()
|
||||||
|
runViewportRecovery()
|
||||||
|
|
||||||
|
nextTick(() => {
|
||||||
|
requestAnimationFrame(() => {
|
||||||
|
runViewportRecovery()
|
||||||
|
|
||||||
|
for (const delay of [50, 150, 300, 500]) {
|
||||||
|
recoveryTimers.push(window.setTimeout(runViewportRecovery, delay))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Reset scroll offsets after navigation — fixes iOS safe-area drift. */
|
||||||
|
export function resetMobileAppScroll() {
|
||||||
|
runViewportRecovery()
|
||||||
|
|
||||||
|
nextTick(() => {
|
||||||
|
requestAnimationFrame(runViewportRecovery)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function dismissMobileKeyboard() {
|
||||||
|
blurFocusedField()
|
||||||
|
await new Promise((resolve) => window.setTimeout(resolve, 120))
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function prepareMobileViewportForAppShell() {
|
||||||
|
blurFocusedField()
|
||||||
|
resetAllScrollPositions()
|
||||||
|
await dismissMobileKeyboard()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Full recovery after auth — runs after home shell is mounted. */
|
||||||
|
export function recoverMobileViewportAfterAuth() {
|
||||||
|
scheduleViewportRecovery()
|
||||||
|
}
|
||||||
|
|
||||||
|
export const resetMobileAppScrollAfterLogin = recoverMobileViewportAfterAuth
|
||||||
|
|
||||||
|
export async function completeLoginNavigation() {
|
||||||
|
await prepareMobileViewportForAppShell()
|
||||||
|
await router.push({ name: 'buyProduct' })
|
||||||
|
await router.isReady()
|
||||||
|
recoverMobileViewportAfterAuth()
|
||||||
|
}
|
||||||
|
|
||||||
|
export function initMobileScrollRestoration() {
|
||||||
|
if (typeof history !== 'undefined' && 'scrollRestoration' in history) {
|
||||||
|
history.scrollRestoration = 'manual'
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
export { useDesktopBreakpoint, useApplyDesktopLayoutClass } from './useAppLayout'
|
||||||
@@ -0,0 +1,98 @@
|
|||||||
|
import type { AppNavItem } from '../types'
|
||||||
|
import {
|
||||||
|
hasAbshodeTrading,
|
||||||
|
hasHomePage,
|
||||||
|
hasProductShop,
|
||||||
|
isKashkoolProject,
|
||||||
|
} from '@/config/project-profile'
|
||||||
|
|
||||||
|
/** تبهای پایین موبایل — کاربر لاگینشده (کشکول و مشابه) */
|
||||||
|
export const AUTH_PRIMARY_NAV: AppNavItem[] = [
|
||||||
|
{ id: 'home', routeName: 'home', label: 'صفحه اصلی', icon: 'vuesax-linear:home' },
|
||||||
|
{ id: 'transactions', routeName: 'transactions', label: 'گزارش', icon: 'vuesax-linear:receipt-item' },
|
||||||
|
{ id: 'wallet', routeName: 'wallet', label: 'کیف پول', icon: 'vuesax-linear:wallet-1' },
|
||||||
|
{ id: 'cart', routeName: 'cart', label: 'سبد خرید', icon: 'vuesax-linear:shopping-cart' },
|
||||||
|
]
|
||||||
|
|
||||||
|
/** تبهای پایین موبایل — قطره (بدون صفحه اصلی) */
|
||||||
|
export const GHATRE_AUTH_PRIMARY_NAV: AppNavItem[] = [
|
||||||
|
{ id: 'buyProduct', routeName: 'buyProduct', label: 'فروشگاه', icon: 'vuesax-linear:coin' },
|
||||||
|
{ id: 'transactions', routeName: 'transactions', label: 'گزارش', icon: 'vuesax-linear:receipt-item' },
|
||||||
|
{ id: 'wallet', routeName: 'wallet', label: 'کیف پول', icon: 'vuesax-linear:wallet-1' },
|
||||||
|
{ id: 'cart', routeName: 'cart', label: 'سبد خرید', icon: 'vuesax-linear:shopping-cart' },
|
||||||
|
]
|
||||||
|
|
||||||
|
/** تبهای پایین موبایل — مهمان */
|
||||||
|
export const GUEST_PRIMARY_NAV: AppNavItem[] = [
|
||||||
|
{ id: 'buyProduct', routeName: 'buyProduct', label: 'فروشگاه', icon: 'vuesax-linear:coin' },
|
||||||
|
{ id: 'about', routeName: 'about', label: 'درباره ما', icon: 'vuesax-linear:info-circle' },
|
||||||
|
{ id: 'cart', routeName: 'cart', label: 'سبد خرید', icon: 'vuesax-linear:shopping-cart' },
|
||||||
|
{ id: 'login', routeName: 'login', label: 'ورود', icon: 'vuesax-linear:login' },
|
||||||
|
]
|
||||||
|
|
||||||
|
/** منوی FAB موبایل + بخش فرعی سایدبار دسکتاپ — کاربر لاگینشده */
|
||||||
|
export const AUTH_SECONDARY_NAV: AppNavItem[] = [
|
||||||
|
{ id: 'notifyTrigger', routeName: 'notifyTrigger', label: 'هشدار قیمت', icon: 'vuesax-linear:bill' },
|
||||||
|
{ id: 'buyProduct', routeName: 'buyProduct', label: 'فروشگاه', icon: 'vuesax-linear:coin' },
|
||||||
|
{ id: 'fund', routeName: 'fund', label: 'دارایی ها', icon: 'vuesax-linear:archive-1' },
|
||||||
|
{ id: 'user', routeName: 'user', label: 'حساب کاربری', icon: 'vuesax-linear:user' },
|
||||||
|
{ id: 'physicalReceive', routeName: 'physicalReceive', label: 'دریافت طلای فیزیکی', icon: 'vuesax-linear:direct-inbox' },
|
||||||
|
{ id: 'list', routeName: 'list', label: 'لیست دریافتیها', icon: 'vuesax-linear:receipt-item' },
|
||||||
|
{ id: 'giftCard', routeName: 'giftCard', label: 'ثبت کارت هدیه', icon: 'vuesax-linear:gift' },
|
||||||
|
{ id: 'earnMoney', routeName: 'earnMoney', label: 'کسب درآمد', icon: 'vuesax-linear:dollar-circle' },
|
||||||
|
{ id: 'about', routeName: 'about', label: 'درباره ما', icon: 'vuesax-linear:info-circle' },
|
||||||
|
{ id: 'rules', routeName: 'rules', label: 'قوانین و مقررات', icon: 'vuesax-linear:task' },
|
||||||
|
]
|
||||||
|
|
||||||
|
/** منوی تمامصفحه کشکول — فقط این آیتمها */
|
||||||
|
export const KASHKOOL_OVERFLOW_NAV: AppNavItem[] = [
|
||||||
|
{ id: 'user', routeName: 'user', label: 'حساب کاربری', icon: 'vuesax-linear:user' },
|
||||||
|
{ id: 'physicalReceive', routeName: 'physicalReceive', label: 'دریافت طلای فیزیکی', icon: 'vuesax-linear:direct-inbox' },
|
||||||
|
{ id: 'notifyTrigger', routeName: 'notifyTrigger', label: 'هشدار قیمت', icon: 'vuesax-linear:bill' },
|
||||||
|
{ id: 'buyProduct', routeName: 'buyProduct', label: 'خرید محصول', icon: 'vuesax-linear:coin' },
|
||||||
|
{ id: 'giftCard', routeName: 'giftCard', label: 'ثبت کارت هدیه', icon: 'vuesax-linear:gift' },
|
||||||
|
{ id: 'rules', routeName: 'rules', label: 'قوانین و مقررات', icon: 'vuesax-linear:task' },
|
||||||
|
]
|
||||||
|
|
||||||
|
function filterSecondaryNavItems(items: AppNavItem[]): AppNavItem[] {
|
||||||
|
return items.filter((item) => {
|
||||||
|
if (item.routeName === 'buyProduct' && !hasProductShop()) return false
|
||||||
|
if (item.routeName === 'notifyTrigger' && !hasAbshodeTrading()) return false
|
||||||
|
if (item.routeName === 'earnMoney' && !hasAbshodeTrading()) return false
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getPrimaryNavItems(isAuthenticated: boolean): AppNavItem[] {
|
||||||
|
if (!isAuthenticated) {
|
||||||
|
return GUEST_PRIMARY_NAV.filter(
|
||||||
|
(item) => item.routeName !== 'buyProduct' || hasProductShop()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!hasHomePage()) {
|
||||||
|
return GHATRE_AUTH_PRIMARY_NAV
|
||||||
|
}
|
||||||
|
|
||||||
|
return AUTH_PRIMARY_NAV
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getSecondaryNavItems(isAuthenticated: boolean): AppNavItem[] {
|
||||||
|
if (!isAuthenticated) return []
|
||||||
|
if (isKashkoolProject()) return KASHKOOL_OVERFLOW_NAV
|
||||||
|
return filterSecondaryNavItems(AUTH_SECONDARY_NAV)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getOverflowMenuItems(isAuthenticated: boolean): AppNavItem[] {
|
||||||
|
if (!isAuthenticated) {
|
||||||
|
return AUTH_SECONDARY_NAV.filter((item) =>
|
||||||
|
['about', 'rules'].includes(item.routeName)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isKashkoolProject()) {
|
||||||
|
return KASHKOOL_OVERFLOW_NAV
|
||||||
|
}
|
||||||
|
|
||||||
|
return filterSecondaryNavItems(AUTH_SECONDARY_NAV)
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
/** Minimum viewport width for desktop app shell (sidebar layout). */
|
||||||
|
export const DESKTOP_LAYOUT_MIN_WIDTH = 768
|
||||||
|
|
||||||
|
export const DESKTOP_SIDEBAR_WIDTH = 260
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
<template>
|
||||||
|
<div class="desktop-app-layout">
|
||||||
|
<DesktopSidebar v-if="!hideMenu" />
|
||||||
|
<main
|
||||||
|
class="desktop-app-layout__main"
|
||||||
|
:class="{ 'desktop-app-layout__main--full': hideMenu }"
|
||||||
|
>
|
||||||
|
<router-view v-slot="{ Component, route }">
|
||||||
|
<div :key="route.fullPath" class="desktop-app-layout__content">
|
||||||
|
<component :is="Component" />
|
||||||
|
</div>
|
||||||
|
</router-view>
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { onUnmounted, watch } from 'vue'
|
||||||
|
import { useAppNavigation } from '../composables/useAppNavigation'
|
||||||
|
import DesktopSidebar from './DesktopSidebar.vue'
|
||||||
|
|
||||||
|
const NO_SIDEBAR_CLASS = 'app-layout--desktop-no-sidebar'
|
||||||
|
const { hideMenu } = useAppNavigation()
|
||||||
|
|
||||||
|
watch(
|
||||||
|
hideMenu,
|
||||||
|
(hidden) => {
|
||||||
|
document.documentElement.classList.toggle(NO_SIDEBAR_CLASS, hidden)
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
)
|
||||||
|
|
||||||
|
onUnmounted(() => {
|
||||||
|
document.documentElement.classList.remove(NO_SIDEBAR_CLASS)
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" src="./desktop-layout.less"></style>
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
<template>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="desktop-nav-item"
|
||||||
|
:class="{ 'desktop-nav-item--active': active }"
|
||||||
|
@click="$emit('click')"
|
||||||
|
>
|
||||||
|
<span class="desktop-nav-item__icon-wrap">
|
||||||
|
<img
|
||||||
|
v-if="iconSrc"
|
||||||
|
:src="iconSrc"
|
||||||
|
alt=""
|
||||||
|
class="desktop-nav-item__icon desktop-nav-item__icon--image"
|
||||||
|
/>
|
||||||
|
<BasicIcon v-else :icon="icon" size="20" class="desktop-nav-item__icon" />
|
||||||
|
<span v-if="badgeCount && badgeCount > 0" class="desktop-nav-item__badge">{{ badgeCount }}</span>
|
||||||
|
</span>
|
||||||
|
<span class="desktop-nav-item__label">{{ label }}</span>
|
||||||
|
</button>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
|
||||||
|
|
||||||
|
defineProps<{
|
||||||
|
icon: string
|
||||||
|
iconSrc?: string
|
||||||
|
label: string
|
||||||
|
active: boolean
|
||||||
|
badgeCount?: number
|
||||||
|
}>()
|
||||||
|
|
||||||
|
defineEmits<{
|
||||||
|
click: []
|
||||||
|
}>()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.desktop-nav-item__icon-wrap {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.desktop-nav-item__badge {
|
||||||
|
position: absolute;
|
||||||
|
top: -4px;
|
||||||
|
left: -4px;
|
||||||
|
min-width: 18px;
|
||||||
|
height: 18px;
|
||||||
|
padding: 0 4px;
|
||||||
|
border-radius: 999px;
|
||||||
|
background: var(--app-primary-color, #a72b77);
|
||||||
|
color: #fff;
|
||||||
|
font-size: 10px;
|
||||||
|
font-weight: 700;
|
||||||
|
line-height: 18px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.desktop-nav-item__icon--image {
|
||||||
|
width: 32px;
|
||||||
|
height: 32px;
|
||||||
|
object-fit: contain;
|
||||||
|
transform: scale(1.75);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
<template>
|
||||||
|
<aside class="desktop-sidebar">
|
||||||
|
<div class="desktop-sidebar__brand">
|
||||||
|
<img :src="navLogo" :alt="projectName" class="desktop-sidebar__logo" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<nav class="desktop-sidebar__section" aria-label="منوی اصلی">
|
||||||
|
<DesktopNavItem
|
||||||
|
v-for="item in primaryItems"
|
||||||
|
:key="item.id"
|
||||||
|
:icon="item.icon"
|
||||||
|
:icon-src="item.iconSrc"
|
||||||
|
:label="item.label"
|
||||||
|
:active="isNavActive(item.routeName)"
|
||||||
|
:badge-count="item.routeName === 'cart' && cartCount ? cartCount : undefined"
|
||||||
|
@click="navigateTo(item.routeName)"
|
||||||
|
/>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<div v-if="secondaryItems.length" class="desktop-sidebar__divider" />
|
||||||
|
|
||||||
|
<nav
|
||||||
|
v-if="secondaryItems.length"
|
||||||
|
class="desktop-sidebar__section desktop-sidebar__section--secondary"
|
||||||
|
aria-label="منوی فرعی"
|
||||||
|
>
|
||||||
|
<DesktopNavItem
|
||||||
|
v-for="item in secondaryItems"
|
||||||
|
:key="item.id"
|
||||||
|
:icon="item.icon"
|
||||||
|
:icon-src="item.iconSrc"
|
||||||
|
:label="item.label"
|
||||||
|
:active="isNavActive(item.routeName)"
|
||||||
|
@click="navigateTo(item.routeName)"
|
||||||
|
/>
|
||||||
|
</nav>
|
||||||
|
</aside>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { computed } from 'vue'
|
||||||
|
import { isToken } from '@/utils'
|
||||||
|
import { useCartStore } from '@/store/cartStore'
|
||||||
|
import { getPrimaryNavItems, getSecondaryNavItems } from '../config/navigation'
|
||||||
|
import { useAppNavigation } from '../composables/useAppNavigation'
|
||||||
|
import { getProjectDisplayName } from '@/config/project-profile'
|
||||||
|
import { getAppLogoFullUrl } from '@/config/brand-assets'
|
||||||
|
import DesktopNavItem from './DesktopNavItem.vue'
|
||||||
|
|
||||||
|
const cartStore = useCartStore()
|
||||||
|
const authenticated = computed(() => isToken())
|
||||||
|
const navLogo = getAppLogoFullUrl()
|
||||||
|
const projectName = getProjectDisplayName('کشکول گلد')
|
||||||
|
const primaryItems = computed(() => getPrimaryNavItems(authenticated.value))
|
||||||
|
const secondaryItems = computed(() => getSecondaryNavItems(authenticated.value))
|
||||||
|
const cartCount = computed(() => cartStore.itemCount || 0)
|
||||||
|
|
||||||
|
const { isNavActive, navigateTo } = useAppNavigation()
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,151 @@
|
|||||||
|
.desktop-app-layout {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
height: 100vh;
|
||||||
|
max-height: 100vh;
|
||||||
|
width: 100%;
|
||||||
|
max-width: 100vw;
|
||||||
|
background: @prefixCls-background-color;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.desktop-app-layout__main {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
min-height: 0;
|
||||||
|
height: 100%;
|
||||||
|
max-height: 100vh;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
overflow: hidden;
|
||||||
|
margin-right: var(--app-desktop-sidebar-width, 260px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.desktop-app-layout__main--full {
|
||||||
|
width: 100%;
|
||||||
|
margin-right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.desktop-app-layout__content {
|
||||||
|
flex: 1 1 0;
|
||||||
|
min-height: 0;
|
||||||
|
width: 100%;
|
||||||
|
overflow-y: auto;
|
||||||
|
overflow-x: hidden;
|
||||||
|
overscroll-behavior: contain;
|
||||||
|
-webkit-overflow-scrolling: touch;
|
||||||
|
background: @prefixCls-background-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
.desktop-sidebar {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
width: var(--app-desktop-sidebar-width, 260px);
|
||||||
|
height: 100vh;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
background: #fff;
|
||||||
|
z-index: 100;
|
||||||
|
padding: 20px 12px 16px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
border-left: 1px solid rgba(0, 0, 0, 0.06);
|
||||||
|
overflow: hidden;
|
||||||
|
overscroll-behavior: contain;
|
||||||
|
}
|
||||||
|
|
||||||
|
.desktop-sidebar__brand {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 8px 12px 20px;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.desktop-sidebar__logo {
|
||||||
|
max-width: 140px;
|
||||||
|
max-height: 56px;
|
||||||
|
width: auto;
|
||||||
|
height: auto;
|
||||||
|
object-fit: contain;
|
||||||
|
}
|
||||||
|
|
||||||
|
.desktop-sidebar__section {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.desktop-sidebar__section--secondary {
|
||||||
|
margin-top: auto;
|
||||||
|
flex: 1;
|
||||||
|
min-height: 0;
|
||||||
|
overflow-y: auto;
|
||||||
|
overscroll-behavior: contain;
|
||||||
|
}
|
||||||
|
|
||||||
|
.desktop-sidebar__divider {
|
||||||
|
height: 1px;
|
||||||
|
background: rgba(0, 0, 0, 0.08);
|
||||||
|
margin: 12px 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.desktop-nav-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
width: 100%;
|
||||||
|
padding: 10px 12px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 10px;
|
||||||
|
background: transparent;
|
||||||
|
cursor: pointer;
|
||||||
|
text-align: right;
|
||||||
|
font-family: inherit;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #6b7280;
|
||||||
|
transition: background 0.15s ease, color 0.15s ease;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: rgba(167, 43, 119, 0.06);
|
||||||
|
color: var(--app-primary-color, #a72b77);
|
||||||
|
}
|
||||||
|
|
||||||
|
&--active {
|
||||||
|
background: rgba(167, 43, 119, 0.1);
|
||||||
|
color: var(--app-primary-color, #a72b77);
|
||||||
|
|
||||||
|
.desktop-nav-item__icon {
|
||||||
|
color: var(--app-primary-color, #a72b77);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.desktop-nav-item__icon {
|
||||||
|
flex-shrink: 0;
|
||||||
|
color: #9ca3af;
|
||||||
|
}
|
||||||
|
|
||||||
|
.desktop-nav-item__icon-wrap {
|
||||||
|
width: 36px;
|
||||||
|
height: 36px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
border-radius: 12px;
|
||||||
|
background: transparent;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.desktop-nav-item__label {
|
||||||
|
flex: 1;
|
||||||
|
line-height: 1.3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.desktop-sidebar__section--secondary .desktop-nav-item {
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 500;
|
||||||
|
padding: 8px 12px;
|
||||||
|
}
|
||||||
@@ -0,0 +1,255 @@
|
|||||||
|
/* Shared desktop layouts for inner pages */
|
||||||
|
|
||||||
|
.dinner {
|
||||||
|
min-height: 100%;
|
||||||
|
background: #f6f7f9;
|
||||||
|
color: #111827;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dinner__container {
|
||||||
|
max-width: 1180px;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 28px 36px 40px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dinner-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);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Cart */
|
||||||
|
.dcart-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
|
||||||
|
gap: 20px;
|
||||||
|
align-items: start;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dcart-items {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dcart-item {
|
||||||
|
display: flex;
|
||||||
|
gap: 16px;
|
||||||
|
padding: 16px;
|
||||||
|
border-radius: 14px;
|
||||||
|
background: #fff;
|
||||||
|
border: 1px solid rgba(15, 23, 42, 0.06);
|
||||||
|
|
||||||
|
&__image {
|
||||||
|
width: 88px;
|
||||||
|
height: 88px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
background: #f9fafb;
|
||||||
|
border-radius: 12px;
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__main {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__title {
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #111827;
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__meta {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #6b7280;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__footer {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__price {
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: var(--app-primary-color, #a72b77);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.dcart-summary {
|
||||||
|
position: sticky;
|
||||||
|
top: 88px;
|
||||||
|
padding: 20px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 16px;
|
||||||
|
|
||||||
|
&__title {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 700;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 12px;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__total {
|
||||||
|
font-size: 20px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: var(--app-primary-color, #a72b77);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Product detail */
|
||||||
|
.dproduct-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
|
||||||
|
gap: 24px;
|
||||||
|
align-items: start;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dproduct-gallery {
|
||||||
|
padding: 20px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
min-height: 280px;
|
||||||
|
background: #f9fafb;
|
||||||
|
border-radius: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dproduct-info {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dproduct-info__price-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 16px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dproduct-info__price {
|
||||||
|
font-size: 22px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: var(--app-primary-color, #a72b77);
|
||||||
|
}
|
||||||
|
|
||||||
|
.dproduct-info__desc {
|
||||||
|
padding: 20px;
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 1.8;
|
||||||
|
color: #4b5563;
|
||||||
|
white-space: pre-line;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Simple form pages (gift card, etc.) */
|
||||||
|
.dform-page {
|
||||||
|
max-width: 560px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dform-card {
|
||||||
|
padding: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Earn money */
|
||||||
|
.dearn-stats {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 1fr;
|
||||||
|
gap: 12px;
|
||||||
|
margin: 16px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dearn-stat {
|
||||||
|
padding: 16px;
|
||||||
|
border-radius: 12px;
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
&--blue {
|
||||||
|
background: #dbeafe;
|
||||||
|
color: #2563eb;
|
||||||
|
}
|
||||||
|
|
||||||
|
&--yellow {
|
||||||
|
background: #fef9c3;
|
||||||
|
color: #ca8a04;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__value {
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__label {
|
||||||
|
font-size: 12px;
|
||||||
|
margin-top: 6px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.dearn-list {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 10px;
|
||||||
|
margin-top: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dearn-list-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 12px;
|
||||||
|
padding: 14px 16px;
|
||||||
|
border-radius: 12px;
|
||||||
|
background: #fff;
|
||||||
|
border: 1px solid rgba(15, 23, 42, 0.06);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Physical receive */
|
||||||
|
.dphysical-list {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dphysical-add {
|
||||||
|
margin-top: 20px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 8px;
|
||||||
|
width: 100%;
|
||||||
|
padding: 14px;
|
||||||
|
border: 1px dashed rgba(15, 23, 42, 0.15);
|
||||||
|
border-radius: 12px;
|
||||||
|
background: #fff;
|
||||||
|
font-family: inherit;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #374151;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: #f9fafb;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,165 @@
|
|||||||
|
html.app-layout--desktop {
|
||||||
|
.dpage {
|
||||||
|
max-width: 1180px;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 28px 36px 48px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dpage-topbar {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
|
gap: 16px;
|
||||||
|
margin-bottom: 24px;
|
||||||
|
padding-bottom: 24px;
|
||||||
|
border-bottom: 1px solid rgba(15, 23, 42, 0.06);
|
||||||
|
|
||||||
|
&--sticky {
|
||||||
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
|
z-index: 30;
|
||||||
|
margin: -4px 0 20px;
|
||||||
|
padding: 12px 0 20px;
|
||||||
|
background: #f6f7f9;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__back {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
border: none;
|
||||||
|
background: transparent;
|
||||||
|
color: #6b7280;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 500;
|
||||||
|
font-family: inherit;
|
||||||
|
cursor: pointer;
|
||||||
|
padding: 8px 0;
|
||||||
|
flex-shrink: 0;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
color: #111827;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&__meta {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__eyebrow {
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #9ca3af;
|
||||||
|
margin: 0 0 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__title {
|
||||||
|
font-size: 26px;
|
||||||
|
font-weight: 700;
|
||||||
|
letter-spacing: -0.03em;
|
||||||
|
color: #111827;
|
||||||
|
line-height: 1.2;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__subtitle {
|
||||||
|
font-size: 14px;
|
||||||
|
color: #6b7280;
|
||||||
|
margin: 6px 0 0;
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Hide mobile fixed headers on desktop inner pages */
|
||||||
|
.fund-info-page-root,
|
||||||
|
.cart-page-root,
|
||||||
|
.gift-card-page-root,
|
||||||
|
.earn-money-page-root,
|
||||||
|
.physical-receive-page-root,
|
||||||
|
.product-detail-page-root,
|
||||||
|
.dinner-page,
|
||||||
|
.cart-page,
|
||||||
|
.gift-card-page,
|
||||||
|
.earn-money-page,
|
||||||
|
.physical-receive-page,
|
||||||
|
.product-detail-page,
|
||||||
|
.about-page-root,
|
||||||
|
.rules-page-root {
|
||||||
|
> .wrap-fix,
|
||||||
|
> div > .wrap-fix,
|
||||||
|
.transaction-list {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.products-page .grid-cols-2 {
|
||||||
|
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (min-width: 1100px) {
|
||||||
|
.products-page .grid-cols-2 {
|
||||||
|
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.dpage-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);
|
||||||
|
}
|
||||||
|
|
||||||
|
.dhome-topbar {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-end;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 24px;
|
||||||
|
margin-bottom: 28px;
|
||||||
|
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;
|
||||||
|
line-height: 1.2;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__actions {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.dhome-btn-ghost {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
padding: 8px 12px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 8px;
|
||||||
|
background: transparent;
|
||||||
|
font-family: inherit;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #6b7280;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: color 0.15s ease, background 0.15s ease;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
color: #111827;
|
||||||
|
background: rgba(15, 23, 42, 0.04);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
<template>
|
||||||
|
<div class="mobile-app-layout">
|
||||||
|
<MobileOverflowMenu
|
||||||
|
:show="popVisible"
|
||||||
|
@close="closeOverflowMenu"
|
||||||
|
@navigate="navigateTo"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div :class="['main-with-bottom-chrome', { 'main-with-bottom-chrome--no-nav': hideMenu }]">
|
||||||
|
<router-view v-slot="{ Component, route: activeRoute }">
|
||||||
|
<transition :name="activeRoute.meta.transition || 'fade'">
|
||||||
|
<component :is="Component" :key="activeRoute.fullPath" class="main-with-bottom-chrome-inner" />
|
||||||
|
</transition>
|
||||||
|
</router-view>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<Teleport to="body">
|
||||||
|
<MobileBottomNav
|
||||||
|
v-if="!hideMenu"
|
||||||
|
:nav-item-class="navItemClass"
|
||||||
|
@navigate="navigateTo"
|
||||||
|
@toggle-overflow="toggleOverflowMenu"
|
||||||
|
/>
|
||||||
|
</Teleport>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { onMounted, watch } from 'vue'
|
||||||
|
import { useRoute } from 'vue-router'
|
||||||
|
import { useAppNavigation } from '../composables/useAppNavigation'
|
||||||
|
import { recoverMobileViewportAfterAuth, resetMobileAppScroll } from '../composables/useMobileScrollReset'
|
||||||
|
import MobileBottomNav from './MobileBottomNav.vue'
|
||||||
|
import MobileOverflowMenu from './MobileOverflowMenu.vue'
|
||||||
|
|
||||||
|
const route = useRoute()
|
||||||
|
|
||||||
|
const {
|
||||||
|
popVisible,
|
||||||
|
hideMenu,
|
||||||
|
navItemClass,
|
||||||
|
navigateTo,
|
||||||
|
toggleOverflowMenu,
|
||||||
|
closeOverflowMenu,
|
||||||
|
} = useAppNavigation()
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => route.fullPath,
|
||||||
|
() => {
|
||||||
|
resetMobileAppScroll()
|
||||||
|
},
|
||||||
|
{ flush: 'post' },
|
||||||
|
)
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
resetMobileAppScroll()
|
||||||
|
recoverMobileViewportAfterAuth()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" src="./mobile-layout.less"></style>
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
<template>
|
||||||
|
<div class="bottom-appbar w-auto mx-auto bg-white">
|
||||||
|
<div class="tabs bottom-0">
|
||||||
|
<template v-for="item in leftTabs" :key="item.id">
|
||||||
|
<div :class="navItemClass(item.routeName)" class="tab" @click="$emit('navigate', item.routeName)">
|
||||||
|
<div class="tab__icon">
|
||||||
|
<a-badge v-if="item.routeName === 'cart'" :count="cartCount">
|
||||||
|
<Icon :icon="item.icon" size="24" />
|
||||||
|
</a-badge>
|
||||||
|
<Icon v-else :icon="item.icon" size="24" />
|
||||||
|
</div>
|
||||||
|
<div class="text-xs mt-1 font-bold">{{ item.label }}</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<div class="main_in">
|
||||||
|
<div class="text-white circle_in">
|
||||||
|
<div class="circle_into" @click="$emit('toggle-overflow')">
|
||||||
|
<img
|
||||||
|
class="p-2"
|
||||||
|
:class="{ 'nav-logo--white': isKashkool }"
|
||||||
|
:src="navLogo"
|
||||||
|
alt=""
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<template v-for="item in rightTabs" :key="item.id">
|
||||||
|
<div :class="navItemClass(item.routeName)" class="tab" @click="$emit('navigate', item.routeName)">
|
||||||
|
<div class="tab__icon">
|
||||||
|
<a-badge v-if="item.routeName === 'cart'" :count="cartCount">
|
||||||
|
<Icon :icon="item.icon" size="24" />
|
||||||
|
</a-badge>
|
||||||
|
<Icon v-else :icon="item.icon" size="24" />
|
||||||
|
</div>
|
||||||
|
<div class="text-xs mt-1 font-bold">{{ item.label }}</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="main">
|
||||||
|
<div class="circle" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { computed } from 'vue'
|
||||||
|
import Icon from '@/components/BasicPacks/BasicIcon.vue'
|
||||||
|
import { isToken } from '@/utils'
|
||||||
|
import { useCartStore } from '@/store/cartStore'
|
||||||
|
import { getAppIconUrl } from '@/config/brand-assets'
|
||||||
|
import { isKashkoolProject } from '@/config/project-profile'
|
||||||
|
import { getPrimaryNavItems } from '../config/navigation'
|
||||||
|
|
||||||
|
defineProps<{
|
||||||
|
navItemClass: (routeName: string) => string
|
||||||
|
}>()
|
||||||
|
|
||||||
|
defineEmits<{
|
||||||
|
navigate: [routeName: string]
|
||||||
|
'toggle-overflow': []
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const cartStore = useCartStore()
|
||||||
|
const navLogo = getAppIconUrl()
|
||||||
|
const isKashkool = isKashkoolProject()
|
||||||
|
const cartCount = computed(() => cartStore.itemCount || 0)
|
||||||
|
|
||||||
|
const primaryItems = computed(() => getPrimaryNavItems(isToken()))
|
||||||
|
const leftTabs = computed(() => primaryItems.value.slice(0, 2))
|
||||||
|
const rightTabs = computed(() => primaryItems.value.slice(2))
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.tab__icon {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 24px;
|
||||||
|
height: 24px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
color: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab__icon :deep(.ant-badge) {
|
||||||
|
color: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-logo--white {
|
||||||
|
filter: brightness(0) invert(1);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
<template>
|
||||||
|
<Transition>
|
||||||
|
<div
|
||||||
|
v-if="show"
|
||||||
|
class="top-0 bottom-0 bg-black wrap-fix z-5000 opacity-60"
|
||||||
|
@click="$emit('close')"
|
||||||
|
/>
|
||||||
|
</Transition>
|
||||||
|
<Transition name="slide-fade">
|
||||||
|
<div v-if="show" class="wrap-fix bottom-11vh z-5000 flex justify-center items-end">
|
||||||
|
<div class="relative flex flex-col items-center">
|
||||||
|
<div
|
||||||
|
class="flex items-center justify-center bg-white rounded-full w-[30px] h-[30px] mb-2"
|
||||||
|
@click="$emit('close')"
|
||||||
|
>
|
||||||
|
<BasicIcon icon="vuesax-linear:close-circle" />
|
||||||
|
</div>
|
||||||
|
<div class="flex flex-col items-center gap-2">
|
||||||
|
<BasicButton
|
||||||
|
v-for="item in menuItems"
|
||||||
|
:key="item.id"
|
||||||
|
icon-size="16"
|
||||||
|
class="!font-bold w-15rem"
|
||||||
|
@click="go(item.routeName)"
|
||||||
|
>
|
||||||
|
<div class="flex gap-2 items-center">
|
||||||
|
<BasicIcon :icon="item.icon" size="16" class="absolute right-2" />
|
||||||
|
<div>{{ item.label }}</div>
|
||||||
|
</div>
|
||||||
|
</BasicButton>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Transition>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { computed } from 'vue'
|
||||||
|
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
|
||||||
|
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
|
||||||
|
import { isToken } from '@/utils'
|
||||||
|
import { getOverflowMenuItems } from '../config/navigation'
|
||||||
|
|
||||||
|
defineProps<{
|
||||||
|
show: boolean
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
close: []
|
||||||
|
navigate: [routeName: string]
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const menuItems = computed(() => getOverflowMenuItems(isToken()))
|
||||||
|
|
||||||
|
function go(routeName: string) {
|
||||||
|
emit('navigate', routeName)
|
||||||
|
emit('close')
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,169 @@
|
|||||||
|
.bottom-appbar {
|
||||||
|
z-index: var(--app-z-nav, 5000);
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0;
|
||||||
|
right: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
max-width: 100vw;
|
||||||
|
height: calc(var(--app-nav-height, 80px) + var(--app-safe-bottom, env(safe-area-inset-bottom, 0px)));
|
||||||
|
padding-bottom: var(--app-safe-bottom, env(safe-area-inset-bottom, 0px));
|
||||||
|
box-sizing: border-box;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-evenly;
|
||||||
|
background: #fff;
|
||||||
|
|
||||||
|
@media screen and (min-width: 426px) {
|
||||||
|
width: 426px;
|
||||||
|
max-width: 426px;
|
||||||
|
left: 50%;
|
||||||
|
right: auto;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.tabs {
|
||||||
|
display: flex;
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
background: #fff;
|
||||||
|
justify-content: space-between;
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
z-index: 400;
|
||||||
|
box-shadow: 0 -2px 4px -2px #0000001a;
|
||||||
|
|
||||||
|
.tab {
|
||||||
|
width: 80px;
|
||||||
|
text-align: center;
|
||||||
|
flex-flow: column;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
align-content: center;
|
||||||
|
|
||||||
|
&.text-primary .tab__icon,
|
||||||
|
&.text-primary .tab__icon .ant-badge {
|
||||||
|
color: var(--app-primary-color, #a72b77);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.text-gray-400 .tab__icon,
|
||||||
|
&.text-gray-400 .tab__icon .ant-badge {
|
||||||
|
color: #9ca3af;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.main_in {
|
||||||
|
width: 70px;
|
||||||
|
height: 70px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
align-self: center;
|
||||||
|
|
||||||
|
.circle_in {
|
||||||
|
margin-top: -10px;
|
||||||
|
border-radius: 50%;
|
||||||
|
width: 70px;
|
||||||
|
height: 70px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
z-index: 20;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
background-color: var(--app-primary-color, #a72b77);
|
||||||
|
|
||||||
|
.circle_into {
|
||||||
|
overflow: hidden;
|
||||||
|
background-color: var(--app-primary-color, #a72b77);
|
||||||
|
border-radius: 50%;
|
||||||
|
width: 56px;
|
||||||
|
height: 56px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
border: white 1px solid;
|
||||||
|
|
||||||
|
img {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
object-fit: cover;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.main {
|
||||||
|
height: 70px;
|
||||||
|
width: 70px;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
.circle {
|
||||||
|
border-radius: 50%;
|
||||||
|
height: 70px;
|
||||||
|
width: 70px;
|
||||||
|
z-index: 20;
|
||||||
|
box-shadow: 0 -5px 4px -2px #0000001a;
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.v-enter-active,
|
||||||
|
.v-leave-active {
|
||||||
|
transition: opacity 0.5s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.v-enter-from,
|
||||||
|
.v-leave-to {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.slide-fade-enter-active {
|
||||||
|
transition: all 0.3s ease-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
.slide-fade-leave-active {
|
||||||
|
transition: all 0.4s cubic-bezier(1, 0.5, 0.8, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.slide-fade-enter-from,
|
||||||
|
.slide-fade-leave-to {
|
||||||
|
transform: translateX(20px);
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mobile-app-layout {
|
||||||
|
height: 100%;
|
||||||
|
max-height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main-with-bottom-chrome {
|
||||||
|
flex: 1 1 auto;
|
||||||
|
min-height: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main-with-bottom-chrome-inner {
|
||||||
|
flex: 1 1 auto;
|
||||||
|
min-height: 0;
|
||||||
|
width: 100%;
|
||||||
|
overflow-y: auto;
|
||||||
|
overflow-x: hidden;
|
||||||
|
-webkit-overflow-scrolling: touch;
|
||||||
|
overscroll-behavior-y: contain;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main-with-bottom-chrome-inner--contained {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main-with-bottom-chrome--no-nav,
|
||||||
|
.main-with-bottom-chrome--no-nav .main-with-bottom-chrome-inner {
|
||||||
|
flex: 1 1 auto;
|
||||||
|
min-height: 0;
|
||||||
|
}
|
||||||
@@ -0,0 +1,174 @@
|
|||||||
|
@desktop-layout-min: 768px;
|
||||||
|
|
||||||
|
@media screen and (min-width: @desktop-layout-min) {
|
||||||
|
html {
|
||||||
|
width: 100%;
|
||||||
|
overflow-x: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
min-width: 100%;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#app {
|
||||||
|
width: 100%;
|
||||||
|
max-width: none;
|
||||||
|
min-height: 100vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
.desktopConfig {
|
||||||
|
position: static !important;
|
||||||
|
width: 100% !important;
|
||||||
|
max-width: none !important;
|
||||||
|
min-height: 100vh;
|
||||||
|
left: auto !important;
|
||||||
|
right: auto !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wrap-fix {
|
||||||
|
width: auto !important;
|
||||||
|
max-width: none !important;
|
||||||
|
left: 0 !important;
|
||||||
|
right: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bottom-appbar {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
html.app-layout--desktop {
|
||||||
|
@media screen and (min-width: @desktop-layout-min) {
|
||||||
|
height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
body,
|
||||||
|
#app,
|
||||||
|
.desktopConfig {
|
||||||
|
height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ant-config-provider {
|
||||||
|
display: block;
|
||||||
|
height: 100%;
|
||||||
|
max-height: 100vh;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.app-main {
|
||||||
|
height: 100vh;
|
||||||
|
max-height: 100vh;
|
||||||
|
min-height: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
--app-desktop-sidebar-width: 260px;
|
||||||
|
|
||||||
|
.wrap-fix {
|
||||||
|
right: var(--app-desktop-sidebar-width, 260px) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
#goftino_w {
|
||||||
|
right: 24px !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.app-layout--desktop-no-sidebar .wrap-fix {
|
||||||
|
right: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.desktop-app-layout__content {
|
||||||
|
.w-screen,
|
||||||
|
.md\:w-auto,
|
||||||
|
.md\:w-\[426px\] {
|
||||||
|
width: 100% !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mt-20 {
|
||||||
|
margin-top: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dpage {
|
||||||
|
width: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fixed.bottom-20,
|
||||||
|
.fixed.bottom-23 {
|
||||||
|
left: var(--app-desktop-sidebar-width, 260px) !important;
|
||||||
|
right: 0 !important;
|
||||||
|
width: auto !important;
|
||||||
|
max-width: none !important;
|
||||||
|
margin: 0 !important;
|
||||||
|
transform: none !important;
|
||||||
|
|
||||||
|
> div {
|
||||||
|
max-width: 640px;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.transaction-list {
|
||||||
|
width: 100% !important;
|
||||||
|
max-width: none !important;
|
||||||
|
left: 0 !important;
|
||||||
|
right: 0 !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Splash — full viewport, centered; never sidebar-offset */
|
||||||
|
.app-splash-screen {
|
||||||
|
position: fixed;
|
||||||
|
inset: 0;
|
||||||
|
width: 100vw;
|
||||||
|
min-height: 100vh;
|
||||||
|
max-width: none;
|
||||||
|
left: 0 !important;
|
||||||
|
right: 0 !important;
|
||||||
|
z-index: 1000000000000;
|
||||||
|
|
||||||
|
&__gradient {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
width: 100%;
|
||||||
|
pointer-events: none;
|
||||||
|
|
||||||
|
&--top {
|
||||||
|
top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
&--bottom {
|
||||||
|
bottom: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&__version {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 20px;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
z-index: 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__spinner {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 40px;
|
||||||
|
left: 50%;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
z-index: 10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
html.app-layout--desktop .app-splash-screen {
|
||||||
|
right: 0 !important;
|
||||||
|
left: 0 !important;
|
||||||
|
width: 100vw !important;
|
||||||
|
}
|
||||||
@@ -0,0 +1,110 @@
|
|||||||
|
/**
|
||||||
|
* Mobile shell width rules.
|
||||||
|
* Below 426px: full viewport (phones).
|
||||||
|
* 426px–767px: centered 426px frame (tablet-ish mobile).
|
||||||
|
*/
|
||||||
|
|
||||||
|
html:not(.app-layout--desktop) {
|
||||||
|
html,
|
||||||
|
body,
|
||||||
|
#app {
|
||||||
|
min-height: 0;
|
||||||
|
height: 100dvh;
|
||||||
|
max-height: 100dvh;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
overscroll-behavior: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.desktopConfig,
|
||||||
|
.app-main {
|
||||||
|
min-height: 0;
|
||||||
|
height: 100dvh;
|
||||||
|
max-height: 100dvh;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.app-main > * {
|
||||||
|
height: 100%;
|
||||||
|
max-height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.app-dock-add-bar,
|
||||||
|
.wallet-card-slider {
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: 425.98px) {
|
||||||
|
body {
|
||||||
|
display: block !important;
|
||||||
|
width: 100% !important;
|
||||||
|
overflow-x: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
#app,
|
||||||
|
.desktopConfig,
|
||||||
|
.app-main,
|
||||||
|
.main-with-bottom-chrome,
|
||||||
|
.main-with-bottom-chrome-inner {
|
||||||
|
width: 100% !important;
|
||||||
|
max-width: 100vw !important;
|
||||||
|
min-width: 0 !important;
|
||||||
|
margin: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wrap-fix,
|
||||||
|
.bottom-appbar {
|
||||||
|
width: 100% !important;
|
||||||
|
max-width: 100vw !important;
|
||||||
|
left: 0 !important;
|
||||||
|
right: 0 !important;
|
||||||
|
margin: 0 !important;
|
||||||
|
transform: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.app-dock-add-bar,
|
||||||
|
.wallet-card-slider {
|
||||||
|
width: 100% !important;
|
||||||
|
max-width: 100vw !important;
|
||||||
|
left: 0 !important;
|
||||||
|
right: 0 !important;
|
||||||
|
margin: 0 !important;
|
||||||
|
transform: none !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (min-width: 426px) and (max-width: 767.98px) {
|
||||||
|
body {
|
||||||
|
display: flex !important;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.desktopConfig {
|
||||||
|
width: 426px !important;
|
||||||
|
max-width: 426px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wrap-fix,
|
||||||
|
.bottom-appbar {
|
||||||
|
width: 426px !important;
|
||||||
|
max-width: 426px !important;
|
||||||
|
left: 50% !important;
|
||||||
|
right: auto !important;
|
||||||
|
margin: 0 !important;
|
||||||
|
transform: translateX(-50%) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.app-dock-add-bar,
|
||||||
|
.wallet-card-slider {
|
||||||
|
width: 426px !important;
|
||||||
|
max-width: 426px !important;
|
||||||
|
left: 50% !important;
|
||||||
|
right: auto !important;
|
||||||
|
margin: 0 !important;
|
||||||
|
transform: translateX(-50%) !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,208 @@
|
|||||||
|
/* Shared mobile page chrome (inner pages — not home .app-header) */
|
||||||
|
|
||||||
|
:root {
|
||||||
|
--mpage-header-bar: 2.75rem;
|
||||||
|
--mpage-header-offset: calc(4rem + var(--app-safe-top, env(safe-area-inset-top, 0px)));
|
||||||
|
--mpage-subheader-offset: calc(var(--mpage-header-bar) + var(--app-safe-top, env(safe-area-inset-top, 0px)));
|
||||||
|
--mpage-content-with-subheader: calc(6.5rem + var(--app-safe-top, env(safe-area-inset-top, 0px)));
|
||||||
|
--mpage-scroll-max-height: calc(100dvh - 50px - var(--app-safe-top, env(safe-area-inset-top, 0px)));
|
||||||
|
--mobile-info-support-block: calc(5rem + var(--app-safe-bottom, env(safe-area-inset-bottom, 0px)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Fixed top bar: background fills under status bar; content sits below safe area */
|
||||||
|
.mobile-top-chrome {
|
||||||
|
top: 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding-top: calc(0.75rem + var(--app-safe-top, env(safe-area-inset-top, 0px)));
|
||||||
|
}
|
||||||
|
|
||||||
|
.mobile-top-chrome.h-12,
|
||||||
|
.mobile-top-chrome.min-h-12 {
|
||||||
|
height: auto;
|
||||||
|
min-height: calc(3rem + var(--app-safe-top, env(safe-area-inset-top, 0px)));
|
||||||
|
}
|
||||||
|
|
||||||
|
.mpage-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.5rem;
|
||||||
|
top: 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding: 0.75rem;
|
||||||
|
padding-top: calc(0.75rem + var(--app-safe-top, env(safe-area-inset-top, 0px)));
|
||||||
|
background: #fff;
|
||||||
|
color: var(--app-primary-color, #a72b77);
|
||||||
|
font-size: 1rem;
|
||||||
|
font-weight: 700;
|
||||||
|
line-height: 1.5;
|
||||||
|
box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
|
||||||
|
z-index: 1999;
|
||||||
|
|
||||||
|
&__back {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
border: none;
|
||||||
|
background: transparent;
|
||||||
|
padding: 0;
|
||||||
|
color: inherit;
|
||||||
|
cursor: pointer;
|
||||||
|
font-family: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__title {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__trailing {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.mpage-subheader {
|
||||||
|
top: var(--mpage-subheader-offset);
|
||||||
|
z-index: 1999;
|
||||||
|
padding: 0.75rem;
|
||||||
|
background: #fff;
|
||||||
|
color: var(--app-primary-color, #a72b77);
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mpage-content {
|
||||||
|
padding-top: var(--mpage-header-offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
.mpage-content--with-subheader {
|
||||||
|
padding-top: var(--mpage-content-with-subheader);
|
||||||
|
}
|
||||||
|
|
||||||
|
.mpage-scroll {
|
||||||
|
overflow-y: auto;
|
||||||
|
max-height: var(--mpage-scroll-max-height);
|
||||||
|
}
|
||||||
|
|
||||||
|
.mobile-page-body--pt10 {
|
||||||
|
padding-top: calc(2.5rem + var(--app-safe-top, env(safe-area-inset-top, 0px)));
|
||||||
|
}
|
||||||
|
|
||||||
|
.mobile-page-body--pt15 {
|
||||||
|
padding-top: calc(3.75rem + var(--app-safe-top, env(safe-area-inset-top, 0px)));
|
||||||
|
}
|
||||||
|
|
||||||
|
.mobile-page-body--pt20 {
|
||||||
|
padding-top: calc(5rem + var(--app-safe-top, env(safe-area-inset-top, 0px)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Info pages (about, educate): fixed shell, scroll inside content box only */
|
||||||
|
.mobile-info-page {
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
height: 100%;
|
||||||
|
min-height: 0;
|
||||||
|
max-height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mobile-info-page__header {
|
||||||
|
z-index: 1999;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Decorative page background — fixed to viewport, never scrolls on iOS */
|
||||||
|
.mobile-page-bg,
|
||||||
|
.mobile-info-page__bg {
|
||||||
|
pointer-events: none;
|
||||||
|
position: fixed;
|
||||||
|
z-index: 0;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: var(--app-bottom-chrome-height, 80px);
|
||||||
|
overflow: hidden;
|
||||||
|
max-width: 100vw;
|
||||||
|
box-sizing: border-box;
|
||||||
|
|
||||||
|
img {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.mobile-page-bg--no-nav,
|
||||||
|
.mobile-info-page__bg {
|
||||||
|
bottom: var(--app-credit-footer-offset, 0px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.mobile-page-bg--cover {
|
||||||
|
background-size: cover;
|
||||||
|
background-position: center;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
}
|
||||||
|
|
||||||
|
html:not(.app-layout--desktop) {
|
||||||
|
@media screen and (min-width: 426px) and (max-width: 767.98px) {
|
||||||
|
.mobile-page-bg,
|
||||||
|
.mobile-info-page__bg {
|
||||||
|
width: 426px;
|
||||||
|
max-width: 426px;
|
||||||
|
left: 50%;
|
||||||
|
right: auto;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.mobile-info-page__main {
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
flex: 1 1 0;
|
||||||
|
min-height: 0;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
overflow: hidden;
|
||||||
|
padding-top: calc(var(--mpage-header-offset) + 1rem);
|
||||||
|
padding-right: 2.5rem;
|
||||||
|
padding-left: 2.5rem;
|
||||||
|
padding-bottom: calc(
|
||||||
|
var(--mobile-info-support-block, 5rem) + var(--app-credit-footer-offset, 0px) + 1.25rem
|
||||||
|
);
|
||||||
|
pointer-events: none;
|
||||||
|
|
||||||
|
> * {
|
||||||
|
pointer-events: auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.mobile-info-page__support {
|
||||||
|
bottom: var(--app-credit-footer-offset, 0px);
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding: 1rem 2.5rem;
|
||||||
|
padding-bottom: calc(1rem + var(--app-safe-bottom, env(safe-area-inset-bottom, 0px)));
|
||||||
|
background: #fff;
|
||||||
|
box-shadow: 0 -2px 8px rgba(15, 23, 42, 0.06);
|
||||||
|
z-index: 1998;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mobile-content-box {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
flex: 1 1 0;
|
||||||
|
min-height: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
margin-bottom: 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mobile-content-box__scroll {
|
||||||
|
flex: 1 1 0;
|
||||||
|
min-height: 0;
|
||||||
|
overflow-y: auto;
|
||||||
|
overflow-x: hidden;
|
||||||
|
-webkit-overflow-scrolling: touch;
|
||||||
|
overscroll-behavior-y: contain;
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
export interface AppNavItem {
|
||||||
|
id: string
|
||||||
|
routeName: string
|
||||||
|
label: string
|
||||||
|
icon: string
|
||||||
|
iconSrc?: string
|
||||||
|
authOnly?: boolean
|
||||||
|
guestOnly?: boolean
|
||||||
|
}
|
||||||
+1
-4
@@ -4,7 +4,6 @@ import 'virtual:uno.css'
|
|||||||
|
|
||||||
import { initPwaInstallCapture } from '@/modules/pwa/manifest'
|
import { initPwaInstallCapture } from '@/modules/pwa/manifest'
|
||||||
import { bootstrapApp } from '@/app/bootstrap'
|
import { bootstrapApp } from '@/app/bootstrap'
|
||||||
import { initWhatsappButtonDrag } from '@/utils/initWhatsappButtonDrag'
|
|
||||||
|
|
||||||
export {
|
export {
|
||||||
setTruth,
|
setTruth,
|
||||||
@@ -16,6 +15,4 @@ export {
|
|||||||
import '@unocss/reset/tailwind-compat.css'
|
import '@unocss/reset/tailwind-compat.css'
|
||||||
|
|
||||||
initPwaInstallCapture()
|
initPwaInstallCapture()
|
||||||
bootstrapApp().then(() => {
|
bootstrapApp()
|
||||||
initWhatsappButtonDrag()
|
|
||||||
})
|
|
||||||
|
|||||||
+18
-3
@@ -12,8 +12,23 @@ export interface Series {
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
export interface PriceUp {
|
||||||
|
buy: number
|
||||||
|
sell: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export type PriceStatus = 'open' | 'closed' | 'no_quote'
|
||||||
|
|
||||||
export interface Price {
|
export interface Price {
|
||||||
sell: number
|
sell: number
|
||||||
buy: number
|
buy: number
|
||||||
price_last: number
|
price: number
|
||||||
|
price_last: number
|
||||||
|
goldir?: number
|
||||||
|
up?: PriceUp
|
||||||
|
closed?: boolean
|
||||||
|
status?: PriceStatus
|
||||||
|
time?: string
|
||||||
|
main_product?: number
|
||||||
|
montzar?: number
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
export interface WalletAssetsMeta {
|
||||||
|
metal_ids: number[]
|
||||||
|
metal_count: number
|
||||||
|
has_count_based_products: boolean
|
||||||
|
has_weight_based_products: boolean
|
||||||
|
weight_unit: string
|
||||||
|
single_metal: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface WalletInventoryCard {
|
||||||
|
product_id: number
|
||||||
|
title: string
|
||||||
|
group_type: string
|
||||||
|
metal_id: number
|
||||||
|
quantity: number
|
||||||
|
unit: string
|
||||||
|
display_type: 'count' | 'weight'
|
||||||
|
unit_weight?: string | null
|
||||||
|
show_in_assets: boolean
|
||||||
|
is_melted?: boolean
|
||||||
|
is_main_wallet?: boolean
|
||||||
|
file?: { src?: string | null } | null
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface WalletMetalTotal {
|
||||||
|
metal_id: number
|
||||||
|
metal_label: string
|
||||||
|
label: string
|
||||||
|
product_weight: number
|
||||||
|
melted_weight: number
|
||||||
|
total_weight: number
|
||||||
|
unit: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface WalletAssetsSummary {
|
||||||
|
meta: WalletAssetsMeta
|
||||||
|
cash_wallet: number
|
||||||
|
inventory_cards: WalletInventoryCard[]
|
||||||
|
count_products: WalletInventoryCard[]
|
||||||
|
metal_totals: WalletMetalTotal[]
|
||||||
|
assets_rial_value: number
|
||||||
|
total_rial_value: number
|
||||||
|
profit_loss?: number
|
||||||
|
}
|
||||||
+5
-14
@@ -1,4 +1,5 @@
|
|||||||
import {createRouter, createWebHistory} from 'vue-router'
|
import {createRouter, createWebHistory} from 'vue-router'
|
||||||
|
import { getDefaultLandingRoute } from '@/config/project-profile'
|
||||||
|
|
||||||
const router = createRouter({
|
const router = createRouter({
|
||||||
history: createWebHistory(import.meta.env.BASE_URL),
|
history: createWebHistory(import.meta.env.BASE_URL),
|
||||||
@@ -17,7 +18,7 @@ const router = createRouter({
|
|||||||
{
|
{
|
||||||
path: `/`,
|
path: `/`,
|
||||||
name: 'main',
|
name: 'main',
|
||||||
redirect: {name: 'buyProduct'},
|
redirect: () => ({ name: getDefaultLandingRoute() }),
|
||||||
component: () => import('../views/base/index.vue'),
|
component: () => import('../views/base/index.vue'),
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
@@ -85,22 +86,12 @@ const router = createRouter({
|
|||||||
name: 'address',
|
name: 'address',
|
||||||
component: () => import('@/views/base/address/index.vue')
|
component: () => import('@/views/base/address/index.vue')
|
||||||
},
|
},
|
||||||
/* {
|
|
||||||
path: 'physicalReceive',
|
|
||||||
name: 'physicalReceive',
|
|
||||||
component: () => import('@/views/base/physicalReceive/index.vue'),
|
|
||||||
},*/
|
|
||||||
// {
|
|
||||||
// path: 'list',
|
|
||||||
// name: 'list',
|
|
||||||
// component: () => import('@/views/base/physicalReceive/components/RequestList.vue'),
|
|
||||||
// },
|
|
||||||
{
|
{
|
||||||
path: 'physicalReceive',
|
path: 'physicalReceive',
|
||||||
name: 'physicalReceive',
|
name: 'physicalReceive',
|
||||||
redirect:{name: 'list'},
|
redirect: { name: 'list' },
|
||||||
// component: () => import('@/views/base/physicalReceive/index.vue'),
|
component: () => import('@/views/base/physicalReceive/index.vue'),
|
||||||
children:[
|
children: [
|
||||||
{
|
{
|
||||||
path: '',
|
path: '',
|
||||||
name: 'list',
|
name: 'list',
|
||||||
|
|||||||
+12
-20
@@ -2,8 +2,8 @@ import { computed, ref } from 'vue'
|
|||||||
import { defineStore } from 'pinia'
|
import { defineStore } from 'pinia'
|
||||||
import type { CartItem } from '@/models/cart'
|
import type { CartItem } from '@/models/cart'
|
||||||
import type { Product } from '@/models/products'
|
import type { Product } from '@/models/products'
|
||||||
import type { Price } from '@/models/home'
|
import { getProductsCatalog } from '@/composables/useProductsCatalog'
|
||||||
import { getProducts } from '@/api/products'
|
import { getProductBuyPrice } from '@/utils/productPrice'
|
||||||
|
|
||||||
const CART_STORAGE_KEY = 'ghatre_cart'
|
const CART_STORAGE_KEY = 'ghatre_cart'
|
||||||
|
|
||||||
@@ -113,23 +113,13 @@ export const useCartStore = defineStore('cart', () => {
|
|||||||
return beforeCount - cartItems.value.length
|
return beforeCount - cartItems.value.length
|
||||||
}
|
}
|
||||||
|
|
||||||
function recalculateCartPrices(lastPrice: Price) {
|
function updateCartItemPrices() {
|
||||||
if (!lastPrice || cartItems.value.length === 0) return
|
if (cartItems.value.length === 0) return
|
||||||
|
|
||||||
cartItems.value.forEach((item) => {
|
cartItems.value.forEach((item) => {
|
||||||
const product = item.product
|
const buyPrice = getProductBuyPrice(item.product)
|
||||||
let newPrice = 0
|
item.price = buyPrice
|
||||||
|
item.totalPrice = parseInt(String(buyPrice * item.quantity))
|
||||||
if (product.group_type == 'آبشده') {
|
|
||||||
newPrice = lastPrice.price_last ?? 0
|
|
||||||
} else {
|
|
||||||
newPrice = product.amount * (lastPrice.price_last ?? 0)
|
|
||||||
}
|
|
||||||
|
|
||||||
product.price = newPrice
|
|
||||||
product.sellPrice = product.amount * (lastPrice.sell ?? 0)
|
|
||||||
item.price = newPrice + (product.cash_fee_buy ?? 0)
|
|
||||||
item.totalPrice = parseInt(String(item.price * item.quantity))
|
|
||||||
})
|
})
|
||||||
|
|
||||||
saveCartToStorage()
|
saveCartToStorage()
|
||||||
@@ -139,8 +129,10 @@ export const useCartStore = defineStore('cart', () => {
|
|||||||
if (cartItems.value.length === 0) return 0
|
if (cartItems.value.length === 0) return 0
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const serverProducts: Product[] = await getProducts()
|
const serverProducts: Product[] = await getProductsCatalog()
|
||||||
return syncProductsFromServer(serverProducts)
|
const removed = syncProductsFromServer(serverProducts)
|
||||||
|
updateCartItemPrices()
|
||||||
|
return removed
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('Error refreshing cart from server:', e)
|
console.error('Error refreshing cart from server:', e)
|
||||||
return 0
|
return 0
|
||||||
@@ -158,7 +150,7 @@ export const useCartStore = defineStore('cart', () => {
|
|||||||
loadCartFromStorage,
|
loadCartFromStorage,
|
||||||
saveCartToStorage,
|
saveCartToStorage,
|
||||||
syncProductsFromServer,
|
syncProductsFromServer,
|
||||||
recalculateCartPrices,
|
updateCartItemPrices,
|
||||||
refreshCartFromServer
|
refreshCartFromServer
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -6,3 +6,31 @@ export function getConfigApp(key: string) {
|
|||||||
}
|
}
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export {
|
||||||
|
getProjectDisplayName,
|
||||||
|
getDefaultLandingRoute,
|
||||||
|
hasHomePage,
|
||||||
|
hasAbshodeTrading,
|
||||||
|
hasProductShop,
|
||||||
|
isGhatreProject,
|
||||||
|
isKashkoolProject,
|
||||||
|
isBoursecuProject,
|
||||||
|
getProjectProfile,
|
||||||
|
getProjectProfileId,
|
||||||
|
} from '@/config/project-profile'
|
||||||
|
|
||||||
|
export {
|
||||||
|
getAppIconUrl,
|
||||||
|
getAppLogoUrl,
|
||||||
|
getAppLogoFullUrl,
|
||||||
|
resolveConfigAssetUrl,
|
||||||
|
} from '@/config/brand-assets'
|
||||||
|
|
||||||
|
export {
|
||||||
|
getAppPrimaryColor,
|
||||||
|
getAppSecondaryColor,
|
||||||
|
getAppTertiaryColor,
|
||||||
|
getAppBackgroundColor,
|
||||||
|
applyBrandTheme,
|
||||||
|
} from '@/config/brand-theme'
|
||||||
|
|||||||
@@ -1,158 +0,0 @@
|
|||||||
import {
|
|
||||||
buildSupportMessengerUrl,
|
|
||||||
loadSupportMessengerFromSettings,
|
|
||||||
supportMessengerSettings,
|
|
||||||
} from '@/utils/supportMessenger'
|
|
||||||
|
|
||||||
const STORAGE_KEY = 'ghatreh_whatsapp_button_position'
|
|
||||||
const DRAG_THRESHOLD = 6
|
|
||||||
const WIDTH = 60
|
|
||||||
const HEIGHT = 60
|
|
||||||
const DEFAULT_BOTTOM_OFFSET = 90
|
|
||||||
const DEFAULT_RIGHT_OFFSET = 20
|
|
||||||
|
|
||||||
type FabPosition = { x: number; y: number }
|
|
||||||
|
|
||||||
function getViewportWidth() {
|
|
||||||
return Math.min(window.innerWidth, 426)
|
|
||||||
}
|
|
||||||
|
|
||||||
function getHorizontalOffset() {
|
|
||||||
const vw = window.innerWidth
|
|
||||||
const contentWidth = getViewportWidth()
|
|
||||||
return Math.max(0, (vw - contentWidth) / 2)
|
|
||||||
}
|
|
||||||
|
|
||||||
function getDefaultPosition(): FabPosition {
|
|
||||||
const vh = window.innerHeight
|
|
||||||
const offsetX = getHorizontalOffset()
|
|
||||||
const contentWidth = getViewportWidth()
|
|
||||||
|
|
||||||
return {
|
|
||||||
x: offsetX + contentWidth - WIDTH - DEFAULT_RIGHT_OFFSET,
|
|
||||||
y: vh - DEFAULT_BOTTOM_OFFSET - HEIGHT,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function loadPosition(): FabPosition | null {
|
|
||||||
try {
|
|
||||||
const raw = localStorage.getItem(STORAGE_KEY)
|
|
||||||
if (!raw) return null
|
|
||||||
const parsed = JSON.parse(raw) as FabPosition
|
|
||||||
if (typeof parsed?.x === 'number' && typeof parsed?.y === 'number') {
|
|
||||||
return parsed
|
|
||||||
}
|
|
||||||
} catch {
|
|
||||||
// ignore
|
|
||||||
}
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
function savePosition(pos: FabPosition) {
|
|
||||||
localStorage.setItem(STORAGE_KEY, JSON.stringify(pos))
|
|
||||||
}
|
|
||||||
|
|
||||||
function clampPosition(pos: FabPosition): FabPosition {
|
|
||||||
const vw = window.innerWidth
|
|
||||||
const vh = window.innerHeight
|
|
||||||
|
|
||||||
return {
|
|
||||||
x: Math.max(0, Math.min(vw - WIDTH, pos.x)),
|
|
||||||
y: Math.max(0, Math.min(vh - HEIGHT, pos.y)),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function applyPosition(button: HTMLElement, pos: FabPosition) {
|
|
||||||
button.style.position = 'fixed'
|
|
||||||
button.style.bottom = 'auto'
|
|
||||||
button.style.right = 'auto'
|
|
||||||
button.style.left = `${pos.x}px`
|
|
||||||
button.style.top = `${pos.y}px`
|
|
||||||
button.style.touchAction = 'none'
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateWhatsappHref(button: HTMLAnchorElement) {
|
|
||||||
const link = buildSupportMessengerUrl(
|
|
||||||
supportMessengerSettings.value.messenger,
|
|
||||||
supportMessengerSettings.value.messengerId
|
|
||||||
)
|
|
||||||
|
|
||||||
button.href = link || '#'
|
|
||||||
button.style.display = 'flex'
|
|
||||||
}
|
|
||||||
|
|
||||||
export function initWhatsappButtonDrag() {
|
|
||||||
const button = document.getElementById('whatsapp-button') as HTMLAnchorElement | null
|
|
||||||
if (!button) return
|
|
||||||
|
|
||||||
let pos = clampPosition(loadPosition() ?? getDefaultPosition())
|
|
||||||
applyPosition(button, pos)
|
|
||||||
|
|
||||||
let pointerId: number | null = null
|
|
||||||
let startX = 0
|
|
||||||
let startY = 0
|
|
||||||
let originX = 0
|
|
||||||
let originY = 0
|
|
||||||
let hasMoved = false
|
|
||||||
let dragging = false
|
|
||||||
|
|
||||||
function onResize() {
|
|
||||||
pos = clampPosition(pos)
|
|
||||||
applyPosition(button!, pos)
|
|
||||||
savePosition(pos)
|
|
||||||
}
|
|
||||||
|
|
||||||
function onPointerDown(event: PointerEvent) {
|
|
||||||
dragging = true
|
|
||||||
hasMoved = false
|
|
||||||
pointerId = event.pointerId
|
|
||||||
startX = event.clientX
|
|
||||||
startY = event.clientY
|
|
||||||
originX = pos.x
|
|
||||||
originY = pos.y
|
|
||||||
button!.classList.add('is-dragging')
|
|
||||||
button!.setPointerCapture(event.pointerId)
|
|
||||||
event.preventDefault()
|
|
||||||
}
|
|
||||||
|
|
||||||
function onPointerMove(event: PointerEvent) {
|
|
||||||
if (!dragging || pointerId !== event.pointerId) return
|
|
||||||
|
|
||||||
const dx = event.clientX - startX
|
|
||||||
const dy = event.clientY - startY
|
|
||||||
|
|
||||||
if (Math.abs(dx) > DRAG_THRESHOLD || Math.abs(dy) > DRAG_THRESHOLD) {
|
|
||||||
hasMoved = true
|
|
||||||
}
|
|
||||||
|
|
||||||
pos = clampPosition({ x: originX + dx, y: originY + dy })
|
|
||||||
applyPosition(button!, pos)
|
|
||||||
}
|
|
||||||
|
|
||||||
function finishPointer(event: PointerEvent) {
|
|
||||||
if (!dragging || pointerId !== event.pointerId) return
|
|
||||||
|
|
||||||
dragging = false
|
|
||||||
pointerId = null
|
|
||||||
button!.classList.remove('is-dragging')
|
|
||||||
savePosition(pos)
|
|
||||||
|
|
||||||
const clicked = !hasMoved
|
|
||||||
hasMoved = false
|
|
||||||
|
|
||||||
if (clicked && button!.href && button!.href !== '#') {
|
|
||||||
window.open(button!.href, '_blank', 'noopener,noreferrer')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
button.addEventListener('pointerdown', onPointerDown)
|
|
||||||
button.addEventListener('pointermove', onPointerMove)
|
|
||||||
button.addEventListener('pointerup', finishPointer)
|
|
||||||
button.addEventListener('pointercancel', finishPointer)
|
|
||||||
button.addEventListener('click', (event) => event.preventDefault())
|
|
||||||
window.addEventListener('resize', onResize)
|
|
||||||
|
|
||||||
void loadSupportMessengerFromSettings().then(() => {
|
|
||||||
updateWhatsappHref(button)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
+16
-2
@@ -32,9 +32,23 @@ import { computed, ref } from 'vue'
|
|||||||
import type { Rule } from 'ant-design-vue/es/form'
|
import type { Rule } from 'ant-design-vue/es/form'
|
||||||
import { useWalletStore } from '@/store/walletStore'
|
import { useWalletStore } from '@/store/walletStore'
|
||||||
import {isToken} from "@/utils/index";
|
import {isToken} from "@/utils/index";
|
||||||
|
import { persianToEnglishDigits } from '@/utils/persianDigits'
|
||||||
|
|
||||||
export const mobileValidation = (title?: string) => {
|
export const mobileValidation = (title?: string): Rule => {
|
||||||
return { len: 11, message: `شماره همراه باید 11 رقم باشد` }
|
const label = title ?? 'شماره تلفن'
|
||||||
|
return {
|
||||||
|
validator: (_rule, value) => {
|
||||||
|
const normalized = persianToEnglishDigits(String(value ?? '').trim())
|
||||||
|
if (!normalized) {
|
||||||
|
return Promise.resolve()
|
||||||
|
}
|
||||||
|
if (!/^09\d{9}$/.test(normalized)) {
|
||||||
|
return Promise.reject(`${label} باید با 09 شروع شود و 11 رقم باشد`)
|
||||||
|
}
|
||||||
|
return Promise.resolve()
|
||||||
|
},
|
||||||
|
trigger: ['change', 'blur'],
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const required = (title?: string) => {
|
export const required = (title?: string) => {
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
const PERSIAN_DIGITS = '۰۱۲۳۴۵۶۷۸۹'
|
||||||
|
const ARABIC_DIGITS = '٠١٢٣٤٥٦٧٨٩'
|
||||||
|
|
||||||
|
/** تبدیل ارقام فارسی/عربی و جداکننده اعشار به فرمت انگلیسی */
|
||||||
|
export function persianToEnglishDigits(value: string | number | null | undefined): string {
|
||||||
|
if (value == null) {
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
|
||||||
|
return String(value)
|
||||||
|
.replace(/[۰-۹]/g, (d) => String(PERSIAN_DIGITS.indexOf(d)))
|
||||||
|
.replace(/[٠-٩]/g, (d) => String(ARABIC_DIGITS.indexOf(d)))
|
||||||
|
.replace(/٫/g, '.')
|
||||||
|
}
|
||||||
|
|
||||||
|
export function shouldNormalizeInputDigits(options: {
|
||||||
|
isPassword?: boolean
|
||||||
|
type?: string
|
||||||
|
inputmode?: string
|
||||||
|
}): boolean {
|
||||||
|
if (options.isPassword) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if (options.type === 'price' || options.type === 'number') {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
const mode = String(options.inputmode ?? '').trim().toLowerCase()
|
||||||
|
return mode === 'numeric' || mode === 'decimal' || mode === 'number'
|
||||||
|
}
|
||||||
+25
-6
@@ -20,14 +20,28 @@ export const olderPrice = ref<number | undefined>(0)
|
|||||||
let lastPriceSourceAt = 0
|
let lastPriceSourceAt = 0
|
||||||
let consecutivePriceFetchFailures = 0
|
let consecutivePriceFetchFailures = 0
|
||||||
|
|
||||||
|
/** buy/sell نمایش و معامله — همان buy/sell/price_last از /api/price/last */
|
||||||
|
export function getTradeBuyPrice(p?: Price | null) {
|
||||||
|
return p?.buy ?? p?.price_last ?? p?.up?.buy ?? 0
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getTradeSellPrice(p?: Price | null) {
|
||||||
|
return p?.sell ?? p?.up?.sell ?? 0
|
||||||
|
}
|
||||||
|
|
||||||
|
/** up جدا نگه داشته میشود؛ buy/sell/price_last از lastPrice سرور دستنخورده میماند */
|
||||||
|
export function normalizePriceResponse(data: Price): Price {
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
|
||||||
function hasValidPricePayload(data?: Price | null): boolean {
|
function hasValidPricePayload(data?: Price | null): boolean {
|
||||||
if (!data) {
|
if (!data) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
Number(data.buy ?? data.up?.buy ?? 0) > 0
|
getTradeBuyPrice(data) > 0
|
||||||
|| Number(data.sell ?? data.up?.sell ?? 0) > 0
|
|| getTradeSellPrice(data) > 0
|
||||||
|| Number(data.price_last ?? data.price ?? 0) > 0
|
|| Number(data.price_last ?? data.price ?? 0) > 0
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -147,13 +161,18 @@ export async function getLastPrices(): Promise<boolean> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function applyLastPricePayload(dataLast: Price) {
|
export function applyLastPricePayload(dataLast: Price) {
|
||||||
if (lastPrice.value?.price_last != dataLast.price_last) {
|
const normalized = normalizePriceResponse(dataLast)
|
||||||
|
if (lastPrice.value?.price_last != normalized.price_last) {
|
||||||
olderPrice.value = lastPrice.value?.price_last
|
olderPrice.value = lastPrice.value?.price_last
|
||||||
}
|
}
|
||||||
lastPrice.value = dataLast
|
lastPrice.value = normalized
|
||||||
price.value = dataLast
|
price.value = {
|
||||||
|
...normalized,
|
||||||
|
buy: getTradeBuyPrice(normalized),
|
||||||
|
sell: getTradeSellPrice(normalized),
|
||||||
|
}
|
||||||
|
|
||||||
if (hasValidPricePayload(dataLast)) {
|
if (hasValidPricePayload(normalized)) {
|
||||||
markPriceSourceReceived()
|
markPriceSourceReceived()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -189,16 +189,14 @@ async function runFallbackPoll() {
|
|||||||
const { getLastPrices, hasRecentPriceFromSource, markPriceSourceFetchFailed } = await import(
|
const { getLastPrices, hasRecentPriceFromSource, markPriceSourceFetchFailed } = await import(
|
||||||
'@/utils/price'
|
'@/utils/price'
|
||||||
)
|
)
|
||||||
const { getProducts } = await import('@/api/products')
|
const { refreshProductsPageData } = await import(
|
||||||
const { applyProductsListFromStream: applyList } = await import('@/utils/productStreamBridge')
|
'@/views/base/products/composables/useProductsPageData'
|
||||||
const [lastResult, products] = await Promise.allSettled([
|
)
|
||||||
getLastPrices(),
|
|
||||||
getProducts(),
|
|
||||||
])
|
|
||||||
|
|
||||||
if (products.status === 'fulfilled' && Array.isArray(products.value) && products.value.length) {
|
const [lastResult] = await Promise.allSettled([
|
||||||
applyList(products.value)
|
getLastPrices(),
|
||||||
}
|
refreshProductsPageData(),
|
||||||
|
])
|
||||||
|
|
||||||
const priceOk =
|
const priceOk =
|
||||||
lastResult.status === 'fulfilled'
|
lastResult.status === 'fulfilled'
|
||||||
|
|||||||
@@ -0,0 +1,71 @@
|
|||||||
|
import type { Product } from '@/models/products'
|
||||||
|
import type { WalletInventoryCard, WalletMetalTotal } from '@/models/walletAssets'
|
||||||
|
import { resolveProductImageSrc } from '@/utils/productImage'
|
||||||
|
|
||||||
|
export function fundPageInventoryCards<T extends { quantity?: number }>(cards: T[]): T[] {
|
||||||
|
return cards.filter((card) => Number(card.quantity ?? 0) > 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function resolveSummaryMetalWeight(
|
||||||
|
metal: { total_weight: number },
|
||||||
|
_cards?: Array<{ metal_id?: number; quantity?: number }>
|
||||||
|
): number {
|
||||||
|
return Number(metal.total_weight ?? 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function enrichInventoryCardsWithCatalog<T extends WalletInventoryCard>(
|
||||||
|
cards: T[],
|
||||||
|
catalog: Product[]
|
||||||
|
): T[] {
|
||||||
|
return cards.map((card) => {
|
||||||
|
const fromCatalog = catalog.find((product) => product.id === card.product_id)
|
||||||
|
if (!fromCatalog) {
|
||||||
|
return card
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
...card,
|
||||||
|
file: card.file ?? fromCatalog.file ?? null,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getProductDisplayImage(product?: {
|
||||||
|
group_type?: string | null
|
||||||
|
title?: string | null
|
||||||
|
file?: { src?: string | null } | null
|
||||||
|
img?: string | null
|
||||||
|
} | null): string {
|
||||||
|
return resolveProductImageSrc(product)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function formatMetalTotal(
|
||||||
|
metal: WalletMetalTotal,
|
||||||
|
inventoryCards: WalletInventoryCard[]
|
||||||
|
): string {
|
||||||
|
return `${resolveSummaryMetalWeight(metal, inventoryCards)}${metal.unit}`
|
||||||
|
}
|
||||||
|
|
||||||
|
export function resolveAssetsRialValue(
|
||||||
|
summary: {
|
||||||
|
total_rial_value?: number
|
||||||
|
assets_rial_value?: number
|
||||||
|
cash_wallet?: number
|
||||||
|
} | null | undefined,
|
||||||
|
liveGoldPrice = 0
|
||||||
|
): number {
|
||||||
|
const total = Number(summary?.total_rial_value ?? 0)
|
||||||
|
if (total > 0) {
|
||||||
|
return total
|
||||||
|
}
|
||||||
|
|
||||||
|
const cash = Number(summary?.cash_wallet ?? 0)
|
||||||
|
const assetsRial = Number(summary?.assets_rial_value ?? 0)
|
||||||
|
if (assetsRial > 0) {
|
||||||
|
return cash + assetsRial
|
||||||
|
}
|
||||||
|
|
||||||
|
const metalWeight = (summary as { metal_totals?: Array<{ total_weight?: number }> } | null)
|
||||||
|
?.metal_totals?.[0]?.total_weight
|
||||||
|
return cash + Number(metalWeight ?? 0) * liveGoldPrice
|
||||||
|
}
|
||||||
@@ -0,0 +1,103 @@
|
|||||||
|
import type { Product } from '@/models/products'
|
||||||
|
import { getTradeBuyPrice, getTradeSellPrice, lastPrice } from '@/utils/price'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* قیمتگیری ماژولار محصول در حالت فروشگاهی (is_store=true).
|
||||||
|
*
|
||||||
|
* منبع حقیقت قیمت و وضعیت نمایش، سرور است: `/customer/product/list` و رویداد SSE
|
||||||
|
* `list` هر دو قیمت هر محصول (`price`/`price_profit`) و `show` را محاسبهشده میفرستند.
|
||||||
|
* این ماژول فقط همان قیمت سرور را میخواند و فقط برای آبشده وقتی قیمت سرور صفر است
|
||||||
|
* به قیمت زندهٔ مرجع (`lastPrice`) fallback میکند — هیچجا قیمت سرور بازنویسی نمیشود.
|
||||||
|
*/
|
||||||
|
|
||||||
|
const MELTED_GROUP = 'آبشده'
|
||||||
|
|
||||||
|
export function isMeltedProduct(product?: Product | null): boolean {
|
||||||
|
return product?.group_type === MELTED_GROUP
|
||||||
|
}
|
||||||
|
|
||||||
|
/** قیمت پایهٔ خرید (بدون کارمزد) — قیمت سرور، با fallback زندهٔ آبشده وقتی سرور صفر است */
|
||||||
|
export function getProductBaseBuyPrice(product?: Product | null): number {
|
||||||
|
if (!product) {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
const serverPrice = Number(product.price ?? 0)
|
||||||
|
if (serverPrice > 0) {
|
||||||
|
return serverPrice
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isMeltedProduct(product)) {
|
||||||
|
const liveBuy = getTradeBuyPrice(lastPrice.value)
|
||||||
|
if (liveBuy > 0) {
|
||||||
|
const amount = Number(product.amount ?? 0)
|
||||||
|
return amount > 0 ? liveBuy * amount : liveBuy
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
/** قیمت خرید نمایشی محصول (همان مقداری که در لیست و صفحهٔ محصول نشان داده میشود) */
|
||||||
|
export function getProductBuyPrice(product?: Product | null): number {
|
||||||
|
const base = getProductBaseBuyPrice(product)
|
||||||
|
if (base <= 0) {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
return base + Number(product?.cash_fee_buy ?? 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** قیمت پایهٔ فروش (بدون کارمزد) — قیمت فروش سرور، با fallback زندهٔ آبشده */
|
||||||
|
export function getProductBaseSellPrice(product?: Product | null): number {
|
||||||
|
if (!product) {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
const serverSell = Number(product.sellPrice ?? 0)
|
||||||
|
if (serverSell > 0) {
|
||||||
|
return serverSell
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isMeltedProduct(product)) {
|
||||||
|
const liveSell = getTradeSellPrice(lastPrice.value)
|
||||||
|
if (liveSell > 0) {
|
||||||
|
const amount = Number(product.amount ?? 0)
|
||||||
|
return amount > 0 ? liveSell * amount : liveSell
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return getProductBaseBuyPrice(product)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** قیمت فروش نمایشی محصول */
|
||||||
|
export function getProductSellPrice(product?: Product | null): number {
|
||||||
|
const base = getProductBaseSellPrice(product)
|
||||||
|
if (base <= 0) {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
return base - Number(product?.cash_fee_sell ?? 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** محصول وقتی قیمت پایهٔ معتبری ندارد، غیرفعال (غیرقابل معامله) است */
|
||||||
|
export function isProductPriceInactive(product?: Product | null): boolean {
|
||||||
|
return getProductBaseBuyPrice(product) <= 0
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* نمایش محصول در فروشگاه — اولویت با `show` سرور.
|
||||||
|
* فقط برای آبشدهای که قیمت سرورش هنوز نرسیده، با قیمت زنده تکمیل میکنیم.
|
||||||
|
*/
|
||||||
|
export function isProductVisible(product?: Product | null): boolean {
|
||||||
|
if (!product || product.active === false) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
if (product.show) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// سازگاری: آبشدهای که سرور هنوز قیمت نداده ولی قیمت زنده موجود است
|
||||||
|
return isMeltedProduct(product) && getProductBaseBuyPrice(product) > 0
|
||||||
|
}
|
||||||
@@ -3,10 +3,15 @@ import type { Product } from '@/models/products'
|
|||||||
type ProductListHandler = (products: Product[]) => void
|
type ProductListHandler = (products: Product[]) => void
|
||||||
|
|
||||||
const handlers = new Set<ProductListHandler>()
|
const handlers = new Set<ProductListHandler>()
|
||||||
|
let lastProductsList: Product[] | null = null
|
||||||
|
|
||||||
export function subscribeProductListStream(handler: ProductListHandler) {
|
export function subscribeProductListStream(handler: ProductListHandler) {
|
||||||
handlers.add(handler)
|
handlers.add(handler)
|
||||||
|
|
||||||
|
if (lastProductsList?.length) {
|
||||||
|
handler(lastProductsList)
|
||||||
|
}
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
handlers.delete(handler)
|
handlers.delete(handler)
|
||||||
}
|
}
|
||||||
@@ -17,5 +22,10 @@ export function applyProductsListFromStream(products: Product[]) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lastProductsList = products
|
||||||
handlers.forEach((handler) => handler(products))
|
handlers.forEach((handler) => handler(products))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getLastStreamProductsList(): Product[] | null {
|
||||||
|
return lastProductsList
|
||||||
|
}
|
||||||
|
|||||||
+46
-1
@@ -1,6 +1,6 @@
|
|||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import { useSettingsStore } from '@/store/settingsStore'
|
import { useSettingsStore } from '@/store/settingsStore'
|
||||||
import { lastPrice } from '@/utils/price'
|
import { getTradeBuyPrice, getTradeSellPrice, lastPrice } from '@/utils/price'
|
||||||
|
|
||||||
export interface StoreTradingHours {
|
export interface StoreTradingHours {
|
||||||
start: string
|
start: string
|
||||||
@@ -162,3 +162,48 @@ export function getStoreClosedMessage(): string {
|
|||||||
|
|
||||||
return `فروشگاه در حال حاضر بسته است. ساعت کاری از ${open} تا ${close} میباشد.`
|
return `فروشگاه در حال حاضر بسته است. ساعت کاری از ${open} تا ${close} میباشد.`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type PriceDisplayState = 'open' | 'closed' | 'no_quote'
|
||||||
|
|
||||||
|
export const NO_QUOTE_MESSAGE = 'مظنه در دسترس نیست'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* وضعیت نمایش قیمت در صفحه اصلی:
|
||||||
|
* - closed → فروشگاه بسته است (خارج از ساعت کاری close_price یا بازه محصول)
|
||||||
|
* - no_quote → مظنه در دسترس نیست (قیمت زنده نداریم و show_last_price خاموش است)
|
||||||
|
* - open → نمایش عادی قیمت
|
||||||
|
*
|
||||||
|
* اولویت با status ارسالی از سرور است؛ اگر نبود به منطق سمت کلاینت برمیگردیم.
|
||||||
|
*/
|
||||||
|
export function getPriceDisplayState(): PriceDisplayState {
|
||||||
|
void productTradingHoursVersion.value
|
||||||
|
const p = lastPrice.value
|
||||||
|
const status = p?.status
|
||||||
|
|
||||||
|
if (status === 'closed') {
|
||||||
|
return 'closed'
|
||||||
|
}
|
||||||
|
if (status === 'no_quote') {
|
||||||
|
return getTradeBuyPrice(p) > 0 ? 'open' : 'no_quote'
|
||||||
|
}
|
||||||
|
if (status === 'open') {
|
||||||
|
return getTradeBuyPrice(p) > 0 || getTradeSellPrice(p) > 0 ? 'open' : 'no_quote'
|
||||||
|
}
|
||||||
|
|
||||||
|
// سرور status نفرستاده (سازگاری با نسخه قدیمی) → استنتاج سمت کلاینت
|
||||||
|
if (isStoreClosed()) {
|
||||||
|
return 'closed'
|
||||||
|
}
|
||||||
|
|
||||||
|
return getTradeBuyPrice(p) > 0 || getTradeSellPrice(p) > 0 ? 'open' : 'no_quote'
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getPriceDisplayMessage(state: PriceDisplayState = getPriceDisplayState()): string {
|
||||||
|
if (state === 'closed') {
|
||||||
|
return getStoreClosedMessage()
|
||||||
|
}
|
||||||
|
if (state === 'no_quote') {
|
||||||
|
return NO_QUOTE_MESSAGE
|
||||||
|
}
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
|||||||
+75
-43
@@ -55,61 +55,93 @@ _axios.interceptors.response.use(
|
|||||||
return response.data
|
return response.data
|
||||||
},
|
},
|
||||||
async function (error) {
|
async function (error) {
|
||||||
if (error.response.data && error.response.data.message) {
|
const response = error.response
|
||||||
|
const config = error.config as MyAxiosRequestConfig | undefined
|
||||||
|
|
||||||
checkStatus(error.response.data.message, error.response.status, error.config)
|
if (response?.status === 401) {
|
||||||
}
|
|
||||||
|
|
||||||
//console.log('this is error on interceptors.response', error.config.meta)
|
|
||||||
/* if (error.response && (error.response.status == 401 || error.response.status == 400)) {
|
|
||||||
//debugger
|
|
||||||
removeToken()
|
|
||||||
router.push({ name: 'login' })
|
|
||||||
}*/
|
|
||||||
if (error.response && error.response.status == 401) {
|
|
||||||
///removeToken()
|
|
||||||
console.log('error')
|
|
||||||
removeToken()
|
removeToken()
|
||||||
// Don't redirect to login if user is on buyProduct page
|
|
||||||
if (router.currentRoute.value.name !== 'buyProduct') {
|
if (router.currentRoute.value.name !== 'buyProduct') {
|
||||||
await router.push({name: 'login'})
|
await router.push({name: 'login'})
|
||||||
}
|
}
|
||||||
} else if (error.response && error.response.status == 403) {
|
return Promise.reject(error)
|
||||||
message.error('شما دسترسی لازم برای انجام این عملیات را ندارید')
|
|
||||||
} else if (error.response && error.response.status == 422) {
|
|
||||||
// message.error(error.response.data?.message)
|
|
||||||
} else if (error.response) {
|
|
||||||
message.error('خطا در بارگذاری اطلاعات')
|
|
||||||
}
|
}
|
||||||
// Any status codes that falls outside the range of 2xx cause this function to trigger
|
|
||||||
// Do something with response error
|
|
||||||
|
|
||||||
//const { response, code, message, config } = error || {}
|
if (!shouldShowApiError(config)) {
|
||||||
//const errorMessageMode = config?.requestOptions?.errorMessageMode || 'none'
|
return Promise.reject(error)
|
||||||
//const msg: string = response?.data?.error?.message ?? ''
|
}
|
||||||
//checkStatus(error?.response?.status, msg)
|
|
||||||
|
const apiMessage = extractApiErrorMessage(response?.data)
|
||||||
|
|
||||||
|
if (response?.status === 403) {
|
||||||
|
showApiError(apiMessage || 'شما دسترسی لازم برای انجام این عملیات را ندارید', config)
|
||||||
|
return Promise.reject(error)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (response?.status === 422) {
|
||||||
|
if (apiMessage) {
|
||||||
|
showApiError(apiMessage, config)
|
||||||
|
}
|
||||||
|
return Promise.reject(error)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (response) {
|
||||||
|
showApiError(apiMessage || DEFAULT_LOAD_ERROR, config)
|
||||||
|
return Promise.reject(error)
|
||||||
|
}
|
||||||
|
|
||||||
|
showApiError(DEFAULT_LOAD_ERROR, config)
|
||||||
return Promise.reject(error)
|
return Promise.reject(error)
|
||||||
})
|
})
|
||||||
|
|
||||||
function checkStatus(msg: string, code: number, config: any) {
|
const DEFAULT_LOAD_ERROR = 'خطا در بارگذاری اطلاعات'
|
||||||
//const { code, data, message } = data
|
|
||||||
const errorMessage = get(config, 'meta.errorMessage', 'message')
|
function extractApiErrorMessage(data: unknown): string {
|
||||||
/*if (config.meta) {
|
if (!data || typeof data !== 'object') {
|
||||||
if (config.meta.message) {
|
return ''
|
||||||
errorMessage = config.meta.message
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
// console.log('this is config', config)
|
|
||||||
if (errorMessage == 'none') return
|
|
||||||
switch (errorMessage) {
|
|
||||||
case 'message':
|
|
||||||
message.error(msg)
|
|
||||||
break
|
|
||||||
default:
|
|
||||||
message.error(msg)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const record = data as Record<string, unknown>
|
||||||
|
const rawMessage = record.message
|
||||||
|
|
||||||
|
if (typeof rawMessage === 'string' && rawMessage.trim()) {
|
||||||
|
return rawMessage.trim()
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof rawMessage === 'number') {
|
||||||
|
return String(rawMessage)
|
||||||
|
}
|
||||||
|
|
||||||
|
const rawError = record.error
|
||||||
|
if (typeof rawError === 'string' && rawError.trim()) {
|
||||||
|
return rawError.trim()
|
||||||
|
}
|
||||||
|
|
||||||
|
const errors = record.errors
|
||||||
|
if (errors && typeof errors === 'object') {
|
||||||
|
for (const value of Object.values(errors as Record<string, unknown>)) {
|
||||||
|
if (Array.isArray(value) && typeof value[0] === 'string' && value[0].trim()) {
|
||||||
|
return value[0].trim()
|
||||||
|
}
|
||||||
|
if (typeof value === 'string' && value.trim()) {
|
||||||
|
return value.trim()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function shouldShowApiError(config: MyAxiosRequestConfig | undefined): boolean {
|
||||||
|
return get(config, 'meta.errorMessage', 'message') !== 'none'
|
||||||
|
}
|
||||||
|
|
||||||
|
function showApiError(msg: string, config: MyAxiosRequestConfig | undefined) {
|
||||||
|
if (!shouldShowApiError(config)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
message.error(msg)
|
||||||
|
}
|
||||||
|
|
||||||
const myAxios = {
|
const myAxios = {
|
||||||
//AxiosResponse<T>
|
//AxiosResponse<T>
|
||||||
|
|||||||
@@ -1,24 +1,53 @@
|
|||||||
import { computed, onMounted, onUnmounted, ref } from 'vue'
|
import { computed, onMounted, onUnmounted, ref } from 'vue'
|
||||||
|
|
||||||
const DRAG_THRESHOLD = 6
|
const DRAG_THRESHOLD = 6
|
||||||
|
const POSITION_VERSION = 1
|
||||||
|
|
||||||
type FabPosition = { x: number; y: number }
|
type FabPosition = { x: number; y: number }
|
||||||
|
|
||||||
|
type SavedFabOffset = {
|
||||||
|
version: number
|
||||||
|
dx: number
|
||||||
|
dy: number
|
||||||
|
}
|
||||||
|
|
||||||
type DraggableFloatingOptions = {
|
type DraggableFloatingOptions = {
|
||||||
width?: number
|
width?: number
|
||||||
height?: number
|
height?: number
|
||||||
defaultBottomOffset?: number
|
defaultBottomGap?: number
|
||||||
defaultRightOffset?: number
|
defaultRightOffset?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function readBottomChromeHeight(): number {
|
||||||
|
const styles = getComputedStyle(document.documentElement)
|
||||||
|
const direct = parseFloat(styles.getPropertyValue('--app-bottom-chrome-height'))
|
||||||
|
if (!Number.isNaN(direct) && direct > 0) {
|
||||||
|
return direct
|
||||||
|
}
|
||||||
|
|
||||||
|
const nav = parseFloat(styles.getPropertyValue('--app-nav-height')) || 80
|
||||||
|
const creditOffset = parseFloat(styles.getPropertyValue('--app-credit-footer-offset'))
|
||||||
|
if (!Number.isNaN(creditOffset) && creditOffset > 0) {
|
||||||
|
return nav + creditOffset
|
||||||
|
}
|
||||||
|
|
||||||
|
const probe = document.createElement('div')
|
||||||
|
probe.style.cssText = 'position:fixed;visibility:hidden;pointer-events:none;height:var(--app-bottom-chrome-height)'
|
||||||
|
document.body.appendChild(probe)
|
||||||
|
const measured = probe.getBoundingClientRect().height
|
||||||
|
document.body.removeChild(probe)
|
||||||
|
|
||||||
|
return measured > 0 ? measured : nav
|
||||||
|
}
|
||||||
|
|
||||||
export function useDraggableFloatingButton(
|
export function useDraggableFloatingButton(
|
||||||
storageKey: string,
|
storageKey: string,
|
||||||
options: DraggableFloatingOptions = {}
|
options: DraggableFloatingOptions = {}
|
||||||
) {
|
) {
|
||||||
const width = options.width ?? 96
|
const width = options.width ?? 96
|
||||||
const height = options.height ?? 44
|
const height = options.height ?? 44
|
||||||
const defaultBottomOffset = options.defaultBottomOffset ?? 92
|
const defaultBottomGap = options.defaultBottomGap ?? 12
|
||||||
const defaultRightOffset = options.defaultRightOffset ?? 20
|
const defaultRightOffset = options.defaultRightOffset ?? 16
|
||||||
|
|
||||||
const pos = ref<FabPosition>({ x: 0, y: 0 })
|
const pos = ref<FabPosition>({ x: 0, y: 0 })
|
||||||
const dragging = ref(false)
|
const dragging = ref(false)
|
||||||
@@ -44,26 +73,40 @@ export function useDraggableFloatingButton(
|
|||||||
function getHorizontalOffset() {
|
function getHorizontalOffset() {
|
||||||
const vw = window.innerWidth
|
const vw = window.innerWidth
|
||||||
const contentWidth = getViewportWidth()
|
const contentWidth = getViewportWidth()
|
||||||
|
|
||||||
return Math.max(0, (vw - contentWidth) / 2)
|
return Math.max(0, (vw - contentWidth) / 2)
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetToDefault() {
|
function getDefaultPosition(): FabPosition {
|
||||||
const vh = window.innerHeight
|
const vh = window.innerHeight
|
||||||
const offsetX = getHorizontalOffset()
|
const offsetX = getHorizontalOffset()
|
||||||
const contentWidth = getViewportWidth()
|
const contentWidth = getViewportWidth()
|
||||||
|
const bottomChrome = readBottomChromeHeight()
|
||||||
|
|
||||||
pos.value = {
|
return {
|
||||||
x: offsetX + contentWidth - width - defaultRightOffset,
|
x: offsetX + contentWidth - width - defaultRightOffset,
|
||||||
y: vh - defaultBottomOffset - height
|
y: vh - bottomChrome - defaultBottomGap - height
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function applySavedOffset(dx: number, dy: number) {
|
||||||
|
const base = getDefaultPosition()
|
||||||
|
pos.value = {
|
||||||
|
x: base.x + dx,
|
||||||
|
y: base.y + dy
|
||||||
|
}
|
||||||
|
clampToViewport()
|
||||||
|
}
|
||||||
|
|
||||||
function clampToViewport() {
|
function clampToViewport() {
|
||||||
const vw = window.innerWidth
|
|
||||||
const vh = window.innerHeight
|
const vh = window.innerHeight
|
||||||
|
const offsetX = getHorizontalOffset()
|
||||||
|
const contentWidth = getViewportWidth()
|
||||||
|
const minX = offsetX
|
||||||
|
const maxX = offsetX + contentWidth - width
|
||||||
|
|
||||||
pos.value = {
|
pos.value = {
|
||||||
x: Math.max(0, Math.min(vw - width, pos.value.x)),
|
x: Math.max(minX, Math.min(maxX, pos.value.x)),
|
||||||
y: Math.max(0, Math.min(vh - height, pos.value.y))
|
y: Math.max(0, Math.min(vh - height, pos.value.y))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -72,25 +115,56 @@ export function useDraggableFloatingButton(
|
|||||||
try {
|
try {
|
||||||
const raw = localStorage.getItem(storageKey)
|
const raw = localStorage.getItem(storageKey)
|
||||||
if (!raw) return false
|
if (!raw) return false
|
||||||
const parsed = JSON.parse(raw) as FabPosition
|
|
||||||
if (typeof parsed?.x === 'number' && typeof parsed?.y === 'number') {
|
const parsed = JSON.parse(raw) as SavedFabOffset
|
||||||
pos.value = parsed
|
if (
|
||||||
clampToViewport()
|
parsed?.version === POSITION_VERSION
|
||||||
|
&& typeof parsed.dx === 'number'
|
||||||
|
&& typeof parsed.dy === 'number'
|
||||||
|
) {
|
||||||
|
applySavedOffset(parsed.dx, parsed.dy)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
function savePosition() {
|
function savePosition() {
|
||||||
localStorage.setItem(storageKey, JSON.stringify(pos.value))
|
const base = getDefaultPosition()
|
||||||
|
const payload: SavedFabOffset = {
|
||||||
|
version: POSITION_VERSION,
|
||||||
|
dx: pos.value.x - base.x,
|
||||||
|
dy: pos.value.y - base.y
|
||||||
|
}
|
||||||
|
localStorage.setItem(storageKey, JSON.stringify(payload))
|
||||||
|
}
|
||||||
|
|
||||||
|
function resetToDefault() {
|
||||||
|
pos.value = getDefaultPosition()
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleResize() {
|
function handleResize() {
|
||||||
clampToViewport()
|
try {
|
||||||
savePosition()
|
const raw = localStorage.getItem(storageKey)
|
||||||
|
if (raw) {
|
||||||
|
const parsed = JSON.parse(raw) as SavedFabOffset
|
||||||
|
if (
|
||||||
|
parsed?.version === POSITION_VERSION
|
||||||
|
&& typeof parsed.dx === 'number'
|
||||||
|
&& typeof parsed.dy === 'number'
|
||||||
|
) {
|
||||||
|
applySavedOffset(parsed.dx, parsed.dy)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
|
||||||
|
resetToDefault()
|
||||||
}
|
}
|
||||||
|
|
||||||
function handlePointerDown(event: PointerEvent) {
|
function handlePointerDown(event: PointerEvent) {
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
export interface AboutSection {
|
||||||
|
title?: string
|
||||||
|
paragraphs?: string[]
|
||||||
|
items?: string[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getAboutSections(projectName: string): AboutSection[] {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
paragraphs: [`${projectName} وبسایت رسمی است.`],
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
<template>
|
||||||
|
<div
|
||||||
|
class="dabout-content dabout-content--default"
|
||||||
|
:class="variant === 'desktop' ? 'dabout-content--default' : 'bg-primary text-white rounded-[12px] p-4 text-xs leading-5'"
|
||||||
|
>
|
||||||
|
<template v-for="(section, sectionIndex) in aboutSections" :key="sectionIndex">
|
||||||
|
<div
|
||||||
|
v-if="sectionIndex > 0"
|
||||||
|
:class="variant === 'desktop' ? 'dabout-content__divider' : 'w-full h-1px my-3 bg-tertiary'"
|
||||||
|
/>
|
||||||
|
<div
|
||||||
|
v-for="(paragraph, paragraphIndex) in section.paragraphs ?? []"
|
||||||
|
:key="`p-${sectionIndex}-${paragraphIndex}`"
|
||||||
|
:class="[variant === 'desktop' ? 'dabout-content__paragraph' : '', paragraphIndex > 0 ? 'mt-3' : '']"
|
||||||
|
>
|
||||||
|
{{ paragraph }}
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { useAboutPageContext } from '../composables/useAboutPage'
|
||||||
|
|
||||||
|
withDefaults(defineProps<{ variant?: 'mobile' | 'desktop' }>(), { variant: 'mobile' })
|
||||||
|
|
||||||
|
const { aboutSections } = useAboutPageContext()
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
<template>
|
||||||
|
<div :class="variant === 'desktop' ? 'dabout-support' : 'wrap-fix bottom-0 px-10 py-6 flex gap-2 bg-white items-center'">
|
||||||
|
<a class="w-full" :href="supportHref" target="_blank" rel="noopener noreferrer">
|
||||||
|
<BasicButton class="w-full" type="primary">تماس با پشتیبانی</BasicButton>
|
||||||
|
</a>
|
||||||
|
<a :href="supportHref" target="_blank" rel="noopener noreferrer">
|
||||||
|
<img
|
||||||
|
src="@/assets/img/rubika.webp"
|
||||||
|
alt=""
|
||||||
|
:class="variant === 'desktop' ? 'dabout-support__bale' : 'w-12'"
|
||||||
|
/>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
|
||||||
|
import { useAboutPageContext } from '../composables/useAboutPage'
|
||||||
|
|
||||||
|
withDefaults(defineProps<{ variant?: 'mobile' | 'desktop' }>(), { variant: 'mobile' })
|
||||||
|
|
||||||
|
const { supportHref } = useAboutPageContext()
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
import { computed, inject, provide, type InjectionKey, type ComputedRef } from 'vue'
|
||||||
|
import { getConfig } from '@/config/app-config'
|
||||||
|
import { getAboutSections, type AboutSection } from '../aboutContent'
|
||||||
|
|
||||||
|
export interface AboutPageContext {
|
||||||
|
projectName: ComputedRef<string>
|
||||||
|
aboutSections: ComputedRef<AboutSection[]>
|
||||||
|
supportHref: ComputedRef<string>
|
||||||
|
}
|
||||||
|
|
||||||
|
export const ABOUT_PAGE_CONTEXT_KEY: InjectionKey<AboutPageContext> = Symbol('aboutPageContext')
|
||||||
|
|
||||||
|
const SUPPORT_LINK = 'https://web.rubika.ir/#c=u0I8F1U0a939b0df5ba9f73618d33d7c'
|
||||||
|
|
||||||
|
export function useAboutPage() {
|
||||||
|
const projectName = computed(() => getConfig('name_fa', 'کشکول گلد'))
|
||||||
|
const aboutSections = computed(() => getAboutSections(projectName.value))
|
||||||
|
const supportHref = computed(() => SUPPORT_LINK)
|
||||||
|
|
||||||
|
const context: AboutPageContext = { projectName, aboutSections, supportHref }
|
||||||
|
provide(ABOUT_PAGE_CONTEXT_KEY, context)
|
||||||
|
return context
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useAboutPageContext() {
|
||||||
|
const context = inject(ABOUT_PAGE_CONTEXT_KEY)
|
||||||
|
if (!context) throw new Error('useAboutPageContext must be used within useAboutPage')
|
||||||
|
return context
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
<template>
|
||||||
|
<div class="dabout">
|
||||||
|
<div class="dabout__container">
|
||||||
|
<DesktopPageTopbar eyebrow="اطلاعات" title="درباره ما" show-back />
|
||||||
|
|
||||||
|
<div class="dabout-layout">
|
||||||
|
<section class="dabout-surface dabout-main">
|
||||||
|
<div class="dabout-main__intro">
|
||||||
|
<div class="dabout-main__logo">
|
||||||
|
<BasicIcon icon="vuesax-linear:info-circle" size="28" />
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<h2 class="dabout-main__project">{{ projectName }}</h2>
|
||||||
|
<p class="dabout-main__tagline">آشنایی با خدمات و چشمانداز ما</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<AboutSectionsContent variant="desktop" />
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<aside class="dabout-surface dabout-side">
|
||||||
|
<h3 class="dabout-side__title">پشتیبانی و ارتباط</h3>
|
||||||
|
<p class="dabout-side__text">
|
||||||
|
در صورت نیاز به راهنمایی یا پاسخ به سوالات، از راههای زیر با ما در ارتباط باشید.
|
||||||
|
</p>
|
||||||
|
<AboutSupportActions variant="desktop" />
|
||||||
|
</aside>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
|
||||||
|
import DesktopPageTopbar from '@/layouts/components/DesktopPageTopbar.vue'
|
||||||
|
import AboutSectionsContent from '../components/AboutSectionsContent.vue'
|
||||||
|
import AboutSupportActions from '../components/AboutSupportActions.vue'
|
||||||
|
import { useAboutPageContext } from '../composables/useAboutPage'
|
||||||
|
|
||||||
|
const { projectName } = useAboutPageContext()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" src="./styles/desktop-about.less"></style>
|
||||||
@@ -0,0 +1,234 @@
|
|||||||
|
/* Premium desktop about page */
|
||||||
|
|
||||||
|
.dabout {
|
||||||
|
min-height: 100%;
|
||||||
|
background: #f6f7f9;
|
||||||
|
color: #111827;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dabout__container {
|
||||||
|
max-width: 1080px;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 28px 36px 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dabout-topbar {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 16px;
|
||||||
|
margin-bottom: 28px;
|
||||||
|
padding-bottom: 24px;
|
||||||
|
border-bottom: 1px solid rgba(15, 23, 42, 0.06);
|
||||||
|
|
||||||
|
&__back {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
border: none;
|
||||||
|
background: transparent;
|
||||||
|
color: #6b7280;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 500;
|
||||||
|
font-family: inherit;
|
||||||
|
cursor: pointer;
|
||||||
|
padding: 8px 0;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
color: #111827;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&__meta {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__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;
|
||||||
|
line-height: 1.2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.dabout-layout {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: minmax(0, 1fr) minmax(0, 300px);
|
||||||
|
gap: 20px;
|
||||||
|
align-items: start;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dabout-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);
|
||||||
|
}
|
||||||
|
|
||||||
|
.dabout-main {
|
||||||
|
padding: 28px;
|
||||||
|
|
||||||
|
&__intro {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 16px;
|
||||||
|
margin-bottom: 24px;
|
||||||
|
padding-bottom: 20px;
|
||||||
|
border-bottom: 1px solid #eef0f3;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__logo {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 56px;
|
||||||
|
height: 56px;
|
||||||
|
border-radius: 14px;
|
||||||
|
background: rgba(9, 61, 81, 0.08);
|
||||||
|
color: var(--app-primary-color, #a72b77);
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__project {
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #111827;
|
||||||
|
margin: 0 0 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__tagline {
|
||||||
|
font-size: 13px;
|
||||||
|
color: #6b7280;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.dabout-content {
|
||||||
|
&--default {
|
||||||
|
padding: 0;
|
||||||
|
background: transparent;
|
||||||
|
color: #374151;
|
||||||
|
}
|
||||||
|
|
||||||
|
&--boursecu {
|
||||||
|
padding: 20px;
|
||||||
|
border: 1px solid rgba(9, 61, 81, 0.15);
|
||||||
|
border-radius: 12px;
|
||||||
|
background: rgba(9, 61, 81, 0.03);
|
||||||
|
color: var(--app-primary-color, #a72b77);
|
||||||
|
}
|
||||||
|
|
||||||
|
&__divider {
|
||||||
|
width: 100%;
|
||||||
|
height: 1px;
|
||||||
|
background: #eef0f3;
|
||||||
|
margin: 20px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__title {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: inherit;
|
||||||
|
margin: 0 0 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__paragraph {
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 1.9;
|
||||||
|
color: inherit;
|
||||||
|
text-align: justify;
|
||||||
|
margin: 0 0 12px;
|
||||||
|
|
||||||
|
&:last-child {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&__list {
|
||||||
|
list-style: none;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__list-item {
|
||||||
|
position: relative;
|
||||||
|
padding-right: 16px;
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 1.7;
|
||||||
|
color: inherit;
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
top: 10px;
|
||||||
|
width: 6px;
|
||||||
|
height: 6px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: currentColor;
|
||||||
|
opacity: 0.6;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.dabout-side {
|
||||||
|
padding: 24px;
|
||||||
|
position: sticky;
|
||||||
|
top: 24px;
|
||||||
|
|
||||||
|
&__title {
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #111827;
|
||||||
|
margin: 0 0 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__text {
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 1.7;
|
||||||
|
color: #6b7280;
|
||||||
|
margin: 0 0 20px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.dabout-support {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
|
||||||
|
> a:first-child {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__bale {
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
object-fit: contain;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 1023.98px) {
|
||||||
|
.dabout-layout {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dabout-side {
|
||||||
|
position: static;
|
||||||
|
}
|
||||||
|
}
|
||||||
+12
-184
@@ -1,195 +1,23 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div class="about-page-root">
|
||||||
<div class="bg-white wrap-fix z-200001 py-3 px-3 text-primary font-bold drop-shadow flex">
|
<DesktopAboutView v-show="isDesktop" />
|
||||||
<div @click="router.back()" class="cursor-pointer">
|
<MobileAboutView v-show="!isDesktop" />
|
||||||
<BasicIcon icon="vuesax-linear:arrow-right-1" />
|
|
||||||
</div>
|
|
||||||
<div class="mr-2">درباره ما</div>
|
|
||||||
</div>
|
|
||||||
<div class="pt-20">
|
|
||||||
<div>
|
|
||||||
<img :src="img" alt="" class="mt-2 w-full absolute bottom-0" />
|
|
||||||
</div>
|
|
||||||
<div class="text-justify text-base z-200000 relative">
|
|
||||||
<div class="px-10">
|
|
||||||
<!-- <img :src="logoFull" class="mb-20 mt-5" />-->
|
|
||||||
<div class="overflow-y-auto h-65vh">
|
|
||||||
<div class="bg-primary text-white rounded-[12px] p-4 text-xs leading-5">
|
|
||||||
<div class="w-full h-1px my-3 bg-tertiary"></div>
|
|
||||||
<div>
|
|
||||||
کشکول گلد وبسایت رسمی تست.
|
|
||||||
</div>
|
|
||||||
<!-- <div class="mt-3">-->
|
|
||||||
<!-- این وبسایت با پشتوانه سه مجموعه معتبر نور هشتم فعالیت میکند و امکان خرید شمش طلا را از وزنهای خرد تا معاملات عمده، با قیمت شفاف و امنیت کامل فراهم میسازد.-->
|
|
||||||
<!-- </div>-->
|
|
||||||
<!-- <div class="mt-3">-->
|
|
||||||
<!-- تمامی فرآیندهای خرید در کشکول گلد بر اساس استانداردهای حرفهای بازار طلا و با اتکا به اعتبار مجموعههای نور هشتم مشهد، نورهشتم فردوس و نورهشتم (داماس) بجستان انجام میشود تا کاربران با آرامش و اطمینان کامل اقدام به خرید کنند.-->
|
|
||||||
<!-- </div>-->
|
|
||||||
<!-- <div class="mt-3">-->
|
|
||||||
<!-- کشکول گلدکشکول گلد، بانکی از طلا بساز...-->
|
|
||||||
<!-- </div>-->
|
|
||||||
<!-- <div class="mt-3">-->
|
|
||||||
<!-- برای ارتباط حضوری، دریافت مشاوره و اطمینان بیشتر، کاربران میتوانند از طریق آدرسهای سه شعبه رسمی نور هشتم با مجموعه در ارتباط باشند و از پشتیبانی مستقیم مجموعه بهرهمند شوند.-->
|
|
||||||
<!-- </div>-->
|
|
||||||
<!-- <div class="w-full h-1px my-3 bg-tertiary"></div>-->
|
|
||||||
<!-- <div class="mt-3 text-xl font-bold">چرا کشکول گلد؟</div>
|
|
||||||
<div class="mt-3">
|
|
||||||
۱. خرید بدون اجرت و مالیات
|
|
||||||
طلایی که از اپلیکیشن کشکول گلد خریداری میکنید، بدون اجرت ساخت و مالیات محاسبه میشود و تنها ۰.۵٪ کارمزد از شما دریافت خواهد شد.
|
|
||||||
</div>
|
|
||||||
<div class="mt-3">
|
|
||||||
۲. خرید بدون محدودیت
|
|
||||||
در کشکول گلد میتوانید از ۵۰ سوت تا چند کیلوگرم طلا را بهصورت آنلاین و بدون هیچگونه محدودیت مکانی خریداری کنید
|
|
||||||
</div>
|
|
||||||
<div class="mt-3">
|
|
||||||
۳. فعالیت در ساعات رسمی معاملات طلا
|
|
||||||
برای رعایت قوانین صنف طلا و جلوگیری از خالیفروشی، فعالیت اپلیکیشن کشکول گلد منطبق با ساعات رسمی معاملات اتحادیه طلافروشان کشور است.
|
|
||||||
</div>
|
|
||||||
<div class="mt-3">
|
|
||||||
۴. امکان تحویل فیزیکی طلا
|
|
||||||
کشکول گلد دارای شعب حضوری معتبر با مجوز خردهفروشی طلاست تا کاربران بتوانند در صورت تمایل، طلای خریداریشده خود را بهصورت فیزیکی تحویل بگیرند و از نزدیک از اصالت آن اطمینان حاصل کنند.
|
|
||||||
</div>
|
|
||||||
<div class="w-full h-1px my-3 bg-tertiary"></div>-->
|
|
||||||
<!-- <div class="mt-3">-->
|
|
||||||
<!-- آدرس شعب ما:-->
|
|
||||||
<!-- </div>-->
|
|
||||||
<!-- <div class="mt-3">-->
|
|
||||||
<!-- مشهد : خیابان امام خمینی / برج طلا و جواهر مرمر / طبقه همکف / واحد 16 / طلا و سکه نورهشتم-->
|
|
||||||
<!-- </div>-->
|
|
||||||
<!-- <div class="mt-3">-->
|
|
||||||
<!-- فردوس : خیابان امام خمینی / بعد از امام خمینی 11 / طلا و سکه نورهشتم-->
|
|
||||||
<!-- </div>-->
|
|
||||||
<!-- <div class="mt-3">-->
|
|
||||||
<!-- بجستان : خیابان امام خمینی / چهارراه وحدت / طلا و جواهر داماس [طلا و سکه نورهشتم]-->
|
|
||||||
<!-- </div>-->
|
|
||||||
<!-- <div class="w-full h-1px my-3 bg-tertiary"></div>-->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="wrap-fix bottom-0 px-10 py-6 flex gap-2 bg-white items-center">
|
|
||||||
<a class="w-full" href="https://web.rubika.ir/#">
|
|
||||||
<BasicButton class="w-full" type="primary">تماس با پشتیبانی</BasicButton>
|
|
||||||
</a>
|
|
||||||
<a href="https://web.rubika.ir/#">
|
|
||||||
<img src="@/assets/img/rubika.webp" alt="" class=" w-12"/>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- <ActionSheet v-model:show="editPassVisible">salam</ActionSheet>-->
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { onMounted, reactive, ref } from 'vue'
|
import { useDesktopBreakpoint } from '@/layouts/composables/useAppLayout'
|
||||||
import img from '@/assets/img/user_ly1.svg'
|
import { useAboutPage } from './composables/useAboutPage'
|
||||||
import gr_bottom from './assets/img/gr_bottom_white.svg'
|
import DesktopAboutView from './desktop/DesktopAboutView.vue'
|
||||||
import { loading } from '@/utils'
|
import MobileAboutView from './mobile/MobileAboutView.vue'
|
||||||
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
|
|
||||||
import BasicActionSheet from '@/components/BasicPacks/BasicActionSheet.vue'
|
|
||||||
import { lengthValidation, required } from '@/utils/inputRules'
|
|
||||||
import BasicInput from '@/components/BasicPacks/BasicInput.vue'
|
|
||||||
import type { User } from '@/models/login'
|
|
||||||
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
|
|
||||||
import router from '@/router'
|
|
||||||
import type { FormInstance } from 'ant-design-vue'
|
|
||||||
import { message } from 'ant-design-vue'
|
|
||||||
import { updateMe } from '@/api/me'
|
|
||||||
import { useUserStore } from '@/store/userStore'
|
|
||||||
import BaseDatePicker from '@/components/BasicPacks/BaseDatePicker'
|
|
||||||
import img_pattern from "@/views/login/assets/img/pattern.svg";
|
|
||||||
|
|
||||||
const userFormState = ref<User>({
|
const isDesktop = useDesktopBreakpoint()
|
||||||
fname: '',
|
useAboutPage()
|
||||||
lname: '',
|
|
||||||
mobile: undefined,
|
|
||||||
birth_date: '',
|
|
||||||
phone_number: '',
|
|
||||||
province: '',
|
|
||||||
city: '',
|
|
||||||
n_code: undefined
|
|
||||||
})
|
|
||||||
const formRef = ref<FormInstance>()
|
|
||||||
const userStore = useUserStore()
|
|
||||||
|
|
||||||
// const editPassVisible = ref<boolean>(false)
|
|
||||||
const editPassVisible = ref<boolean>(false)
|
|
||||||
|
|
||||||
function setForm() {
|
|
||||||
userFormState.value = userStore.userInfo
|
|
||||||
}
|
|
||||||
|
|
||||||
function copyCode() {
|
|
||||||
// nextTick(() => {
|
|
||||||
const val = userStore.userInfo?.referral_id
|
|
||||||
navigator.clipboard.writeText(val)
|
|
||||||
message.info('کد رونوشت شد')
|
|
||||||
// })
|
|
||||||
}
|
|
||||||
|
|
||||||
function shareCode() {
|
|
||||||
// nextTick(() => {
|
|
||||||
const val = `⭐️الان طلا بخر؛ آخر ماه سودشو ببر!
|
|
||||||
با خرید طلای آبشده در مقدارهای کم ولی مستمر، سود بیشتری ببر!
|
|
||||||
|
|
||||||
این دعوت نامه از طرف "${userStore.userInfo?.name}" عزیز برای شما ارسال شده تا شما هم از بازار طلای کشکول گلد جا نمونید.
|
|
||||||
روی لینک زیر کلیک کنید و ثبت نام خود را تکمیل کنید.
|
|
||||||
|
|
||||||
kh.kashkolgold.ir/login?id=${userStore.userInfo?.referral_id}`
|
|
||||||
navigator.share({
|
|
||||||
title: 'کشکول گلد',
|
|
||||||
text: val
|
|
||||||
})
|
|
||||||
// message.info('کد رونوشت شد')
|
|
||||||
// })
|
|
||||||
}
|
|
||||||
|
|
||||||
const resetData = () => {
|
|
||||||
formRef.value?.resetFields()
|
|
||||||
userFormState.value = {
|
|
||||||
fname: '',
|
|
||||||
lname: '',
|
|
||||||
mobile: undefined,
|
|
||||||
birth_date: '',
|
|
||||||
phone_number: '',
|
|
||||||
province: '',
|
|
||||||
city: '',
|
|
||||||
n_code: undefined
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
setForm()
|
|
||||||
})
|
|
||||||
|
|
||||||
function ok() {
|
|
||||||
formRef.value?.validateFields().then(async () => {
|
|
||||||
try {
|
|
||||||
loading.value = true
|
|
||||||
await updateMe(userFormState.value)
|
|
||||||
await userStore.getMyInfo()
|
|
||||||
editPassVisible.value = false
|
|
||||||
message.success('اطلاعات شما با موفقیت به روز رسانی شد')
|
|
||||||
} catch (e) {
|
|
||||||
console.log(e)
|
|
||||||
} finally {
|
|
||||||
loading.value = false
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
/*.fade-enter-active,
|
.about-page-root {
|
||||||
.fade-leave-active {
|
min-height: 100%;
|
||||||
transition: opacity 0.2s ease;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.fade-enter-from,
|
|
||||||
.fade-leave-to {
|
|
||||||
opacity: 0;
|
|
||||||
}*/
|
|
||||||
/*.trans{
|
|
||||||
transition: height 1s;
|
|
||||||
}*/
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<MobilePageHeader title="درباره ما" show-back />
|
||||||
|
<div class="mpage-content pb-[calc(var(--app-bottom-chrome-height)+1rem)]">
|
||||||
|
<div class="px-5">
|
||||||
|
<AboutSectionsContent variant="mobile" />
|
||||||
|
</div>
|
||||||
|
<AboutSupportActions variant="mobile" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import MobilePageHeader from '@/layouts/components/MobilePageHeader.vue'
|
||||||
|
import AboutSectionsContent from '../components/AboutSectionsContent.vue'
|
||||||
|
import AboutSupportActions from '../components/AboutSupportActions.vue'
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,309 @@
|
|||||||
|
import { computed, inject, onMounted, onUnmounted, provide, ref, watch, type InjectionKey } from 'vue'
|
||||||
|
import { message, Modal } from 'ant-design-vue'
|
||||||
|
import { useCartStore } from '@/store/cartStore'
|
||||||
|
import { useWalletStore } from '@/store/walletStore'
|
||||||
|
import { useWalletAssets } from '@/composables/useWalletAssets'
|
||||||
|
import { checkoutCart } from '@/api/card'
|
||||||
|
import { registerCodeDiscount } from '@/api/giftCard'
|
||||||
|
import { getProductBaseBuyPrice } from '@/utils/productPrice'
|
||||||
|
import { subscribeProductListStream } from '@/utils/productStreamBridge'
|
||||||
|
import {
|
||||||
|
getLastPrices,
|
||||||
|
lastPrice,
|
||||||
|
startLastPricePolling,
|
||||||
|
stopPriceInterval,
|
||||||
|
} from '@/utils/price'
|
||||||
|
import {
|
||||||
|
priceSocketConnected,
|
||||||
|
priceStreamLifecycle,
|
||||||
|
priceWssEnabled,
|
||||||
|
shouldUsePricePolling,
|
||||||
|
} from '@/utils/priceSocketState'
|
||||||
|
import { getToken, loading } from '@/utils'
|
||||||
|
import router from '@/router'
|
||||||
|
import type { Price } from '@/models/home'
|
||||||
|
import type { Order } from '@/models/order'
|
||||||
|
import type { Product } from '@/models/products'
|
||||||
|
|
||||||
|
export interface CartPageContext {
|
||||||
|
cartStore: ReturnType<typeof useCartStore>
|
||||||
|
loading: typeof loading
|
||||||
|
infoVisible: ReturnType<typeof ref<boolean>>
|
||||||
|
showDiscountModal: ReturnType<typeof ref<boolean>>
|
||||||
|
discountCode: ReturnType<typeof ref<string>>
|
||||||
|
discountInfo: ReturnType<typeof ref<any>>
|
||||||
|
price: ReturnType<typeof computed<Price>>
|
||||||
|
totalPrice: ReturnType<typeof computed<number>>
|
||||||
|
displaytotalPrice: ReturnType<typeof computed<number | string>>
|
||||||
|
discountPercentLabel: ReturnType<typeof computed<string>>
|
||||||
|
formatWeight: (weight?: number) => string
|
||||||
|
handleRemoveItem: (itemId: string) => void
|
||||||
|
handleCheckout: () => Promise<void>
|
||||||
|
submitDiscount: () => Promise<void>
|
||||||
|
removeDiscount: () => void
|
||||||
|
}
|
||||||
|
|
||||||
|
export const CART_PAGE_CONTEXT_KEY: InjectionKey<CartPageContext> = Symbol('cartPageContext')
|
||||||
|
|
||||||
|
export function useCartPage() {
|
||||||
|
const cartStore = useCartStore()
|
||||||
|
const walletStore = useWalletStore()
|
||||||
|
const { loadWalletAssets } = useWalletAssets()
|
||||||
|
const infoVisible = ref(false)
|
||||||
|
const showDiscountModal = ref(false)
|
||||||
|
const discountCode = ref('')
|
||||||
|
const discountInfo = ref<any>()
|
||||||
|
|
||||||
|
let cartRefreshInterval: ReturnType<typeof setInterval> | undefined
|
||||||
|
let unsubscribeProductStream: (() => void) | undefined
|
||||||
|
|
||||||
|
const price = computed((): Price => <Price>lastPrice.value ?? 0)
|
||||||
|
|
||||||
|
function syncCartFromProducts(products: Product[]) {
|
||||||
|
if (cartStore.itemCount === 0) return
|
||||||
|
const removedCount = cartStore.syncProductsFromServer(products)
|
||||||
|
cartStore.updateCartItemPrices()
|
||||||
|
if (removedCount > 0) {
|
||||||
|
message.warning(`${removedCount} محصول از سبد خرید حذف شد (دیگر در دسترس نیست)`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(lastPrice, () => {
|
||||||
|
if (lastPrice.value && cartStore.itemCount > 0) {
|
||||||
|
cartStore.updateCartItemPrices()
|
||||||
|
}
|
||||||
|
}, { deep: true, immediate: false })
|
||||||
|
|
||||||
|
const totalPrice = computed(() =>
|
||||||
|
parseInt(String(cartStore.cartItems.reduce((sum, item) => sum + item.totalPrice, 0)))
|
||||||
|
)
|
||||||
|
|
||||||
|
const displaytotalPrice = computed(() => {
|
||||||
|
if (discountInfo.value?.amount > 0) {
|
||||||
|
return (totalPrice.value - totalPrice.value * discountInfo.value.amount).toFixed(0)
|
||||||
|
}
|
||||||
|
return totalPrice.value
|
||||||
|
})
|
||||||
|
|
||||||
|
const discountPercentLabel = computed(() => {
|
||||||
|
const amount = Number(discountInfo.value?.amount ?? 0)
|
||||||
|
if (amount <= 0) return ''
|
||||||
|
return `${Math.round(amount * 100)}٪`
|
||||||
|
})
|
||||||
|
|
||||||
|
function removeDiscount() {
|
||||||
|
discountInfo.value = undefined
|
||||||
|
discountCode.value = ''
|
||||||
|
message.success('کد تخفیف حذف شد')
|
||||||
|
}
|
||||||
|
|
||||||
|
async function submitDiscount() {
|
||||||
|
try {
|
||||||
|
loading.value = true
|
||||||
|
const temp = await registerCodeDiscount(discountCode.value)
|
||||||
|
discountInfo.value = temp.giftcard
|
||||||
|
message.success('کد تخفیف با موفقیت اعمال شد')
|
||||||
|
showDiscountModal.value = false
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatWeight(weight?: number) {
|
||||||
|
if (!weight) return ''
|
||||||
|
if (weight < 1) {
|
||||||
|
const sot = weight * 1000
|
||||||
|
return sot < 1 ? '1 سوت' : `${Math.round(sot)} سوت`
|
||||||
|
}
|
||||||
|
return `${weight} گرم`
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleRemoveItem(itemId: string) {
|
||||||
|
Modal.confirm({
|
||||||
|
title: 'حذف از سبد خرید',
|
||||||
|
content: 'آیا از حذف این آیتم از سبد خرید اطمینان دارید؟',
|
||||||
|
okText: 'تایید',
|
||||||
|
okType: 'danger',
|
||||||
|
centered: true,
|
||||||
|
cancelText: 'انصراف',
|
||||||
|
onOk() {
|
||||||
|
cartStore.removeFromCart(itemId)
|
||||||
|
message.success('آیتم از سبد خرید حذف شد')
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleCheckout() {
|
||||||
|
if (!getToken()) {
|
||||||
|
message.warning('برای تسویه حساب، لطفا ابتدا وارد حساب کاربری خود شوید')
|
||||||
|
await router.push({ name: 'login' })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (cartStore.itemCount === 0) {
|
||||||
|
message.warning('سبد خرید شما خالی است')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!lastPrice.value) {
|
||||||
|
message.error('لطفا منتظر بمانید تا قیمتها بارگذاری شوند')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
let cashItemsTotal = cartStore.cartItems
|
||||||
|
.filter((item) => item.method === 'cash' && !item.gateway)
|
||||||
|
.reduce((sum, item) => parseInt(String(sum + item.totalPrice)), 0)
|
||||||
|
|
||||||
|
if (cashItemsTotal > 0) {
|
||||||
|
if (discountInfo.value?.amount > 0) {
|
||||||
|
cashItemsTotal -= cashItemsTotal * discountInfo.value.amount
|
||||||
|
}
|
||||||
|
if (!walletStore.walletInfo) await walletStore.getMyWallet()
|
||||||
|
if (!walletStore.walletInfo?.cash || cashItemsTotal > walletStore.walletInfo.cash) {
|
||||||
|
message.error('موجودی کیف پول شما ناکافی است')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const goldItemsTotal = cartStore.cartItems
|
||||||
|
.filter((item) => item.method === 'gold')
|
||||||
|
.reduce((sum, item) => sum + (item.goldVazn ? item.goldVazn * item.quantity : 0), 0)
|
||||||
|
|
||||||
|
if (goldItemsTotal > 0) {
|
||||||
|
if (!walletStore.walletInfo) await walletStore.getMyWallet()
|
||||||
|
if (!walletStore.walletInfo?.gold || goldItemsTotal > walletStore.walletInfo.gold) {
|
||||||
|
message.error('موجودی کیف طلا شما ناکافی است')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
infoVisible.value = true
|
||||||
|
const orders: Order[] = cartStore.cartItems.map((item) => ({
|
||||||
|
direction: 1,
|
||||||
|
price: getProductBaseBuyPrice(item.product),
|
||||||
|
amount: item.product.amount,
|
||||||
|
gateway: item.gateway,
|
||||||
|
product_id: item.product.id,
|
||||||
|
method: item.method,
|
||||||
|
number: item.quantity,
|
||||||
|
discount_code: discountInfo.value?.code,
|
||||||
|
}))
|
||||||
|
|
||||||
|
const data = await checkoutCart(orders)
|
||||||
|
let returnUrl: string | null = null
|
||||||
|
if (Array.isArray(data)) {
|
||||||
|
const itemWithReturnUrl = data.find((item) => item?.returnUrl)
|
||||||
|
if (itemWithReturnUrl?.returnUrl) returnUrl = itemWithReturnUrl.returnUrl
|
||||||
|
} else if (data?.returnUrl) {
|
||||||
|
returnUrl = data.returnUrl
|
||||||
|
}
|
||||||
|
|
||||||
|
if (returnUrl) {
|
||||||
|
window.location.href = returnUrl
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
await walletStore.getMyWallet()
|
||||||
|
cartStore.clearCart()
|
||||||
|
await router.push({ name: 'transactions' })
|
||||||
|
message.success('سفارشات شما با موفقیت ثبت شد')
|
||||||
|
await loadWalletAssets(true)
|
||||||
|
} catch (e) {
|
||||||
|
console.error('Error in checkout:', e)
|
||||||
|
message.error('خطا در ثبت سفارش. لطفا دوباره تلاش کنید.')
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
infoVisible.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function initPrice() {
|
||||||
|
try {
|
||||||
|
if (shouldUsePricePolling()) await getLastPrices()
|
||||||
|
startLastPricePolling()
|
||||||
|
cartStore.updateCartItemPrices()
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function refreshCart() {
|
||||||
|
const removedCount = await cartStore.refreshCartFromServer()
|
||||||
|
if (removedCount > 0) {
|
||||||
|
message.warning(`${removedCount} محصول از سبد خرید حذف شد (دیگر در دسترس نیست)`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function startCartRefreshPolling() {
|
||||||
|
if (cartRefreshInterval || !shouldUsePricePolling()) return
|
||||||
|
cartRefreshInterval = setInterval(() => {
|
||||||
|
if (shouldUsePricePolling()) void refreshCart()
|
||||||
|
}, 10000)
|
||||||
|
}
|
||||||
|
|
||||||
|
function stopCartRefreshPolling() {
|
||||||
|
if (cartRefreshInterval) {
|
||||||
|
clearInterval(cartRefreshInterval)
|
||||||
|
cartRefreshInterval = undefined
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function syncCartRefreshPolling() {
|
||||||
|
if (shouldUsePricePolling()) startCartRefreshPolling()
|
||||||
|
else stopCartRefreshPolling()
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => [priceWssEnabled.value, priceSocketConnected.value, priceStreamLifecycle.value] as const,
|
||||||
|
() => {
|
||||||
|
syncCartRefreshPolling()
|
||||||
|
if (shouldUsePricePolling() && cartStore.itemCount > 0) void refreshCart()
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
cartStore.loadCartFromStorage()
|
||||||
|
unsubscribeProductStream = subscribeProductListStream(syncCartFromProducts)
|
||||||
|
loading.value = true
|
||||||
|
try {
|
||||||
|
await initPrice()
|
||||||
|
if (shouldUsePricePolling()) await refreshCart()
|
||||||
|
syncCartRefreshPolling()
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
onUnmounted(() => {
|
||||||
|
unsubscribeProductStream?.()
|
||||||
|
unsubscribeProductStream = undefined
|
||||||
|
stopCartRefreshPolling()
|
||||||
|
stopPriceInterval()
|
||||||
|
})
|
||||||
|
|
||||||
|
const context: CartPageContext = {
|
||||||
|
cartStore,
|
||||||
|
loading,
|
||||||
|
infoVisible,
|
||||||
|
showDiscountModal,
|
||||||
|
discountCode,
|
||||||
|
discountInfo,
|
||||||
|
price,
|
||||||
|
totalPrice,
|
||||||
|
displaytotalPrice,
|
||||||
|
discountPercentLabel,
|
||||||
|
formatWeight,
|
||||||
|
handleRemoveItem,
|
||||||
|
handleCheckout,
|
||||||
|
submitDiscount,
|
||||||
|
removeDiscount,
|
||||||
|
}
|
||||||
|
|
||||||
|
provide(CART_PAGE_CONTEXT_KEY, context)
|
||||||
|
return context
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useCartPageContext() {
|
||||||
|
const context = inject(CART_PAGE_CONTEXT_KEY)
|
||||||
|
if (!context) throw new Error('useCartPageContext must be used within useCartPage')
|
||||||
|
return context
|
||||||
|
}
|
||||||
@@ -0,0 +1,184 @@
|
|||||||
|
<template>
|
||||||
|
<div class="dinner cart-page">
|
||||||
|
<div class="dinner__container">
|
||||||
|
<DesktopPageTopbar title="سبد خرید" show-back>
|
||||||
|
<template #trailing>
|
||||||
|
<div v-if="price" class="dcart-header-price number-ltr">
|
||||||
|
<span class="dcart-header-price__label">قیمت خرید از کشکول گلد:</span>
|
||||||
|
<strong>{{ usePriceWithoutType(price?.price_last ?? 0) }}</strong>
|
||||||
|
<span>ریال</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</DesktopPageTopbar>
|
||||||
|
|
||||||
|
<GoldLoading v-model:show="infoVisible" title="" />
|
||||||
|
|
||||||
|
<template v-if="loading">
|
||||||
|
<TransactionSkeleton v-for="i in 3" :key="i" class="mt-4" />
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<div v-else-if="cartStore.itemCount === 0" class="dinner-surface dcart-empty">
|
||||||
|
<p>سبد خرید شما خالی است</p>
|
||||||
|
<BasicButton type="primary" @click="router.push({ name: 'buyProduct' })">مشاهده محصولات</BasicButton>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-else class="dcart-grid">
|
||||||
|
<div class="dcart-items">
|
||||||
|
<article v-for="item in cartStore.cartItems" :key="item.id" class="dcart-item">
|
||||||
|
<div class="dcart-item__image">
|
||||||
|
<ProductImage :product="item.product" img-class="max-w-full max-h-full object-contain" />
|
||||||
|
</div>
|
||||||
|
<div class="dcart-item__main">
|
||||||
|
<h3 class="dcart-item__title">{{ item.product.title }}</h3>
|
||||||
|
<p class="dcart-item__meta">
|
||||||
|
روش پرداخت: {{ item.method === 'cash' ? 'نقدی' : 'طلایی' }}
|
||||||
|
<span v-if="item.method === 'cash' && item.gateway"> (با درگاه)</span>
|
||||||
|
</p>
|
||||||
|
<p class="dcart-item__meta">
|
||||||
|
تعداد: {{ item.quantity }} عدد
|
||||||
|
<span v-if="item.goldVazn"> | وزن: {{ formatWeight(item.goldVazn) }}</span>
|
||||||
|
</p>
|
||||||
|
<div class="dcart-item__footer">
|
||||||
|
<span class="dcart-item__price">{{ usePrice(item.totalPrice) }}</span>
|
||||||
|
<BasicIcon
|
||||||
|
icon="vuesax-linear:trash"
|
||||||
|
class="text-red-500 cursor-pointer"
|
||||||
|
@click.stop="handleRemoveItem(item.id)"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<aside class="dinner-surface dcart-summary">
|
||||||
|
<h2 class="dcart-summary__title">خلاصه سفارش</h2>
|
||||||
|
|
||||||
|
<div
|
||||||
|
v-if="discountInfo?.amount > 0"
|
||||||
|
class="dcart-summary__discount"
|
||||||
|
>
|
||||||
|
<div>
|
||||||
|
<span>کد تخفیف: </span>
|
||||||
|
<strong>{{ discountInfo.code }}</strong>
|
||||||
|
<div class="text-xs text-green-600">{{ discountPercentLabel }} تخفیف اعمال شد</div>
|
||||||
|
</div>
|
||||||
|
<button type="button" class="dcart-summary__remove-discount" @click="removeDiscount">
|
||||||
|
<BasicIcon icon="vuesax-linear:close-circle" size="18" />
|
||||||
|
حذف
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="dcart-summary__row">
|
||||||
|
<span>مجموع:</span>
|
||||||
|
<div class="text-left">
|
||||||
|
<div class="dcart-summary__total">{{ usePrice(displaytotalPrice) }}</div>
|
||||||
|
<div v-if="discountInfo?.amount > 0" class="text-xs text-gray-400 line-through">
|
||||||
|
{{ usePrice(totalPrice) }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button
|
||||||
|
v-if="!discountInfo?.amount"
|
||||||
|
type="button"
|
||||||
|
class="dcart-summary__discount-link"
|
||||||
|
@click="showDiscountModal = true"
|
||||||
|
>
|
||||||
|
کد تخفیف دارم
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<BasicButton class="w-full" type="primary" size="large" @click="handleCheckout">
|
||||||
|
تسویه حساب
|
||||||
|
</BasicButton>
|
||||||
|
</aside>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import router from '@/router'
|
||||||
|
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
|
||||||
|
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
|
||||||
|
import GoldLoading from '@/components/GoldLoading.vue'
|
||||||
|
import ProductImage from '@/components/ProductImage.vue'
|
||||||
|
import TransactionSkeleton from '@/components/TransactionSkeleton.vue'
|
||||||
|
import DesktopPageTopbar from '@/layouts/components/DesktopPageTopbar.vue'
|
||||||
|
import { usePrice, usePriceWithoutType } from '@/utils/usePrice'
|
||||||
|
import { useCartPageContext } from '../composables/useCartPage'
|
||||||
|
|
||||||
|
const {
|
||||||
|
cartStore,
|
||||||
|
loading,
|
||||||
|
infoVisible,
|
||||||
|
showDiscountModal,
|
||||||
|
discountInfo,
|
||||||
|
price,
|
||||||
|
totalPrice,
|
||||||
|
displaytotalPrice,
|
||||||
|
discountPercentLabel,
|
||||||
|
formatWeight,
|
||||||
|
handleRemoveItem,
|
||||||
|
handleCheckout,
|
||||||
|
removeDiscount,
|
||||||
|
} = useCartPageContext()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.dcart-header-price {
|
||||||
|
display: flex;
|
||||||
|
align-items: baseline;
|
||||||
|
gap: 6px;
|
||||||
|
font-size: 13px;
|
||||||
|
color: #6b7280;
|
||||||
|
|
||||||
|
strong {
|
||||||
|
font-size: 16px;
|
||||||
|
color: #111827;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.dcart-empty {
|
||||||
|
padding: 48px 24px;
|
||||||
|
text-align: center;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
gap: 16px;
|
||||||
|
color: #6b7280;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dcart-summary__discount {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 12px;
|
||||||
|
padding: 12px;
|
||||||
|
border-radius: 10px;
|
||||||
|
background: rgba(167, 43, 119, 0.06);
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dcart-summary__remove-discount {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 4px;
|
||||||
|
border: none;
|
||||||
|
background: transparent;
|
||||||
|
color: #ef4444;
|
||||||
|
font-size: 12px;
|
||||||
|
cursor: pointer;
|
||||||
|
font-family: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dcart-summary__discount-link {
|
||||||
|
border: none;
|
||||||
|
background: transparent;
|
||||||
|
color: var(--app-primary-color, #a72b77);
|
||||||
|
font-size: 13px;
|
||||||
|
text-decoration: underline;
|
||||||
|
cursor: pointer;
|
||||||
|
font-family: inherit;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
+26
-453
@@ -1,464 +1,37 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div class="cart-page-root">
|
||||||
<div class="absolute inset-0 bg-cover bg-center opacity-60 z--1" :style="{ backgroundImage: `url(${img})` }"></div>
|
<DesktopCartView v-show="isDesktop" />
|
||||||
<div class="bg-white drop-shadow z-[1999] wrap-fix">
|
<MobileCartView v-show="!isDesktop" />
|
||||||
<div class="py-3 px-3 font-bold flex items-center justify-between">
|
|
||||||
<div>سبد خرید</div>
|
<AModal
|
||||||
<!-- Price Display in Header -->
|
v-model:visible="showDiscountModal"
|
||||||
<div v-if="price" class="flex gap-1 items-center text-xs flex-1 justify-end">
|
ok-text="اعمال کد تخفیف"
|
||||||
<span class="text-gray-600 text-xs">قیمت خرید از کشکول گلد:</span>
|
cancel-text="انصراف"
|
||||||
<div class="font-bold text-base" style="font-family: iran-sans; direction: ltr">
|
@ok="submitDiscount"
|
||||||
{{ usePriceWithoutType(price?.price_last ?? 0) }}
|
@cancel="showDiscountModal = false"
|
||||||
</div>
|
>
|
||||||
<span class="text-xs">ریال</span>
|
<div class="p-5">
|
||||||
</div>
|
<div>کد تخفیف</div>
|
||||||
|
<AInput v-model:value="discountCode" />
|
||||||
|
<div class="font-bold text-xs mt-3">*حساس به حروف بزرگ و کوچک</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</AModal>
|
||||||
<GoldLoading v-model:show="infoVisible" title=""/>
|
|
||||||
<div class="px-5 pt-26 pb-30" :class="loading ? 'h-[60vh]' : ''">
|
|
||||||
<template v-if="loading">
|
|
||||||
<TransactionSkeleton v-for="i in 3" :key="i" class="mt-4" />
|
|
||||||
</template>
|
|
||||||
<template v-else>
|
|
||||||
<!-- Empty Cart Message -->
|
|
||||||
<div v-if="cartStore.itemCount === 0" class="flex flex-col items-center justify-center h-[60vh]">
|
|
||||||
<div class="text-gray-500 text-lg font-semibold mb-4">سبد خرید شما خالی است</div>
|
|
||||||
<BasicButton type="primary" @click="$router.push({ name: 'buyProduct' })">
|
|
||||||
مشاهده محصولات
|
|
||||||
</BasicButton>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Cart Items -->
|
|
||||||
<div v-else>
|
|
||||||
<div class="space-y-4 mb-20">
|
|
||||||
<div
|
|
||||||
v-for="item in cartStore.cartItems"
|
|
||||||
:key="item.id"
|
|
||||||
class="bg-white rounded-lg border border-gray-200 p-4 shadow-sm"
|
|
||||||
>
|
|
||||||
<div class="flex gap-4">
|
|
||||||
<!-- Product Image -->
|
|
||||||
<div class="bg-gray-100 rounded-lg flex justify-center items-center p-1 min-w-[80px] h-[80px]">
|
|
||||||
<ProductImage
|
|
||||||
:product="item.product"
|
|
||||||
img-class="max-w-full max-h-full object-contain"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Product Info -->
|
|
||||||
<div class="flex-1 flex flex-col justify-between">
|
|
||||||
<div>
|
|
||||||
<div class="text-base font-semibold mb-1">{{ item.product.title }}</div>
|
|
||||||
<!-- <div class="text-xs text-gray-500 mb-2">-->
|
|
||||||
<!-- {{ getProductAmount(item.product.amount) }}-->
|
|
||||||
<!-- </div>-->
|
|
||||||
<div class="text-xs text-gray-500 mb-2">
|
|
||||||
روش پرداخت: {{ item.method === 'cash' ? 'نقدی' : 'طلایی' }}
|
|
||||||
<span v-if="item.method === 'cash' && item.gateway" class="mr-2">(با درگاه)</span>
|
|
||||||
</div>
|
|
||||||
<div class="text-xs text-gray-500">
|
|
||||||
تعداد: {{ item.quantity }} عدد
|
|
||||||
<span v-if="item.goldVazn" class="mr-2">| وزن: {{ formatWeight(item.goldVazn) }}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex items-center justify-between mt-2">
|
|
||||||
<div class="text-primary font-bold">
|
|
||||||
{{ usePrice(item.totalPrice) }}
|
|
||||||
</div>
|
|
||||||
<BasicIcon
|
|
||||||
icon="vuesax-linear:trash"
|
|
||||||
class="text-red-500 cursor-pointer"
|
|
||||||
@click.stop="handleRemoveItem(item.id)"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Total and Checkout -->
|
|
||||||
<div class=" flex justify-center fixed bottom-20 left-0 right-0 z-1">
|
|
||||||
<div class="md:w-[426px] w-full bg-white border-t border-gray-200 p-4 shadow-lg">
|
|
||||||
<div
|
|
||||||
v-if="discountInfo?.amount > 0"
|
|
||||||
class="mb-3 flex items-center justify-between rounded-lg bg-purple-50 px-3 py-2"
|
|
||||||
>
|
|
||||||
<div class="flex flex-col gap-0.5 text-sm">
|
|
||||||
<div class="flex items-center gap-2">
|
|
||||||
<span class="text-gray-600">کد تخفیف:</span>
|
|
||||||
<span class="font-semibold">{{ discountInfo.code }}</span>
|
|
||||||
</div>
|
|
||||||
<div class="text-xs text-green-600">
|
|
||||||
{{ discountPercentLabel }} تخفیف اعمال شد
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="flex items-center gap-1 text-xs text-red-500"
|
|
||||||
@click="removeDiscount"
|
|
||||||
>
|
|
||||||
<BasicIcon icon="vuesax-linear:close-circle" size="18" />
|
|
||||||
<span>حذف</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex justify-between items-center mb-4">
|
|
||||||
<div class="text-lg font-semibold">مجموع:</div>
|
|
||||||
<div class="flex flex-col items-end gap-1">
|
|
||||||
<div class="text-primary font-bold text-xl">
|
|
||||||
{{ usePrice(displaytotalPrice) }}
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
v-if="discountInfo?.amount > 0"
|
|
||||||
class="text-xs text-gray-400 line-through"
|
|
||||||
>
|
|
||||||
{{ usePrice(totalPrice) }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div
|
|
||||||
v-if="!discountInfo?.amount"
|
|
||||||
class="mb-3 text-center"
|
|
||||||
>
|
|
||||||
<span
|
|
||||||
class="text-xs text-primary underline cursor-pointer"
|
|
||||||
@click="showDiscountModal = true"
|
|
||||||
>
|
|
||||||
کد تخفیف دارم
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<BasicButton
|
|
||||||
class="w-full py-3"
|
|
||||||
type="primary"
|
|
||||||
size="large"
|
|
||||||
@click="handleCheckout"
|
|
||||||
>
|
|
||||||
تسویه حساب
|
|
||||||
</BasicButton>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<AModal v-model:visible="showDiscountModal" ok-text="اعمال کد تخفیف" cancel-text="انصراف" @ok="submitDiscount"
|
|
||||||
@cancel="showDiscountModal=false">
|
|
||||||
<div class="p-5">
|
|
||||||
<div>کد تخفیف</div>
|
|
||||||
<AInput v-model:value="discountCode"></AInput>
|
|
||||||
<div class="font-bold text-xs mt-3">
|
|
||||||
*حساس به حروف بزرگ و کوچک
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</AModal>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script lang="ts" setup>
|
||||||
import {ref, onMounted, onUnmounted, watch, computed} from 'vue'
|
import { useDesktopBreakpoint } from '@/layouts/composables/useAppLayout'
|
||||||
import {useCartStore} from '@/store/cartStore'
|
import { useCartPage } from './composables/useCartPage'
|
||||||
import {usePrice, usePriceWithoutType} from '@/utils/usePrice'
|
import DesktopCartView from './desktop/DesktopCartView.vue'
|
||||||
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
|
import MobileCartView from './mobile/MobileCartView.vue'
|
||||||
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
|
|
||||||
import {message, Modal} from 'ant-design-vue'
|
|
||||||
import img from '@/assets/img/user_ly1.svg'
|
|
||||||
import {
|
|
||||||
getLastPrices,
|
|
||||||
lastPrice,
|
|
||||||
stopPriceInterval,
|
|
||||||
setIntervalGetLastPrice
|
|
||||||
} from '@/utils/price'
|
|
||||||
import {checkoutCart} from '@/api/card'
|
|
||||||
import router from '@/router'
|
|
||||||
import {useWalletStore} from '@/store/walletStore'
|
|
||||||
import {useFundUserStore} from '@/store/fundStore'
|
|
||||||
import type {Price} from '@/models/home'
|
|
||||||
import type {Order} from '@/models/order'
|
|
||||||
|
|
||||||
import {loading, getToken} from '@/utils'
|
const isDesktop = useDesktopBreakpoint()
|
||||||
import GoldLoading from '@/components/GoldLoading.vue'
|
const { showDiscountModal, discountCode, submitDiscount } = useCartPage()
|
||||||
import TransactionSkeleton from '@/components/TransactionSkeleton.vue'
|
|
||||||
import ProductImage from '@/components/ProductImage.vue'
|
|
||||||
import {registerCodeDiscount} from "@/api/giftCard";
|
|
||||||
|
|
||||||
const cartStore = useCartStore()
|
|
||||||
const walletStore = useWalletStore()
|
|
||||||
const fundStore = useFundUserStore()
|
|
||||||
const infoVisible = ref(false)
|
|
||||||
const showDiscountModal = ref(false)
|
|
||||||
const discountCode = ref<string>('')
|
|
||||||
const discountInfo = ref()
|
|
||||||
let totalPriceWithDiscount = 0
|
|
||||||
|
|
||||||
const price = computed((): Price => <Price>lastPrice.value ?? 0)
|
|
||||||
|
|
||||||
// Watch for price updates and update cart items
|
|
||||||
watch(lastPrice, () => {
|
|
||||||
if (lastPrice.value) {
|
|
||||||
cartStore.recalculateCartPrices(lastPrice.value)
|
|
||||||
}
|
|
||||||
}, {deep: true, immediate: false})
|
|
||||||
|
|
||||||
// Computed total price that updates with price changes
|
|
||||||
const totalPrice = computed(() => {
|
|
||||||
return parseInt(cartStore.cartItems.reduce((sum, item) => sum + item.totalPrice, 0))
|
|
||||||
})
|
|
||||||
const displaytotalPrice = computed(() => {
|
|
||||||
if (discountInfo.value?.amount > 0) {
|
|
||||||
return (totalPrice.value - (totalPrice.value * discountInfo.value?.amount)).toFixed(0)
|
|
||||||
|
|
||||||
} else
|
|
||||||
return totalPrice.value
|
|
||||||
})
|
|
||||||
|
|
||||||
const discountPercentLabel = computed(() => {
|
|
||||||
const amount = Number(discountInfo.value?.amount ?? 0)
|
|
||||||
if (amount <= 0) return ''
|
|
||||||
return `${Math.round(amount * 100)}٪`
|
|
||||||
})
|
|
||||||
|
|
||||||
function removeDiscount() {
|
|
||||||
discountInfo.value = undefined
|
|
||||||
discountCode.value = ''
|
|
||||||
message.success('کد تخفیف حذف شد')
|
|
||||||
}
|
|
||||||
|
|
||||||
async function submitDiscount() {
|
|
||||||
try {
|
|
||||||
loading.value = true
|
|
||||||
const temp = await registerCodeDiscount(discountCode.value)
|
|
||||||
discountInfo.value = temp.giftcard
|
|
||||||
message.success('کد تخفیف با موفقیت اعمال شد')
|
|
||||||
showDiscountModal.value = false
|
|
||||||
} catch (e) {
|
|
||||||
|
|
||||||
} finally {
|
|
||||||
loading.value = false
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getProductAmount(amount?: number) {
|
|
||||||
if (!amount) return ''
|
|
||||||
if (amount < 1) {
|
|
||||||
// کمتر از 1 گرم را به سوت تبدیل کن (مشابه ProductItem)
|
|
||||||
const sot = amount * 1000
|
|
||||||
// اگر نتیجه کمتر از 1 شد، حداقل 1 نمایش بده
|
|
||||||
if (sot < 1) {
|
|
||||||
return `1 سوت`
|
|
||||||
}
|
|
||||||
// در غیر این صورت، عدد را به عدد صحیح گرد کن
|
|
||||||
return `${Math.round(sot)} سوت`
|
|
||||||
}
|
|
||||||
return `${amount} گرم`
|
|
||||||
}
|
|
||||||
|
|
||||||
function formatWeight(weight?: number) {
|
|
||||||
if (!weight) return ''
|
|
||||||
if (weight < 1) {
|
|
||||||
// کمتر از 1 گرم را به سوت تبدیل کن
|
|
||||||
const sot = weight * 1000
|
|
||||||
// اگر نتیجه کمتر از 1 شد، حداقل 1 نمایش بده
|
|
||||||
if (sot < 1) {
|
|
||||||
return `1 سوت`
|
|
||||||
}
|
|
||||||
// در غیر این صورت، عدد را به عدد صحیح گرد کن
|
|
||||||
return `${Math.round(sot)} سوت`
|
|
||||||
}
|
|
||||||
return `${weight} گرم`
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleRemoveItem(itemId: string) {
|
|
||||||
Modal.confirm({
|
|
||||||
title: 'حذف از سبد خرید',
|
|
||||||
content: 'آیا از حذف این آیتم از سبد خرید اطمینان دارید؟',
|
|
||||||
okText: 'تایید',
|
|
||||||
okType: 'danger',
|
|
||||||
centered: true,
|
|
||||||
cancelText: 'انصراف',
|
|
||||||
onOk() {
|
|
||||||
cartStore.removeFromCart(itemId)
|
|
||||||
message.success('آیتم از سبد خرید حذف شد')
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
async function handleCheckout() {
|
|
||||||
// Check if user is logged in
|
|
||||||
if (!getToken()) {
|
|
||||||
message.warning('برای تسویه حساب، لطفا ابتدا وارد حساب کاربری خود شوید')
|
|
||||||
await router.push({name: 'login'})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cartStore.itemCount === 0) {
|
|
||||||
message.warning('سبد خرید شما خالی است')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!lastPrice.value) {
|
|
||||||
message.error('لطفا منتظر بمانید تا قیمتها بارگذاری شوند')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check wallet balance for cash method items (without gateway)
|
|
||||||
let cashItemsTotal = cartStore.cartItems
|
|
||||||
.filter(item => item.method === 'cash' && !item.gateway)
|
|
||||||
.reduce((sum, item) => parseInt(sum + item.totalPrice), 0)
|
|
||||||
|
|
||||||
if (cashItemsTotal > 0) {
|
|
||||||
// Ensure wallet info is loaded
|
|
||||||
if (discountInfo.value?.amount && discountInfo.value?.amount>0){
|
|
||||||
cashItemsTotal=cashItemsTotal-cashItemsTotal*discountInfo.value?.amount
|
|
||||||
}
|
|
||||||
if (!walletStore.walletInfo) {
|
|
||||||
await walletStore.getMyWallet()
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!walletStore.walletInfo?.cash || cashItemsTotal > walletStore.walletInfo.cash) {
|
|
||||||
message.error('موجودی کیف پول شما ناکافی است')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check gold balance for gold method items
|
|
||||||
const goldItemsTotal = cartStore.cartItems
|
|
||||||
.filter(item => item.method === 'gold')
|
|
||||||
.reduce((sum, item) => {
|
|
||||||
// Calculate total gold weight needed
|
|
||||||
const goldWeight = item.goldVazn ? item.goldVazn * item.quantity : 0
|
|
||||||
return sum + goldWeight
|
|
||||||
}, 0)
|
|
||||||
|
|
||||||
if (goldItemsTotal > 0) {
|
|
||||||
// Ensure wallet info is loaded
|
|
||||||
if (!walletStore.walletInfo) {
|
|
||||||
await walletStore.getMyWallet()
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!walletStore.walletInfo?.gold || goldItemsTotal > walletStore.walletInfo.gold) {
|
|
||||||
message.error('موجودی کیف طلا شما ناکافی است')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
infoVisible.value = true
|
|
||||||
|
|
||||||
// Prepare orders array with same structure as createOrder for each product
|
|
||||||
const orders: Order[] = cartStore.cartItems.map(item => {
|
|
||||||
console.log(item)
|
|
||||||
const product = item.product
|
|
||||||
// Calculate price similar to createOrder (buy price)
|
|
||||||
let productPrice = 0
|
|
||||||
if (product.group_type == 'آبشده') {
|
|
||||||
productPrice = lastPrice.value?.price_last ?? 0
|
|
||||||
} else {
|
|
||||||
productPrice = (product.amount ?? 0) * (lastPrice.value?.price_last ?? 0)
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
direction: 1, // 1 for buy (cart items are always buy orders)
|
|
||||||
price: productPrice,
|
|
||||||
amount: product.amount,
|
|
||||||
gateway: item.gateway,
|
|
||||||
product_id: product.id,
|
|
||||||
method: item.method,
|
|
||||||
number: item.quantity,
|
|
||||||
discount_code:discountInfo.value?.code
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
// Call checkoutCart API with orders array
|
|
||||||
const data = await checkoutCart(orders)
|
|
||||||
|
|
||||||
// Check for returnUrl (gateway payment)
|
|
||||||
let returnUrl = null
|
|
||||||
if (Array.isArray(data)) {
|
|
||||||
const itemWithReturnUrl = data.find(item => item?.returnUrl)
|
|
||||||
if (itemWithReturnUrl?.returnUrl) {
|
|
||||||
returnUrl = itemWithReturnUrl.returnUrl
|
|
||||||
}
|
|
||||||
} else if (data?.returnUrl) {
|
|
||||||
returnUrl = data.returnUrl
|
|
||||||
}
|
|
||||||
|
|
||||||
// If returnUrl exists, redirect to gateway and stop execution
|
|
||||||
if (returnUrl) {
|
|
||||||
window.location.href = returnUrl
|
|
||||||
return // Stop execution here
|
|
||||||
}
|
|
||||||
|
|
||||||
// If no gateway, continue with normal flow
|
|
||||||
await walletStore.getMyWallet()
|
|
||||||
cartStore.clearCart()
|
|
||||||
await router.push({name: 'transactions'})
|
|
||||||
message.success('سفارشات شما با موفقیت ثبت شد')
|
|
||||||
await fundStore.getMyFund()
|
|
||||||
} catch (e: any) {
|
|
||||||
console.error('Error in checkout:', e)
|
|
||||||
message.error('خطا در ثبت سفارش. لطفا دوباره تلاش کنید.')
|
|
||||||
} finally {
|
|
||||||
loading.value = false
|
|
||||||
infoVisible.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function initPrice() {
|
|
||||||
try {
|
|
||||||
await getLastPrices()
|
|
||||||
await setIntervalGetLastPrice()
|
|
||||||
if (lastPrice.value) {
|
|
||||||
cartStore.recalculateCartPrices(lastPrice.value)
|
|
||||||
}
|
|
||||||
} catch (e: any) {
|
|
||||||
console.log(e)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function refreshCart() {
|
|
||||||
const removedCount = await cartStore.refreshCartFromServer()
|
|
||||||
if (removedCount > 0) {
|
|
||||||
message.warning(`${removedCount} محصول از سبد خرید حذف شد (دیگر در دسترس نیست)`)
|
|
||||||
}
|
|
||||||
if (lastPrice.value) {
|
|
||||||
cartStore.recalculateCartPrices(lastPrice.value)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onMounted(async () => {
|
|
||||||
cartStore.loadCartFromStorage()
|
|
||||||
loading.value = true
|
|
||||||
try {
|
|
||||||
await initPrice()
|
|
||||||
await refreshCart()
|
|
||||||
const refreshCartInfo=setInterval(async () => {
|
|
||||||
await refreshCart()
|
|
||||||
// await getUpPrice()
|
|
||||||
}, 10000)
|
|
||||||
} finally {
|
|
||||||
loading.value = false
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
onUnmounted(() => {
|
|
||||||
stopPriceInterval()
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.text-primary {
|
.cart-page-root {
|
||||||
color: #d3a233;
|
min-height: 100%;
|
||||||
}
|
height: 100%;
|
||||||
|
|
||||||
@media screen and (min-width: 426px) {
|
|
||||||
.wrap-fix {
|
|
||||||
width: 426px;
|
|
||||||
margin: 0 auto;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -0,0 +1,142 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<div class="absolute inset-0 bg-cover bg-center opacity-60 z--1" :style="{ backgroundImage: `url(${img})` }" />
|
||||||
|
<div class="mpage-header wrap-fix z-[1999]">
|
||||||
|
<div class="py-3 px-3 font-bold flex items-center justify-between w-full">
|
||||||
|
<div>سبد خرید</div>
|
||||||
|
<div v-if="price" class="flex gap-1 items-center text-xs flex-1 justify-end">
|
||||||
|
<span class="text-gray-600 text-xs">قیمت خرید از کشکول گلد:</span>
|
||||||
|
<div class="font-bold text-base" style="font-family: iran-sans; direction: ltr">
|
||||||
|
{{ usePriceWithoutType(price?.price_last ?? 0) }}
|
||||||
|
</div>
|
||||||
|
<span class="text-xs">ریال</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<GoldLoading v-model:show="infoVisible" title="" />
|
||||||
|
<div class="px-5 mpage-content pb-[calc(var(--app-bottom-chrome-height)+1rem)]" :class="loading ? 'h-[60vh]' : ''">
|
||||||
|
<template v-if="loading">
|
||||||
|
<TransactionSkeleton v-for="i in 3" :key="i" class="mt-4" />
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<div v-if="cartStore.itemCount === 0" class="flex flex-col items-center justify-center h-[60vh]">
|
||||||
|
<div class="text-gray-500 text-lg font-semibold mb-4">سبد خرید شما خالی است</div>
|
||||||
|
<BasicButton type="primary" @click="router.push({ name: 'buyProduct' })">مشاهده محصولات</BasicButton>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-else>
|
||||||
|
<div class="space-y-4 mb-20">
|
||||||
|
<div
|
||||||
|
v-for="item in cartStore.cartItems"
|
||||||
|
:key="item.id"
|
||||||
|
class="bg-white rounded-lg border border-gray-200 p-4 shadow-sm"
|
||||||
|
>
|
||||||
|
<div class="flex gap-4">
|
||||||
|
<div class="bg-gray-100 rounded-lg flex justify-center items-center p-1 min-w-[80px] h-[80px]">
|
||||||
|
<ProductImage :product="item.product" img-class="max-w-full max-h-full object-contain" />
|
||||||
|
</div>
|
||||||
|
<div class="flex-1 flex flex-col justify-between">
|
||||||
|
<div>
|
||||||
|
<div class="text-base font-semibold mb-1">{{ item.product.title }}</div>
|
||||||
|
<div class="text-xs text-gray-500 mb-2">
|
||||||
|
روش پرداخت: {{ item.method === 'cash' ? 'نقدی' : 'طلایی' }}
|
||||||
|
<span v-if="item.method === 'cash' && item.gateway" class="mr-2">(با درگاه)</span>
|
||||||
|
</div>
|
||||||
|
<div class="text-xs text-gray-500">
|
||||||
|
تعداد: {{ item.quantity }} عدد
|
||||||
|
<span v-if="item.goldVazn" class="mr-2">| وزن: {{ formatWeight(item.goldVazn) }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="flex items-center justify-between mt-2">
|
||||||
|
<div class="text-primary font-bold">{{ usePrice(item.totalPrice) }}</div>
|
||||||
|
<BasicIcon
|
||||||
|
icon="vuesax-linear:trash"
|
||||||
|
class="text-red-500 cursor-pointer"
|
||||||
|
@click.stop="handleRemoveItem(item.id)"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex justify-center fixed bottom-20 left-0 right-0 z-1">
|
||||||
|
<div class="md:w-[426px] w-full bg-white border-t border-gray-200 p-4 shadow-lg">
|
||||||
|
<div
|
||||||
|
v-if="discountInfo?.amount > 0"
|
||||||
|
class="mb-3 flex items-center justify-between rounded-lg bg-purple-50 px-3 py-2"
|
||||||
|
>
|
||||||
|
<div class="flex flex-col gap-0.5 text-sm">
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<span class="text-gray-600">کد تخفیف:</span>
|
||||||
|
<span class="font-semibold">{{ discountInfo.code }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="text-xs text-green-600">{{ discountPercentLabel }} تخفیف اعمال شد</div>
|
||||||
|
</div>
|
||||||
|
<button type="button" class="flex items-center gap-1 text-xs text-red-500" @click="removeDiscount">
|
||||||
|
<BasicIcon icon="vuesax-linear:close-circle" size="18" />
|
||||||
|
<span>حذف</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex justify-between items-center mb-4">
|
||||||
|
<div class="text-lg font-semibold">مجموع:</div>
|
||||||
|
<div class="flex flex-col items-end gap-1">
|
||||||
|
<div class="text-primary font-bold text-xl">{{ usePrice(displaytotalPrice) }}</div>
|
||||||
|
<div v-if="discountInfo?.amount > 0" class="text-xs text-gray-400 line-through">
|
||||||
|
{{ usePrice(totalPrice) }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-if="!discountInfo?.amount" class="mb-3 text-center">
|
||||||
|
<span class="text-xs text-primary underline cursor-pointer" @click="showDiscountModal = true">
|
||||||
|
کد تخفیف دارم
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<BasicButton class="w-full py-3" type="primary" size="large" @click="handleCheckout">
|
||||||
|
تسویه حساب
|
||||||
|
</BasicButton>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import router from '@/router'
|
||||||
|
import img from '@/assets/img/user_ly1.svg'
|
||||||
|
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
|
||||||
|
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
|
||||||
|
import GoldLoading from '@/components/GoldLoading.vue'
|
||||||
|
import ProductImage from '@/components/ProductImage.vue'
|
||||||
|
import TransactionSkeleton from '@/components/TransactionSkeleton.vue'
|
||||||
|
import { usePrice, usePriceWithoutType } from '@/utils/usePrice'
|
||||||
|
import { useCartPageContext } from '../composables/useCartPage'
|
||||||
|
|
||||||
|
const {
|
||||||
|
cartStore,
|
||||||
|
loading,
|
||||||
|
infoVisible,
|
||||||
|
showDiscountModal,
|
||||||
|
discountInfo,
|
||||||
|
price,
|
||||||
|
totalPrice,
|
||||||
|
displaytotalPrice,
|
||||||
|
discountPercentLabel,
|
||||||
|
formatWeight,
|
||||||
|
handleRemoveItem,
|
||||||
|
handleCheckout,
|
||||||
|
removeDiscount,
|
||||||
|
} = useCartPageContext()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.text-primary {
|
||||||
|
color: #d3a233;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
import { inject, onMounted, provide, ref, type InjectionKey } from 'vue'
|
||||||
|
import { message } from 'ant-design-vue'
|
||||||
|
import { getEarnMoney } from '@/api/earnMoney'
|
||||||
|
import { useUserStore } from '@/store/userStore'
|
||||||
|
import { loading } from '@/utils'
|
||||||
|
import type { EarnMoney } from '@/models/earnMoney'
|
||||||
|
|
||||||
|
export interface EarnMoneyPageContext {
|
||||||
|
data: ReturnType<typeof ref<EarnMoney | undefined>>
|
||||||
|
userStore: ReturnType<typeof useUserStore>
|
||||||
|
isTransaction: ReturnType<typeof ref<boolean>>
|
||||||
|
setIsTransaction: (value: boolean) => void
|
||||||
|
copyCode: () => void
|
||||||
|
shareCode: () => void
|
||||||
|
}
|
||||||
|
|
||||||
|
export const EARN_MONEY_PAGE_CONTEXT_KEY: InjectionKey<EarnMoneyPageContext> = Symbol('earnMoneyPageContext')
|
||||||
|
|
||||||
|
export function useEarnMoneyPage() {
|
||||||
|
const data = ref<EarnMoney>()
|
||||||
|
const userStore = useUserStore()
|
||||||
|
const isTransaction = ref(false)
|
||||||
|
|
||||||
|
function setIsTransaction(value: boolean) {
|
||||||
|
isTransaction.value = value
|
||||||
|
}
|
||||||
|
|
||||||
|
function copyCode() {
|
||||||
|
const val = userStore.userInfo?.referral_id
|
||||||
|
if (val) {
|
||||||
|
navigator.clipboard.writeText(val)
|
||||||
|
message.info('کد رونوشت شد')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function shareCode() {
|
||||||
|
const val = `⭐️الان طلا بخر؛ آخر ماه سودشو ببر!
|
||||||
|
با خرید طلای آبشده در مقدارهای کم ولی مستمر، سود بیشتری ببر!
|
||||||
|
|
||||||
|
این دعوت نامه از طرف "${userStore.userInfo?.name}" عزیز برای شما ارسال شده تا شما هم از بازار طلای کشکول گلد جا نمونید.
|
||||||
|
روی لینک زیر کلیک کنید و ثبت نام خود را تکمیل کنید.
|
||||||
|
|
||||||
|
kh.kashkolgold.ir/login?id=${userStore.userInfo?.referral_id}`
|
||||||
|
navigator.share({ title: 'کشکول گلد', text: val })
|
||||||
|
}
|
||||||
|
|
||||||
|
async function earnMoney() {
|
||||||
|
try {
|
||||||
|
loading.value = true
|
||||||
|
data.value = await getEarnMoney()
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e)
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
void earnMoney()
|
||||||
|
})
|
||||||
|
|
||||||
|
const context: EarnMoneyPageContext = {
|
||||||
|
data,
|
||||||
|
userStore,
|
||||||
|
isTransaction,
|
||||||
|
setIsTransaction,
|
||||||
|
copyCode,
|
||||||
|
shareCode,
|
||||||
|
}
|
||||||
|
|
||||||
|
provide(EARN_MONEY_PAGE_CONTEXT_KEY, context)
|
||||||
|
return context
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useEarnMoneyPageContext() {
|
||||||
|
const context = inject(EARN_MONEY_PAGE_CONTEXT_KEY)
|
||||||
|
if (!context) throw new Error('useEarnMoneyPageContext must be used within useEarnMoneyPage')
|
||||||
|
return context
|
||||||
|
}
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
<template>
|
||||||
|
<div class="dinner earn-money-page">
|
||||||
|
<div class="dinner__container">
|
||||||
|
<DesktopPageTopbar title="کسب درآمد" show-back />
|
||||||
|
|
||||||
|
<section class="dinner-surface p-5 mb-4">
|
||||||
|
<div class="flex items-start gap-3">
|
||||||
|
<div class="bg-[#DBEAFE] h-10 w-10 rounded-full flex justify-center items-center flex-shrink-0">
|
||||||
|
<img :src="coin" alt="" class="w-6 h-6" />
|
||||||
|
</div>
|
||||||
|
<div class="min-w-0">
|
||||||
|
<h2 class="font-bold mb-2">دعوت دوستان</h2>
|
||||||
|
<p class="text-sm text-gray-600 leading-6">
|
||||||
|
با دعوت دوستانتان به اپلیکیشن کشکول گلد، دوست شما اولین خرید خود را بدون کارمزد انجام میدهد
|
||||||
|
و شما نیز ۱۰٪ از کارمزد ۱۰ معاملهی اول او را بهعنوان پاداش دریافت میکنید.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="flex items-center justify-center gap-2 mt-4">
|
||||||
|
<span class="text-sm text-gray-500">کد بازاریابی</span>
|
||||||
|
<strong class="text-lg tracking-wide">{{ userStore.userInfo?.referral_id }}</strong>
|
||||||
|
</div>
|
||||||
|
<div class="grid grid-cols-2 gap-2 mt-4 max-w-md mx-auto">
|
||||||
|
<BasicButton icon="vuesax-linear:share" size="small" icon-size="18" @click="shareCode">اشتراک گذاری</BasicButton>
|
||||||
|
<BasicButton icon="vuesax-linear:copy" size="small" icon-size="18" @click="copyCode">رونوشت</BasicButton>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<div class="dearn-stats">
|
||||||
|
<div class="dearn-stat dearn-stat--blue">
|
||||||
|
<div class="dearn-stat__value">{{ data?.usersSum }} عدد</div>
|
||||||
|
<div class="dearn-stat__label">تعداد زیر مجموعه</div>
|
||||||
|
</div>
|
||||||
|
<div class="dearn-stat dearn-stat--yellow">
|
||||||
|
<div class="dearn-stat__value">{{ data?.giftsSum }} سوت</div>
|
||||||
|
<div class="dearn-stat__label">میزان کل پاداش ها</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="dinner-surface p-2 mb-4 flex gap-2">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="dearn-tab"
|
||||||
|
:class="{ 'dearn-tab--active': isTransaction }"
|
||||||
|
@click="setIsTransaction(true)"
|
||||||
|
>
|
||||||
|
پاداش ها
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="dearn-tab"
|
||||||
|
:class="{ 'dearn-tab--active': !isTransaction }"
|
||||||
|
@click="setIsTransaction(false)"
|
||||||
|
>
|
||||||
|
فهرست زیر مجموعه
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="dearn-list">
|
||||||
|
<template v-if="isTransaction">
|
||||||
|
<GiftCard v-for="(val, i) in data?.gifts" :key="`gift-${i}`" :item="val" />
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<EarnCard v-for="(val, i) in data?.users" :key="`user-${i}`" :item="val" />
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import coin from '@/assets/img/coin.png'
|
||||||
|
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
|
||||||
|
import DesktopPageTopbar from '@/layouts/components/DesktopPageTopbar.vue'
|
||||||
|
import EarnCard from '../components/EarnCard.vue'
|
||||||
|
import GiftCard from '../components/GiftCard.vue'
|
||||||
|
import { useEarnMoneyPageContext } from '../composables/useEarnMoneyPage'
|
||||||
|
|
||||||
|
const { data, userStore, isTransaction, setIsTransaction, copyCode, shareCode } = useEarnMoneyPageContext()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.dearn-tab {
|
||||||
|
flex: 1;
|
||||||
|
border: none;
|
||||||
|
background: transparent;
|
||||||
|
padding: 10px;
|
||||||
|
border-radius: 10px;
|
||||||
|
font-family: inherit;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #9ca3af;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
&--active {
|
||||||
|
background: #fff;
|
||||||
|
color: var(--app-primary-color, #a72b77);
|
||||||
|
box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,163 +1,23 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div class="earn-money-page-root">
|
||||||
<div class="bg-white w-full py-3 px-3 text-primary font-bold drop-shadow flex">
|
<DesktopEarnMoneyView v-show="isDesktop" />
|
||||||
<div @click="router.back()">
|
<MobileEarnMoneyView v-show="!isDesktop" />
|
||||||
<BasicIcon icon="vuesax-linear:arrow-right-1" />
|
|
||||||
</div>
|
|
||||||
<div class="mr-2">کسب درآمد</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="p-4">
|
|
||||||
<div class=" p-3 border-solid border-1 rounded-[8px] border-[#a72b77] ">
|
|
||||||
<div class="flex items-center">
|
|
||||||
<div class=" bg-[#DBEAFE] h-10 w-10 rounded-100% flex justify-center items-center">
|
|
||||||
<img :src="coin" />
|
|
||||||
</div>
|
|
||||||
<div class="mr-2">
|
|
||||||
<div class="flex">
|
|
||||||
<div class="font-bold">دعوت دوستان</div>
|
|
||||||
<!-- <div class="text-xs ">راهنمای کسب درآمد</div>-->
|
|
||||||
</div>
|
|
||||||
<div class=" mt-2 text-xs">با دعوت دوستانتان به اپلیکیشن کشکول گلد،
|
|
||||||
دوست شما اولین خرید خود را بدون کارمزد انجام میدهد
|
|
||||||
و شما نیز ۱۰٪ از کارمزد ۱۰ معاملهی اول او را بهعنوان پاداش دریافت میکنید. 💰</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="flex justify-center mt-4">
|
|
||||||
<div class="text-[10px] content-center ">کد بازاریابی</div>
|
|
||||||
<div class="mr-2 font-bold">{{userStore.userInfo.referral_id}}</div>
|
|
||||||
</div>
|
|
||||||
<div class="flex mt-4 gap-2">
|
|
||||||
<BasicButton icon="vuesax-linear:share" size="small" class="flex-1" icon-size="18" @click.stop="shareCode()">
|
|
||||||
اشتراک گذاری
|
|
||||||
</BasicButton>
|
|
||||||
<BasicButton icon="vuesax-linear:copy" size="small" class="flex-1" icon-size="18" @click.stop="copyCode()">
|
|
||||||
رونوشت
|
|
||||||
</BasicButton>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="grid grid-cols-2 gap-4 mt-4 ">
|
|
||||||
<div class="text-center bg-[#DBEAFE] p-2 rounded-[8px]">
|
|
||||||
<div class="font-bold text-[#2563EB] text-md">
|
|
||||||
{{data?.usersSum}} عدد
|
|
||||||
</div>
|
|
||||||
<div class="text-xs text-[#2563EB] mt-2">تعداد زیر مجموعه</div>
|
|
||||||
</div>
|
|
||||||
<div class="text-center bg-[#FEF9C3] p-2 rounded-[8px]">
|
|
||||||
<div class="font-bold text-[#CA8A04] text-md">
|
|
||||||
{{data?.giftsSum}} سوت
|
|
||||||
</div>
|
|
||||||
<div class="text-xs text-[#CA8A04] mt-2">میزان کل پاداش ها</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="flex justify-evenly w-full px-2 h-11 items-center bg-gray-50 relative rounded-lg mt-6 ">
|
|
||||||
<div :class="isTransaction?'text-primary bg-white h-8 w-1/2 rounded-lg':'text-gray-400'" class="w-full text-center z-2 flex items-center justify-center"
|
|
||||||
@click.stop="setIsTransaction(true) ">
|
|
||||||
پاداش ها
|
|
||||||
</div>
|
|
||||||
<div :class="!isTransaction?'text-primary bg-white h-8 w-1/2 rounded-lg':'text-gray-400'" class="w-full text-center z-2 flex items-center justify-center"
|
|
||||||
@click.stop="setIsTransaction(false) ">
|
|
||||||
فهرست زیر مجموعه
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- //**************************************-->
|
|
||||||
<!-- <div class="flex mt-6">-->
|
|
||||||
<!-- <div class="bg-[#a72b77] p-2 rounded-[8px] w-full">-->
|
|
||||||
<!-- <div class="text-white text-center">فهرست زیرمجموعه</div>-->
|
|
||||||
<!-- </div>-->
|
|
||||||
<!-- <div class="bg-[#a72b77] p-2 rounded-[8px] w-full mr-2">-->
|
|
||||||
<!-- <div class="text-white text-center">پاداش ها</div>-->
|
|
||||||
<!-- </div>-->
|
|
||||||
<!-- </div>-->
|
|
||||||
<div class="border-solid border-1 border-[#E5E7EB] mt-6 "></div>
|
|
||||||
<div class="h-20rem overflow-y-scroll" v-if="isTransaction">
|
|
||||||
<GiftCard v-for="(val,i) in data?.gifts" :key="i" :item="val"/>
|
|
||||||
</div>
|
|
||||||
<div v-else class="h-20rem overflow-y-scroll">
|
|
||||||
<EarnCard v-for="(val,i) in data?.users" :key="i" :item="val"/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
import { useDesktopBreakpoint } from '@/layouts/composables/useAppLayout'
|
||||||
|
import { useEarnMoneyPage } from './composables/useEarnMoneyPage'
|
||||||
|
import DesktopEarnMoneyView from './desktop/DesktopEarnMoneyView.vue'
|
||||||
|
import MobileEarnMoneyView from './mobile/MobileEarnMoneyView.vue'
|
||||||
|
|
||||||
import router from '@/router'
|
const isDesktop = useDesktopBreakpoint()
|
||||||
import coin from '@/assets/img/coin.png'
|
useEarnMoneyPage()
|
||||||
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
|
|
||||||
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
|
|
||||||
import { useUserStore } from '@/store/userStore'
|
|
||||||
import { type FormInstance, message } from 'ant-design-vue'
|
|
||||||
import { onMounted, reactive, ref } from 'vue'
|
|
||||||
import type { EarnMoney } from '@/models/earnMoney'
|
|
||||||
import { loading } from '@/utils'
|
|
||||||
import { getEarnMoney } from '@/api/earnMoney'
|
|
||||||
import EarnCard from '@/views/base/earnMoney/components/EarnCard.vue'
|
|
||||||
import TransactionCard from '@/views/base/transactions/components/Item.vue'
|
|
||||||
import GiftCard from '@/views/base/earnMoney/components/GiftCard.vue'
|
|
||||||
|
|
||||||
const data = ref<EarnMoney>()
|
|
||||||
|
|
||||||
const userStore = useUserStore()
|
|
||||||
|
|
||||||
const isTransaction = ref<boolean>(false)
|
|
||||||
|
|
||||||
function setIsTransaction(value: boolean) {
|
|
||||||
isTransaction.value = value
|
|
||||||
}
|
|
||||||
|
|
||||||
function copyCode() {
|
|
||||||
// nextTick(() => {
|
|
||||||
const val = userStore.userInfo?.referral_id
|
|
||||||
navigator.clipboard.writeText(val)
|
|
||||||
message.info('کد رونوشت شد')
|
|
||||||
// })
|
|
||||||
}
|
|
||||||
|
|
||||||
function shareCode() {
|
|
||||||
// nextTick(() => {
|
|
||||||
const val = `⭐️الان طلا بخر؛ آخر ماه سودشو ببر!
|
|
||||||
با خرید طلای آبشده در مقدارهای کم ولی مستمر، سود بیشتری ببر!
|
|
||||||
|
|
||||||
این دعوت نامه از طرف "${userStore.userInfo?.name}" عزیز برای شما ارسال شده تا شما هم از بازار طلای کشکول گلد جا نمونید.
|
|
||||||
روی لینک زیر کلیک کنید و ثبت نام خود را تکمیل کنید.
|
|
||||||
|
|
||||||
kh.kashkolgold.ir/login?id=${userStore.userInfo?.referral_id}`
|
|
||||||
navigator.share({
|
|
||||||
title: 'کشکول گلد',
|
|
||||||
text: val
|
|
||||||
})
|
|
||||||
// message.info('کد رونوشت شد')
|
|
||||||
// })
|
|
||||||
}
|
|
||||||
|
|
||||||
async function earnMoney() {
|
|
||||||
try {
|
|
||||||
loading.value = true
|
|
||||||
data.value = await getEarnMoney()
|
|
||||||
} catch (e) {
|
|
||||||
console.log(e)
|
|
||||||
} finally {
|
|
||||||
loading.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function subsetList(){
|
|
||||||
|
|
||||||
}
|
|
||||||
onMounted(async () => {
|
|
||||||
earnMoney()
|
|
||||||
})
|
|
||||||
|
|
||||||
function useStyle() {
|
|
||||||
if (data.value?.User) return 'right: 2%;'
|
|
||||||
// if (isbuy.value) return 'animation-direction: normal'
|
|
||||||
// else return 'animation-direction: reverse'
|
|
||||||
else return ' right: 98%; transform: translate(100%, 0);'
|
|
||||||
}
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
.earn-money-page-root {
|
||||||
|
min-height: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<div class="bg-white w-full py-3 px-3 text-primary font-bold drop-shadow flex">
|
||||||
|
<div @click="router.back()">
|
||||||
|
<BasicIcon icon="vuesax-linear:arrow-right-1" />
|
||||||
|
</div>
|
||||||
|
<div class="mr-2">کسب درآمد</div>
|
||||||
|
</div>
|
||||||
|
<div class="p-4">
|
||||||
|
<div class="p-3 border-solid border-1 rounded-[8px] border-primary">
|
||||||
|
<div class="flex items-center">
|
||||||
|
<div class="bg-[#DBEAFE] h-10 w-10 rounded-100% flex justify-center items-center">
|
||||||
|
<img :src="coin" />
|
||||||
|
</div>
|
||||||
|
<div class="mr-2">
|
||||||
|
<div class="font-bold">دعوت دوستان</div>
|
||||||
|
<div class="mt-2 text-xs">
|
||||||
|
با دعوت دوستانتان به اپلیکیشن کشکول گلد، دوست شما اولین خرید خود را بدون کارمزد انجام میدهد
|
||||||
|
و شما نیز ۱۰٪ از کارمزد ۱۰ معاملهی اول او را بهعنوان پاداش دریافت میکنید. 💰
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="flex justify-center mt-4">
|
||||||
|
<div class="text-[10px] content-center">کد بازاریابی</div>
|
||||||
|
<div class="mr-2 font-bold">{{ userStore.userInfo?.referral_id }}</div>
|
||||||
|
</div>
|
||||||
|
<div class="flex mt-4 gap-2">
|
||||||
|
<BasicButton icon="vuesax-linear:share" size="small" class="flex-1" icon-size="18" @click="shareCode">
|
||||||
|
اشتراک گذاری
|
||||||
|
</BasicButton>
|
||||||
|
<BasicButton icon="vuesax-linear:copy" size="small" class="flex-1" icon-size="18" @click="copyCode">
|
||||||
|
رونوشت
|
||||||
|
</BasicButton>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="grid grid-cols-2 gap-4 mt-4">
|
||||||
|
<div class="text-center bg-[#DBEAFE] p-2 rounded-[8px]">
|
||||||
|
<div class="font-bold text-[#2563EB] text-md">{{ data?.usersSum }} عدد</div>
|
||||||
|
<div class="text-xs text-[#2563EB] mt-2">تعداد زیر مجموعه</div>
|
||||||
|
</div>
|
||||||
|
<div class="text-center bg-[#FEF9C3] p-2 rounded-[8px]">
|
||||||
|
<div class="font-bold text-[#CA8A04] text-md">{{ data?.giftsSum }} سوت</div>
|
||||||
|
<div class="text-xs text-[#CA8A04] mt-2">میزان کل پاداش ها</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex justify-evenly w-full px-2 h-11 items-center bg-gray-50 relative rounded-lg mt-6">
|
||||||
|
<div
|
||||||
|
:class="isTransaction ? 'text-primary bg-white h-8 w-1/2 rounded-lg' : 'text-gray-400'"
|
||||||
|
class="w-full text-center z-2 flex items-center justify-center"
|
||||||
|
@click="setIsTransaction(true)"
|
||||||
|
>
|
||||||
|
پاداش ها
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
:class="!isTransaction ? 'text-primary bg-white h-8 w-1/2 rounded-lg' : 'text-gray-400'"
|
||||||
|
class="w-full text-center z-2 flex items-center justify-center"
|
||||||
|
@click="setIsTransaction(false)"
|
||||||
|
>
|
||||||
|
فهرست زیر مجموعه
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="border-solid border-1 border-[#E5E7EB] mt-6" />
|
||||||
|
<div v-if="isTransaction" class="h-20rem overflow-y-scroll">
|
||||||
|
<GiftCard v-for="(val, i) in data?.gifts" :key="i" :item="val" />
|
||||||
|
</div>
|
||||||
|
<div v-else class="h-20rem overflow-y-scroll">
|
||||||
|
<EarnCard v-for="(val, i) in data?.users" :key="i" :item="val" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import router from '@/router'
|
||||||
|
import coin from '@/assets/img/coin.png'
|
||||||
|
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
|
||||||
|
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
|
||||||
|
import EarnCard from '../components/EarnCard.vue'
|
||||||
|
import GiftCard from '../components/GiftCard.vue'
|
||||||
|
import { useEarnMoneyPageContext } from '../composables/useEarnMoneyPage'
|
||||||
|
|
||||||
|
const { data, userStore, isTransaction, setIsTransaction, copyCode, shareCode } = useEarnMoneyPageContext()
|
||||||
|
</script>
|
||||||
@@ -1,69 +1,61 @@
|
|||||||
<template>
|
<template>
|
||||||
<div v-if="item" class="bg-white flex flex-col items-center p-3 rounded-xl">
|
<div
|
||||||
<img v-lazy="{ src: itemImg, loading: logo,error: logo}" alt="" class="w-[87px] ">
|
v-if="item"
|
||||||
<div class="mt-3">{{props.item?.title?? '-'}}</div>
|
class="bg-white flex flex-col items-center p-3 rounded-xl"
|
||||||
<div class="mt-1 flex gap-1"><div class="font-bold">{{props.item?.wallet[0]?.gold?? '-'}}</div> گرم</div>
|
:class="{ 'dfund-card': variant === 'desktop' }"
|
||||||
<!-- {{props.item?.wallet[0]?.cash}}-->
|
>
|
||||||
|
<img :src="displayImage" class="w-[87px] h-[87px] object-contain" alt="" @error="onImageError">
|
||||||
|
<div class="mt-3 text-center line-clamp-2">{{ item.title ?? '-' }}</div>
|
||||||
|
<div class="mt-1 flex flex-col items-center gap-0.5 text-center">
|
||||||
|
<div class="flex gap-1">
|
||||||
|
<div class="font-bold">{{ item.quantity ?? '-' }}</div>
|
||||||
|
{{ item.unit }}
|
||||||
|
</div>
|
||||||
|
<div v-if="item.unit_weight && item.display_type === 'count'" class="text-xs text-gray-500">
|
||||||
|
هر عدد {{ item.unit_weight }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import homeImg from '@/assets/img/cash_home.svg'
|
import { computed, ref, watch } from 'vue'
|
||||||
import giftImg from '@/assets/img/cash_gift.svg'
|
import type { WalletInventoryCard } from '@/models/walletAssets'
|
||||||
import circulationImg from '@/assets/img/cash_circulation.svg'
|
import { getProductDisplayImage } from '@/utils/productAssets'
|
||||||
import loveImg from '@/assets/img/cash_love.svg'
|
|
||||||
import repairsImg from '@/assets/img/cash_repairs.svg'
|
|
||||||
import savingImg from '@/assets/img/cash_saving.svg'
|
|
||||||
import {computed} from "vue";
|
|
||||||
import type {Fund} from "@/models/fund";
|
|
||||||
import logo from "@/assets/img/logo_full_.png";
|
|
||||||
/*function itemImg() {
|
|
||||||
|
|
||||||
}*/
|
|
||||||
interface Prop {
|
interface Prop {
|
||||||
item: Fund
|
item: WalletInventoryCard
|
||||||
|
variant?: 'mobile' | 'desktop'
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = defineProps<Prop>()
|
const props = withDefaults(defineProps<Prop>(), {
|
||||||
|
variant: 'mobile',
|
||||||
const itemImg = computed(() => {
|
|
||||||
switch (props.item?.title) {
|
|
||||||
case 'خرید لوازم منزل':
|
|
||||||
return homeImg
|
|
||||||
case 'هدیه':
|
|
||||||
return giftImg
|
|
||||||
case 'گردش':
|
|
||||||
return circulationImg
|
|
||||||
case 'ازدواج':
|
|
||||||
return loveImg
|
|
||||||
case 'تعمیرات':
|
|
||||||
return repairsImg
|
|
||||||
case 'پس انداز':
|
|
||||||
return savingImg
|
|
||||||
default: return savingImg
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
const imageSrc = ref('')
|
||||||
|
|
||||||
/*const itemName = computed(() => {
|
const displayImage = computed(() => imageSrc.value || resolveImage())
|
||||||
switch (props.type) {
|
|
||||||
case 'home':
|
|
||||||
return 'خرید لوازم منزل'
|
|
||||||
case 'gift':
|
|
||||||
return 'هدیه'
|
|
||||||
case 'circulation':
|
|
||||||
return 'گردش'
|
|
||||||
case 'love':
|
|
||||||
return 'ازدواج'
|
|
||||||
case 'repairs':
|
|
||||||
return 'تعمیرات'
|
|
||||||
case 'saving':
|
|
||||||
return 'پس انداز'
|
|
||||||
default: return null
|
|
||||||
}
|
|
||||||
})*/
|
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.item,
|
||||||
|
() => {
|
||||||
|
imageSrc.value = resolveImage()
|
||||||
|
},
|
||||||
|
{ immediate: true, deep: true }
|
||||||
|
)
|
||||||
|
|
||||||
|
function resolveImage() {
|
||||||
|
return getProductDisplayImage({
|
||||||
|
title: props.item.title,
|
||||||
|
group_type: props.item.group_type,
|
||||||
|
file: props.item.file,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function onImageError() {
|
||||||
|
imageSrc.value = getProductDisplayImage({
|
||||||
|
title: props.item.title,
|
||||||
|
group_type: props.item.group_type,
|
||||||
|
file: null,
|
||||||
|
})
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
|
|
||||||
</style>
|
|
||||||
@@ -0,0 +1,99 @@
|
|||||||
|
import { computed, inject, onMounted, provide, type InjectionKey, type Ref } from 'vue'
|
||||||
|
import router from '@/router'
|
||||||
|
import { loading } from '@/utils'
|
||||||
|
import { usePriceWithoutType } from '@/utils/usePrice'
|
||||||
|
import { useWalletAssets } from '@/composables/useWalletAssets'
|
||||||
|
import type { WalletMetalTotal } from '@/models/walletAssets'
|
||||||
|
import { fundPageInventoryCards, formatMetalTotal as buildMetalTotalLabel } from '@/utils/productAssets'
|
||||||
|
import { getLastPrices } from '@/utils/price'
|
||||||
|
import img from '@/assets/img/user_ly1.svg'
|
||||||
|
import empty from '@/assets/img/cash_empty.svg'
|
||||||
|
|
||||||
|
export interface FundPageContext {
|
||||||
|
meta: ReturnType<typeof computed>
|
||||||
|
inventoryCards: ReturnType<typeof computed>
|
||||||
|
metalTotals: ReturnType<typeof computed>
|
||||||
|
primaryMetalTotal: ReturnType<typeof computed>
|
||||||
|
cashWallet: ReturnType<typeof computed>
|
||||||
|
totalRialValue: ReturnType<typeof computed>
|
||||||
|
countBasedInventory: ReturnType<typeof computed>
|
||||||
|
fundHeaderBackground: string
|
||||||
|
fundEmptyImage: string
|
||||||
|
fundEmptyText: string
|
||||||
|
formatMetalTotal: (metal: WalletMetalTotal) => string
|
||||||
|
openFundInfo: (productId: number) => void
|
||||||
|
goBack: () => void
|
||||||
|
}
|
||||||
|
|
||||||
|
export const FUND_PAGE_KEY: InjectionKey<FundPageContext> = Symbol('fundPage')
|
||||||
|
|
||||||
|
export function useFundPage(_isDesktop: Ref<boolean>) {
|
||||||
|
const { assetsSummary, loadWalletAssets } = useWalletAssets()
|
||||||
|
|
||||||
|
const meta = computed(() => assetsSummary.value?.meta)
|
||||||
|
const inventoryCards = computed(() =>
|
||||||
|
fundPageInventoryCards(assetsSummary.value?.inventory_cards ?? [])
|
||||||
|
)
|
||||||
|
const metalTotals = computed(() => assetsSummary.value?.metal_totals ?? [])
|
||||||
|
const primaryMetalTotal = computed(() => metalTotals.value[0])
|
||||||
|
const cashWallet = computed(() => assetsSummary.value?.cash_wallet ?? 0)
|
||||||
|
const totalRialValue = computed(() => assetsSummary.value?.total_rial_value ?? 0)
|
||||||
|
const countBasedInventory = computed(() =>
|
||||||
|
(assetsSummary.value?.count_products ?? []).reduce(
|
||||||
|
(sum, item) => sum + Number(item.quantity ?? 0),
|
||||||
|
0
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
function formatMetalTotal(metal: WalletMetalTotal) {
|
||||||
|
return buildMetalTotalLabel(metal, inventoryCards.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
function openFundInfo(productId: number) {
|
||||||
|
const id = Number(productId)
|
||||||
|
if (!Number.isFinite(id) || id <= 0) return
|
||||||
|
router.push({ name: 'fund_info', params: { id: String(id) } })
|
||||||
|
}
|
||||||
|
|
||||||
|
function goBack() {
|
||||||
|
router.back()
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
try {
|
||||||
|
loading.value = true
|
||||||
|
await Promise.all([loadWalletAssets(true), getLastPrices()])
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e)
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const context: FundPageContext = {
|
||||||
|
meta,
|
||||||
|
inventoryCards,
|
||||||
|
metalTotals,
|
||||||
|
primaryMetalTotal,
|
||||||
|
cashWallet,
|
||||||
|
totalRialValue,
|
||||||
|
countBasedInventory,
|
||||||
|
fundHeaderBackground: img,
|
||||||
|
fundEmptyImage: empty,
|
||||||
|
fundEmptyText: 'یک گنج جدید بساز!',
|
||||||
|
formatMetalTotal,
|
||||||
|
openFundInfo,
|
||||||
|
goBack,
|
||||||
|
}
|
||||||
|
|
||||||
|
provide(FUND_PAGE_KEY, context)
|
||||||
|
return context
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useFundPageContext() {
|
||||||
|
const context = inject(FUND_PAGE_KEY)
|
||||||
|
if (!context) {
|
||||||
|
throw new Error('useFundPageContext must be used within useFundPage')
|
||||||
|
}
|
||||||
|
return context
|
||||||
|
}
|
||||||
@@ -0,0 +1,114 @@
|
|||||||
|
<template>
|
||||||
|
<div class="dfund">
|
||||||
|
<div class="dfund__container">
|
||||||
|
<header class="dfund-topbar">
|
||||||
|
<button type="button" class="dfund-topbar__back" @click="goBack()">
|
||||||
|
<BasicIcon icon="vuesax-linear:arrow-right-1" size="18" />
|
||||||
|
بازگشت
|
||||||
|
</button>
|
||||||
|
<div class="dfund-topbar__meta">
|
||||||
|
<p class="dfund-topbar__eyebrow">دارایی</p>
|
||||||
|
<h1 class="dfund-topbar__title">داراییها</h1>
|
||||||
|
<p class="dfund-topbar__subtitle">نمای کلی موجودی محصولات و کیف پول</p>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<section class="dfund-summary dfund-summary--ghatreh">
|
||||||
|
<img :src="fundHeaderBackground" alt="" class="dfund-summary__bg" />
|
||||||
|
<div class="dfund-summary__content">
|
||||||
|
<h2 class="dfund-summary__title">موجودی داراییها</h2>
|
||||||
|
|
||||||
|
<div v-if="meta?.has_count_based_products" class="dfund-summary__row">
|
||||||
|
<span>محصولات</span>
|
||||||
|
<strong>{{ countBasedInventory }} عدد</strong>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<template v-if="meta?.single_metal && primaryMetalTotal">
|
||||||
|
<div class="dfund-summary__row">
|
||||||
|
<span>{{ primaryMetalTotal.label }}</span>
|
||||||
|
<strong>{{ formatMetalTotal(primaryMetalTotal) }}</strong>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<div
|
||||||
|
v-for="metal in metalTotals"
|
||||||
|
:key="`metal-${metal.metal_id}`"
|
||||||
|
class="dfund-summary__row"
|
||||||
|
>
|
||||||
|
<span>{{ metal.label }}</span>
|
||||||
|
<strong>{{ formatMetalTotal(metal) }}</strong>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<div v-if="meta?.has_count_based_products" class="dfund-summary__row">
|
||||||
|
<span>مجموع موجودی</span>
|
||||||
|
<strong>{{ countBasedInventory }} عدد</strong>
|
||||||
|
</div>
|
||||||
|
<div class="dfund-summary__row">
|
||||||
|
<span>دارایی ریالی</span>
|
||||||
|
<strong class="number-ltr">{{ usePriceWithoutType(cashWallet) }} ریال</strong>
|
||||||
|
</div>
|
||||||
|
<div class="dfund-summary__row dfund-summary__row--highlight">
|
||||||
|
<span>معادل ریالی مجموع</span>
|
||||||
|
<strong class="number-ltr">{{ usePriceWithoutType(totalRialValue) }} ریال</strong>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="dfund-inventory">
|
||||||
|
<div class="dfund-inventory__header">
|
||||||
|
<h3 class="dfund-inventory__title">لیست داراییها</h3>
|
||||||
|
<span class="dfund-inventory__count">{{ inventoryCards.length }} مورد</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
v-if="inventoryCards.length === 0 && !loading"
|
||||||
|
class="dfund-inventory__empty"
|
||||||
|
>
|
||||||
|
<img :src="fundEmptyImage" alt="" class="dfund-inventory__empty-img" />
|
||||||
|
<p>{{ fundEmptyText }}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<a-spin :spinning="loading">
|
||||||
|
<div v-if="inventoryCards.length" class="dfund-inventory__grid">
|
||||||
|
<button
|
||||||
|
v-for="item in inventoryCards"
|
||||||
|
:key="item.product_id"
|
||||||
|
type="button"
|
||||||
|
class="dfund-inventory__card"
|
||||||
|
@click="openFundInfo(item.product_id)"
|
||||||
|
>
|
||||||
|
<Item :item="item" variant="desktop" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</a-spin>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
|
||||||
|
import { loading } from '@/utils'
|
||||||
|
import { usePriceWithoutType } from '@/utils/usePrice'
|
||||||
|
import Item from '../components/Item.vue'
|
||||||
|
import { useFundPageContext } from '../composables/useFundPage'
|
||||||
|
|
||||||
|
const {
|
||||||
|
meta,
|
||||||
|
inventoryCards,
|
||||||
|
metalTotals,
|
||||||
|
primaryMetalTotal,
|
||||||
|
cashWallet,
|
||||||
|
totalRialValue,
|
||||||
|
countBasedInventory,
|
||||||
|
fundHeaderBackground,
|
||||||
|
fundEmptyImage,
|
||||||
|
fundEmptyText,
|
||||||
|
formatMetalTotal,
|
||||||
|
openFundInfo,
|
||||||
|
goBack,
|
||||||
|
} = useFundPageContext()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" src="./styles/desktop-fund.less"></style>
|
||||||
@@ -0,0 +1,506 @@
|
|||||||
|
/* Premium desktop fund page */
|
||||||
|
|
||||||
|
.dfund {
|
||||||
|
min-height: 100%;
|
||||||
|
background: #f6f7f9;
|
||||||
|
color: #111827;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dfund__container {
|
||||||
|
max-width: 1180px;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 28px 36px 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dfund-topbar {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
|
gap: 16px;
|
||||||
|
margin-bottom: 24px;
|
||||||
|
padding-bottom: 24px;
|
||||||
|
border-bottom: 1px solid rgba(15, 23, 42, 0.06);
|
||||||
|
|
||||||
|
&__back {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
border: none;
|
||||||
|
background: transparent;
|
||||||
|
color: #6b7280;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 500;
|
||||||
|
font-family: inherit;
|
||||||
|
cursor: pointer;
|
||||||
|
padding: 8px 0;
|
||||||
|
flex-shrink: 0;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
color: #111827;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&__meta {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__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;
|
||||||
|
line-height: 1.2;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__subtitle {
|
||||||
|
font-size: 14px;
|
||||||
|
color: #6b7280;
|
||||||
|
margin: 6px 0 0;
|
||||||
|
line-height: 1.6;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.dfund-summary {
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
border-radius: 16px;
|
||||||
|
margin-bottom: 24px;
|
||||||
|
background: var(--app-primary-color, #a72b77);
|
||||||
|
color: #fff;
|
||||||
|
|
||||||
|
&--bazretala {
|
||||||
|
background: #000;
|
||||||
|
}
|
||||||
|
|
||||||
|
&--ghatreh {
|
||||||
|
background: #efced9;
|
||||||
|
color: #374151;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__bg {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
opacity: 0.08;
|
||||||
|
pointer-events: none;
|
||||||
|
|
||||||
|
&--cover {
|
||||||
|
inset: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
object-fit: cover;
|
||||||
|
opacity: 0.35;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&__content {
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
padding: 24px 28px;
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||||
|
gap: 16px 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__title {
|
||||||
|
grid-column: 1 / -1;
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 600;
|
||||||
|
margin: 0 0 4px;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__row {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 4px;
|
||||||
|
font-size: 13px;
|
||||||
|
|
||||||
|
span {
|
||||||
|
opacity: 0.85;
|
||||||
|
}
|
||||||
|
|
||||||
|
strong {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
&--highlight {
|
||||||
|
grid-column: 1 / -1;
|
||||||
|
padding-top: 8px;
|
||||||
|
border-top: 1px solid rgba(255, 255, 255, 0.2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.dfund-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);
|
||||||
|
}
|
||||||
|
|
||||||
|
.dfund-inventory {
|
||||||
|
background: #fff;
|
||||||
|
border: 1px solid rgba(15, 23, 42, 0.06);
|
||||||
|
border-radius: 16px;
|
||||||
|
padding: 24px;
|
||||||
|
box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
|
||||||
|
|
||||||
|
&__header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 12px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__title {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 600;
|
||||||
|
margin: 0;
|
||||||
|
color: #111827;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__count {
|
||||||
|
font-size: 13px;
|
||||||
|
color: #9ca3af;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||||
|
gap: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__card {
|
||||||
|
border: none;
|
||||||
|
background: transparent;
|
||||||
|
padding: 0;
|
||||||
|
cursor: pointer;
|
||||||
|
font-family: inherit;
|
||||||
|
text-align: inherit;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
&:hover .dfund-card {
|
||||||
|
border-color: rgba(15, 23, 42, 0.12);
|
||||||
|
box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&__empty {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
padding: 48px 24px;
|
||||||
|
text-align: center;
|
||||||
|
color: #6b7280;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__empty-img {
|
||||||
|
width: 160px;
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.dfund-card {
|
||||||
|
width: 100%;
|
||||||
|
border: 1px solid rgba(15, 23, 42, 0.08) !important;
|
||||||
|
border-radius: 14px !important;
|
||||||
|
transition: border-color 0.15s ease, box-shadow 0.15s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 1024px) {
|
||||||
|
.dfund-summary__content {
|
||||||
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||||
|
}
|
||||||
|
|
||||||
|
.dfund-inventory__grid {
|
||||||
|
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.dfund-inventory__grid {
|
||||||
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Fund info desktop */
|
||||||
|
|
||||||
|
.dfund-info {
|
||||||
|
min-height: 100%;
|
||||||
|
background: #f6f7f9;
|
||||||
|
color: #111827;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dfund-info__container {
|
||||||
|
max-width: 1180px;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 28px 36px 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dfund-info-topbar {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
|
gap: 16px;
|
||||||
|
margin-bottom: 24px;
|
||||||
|
padding-bottom: 24px;
|
||||||
|
border-bottom: 1px solid rgba(15, 23, 42, 0.06);
|
||||||
|
|
||||||
|
&__back {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
border: none;
|
||||||
|
background: transparent;
|
||||||
|
color: #6b7280;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 500;
|
||||||
|
font-family: inherit;
|
||||||
|
cursor: pointer;
|
||||||
|
padding: 8px 0;
|
||||||
|
flex-shrink: 0;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
color: #111827;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&__meta {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__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;
|
||||||
|
line-height: 1.2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.dfund-info__layout {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 280px minmax(0, 1fr);
|
||||||
|
gap: 20px;
|
||||||
|
align-items: start;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dfund-info__hero {
|
||||||
|
padding: 28px 24px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dfund-info__image {
|
||||||
|
width: 120px;
|
||||||
|
height: 120px;
|
||||||
|
margin: 0 auto 16px;
|
||||||
|
border-radius: 16px;
|
||||||
|
background: #e0f2fe;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
img {
|
||||||
|
max-width: 80%;
|
||||||
|
max-height: 80%;
|
||||||
|
object-fit: contain;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.dfund-info__balance {
|
||||||
|
display: flex;
|
||||||
|
align-items: baseline;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dfund-info__balance-value {
|
||||||
|
font-size: 28px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: var(--app-primary-color, #a72b77);
|
||||||
|
}
|
||||||
|
|
||||||
|
.dfund-info__balance-unit {
|
||||||
|
font-size: 14px;
|
||||||
|
color: #6b7280;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dfund-info__balance-label {
|
||||||
|
margin: 8px 0 0;
|
||||||
|
font-size: 13px;
|
||||||
|
color: #9ca3af;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dfund-info__transactions {
|
||||||
|
padding: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dfund-info__transactions-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 12px;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dfund-info__transactions-title {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 600;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dfund-info__transactions-count {
|
||||||
|
font-size: 13px;
|
||||||
|
color: #9ca3af;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dfund-info__transactions-list {
|
||||||
|
max-height: 520px;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 1024px) {
|
||||||
|
.dfund-info__layout {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Fund new desktop */
|
||||||
|
|
||||||
|
.dfund-new {
|
||||||
|
min-height: 100%;
|
||||||
|
background: #f6f7f9;
|
||||||
|
color: #111827;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dfund-new__container {
|
||||||
|
max-width: 640px;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 28px 36px 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dfund-new-topbar {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
|
gap: 16px;
|
||||||
|
margin-bottom: 24px;
|
||||||
|
padding-bottom: 24px;
|
||||||
|
border-bottom: 1px solid rgba(15, 23, 42, 0.06);
|
||||||
|
|
||||||
|
&__back {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
border: none;
|
||||||
|
background: transparent;
|
||||||
|
color: #6b7280;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 500;
|
||||||
|
font-family: inherit;
|
||||||
|
cursor: pointer;
|
||||||
|
padding: 8px 0;
|
||||||
|
flex-shrink: 0;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
color: #111827;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&__meta {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__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;
|
||||||
|
line-height: 1.2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.dfund-new__card {
|
||||||
|
padding: 32px 28px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dfund-new__preview {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
margin-bottom: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dfund-new__preview-img {
|
||||||
|
width: 120px;
|
||||||
|
height: 120px;
|
||||||
|
object-fit: contain;
|
||||||
|
border-radius: 16px;
|
||||||
|
background: #e0f2fe;
|
||||||
|
padding: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dfund-new__label {
|
||||||
|
display: block;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #374151;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dfund-new__tags {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 8px;
|
||||||
|
margin: 20px 0 28px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dfund-new__tag {
|
||||||
|
padding: 8px 14px;
|
||||||
|
border-radius: 999px;
|
||||||
|
border: 1px solid rgba(15, 23, 42, 0.1);
|
||||||
|
background: #f3f4f6;
|
||||||
|
color: #4b5563;
|
||||||
|
font-size: 12px;
|
||||||
|
font-family: inherit;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
&--active {
|
||||||
|
background: var(--app-primary-color, #a72b77);
|
||||||
|
border-color: var(--app-primary-color, #a72b77);
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.dfund-new__submit {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
+13
-112
@@ -1,122 +1,23 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div class="fund-page-root main-with-bottom-chrome-inner--contained">
|
||||||
<div class="bg-white w-full py-3 px-3 text-black font-bold drop-shadow fixed md:absolute top-0 flex h-12 z-20">
|
<DesktopFundView v-show="isDesktop" />
|
||||||
<div @click="router.back()">
|
<MobileFundView v-show="!isDesktop" />
|
||||||
<BasicIcon icon="vuesax-linear:arrow-right-1"/>
|
|
||||||
</div>
|
|
||||||
<div class="mr-2">قلک</div>
|
|
||||||
</div>
|
|
||||||
<div class="bg-[#EFCED9] w-screen md:w-full h-[70vh] fixed md:absolute">
|
|
||||||
<div class="pt-15 flex flex-col">
|
|
||||||
<div class="text-gray-500 font-bold mr-5 z-20">موجودی قلک ها</div>
|
|
||||||
<div class="flex items-baseline justify-center mt-2 w-full z-20">
|
|
||||||
<div class="text-3xl font-bold">{{ inventory }}</div>
|
|
||||||
/گرم
|
|
||||||
</div>
|
|
||||||
<img :src="img" alt="" class="mt-[-4rem] mr-10 max-w-[22rem] self-end">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="pt-[20rem] ">
|
|
||||||
<div class="bg-gray-100 w-screen md:w-full z-20 relative rounded-t-3xl h-[calc(100vh-20rem-70px)] overflow-y-auto pb-15"
|
|
||||||
style="box-shadow: 0px -2px 4px -2px #0000001A;">
|
|
||||||
|
|
||||||
<div v-if="items.length === 0 && !loading" class="w-full h-full flex justify-center items-center">
|
|
||||||
<div>
|
|
||||||
<img :src="empty" alt="" class="w-70 ">
|
|
||||||
<div class="text-center text-lg">یک قلک جدید بساز!</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<a-spin :spinning="loading">
|
|
||||||
<div :class="loading? 'h-[40vh]':''" class="grid grid-cols-2 gap-3 p-5">
|
|
||||||
<Item v-for="item in items" :item="item"
|
|
||||||
@click="router.push({name: 'fund_info', params:{id:item.id}})"/>
|
|
||||||
</div>
|
|
||||||
</a-spin>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="fixed w-full flex justify-center bottom-23 z-200 md:right-0">
|
|
||||||
<div class="rounded-3xl bg-primary text-white px-5 py-2" @click="router.push({name: 'fund_add'})">افزودن قلک
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
import { useDesktopBreakpoint } from '@/layouts/composables/useAppLayout'
|
||||||
|
import { useFundPage } from './composables/useFundPage'
|
||||||
|
import DesktopFundView from './desktop/DesktopFundView.vue'
|
||||||
|
import MobileFundView from './mobile/MobileFundView.vue'
|
||||||
|
|
||||||
import router from "@/router";
|
const isDesktop = useDesktopBreakpoint()
|
||||||
import BasicIcon from "@/components/BasicPacks/BasicIcon.vue";
|
useFundPage(isDesktop)
|
||||||
import img from '@/assets/img/cash_img.svg'
|
|
||||||
import empty from '@/assets/img/cash_empty.svg'
|
|
||||||
import Item from './components/Item.vue'
|
|
||||||
import {onMounted, ref} from "vue";
|
|
||||||
import {loading} from "@/utils";
|
|
||||||
import type {TableOutput} from "@/models/table";
|
|
||||||
import type {Fund} from "@/models/fund";
|
|
||||||
import {useFundUserStore} from "@/store/fundStore";
|
|
||||||
|
|
||||||
const items = ref<Fund[]>([])
|
|
||||||
const tableOutput = ref<TableOutput<Fund> | null>(null)
|
|
||||||
const inventory = ref<number>(0)
|
|
||||||
const fundStore = useFundUserStore()
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
initTable()
|
|
||||||
})
|
|
||||||
|
|
||||||
async function initTable() {
|
|
||||||
try {
|
|
||||||
loading.value = true
|
|
||||||
tableOutput.value = fundStore.myFunds ?? await fundStore.getMyFund() ?? null
|
|
||||||
// console.log(tableOutput.value)
|
|
||||||
items.value.push(...tableOutput.value?.rows ?? [])
|
|
||||||
items.value.forEach(x => {
|
|
||||||
// console.log(x.wallet[0]?.gold)
|
|
||||||
inventory.value += x?.wallet[0]?.gold ?? 0
|
|
||||||
// console.log(inventory.value)
|
|
||||||
})
|
|
||||||
// console.log(tableOutput.value)
|
|
||||||
} catch (e) {
|
|
||||||
console.log(e)
|
|
||||||
} finally {
|
|
||||||
loading.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*watch(()=> router.currentRoute.value.name, () =>{
|
|
||||||
console.log('salammmmmmmmmmmmmmmmmmmmmmmmmmm')
|
|
||||||
})*/
|
|
||||||
/*
|
|
||||||
const items = [
|
|
||||||
{
|
|
||||||
type: 'home',
|
|
||||||
amount: 2.7
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'gift',
|
|
||||||
amount: 13.1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'saving',
|
|
||||||
amount: 6.4
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'repairs',
|
|
||||||
amount: 16.6
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'circulation',
|
|
||||||
amount: 5.4
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'love',
|
|
||||||
amount: 3.7
|
|
||||||
},
|
|
||||||
]
|
|
||||||
*/
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
.fund-page-root {
|
||||||
|
min-height: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -1,69 +1,63 @@
|
|||||||
<template>
|
<template>
|
||||||
|
|
||||||
<div @click="infoVisible = true">
|
<div @click="infoVisible = true">
|
||||||
<div class="flex">
|
<div class="flex">
|
||||||
<div :class="isUp? 'bg-green-50':'bg-red-50'"
|
<div
|
||||||
class="rounded-lg p-3 h-fit w-fit flex justify-center items-center ">
|
:class="isUp ? 'bg-green-50' : 'bg-red-50'"
|
||||||
<Icon :class="isUp? 'text-green-600':'text-red-600'"
|
class="rounded-lg p-3 h-fit w-fit flex justify-center items-center"
|
||||||
:icon="`vuesax-linear:${isUp? 'arrow-up-2':'arrow-down-2'}`"/>
|
>
|
||||||
|
<Icon
|
||||||
|
:class="isUp ? 'text-green-600' : 'text-red-600'"
|
||||||
|
:icon="`vuesax-linear:${isUp ? 'arrow-up-2' : 'arrow-down-2'}`"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="w-full mr-3">
|
<div class="w-full mr-3">
|
||||||
<div class="flex justify-between w-full">
|
<div class="flex justify-between w-full">
|
||||||
<div>{{ item.type_str }}</div>
|
<div>{{ item.title }}</div>
|
||||||
<div>{{ toJalaliNotime(item.expire_at) }}</div>
|
<div>{{ toJalaliNotime(item.expire_at) }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex justify-between mt-2 ">
|
<div class="flex justify-between mt-2">
|
||||||
<div :class="item.gold >= 0? 'text-green-600':'text-red-600'" class="text-gray-500 text-xs number-ltr">
|
<div
|
||||||
</div>
|
:class="item.gold >= 0 ? 'text-green-600' : 'text-red-600'"
|
||||||
|
class="text-gray-500 text-xs number-ltr"
|
||||||
|
/>
|
||||||
<div class="text-gray-500 flex gap-1 text-xs items-center">
|
<div class="text-gray-500 flex gap-1 text-xs items-center">
|
||||||
<div :class="item.gold > 0 ? 'text-green-600':'text-red-600'" class="text-base number-ltr">
|
<div
|
||||||
{{ item.gold }}
|
:class="item.gold > 0 ? 'text-green-600' : 'text-red-600'"
|
||||||
|
class="text-base number-ltr"
|
||||||
|
>
|
||||||
|
{{ formatGoldAmount(item.gold) }}
|
||||||
</div>
|
</div>
|
||||||
گرم
|
{{ item.unit }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- <div v-if="isGold" class="flex w-full justify-between mt-2">
|
<a-divider class="!my-3" />
|
||||||
<div class="text-gray-500">قیمت معامله</div>
|
|
||||||
<div class="text-gray-500 flex gap-1 text-xs items-center">
|
|
||||||
<div class="text-base">{{ usePriceWithoutType(Math.abs(item.cash) / Math.abs(item.gold)) }}</div>
|
|
||||||
ریال
|
|
||||||
</div>
|
|
||||||
</div>-->
|
|
||||||
<!-- <div v-else class="h-8"></div>-->
|
|
||||||
<a-divider class="!my-3"/>
|
|
||||||
<BasicActionSheet v-model:show="infoVisible">
|
<BasicActionSheet v-model:show="infoVisible">
|
||||||
<div class="font-bold text-lg">{{ props.item.type_str }}</div>
|
<div class="font-bold text-lg">{{ props.item.title }}</div>
|
||||||
<div class="pb-20 mt-5">
|
<div class="pb-20 mt-5">
|
||||||
<div class="flex justify-between mb-3">
|
<div class="flex justify-between mb-3">
|
||||||
<div class="text-black">مقدار طلا مبادله شده:</div>
|
<div class="text-black">مقدار {{ props.title }} مبادله شده:</div>
|
||||||
<div :class="item.gold >= 0? 'text-green-600' : 'text-red-600'" class="flex text-xs items-center">
|
<div
|
||||||
<div class="text-base ml-1 number-ltr">{{ item.gold }}</div>
|
:class="item.gold >= 0 ? 'text-green-600' : 'text-red-600'"
|
||||||
گرم
|
class="flex text-xs items-center"
|
||||||
|
>
|
||||||
|
<div class="text-base ml-1 number-ltr">{{ formatGoldAmount(item.gold) }}</div>
|
||||||
|
{{ item.unit }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex justify-between mb-3">
|
<div class="flex justify-between mb-3">
|
||||||
<div class="text-black">موجودی کیف طلا:</div>
|
<div class="text-black">موجودی {{ props.title }}:</div>
|
||||||
<div class="flex text-xs text-yellow-700 items-center">
|
<div class="flex text-xs text-yellow-700 items-center">
|
||||||
<div class="text-base ml-1">{{ item.balance_gold }}</div>
|
<div class="text-base ml-1">{{ formatGoldAmount(item.balance_gold) }}</div>
|
||||||
گرم
|
{{ item.unit }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class="flex justify-between mb-3">
|
|
||||||
<div class="text-black">موجودی کیف پول:</div>
|
|
||||||
<div class="flex text-xs items-center" :class="isUp? 'text-green-600' : 'text-red-600'"><div class="text-base">{{usePriceWithoutType(12000000)}}</div>ریال</div>
|
|
||||||
</div>
|
|
||||||
<div class="flex justify-between mb-3">
|
|
||||||
<div class="text-black">موجودی کیف طلا:</div>
|
|
||||||
<div class="flex items-center" :class="isUp? 'text-red-600' : 'text-green-600'">60 گرم</div>
|
|
||||||
</div>-->
|
|
||||||
<div class="flex justify-between mb-3">
|
<div class="flex justify-between mb-3">
|
||||||
<div class="text-black">وضعیت:</div>
|
<div class="text-black">وضعیت:</div>
|
||||||
<div class="flex text-xs items-center">
|
<div class="flex text-xs items-center">
|
||||||
<ATag :color="item.active? 'blue': 'red'" class="!py-1 !px-6 !ml-0">{{
|
<ATag :color="item.active ? 'blue' : 'red'" class="!py-1 !px-6 !ml-0">
|
||||||
item.active ? 'موفق' : 'نا موفق'
|
{{ item.active ? 'موفق' : 'نا موفق' }}
|
||||||
}}
|
|
||||||
</ATag>
|
</ATag>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -79,43 +73,24 @@
|
|||||||
</div>
|
</div>
|
||||||
</BasicActionSheet>
|
</BasicActionSheet>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import Icon from "@/components/BasicPacks/BasicIcon.vue";
|
import Icon from '@/components/BasicPacks/BasicIcon.vue'
|
||||||
import BasicActionSheet from "@/components/BasicPacks/BasicActionSheet.vue";
|
import BasicActionSheet from '@/components/BasicPacks/BasicActionSheet.vue'
|
||||||
import {computed, ref} from "vue";
|
import { computed, ref } from 'vue'
|
||||||
import BasicButton from "@/components/BasicPacks/BasicButton.vue";
|
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
|
||||||
import type {Transaction} from "@/models/transaction";
|
import type { Transaction } from '@/models/transaction'
|
||||||
import {toJalaliNotime, toTime} from "../../../../../utils/useDateTime";
|
import { formatGoldAmount } from '@/utils/usePrice'
|
||||||
|
import { toJalaliNotime, toTime } from '@/utils/useDateTime'
|
||||||
|
|
||||||
const infoVisible = ref<boolean>(false)
|
const infoVisible = ref<boolean>(false)
|
||||||
|
|
||||||
interface Prop {
|
interface Prop {
|
||||||
item: Transaction
|
item: Transaction
|
||||||
|
title?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = withDefaults(defineProps<Prop>(), {})
|
const props = withDefaults(defineProps<Prop>(), {})
|
||||||
const isUp = computed(() => props.item.type === 3 || props.item.type === 1)
|
const isUp = computed(() => props.item.type === 3 || props.item.type === 1)
|
||||||
const isGold = computed(() => props.item.type === 1 || props.item.type === 2)
|
|
||||||
/*const title = computed(() => {
|
|
||||||
if (isUp.value) {
|
|
||||||
if (isGold.value) {
|
|
||||||
return 'واریز ریالی'
|
|
||||||
} else {
|
|
||||||
return 'خرید طلا'
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (isGold.value) {
|
|
||||||
return 'برداشت ریالی'
|
|
||||||
} else {
|
|
||||||
return 'فروش طلا'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})*/
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
|
|
||||||
</style>
|
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
import { computed, inject, provide, ref, watch, type InjectionKey } from 'vue'
|
||||||
|
import { useRoute } from 'vue-router'
|
||||||
|
import router from '@/router'
|
||||||
|
import { loading } from '@/utils'
|
||||||
|
import { getFundTransactionTable } from '@/api/fund'
|
||||||
|
import { getOneProductWallet } from '@/api/products'
|
||||||
|
import type { Product } from '@/models/products'
|
||||||
|
import type { TableInput, TableOutput } from '@/models/table'
|
||||||
|
import type { Transaction } from '@/models/transaction'
|
||||||
|
|
||||||
|
export interface FundInfoPageContext {
|
||||||
|
info: ReturnType<typeof ref<Product | undefined>>
|
||||||
|
items: ReturnType<typeof ref<Transaction[]>>
|
||||||
|
infoId: ReturnType<typeof computed<number | null>>
|
||||||
|
goBack: () => void
|
||||||
|
}
|
||||||
|
|
||||||
|
export const FUND_INFO_PAGE_KEY: InjectionKey<FundInfoPageContext> = Symbol('fundInfoPage')
|
||||||
|
|
||||||
|
function parseRouteProductId(raw: string | string[] | undefined): number | null {
|
||||||
|
const value = Array.isArray(raw) ? raw[0] : raw
|
||||||
|
if (value == null || value === '') return null
|
||||||
|
const id = Number.parseInt(String(value), 10)
|
||||||
|
return Number.isFinite(id) && id > 0 ? id : null
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useFundInfoPage() {
|
||||||
|
const route = useRoute()
|
||||||
|
const info = ref<Product>()
|
||||||
|
const items = ref<Transaction[]>([])
|
||||||
|
const tableOutput = ref<TableOutput<Transaction> | null>(null)
|
||||||
|
const pagination = ref<TableInput>({})
|
||||||
|
|
||||||
|
const infoId = computed(() => parseRouteProductId(route.params.id))
|
||||||
|
|
||||||
|
async function initTable() {
|
||||||
|
if (!info.value?.wallet?.id) return
|
||||||
|
|
||||||
|
try {
|
||||||
|
loading.value = true
|
||||||
|
items.value = []
|
||||||
|
Object.assign(pagination.value, { wallet_id: info.value.wallet.id })
|
||||||
|
tableOutput.value = await getFundTransactionTable(pagination.value)
|
||||||
|
items.value.push(...(tableOutput.value?.rows ?? []))
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e)
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function initInfo() {
|
||||||
|
const id = infoId.value
|
||||||
|
if (id == null) {
|
||||||
|
console.error('Invalid fund product id in route')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
loading.value = true
|
||||||
|
info.value = await getOneProductWallet(id)
|
||||||
|
await initTable()
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e)
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(infoId, (id) => {
|
||||||
|
if (id != null) void initInfo()
|
||||||
|
}, { immediate: true })
|
||||||
|
|
||||||
|
function goBack() {
|
||||||
|
router.back()
|
||||||
|
}
|
||||||
|
|
||||||
|
const context: FundInfoPageContext = {
|
||||||
|
info,
|
||||||
|
items,
|
||||||
|
infoId,
|
||||||
|
goBack,
|
||||||
|
}
|
||||||
|
|
||||||
|
provide(FUND_INFO_PAGE_KEY, context)
|
||||||
|
return context
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useFundInfoPageContext() {
|
||||||
|
const context = inject(FUND_INFO_PAGE_KEY)
|
||||||
|
if (!context) throw new Error('useFundInfoPageContext must be used within useFundInfoPage')
|
||||||
|
return context
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
<template>
|
||||||
|
<div class="dfund-info">
|
||||||
|
<div class="dfund-info__container">
|
||||||
|
<DesktopPageTopbar
|
||||||
|
eyebrow="جزئیات دارایی"
|
||||||
|
:title="info?.title ?? '—'"
|
||||||
|
show-back
|
||||||
|
sticky
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div class="dfund-info__layout">
|
||||||
|
<section class="dfund-info__hero dfund-surface">
|
||||||
|
<a-spin :spinning="loading">
|
||||||
|
<div class="dfund-info__image">
|
||||||
|
<ProductImage
|
||||||
|
v-if="info"
|
||||||
|
:product="info"
|
||||||
|
img-class="max-w-full max-h-full object-contain"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</a-spin>
|
||||||
|
<div class="dfund-info__balance">
|
||||||
|
<span class="dfund-info__balance-value">{{ info?.wallet?.gold ?? 0 }}</span>
|
||||||
|
<span class="dfund-info__balance-unit">{{ info?.unit ?? 'عدد' }}</span>
|
||||||
|
</div>
|
||||||
|
<p class="dfund-info__balance-label">موجودی {{ info?.title }}</p>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="dfund-info__transactions dfund-surface">
|
||||||
|
<div class="dfund-info__transactions-header">
|
||||||
|
<h2 class="dfund-info__transactions-title">تراکنشها</h2>
|
||||||
|
<span class="dfund-info__transactions-count">{{ items.length }} مورد</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="dfund-info__transactions-list">
|
||||||
|
<list-anim v-if="!loading">
|
||||||
|
<Item v-for="item in items" :key="item.id" :item="item" :title="info?.title" />
|
||||||
|
</list-anim>
|
||||||
|
<TransactionSkeleton v-for="i in 6" v-else :key="i" class="mt-1" />
|
||||||
|
<empty v-if="items.length === 0 && !loading" text="هیچ تراکنشی یافت نشد" />
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import DesktopPageTopbar from '@/layouts/components/DesktopPageTopbar.vue'
|
||||||
|
import ProductImage from '@/components/ProductImage.vue'
|
||||||
|
import { loading } from '@/utils'
|
||||||
|
import ListAnim from '@/components/ListAnim.vue'
|
||||||
|
import TransactionSkeleton from '@/components/TransactionSkeleton.vue'
|
||||||
|
import Empty from '@/components/empty.vue'
|
||||||
|
import Item from '../components/Item.vue'
|
||||||
|
import { useFundInfoPageContext } from '../composables/useFundInfoPage'
|
||||||
|
|
||||||
|
const { info, items } = useFundInfoPageContext()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" src="../../desktop/styles/desktop-fund.less"></style>
|
||||||
@@ -1,291 +1,23 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div class="fund-info-page-root">
|
||||||
<div class="bg-white wrap-fix py-3 px-3 text-black font-bold drop-shadow flex h-12 z-20 justify-between">
|
<DesktopFundInfoView v-show="isDesktop" />
|
||||||
<div class="flex ">
|
<MobileFundInfoView v-show="!isDesktop" />
|
||||||
<div @click="router.back()" class="cursor-pointer">
|
|
||||||
<BasicIcon icon="vuesax-linear:arrow-right-1" />
|
|
||||||
</div>
|
|
||||||
<div class="mr-2">{{ info?.title }}</div>
|
|
||||||
</div>
|
|
||||||
<div @click="editShow = true">
|
|
||||||
<BasicIcon icon="vuesax-linear:setting-4" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="pt-20 flex flex-col justify-center items-center">
|
|
||||||
<a-spin :spinning="loading">
|
|
||||||
<div class="bg-sky-100 w-[120px] aspect-square flex justify-center rounded-xl">
|
|
||||||
<img v-if="!loading" :src="itemImg" alt="">
|
|
||||||
</div>
|
|
||||||
</a-spin>
|
|
||||||
<div class="mt-2 font-bold flex text-xs items-center text-gray-500">
|
|
||||||
<div class="ml-1 text-base text-black">{{ info?.wallet[0]?.gold }}</div>
|
|
||||||
گرم
|
|
||||||
</div>
|
|
||||||
<div class="text-gray-400">موجودی قلک {{ info?.title }}</div>
|
|
||||||
<div class="w-full p-5">
|
|
||||||
<div class="w-full flex gap-3">
|
|
||||||
<BasicButton class="w-full !bg-[#F3F0E9] !border-0 !rounded" icon="vuesax-linear:add-square" icon-size="18"
|
|
||||||
@click="()=> {transactionShow = true; isDeposit= false}">برداشت
|
|
||||||
</BasicButton>
|
|
||||||
<BasicButton class="w-full !bg-[#F3F0E9] !border-0 !rounded" icon="vuesax-linear:arrow-up" icon-size="18"
|
|
||||||
@click="()=> {transactionShow = true; isDeposit= true}">واریز
|
|
||||||
</BasicButton>
|
|
||||||
</div>
|
|
||||||
<div class=" font-bold mt-5">تراکنش ها</div>
|
|
||||||
<!-- <a-spin :spinning="loading">-->
|
|
||||||
<div class="mt-5 pb-17 overflow-y-scroll h-[54vh]">
|
|
||||||
<list-anim v-if="!loading">
|
|
||||||
<Item v-for="item in items" :key="item.id" :item="item" />
|
|
||||||
</list-anim>
|
|
||||||
<TransactionSkeleton v-for="i in 8" v-else :key="i" class="mt-1" />
|
|
||||||
<empty v-if="items.length === 0 && !loading" text="هیچ تراکنشی یافت نشد" />
|
|
||||||
</div>
|
|
||||||
<!-- </a-spin>-->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<BasicActionSheet v-model:show="transactionShow">
|
|
||||||
<div class="font-bold text-lg">{{ isDeposit ? 'واریز' : 'برداشت' }}</div>
|
|
||||||
<a-form ref="formRef" :model="userFormState" class="!mt-5" name="basic" @finish="transaction()">
|
|
||||||
<a-form-item :rules="[required()]" label="مقدار گرم طلا" name="value" class="!block">
|
|
||||||
<BasicInput v-model:value="userFormState.value"
|
|
||||||
addon-before="گرم" place-holder="گرم"
|
|
||||||
type="text" inputmode="decimal"
|
|
||||||
size="large" />
|
|
||||||
<div v-if="isDeposit" class="mt-2 text-xs font-bold leading-5">
|
|
||||||
<div>موجودی کیف طلا: {{ walletStore?.walletInfo?.gold }} گرم</div>
|
|
||||||
<div v-if="info?.wallet[0]?.gold !== 0">
|
|
||||||
{{ `موجودی قابل برداشت قلک: ${info?.wallet[0]?.gold ?? 0} گرم` }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div v-else class="mt-2 text-xs font-bold">موجودی قلک {{ info.title }}: {{ info?.wallet[0]?.gold }} گرم
|
|
||||||
</div>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item>
|
|
||||||
<BasicButton
|
|
||||||
:disabled="transButtonDisable"
|
|
||||||
class=" w-full py-2 mt-2"
|
|
||||||
html-type="submit"
|
|
||||||
type="primary"
|
|
||||||
>
|
|
||||||
<div>
|
|
||||||
<a-spin v-if="loading" size="small" />
|
|
||||||
<div v-else>{{ isDeposit ? 'واریز' : 'برداشت' }}</div>
|
|
||||||
</div>
|
|
||||||
</BasicButton>
|
|
||||||
<BasicButton class="mb-20 mt-2 w-full" @click="transactionShow = false">بازگشت</BasicButton>
|
|
||||||
</a-form-item>
|
|
||||||
</a-form>
|
|
||||||
</BasicActionSheet>
|
|
||||||
<BasicActionSheet v-model:show="editShow">
|
|
||||||
<div class="font-bold text-lg">قلک {{ info?.title }}</div>
|
|
||||||
|
|
||||||
<BasicButton class="mt-12 w-full" icon="vuesax-linear:edit"
|
|
||||||
icon-size="16" @click="$router.push({name: 'fund_add', query:{id:infoId}})">
|
|
||||||
<div class="flex w-full justify-right">ویرایش</div>
|
|
||||||
</BasicButton>
|
|
||||||
<BasicButton :loading="loading" class="mb-10 mt-2 w-full !text-red-600"
|
|
||||||
icon="vuesax-linear:trash"
|
|
||||||
icon-size="16"
|
|
||||||
@click="deleteFundConfirm">
|
|
||||||
<div class="flex w-full justify-right">حذف</div>
|
|
||||||
</BasicButton>
|
|
||||||
|
|
||||||
<BasicButton class="mb-20 mt-2 w-full" type="primary" @click="transactionShow = false">بازگشت</BasicButton>
|
|
||||||
</BasicActionSheet>
|
|
||||||
<DialogVant v-model:show="showDeleteConfirm" :closeOnClickOverlay="true" :timeOut="-1">
|
|
||||||
<!-- <template v-slot:img>
|
|
||||||
<img :src="registerDelayImage" alt="" class="opacity-80">
|
|
||||||
</template>-->
|
|
||||||
|
|
||||||
<template v-slot:title>
|
|
||||||
<div class="p-5 text-sm">
|
|
||||||
آیا از حذف قلک خود اطمینان دارید؟
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template v-slot:button>
|
|
||||||
<div class="text-center text-red" @click="deleteFundFunction">
|
|
||||||
حذف
|
|
||||||
</div>
|
|
||||||
<div class="text-center" @click="showDeleteConfirm = false">
|
|
||||||
انصراف
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
</DialogVant>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
import { useDesktopBreakpoint } from '@/layouts/composables/useAppLayout'
|
||||||
|
import { useFundInfoPage } from './composables/useFundInfoPage'
|
||||||
|
import DesktopFundInfoView from './desktop/DesktopFundInfoView.vue'
|
||||||
|
import MobileFundInfoView from './mobile/MobileFundInfoView.vue'
|
||||||
|
|
||||||
import router from '@/router'
|
const isDesktop = useDesktopBreakpoint()
|
||||||
import { computed, onMounted, reactive, ref, watch } from 'vue'
|
useFundInfoPage()
|
||||||
import Item from './components/Item.vue'
|
|
||||||
import homeImg from '@/assets/img/cash_home.svg'
|
|
||||||
import giftImg from '@/assets/img/cash_gift.svg'
|
|
||||||
import circulationImg from '@/assets/img/cash_circulation.svg'
|
|
||||||
import loveImg from '@/assets/img/cash_love.svg'
|
|
||||||
import repairsImg from '@/assets/img/cash_repairs.svg'
|
|
||||||
import savingImg from '@/assets/img/cash_saving.svg'
|
|
||||||
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
|
|
||||||
import { loading } from '@/utils'
|
|
||||||
import { deleteFund, fundDeposit, fundWithdraw, getFundById, getFundTransactionTable } from '@/api/fund'
|
|
||||||
import type { Fund, FundTransaction } from '@/models/fund'
|
|
||||||
import type { TableInput, TableOutput } from '@/models/table'
|
|
||||||
import type { Transaction } from '@/models/transaction'
|
|
||||||
import Empty from '@/components/empty.vue'
|
|
||||||
import { required } from '@/utils/inputRules'
|
|
||||||
import type { FormInstance } from 'ant-design-vue'
|
|
||||||
import { message } from 'ant-design-vue'
|
|
||||||
import BasicActionSheet from '@/components/BasicPacks/BasicActionSheet.vue'
|
|
||||||
import BasicInput from '@/components/BasicPacks/BasicInput.vue'
|
|
||||||
import { useWalletStore } from '@/store/walletStore'
|
|
||||||
import ListAnim from '@/components/ListAnim.vue'
|
|
||||||
import TransactionSkeleton from '@/components/TransactionSkeleton.vue'
|
|
||||||
import DialogVant from '@/components/DialogVant.vue'
|
|
||||||
import { useFundUserStore } from '@/store/fundStore'
|
|
||||||
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
|
|
||||||
|
|
||||||
const info = ref<Fund>()
|
|
||||||
const items = ref<Transaction[]>([])
|
|
||||||
const tableOutput = ref<TableOutput<Transaction> | null>(null)
|
|
||||||
const pagination = ref<TableInput>({/*limit: 100, page: 0*/ })
|
|
||||||
const transactionShow = ref<boolean>()
|
|
||||||
const editShow = ref<boolean>()
|
|
||||||
const showDeleteConfirm = ref<boolean>()
|
|
||||||
const isDeposit = ref<boolean>()
|
|
||||||
const formRef = ref<FormInstance>()
|
|
||||||
let fundStore = useFundUserStore()
|
|
||||||
let walletStore = useWalletStore()
|
|
||||||
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
initInfo()
|
|
||||||
// initTable()
|
|
||||||
})
|
|
||||||
|
|
||||||
function deleteFundConfirm() {
|
|
||||||
if (info.value?.wallet[0] === undefined || info.value?.wallet[0]?.gold === 0) {
|
|
||||||
showDeleteConfirm.value = true
|
|
||||||
} else {
|
|
||||||
message.error('ابتدا قلک خود را خالی کنید')
|
|
||||||
editShow.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function deleteFundFunction() {
|
|
||||||
try {
|
|
||||||
loading.value = true
|
|
||||||
showDeleteConfirm.value = false
|
|
||||||
await deleteFund(infoId)
|
|
||||||
await fundStore.getMyFund()
|
|
||||||
router.back()
|
|
||||||
message.success('قلک با موفقیت حذف شد')
|
|
||||||
} catch (e) {
|
|
||||||
console.log(e)
|
|
||||||
} finally {
|
|
||||||
loading.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const infoId: number = parseInt(<string>router.currentRoute.value.params.id)
|
|
||||||
const userFormState = reactive<FundTransaction>({
|
|
||||||
value: undefined,
|
|
||||||
fund_id: infoId
|
|
||||||
})
|
|
||||||
|
|
||||||
watch(transactionShow, (n) => !n ? userFormState.value = undefined : '')
|
|
||||||
|
|
||||||
const transButtonDisable = computed(() => {
|
|
||||||
if (!loading.value) {
|
|
||||||
if (userFormState.value !== undefined) {
|
|
||||||
if (isDeposit.value) {
|
|
||||||
return userFormState.value > walletStore?.walletInfo?.gold
|
|
||||||
} else {
|
|
||||||
return userFormState.value > info.value?.wallet[0]?.gold
|
|
||||||
}
|
|
||||||
// return isDeposit.value ? userFormState.value > walletStore?.walletInfo?.gold : userFormState.value > info.value?.wallet[0]?.gold
|
|
||||||
} else return true
|
|
||||||
} else {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
async function initInfo() {
|
|
||||||
try {
|
|
||||||
loading.value = true
|
|
||||||
info.value = await getFundById(infoId)
|
|
||||||
//pagination.value.page=0
|
|
||||||
await initTable()
|
|
||||||
} catch (e) {
|
|
||||||
console.log(e)
|
|
||||||
} finally {
|
|
||||||
loading.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function initTable() {
|
|
||||||
if (info.value?.wallet)
|
|
||||||
try {
|
|
||||||
loading.value = true
|
|
||||||
items.value = []
|
|
||||||
Object.assign(pagination.value, { wallet_id: info.value?.wallet[0]?.id })
|
|
||||||
// pagination.value.fund_id = infoId
|
|
||||||
tableOutput.value = await getFundTransactionTable(pagination.value)
|
|
||||||
items.value.push(...tableOutput.value.rows)
|
|
||||||
// console.log(tableOutput.value)
|
|
||||||
} catch (e) {
|
|
||||||
console.log(e)
|
|
||||||
} finally {
|
|
||||||
loading.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function transaction() {
|
|
||||||
formRef.value?.validateFields().then(async () => {
|
|
||||||
try {
|
|
||||||
loading.value = true
|
|
||||||
userFormState.fund_id = infoId
|
|
||||||
isDeposit.value ? await fundDeposit(userFormState) : await fundWithdraw(userFormState)
|
|
||||||
await initInfo()
|
|
||||||
// await initTable()
|
|
||||||
await fundStore.getMyFund()
|
|
||||||
await walletStore.getMyWallet()
|
|
||||||
fundStore = useWalletStore()
|
|
||||||
walletStore = useWalletStore()
|
|
||||||
message.success(` با موفقیت${isDeposit.value ? ' واریز' : ' برداشت'} شد`)
|
|
||||||
transactionShow.value = false
|
|
||||||
} catch (e) {
|
|
||||||
console.log(e)
|
|
||||||
} finally {
|
|
||||||
loading.value = false
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
const itemImg = computed(() => {
|
|
||||||
switch (info.value?.title) {
|
|
||||||
case 'خرید لوازم منزل':
|
|
||||||
return homeImg
|
|
||||||
case 'هدیه':
|
|
||||||
return giftImg
|
|
||||||
case 'گردش':
|
|
||||||
return circulationImg
|
|
||||||
case 'ازدواج':
|
|
||||||
return loveImg
|
|
||||||
case 'تعمیرات':
|
|
||||||
return repairsImg
|
|
||||||
case 'پس انداز':
|
|
||||||
return savingImg
|
|
||||||
default:
|
|
||||||
return savingImg
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
.fund-info-page-root {
|
||||||
|
min-height: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -0,0 +1,51 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<div class="bg-white wrap-fix py-3 px-3 text-black font-bold drop-shadow flex h-12 z-20">
|
||||||
|
<div class="flex">
|
||||||
|
<div class="cursor-pointer" @click="goBack()">
|
||||||
|
<BasicIcon icon="vuesax-linear:arrow-right-1" />
|
||||||
|
</div>
|
||||||
|
<div class="mr-2">{{ info?.title }}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="pt-20 flex flex-col justify-center items-center">
|
||||||
|
<a-spin :spinning="loading">
|
||||||
|
<div class="bg-gray-100 w-[120px] aspect-square flex justify-center items-center rounded-xl p-2">
|
||||||
|
<ProductImage
|
||||||
|
v-if="info"
|
||||||
|
:product="info"
|
||||||
|
img-class="max-h-full max-w-full object-contain"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</a-spin>
|
||||||
|
<div class="mt-2 font-bold flex text-xs items-center text-gray-500">
|
||||||
|
<div class="ml-1 text-base text-black">{{ info?.wallet?.gold ?? 0 }}</div>
|
||||||
|
{{ info?.unit ?? 'عدد' }}
|
||||||
|
</div>
|
||||||
|
<div class="text-gray-400">موجودی {{ info?.title }}</div>
|
||||||
|
<div class="w-full p-5">
|
||||||
|
<div class="font-bold mt-5">تراکنش ها</div>
|
||||||
|
<div class="mt-5 pb-17 overflow-y-scroll h-[54vh]">
|
||||||
|
<list-anim v-if="!loading">
|
||||||
|
<Item v-for="item in items" :key="item.id" :item="item" :title="info?.title" />
|
||||||
|
</list-anim>
|
||||||
|
<TransactionSkeleton v-for="i in 8" v-else :key="i" class="mt-1" />
|
||||||
|
<empty v-if="items.length === 0 && !loading" text="هیچ تراکنشی یافت نشد" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
|
||||||
|
import ProductImage from '@/components/ProductImage.vue'
|
||||||
|
import { loading } from '@/utils'
|
||||||
|
import ListAnim from '@/components/ListAnim.vue'
|
||||||
|
import TransactionSkeleton from '@/components/TransactionSkeleton.vue'
|
||||||
|
import Empty from '@/components/empty.vue'
|
||||||
|
import Item from '../components/Item.vue'
|
||||||
|
import { useFundInfoPageContext } from '../composables/useFundInfoPage'
|
||||||
|
|
||||||
|
const { info, items, goBack } = useFundInfoPageContext()
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,171 @@
|
|||||||
|
<template>
|
||||||
|
<div class="fund-mobile-root">
|
||||||
|
<div
|
||||||
|
class="fund-mobile-root__header bg-white w-full mobile-top-chrome px-3 pb-3 text-primary font-bold drop-shadow flex min-h-12 z-20"
|
||||||
|
>
|
||||||
|
<div class="cursor-pointer" @click="goBack()">
|
||||||
|
<BasicIcon icon="vuesax-linear:arrow-right-1" />
|
||||||
|
</div>
|
||||||
|
<div class="mr-2">دارایی ها</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="fund-mobile-root__hero text-tertiary bg-primary">
|
||||||
|
<img
|
||||||
|
:src="fundHeaderBackground"
|
||||||
|
alt=""
|
||||||
|
class="fund-mobile-root__hero-bg"
|
||||||
|
/>
|
||||||
|
<div class="fund-mobile-root__hero-content flex flex-col">
|
||||||
|
<div class="font-bold mr-5 z-20">موجودی دارایی ها</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
v-if="meta?.has_count_based_products"
|
||||||
|
class="flex justify-center mt-4 w-full z-20"
|
||||||
|
>
|
||||||
|
محصولات:
|
||||||
|
<div class="text-l mr-4 font-bold">{{ countBasedInventory }} عدد</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<template v-if="meta?.single_metal && primaryMetalTotal">
|
||||||
|
<div class="flex justify-center mt-2 w-full z-20">
|
||||||
|
{{ primaryMetalTotal.label }}:
|
||||||
|
<div class="text-l mr-4 font-bold">{{ formatMetalTotal(primaryMetalTotal) }}</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<div
|
||||||
|
v-for="metal in metalTotals"
|
||||||
|
:key="`metal-${metal.metal_id}`"
|
||||||
|
class="flex justify-center mt-2 w-full z-20"
|
||||||
|
>
|
||||||
|
{{ metal.label }}:
|
||||||
|
<div class="text-l mr-4 font-bold">{{ formatMetalTotal(metal) }}</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<div
|
||||||
|
v-if="meta?.has_count_based_products"
|
||||||
|
class="flex justify-center mt-2 w-full z-20"
|
||||||
|
>
|
||||||
|
مجموع موجودی:
|
||||||
|
<div class="text-l mr-4 font-bold">{{ countBasedInventory }} عدد</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex justify-center mt-2 w-full z-20">
|
||||||
|
دارایی ریالی:
|
||||||
|
<div class="text-l mr-4 font-bold">{{ usePriceWithoutType(cashWallet) }} ریال</div>
|
||||||
|
</div>
|
||||||
|
<div class="flex justify-center mt-2 w-full z-20">
|
||||||
|
معادل ریالی مجموع دارایی ها:
|
||||||
|
<div class="text-l mr-4 font-bold">{{ usePriceWithoutType(totalRialValue) }} ریال</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="fund-mobile-root__scroll">
|
||||||
|
<div class="fund-mobile-root__panel bg-gray-100 rounded-t-3xl">
|
||||||
|
<div
|
||||||
|
v-if="inventoryCards.length === 0 && !loading"
|
||||||
|
class="w-full min-h-[40vh] flex justify-center items-center"
|
||||||
|
>
|
||||||
|
<div>
|
||||||
|
<img :src="fundEmptyImage" alt="" class="w-70" />
|
||||||
|
<div class="text-center text-lg">{{ fundEmptyText }}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<a-spin :spinning="loading">
|
||||||
|
<div :class="loading ? 'h-[40vh]' : ''" class="grid grid-cols-2 gap-3 p-5">
|
||||||
|
<Item
|
||||||
|
v-for="item in inventoryCards"
|
||||||
|
:key="item.product_id"
|
||||||
|
:item="item"
|
||||||
|
@click="openFundInfo(item.product_id)"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</a-spin>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
|
||||||
|
import { loading } from '@/utils'
|
||||||
|
import { usePriceWithoutType } from '@/utils/usePrice'
|
||||||
|
import Item from '../components/Item.vue'
|
||||||
|
import { useFundPageContext } from '../composables/useFundPage'
|
||||||
|
|
||||||
|
const {
|
||||||
|
meta,
|
||||||
|
inventoryCards,
|
||||||
|
metalTotals,
|
||||||
|
primaryMetalTotal,
|
||||||
|
cashWallet,
|
||||||
|
totalRialValue,
|
||||||
|
countBasedInventory,
|
||||||
|
fundHeaderBackground,
|
||||||
|
fundEmptyImage,
|
||||||
|
fundEmptyText,
|
||||||
|
formatMetalTotal,
|
||||||
|
openFundInfo,
|
||||||
|
goBack,
|
||||||
|
} = useFundPageContext()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.fund-mobile-root {
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
flex: 1 1 0;
|
||||||
|
min-height: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fund-mobile-root__header {
|
||||||
|
flex: 0 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fund-mobile-root__hero {
|
||||||
|
position: relative;
|
||||||
|
flex: 0 0 auto;
|
||||||
|
overflow: hidden;
|
||||||
|
padding-bottom: 2.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fund-mobile-root__hero-bg {
|
||||||
|
pointer-events: none;
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
z-index: 0;
|
||||||
|
width: 100%;
|
||||||
|
opacity: 0.05;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fund-mobile-root__hero-content {
|
||||||
|
position: relative;
|
||||||
|
z-index: 10;
|
||||||
|
padding: 1rem 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fund-mobile-root__scroll {
|
||||||
|
position: relative;
|
||||||
|
z-index: 20;
|
||||||
|
flex: 1 1 0;
|
||||||
|
min-height: 0;
|
||||||
|
margin-top: -2rem;
|
||||||
|
overflow-y: auto;
|
||||||
|
overflow-x: hidden;
|
||||||
|
-webkit-overflow-scrolling: touch;
|
||||||
|
overscroll-behavior-y: contain;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fund-mobile-root__panel {
|
||||||
|
min-height: 100%;
|
||||||
|
padding-bottom: calc(var(--app-bottom-chrome-height, 80px) + 1rem);
|
||||||
|
box-shadow: 0 -2px 4px -2px #0000001a;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
<template>
|
||||||
|
<a-form :model="form" class="!mt-0" name="gift-card-form" @finish="registerGiftCard">
|
||||||
|
<a-form-item :rules="[required()]" label="کد کارت هدیه" name="code">
|
||||||
|
<BasicInput
|
||||||
|
v-model:value="form.code"
|
||||||
|
place-holder="کد کارت هدیه را وارد کنید"
|
||||||
|
size="large"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<p :class="variant === 'desktop' ? 'dgift-form__hint' : 'gift-card-form__hint'">
|
||||||
|
کد کارت هدیه خود را در فیلد بالا وارد کنید و سپس دکمه ثبت را بزنید.
|
||||||
|
</p>
|
||||||
|
<p :class="variant === 'desktop' ? 'dgift-form__case-note' : 'gift-card-form__case-note'">
|
||||||
|
*حساس به حروف بزرگ و کوچک
|
||||||
|
</p>
|
||||||
|
<a-form-item>
|
||||||
|
<BasicButton
|
||||||
|
:disabled="disableButton"
|
||||||
|
:class="variant === 'desktop' ? 'dgift-form__submit' : 'w-full py-2 mt-5'"
|
||||||
|
html-type="submit"
|
||||||
|
type="primary"
|
||||||
|
>
|
||||||
|
<a-spin v-if="loading" size="small" />
|
||||||
|
<span v-else>ثبت کد</span>
|
||||||
|
</BasicButton>
|
||||||
|
</a-form-item>
|
||||||
|
</a-form>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
|
||||||
|
import BasicInput from '@/components/BasicPacks/BasicInput.vue'
|
||||||
|
import { loading } from '@/utils'
|
||||||
|
import { required } from '@/utils/inputRules'
|
||||||
|
import { useGiftCardPageContext } from '../composables/useGiftCardPage'
|
||||||
|
|
||||||
|
withDefaults(defineProps<{ variant?: 'mobile' | 'desktop' }>(), { variant: 'mobile' })
|
||||||
|
|
||||||
|
const { form, disableButton, registerGiftCard } = useGiftCardPageContext()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.gift-card-form__hint,
|
||||||
|
.gift-card-form__case-note {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 0.75rem;
|
||||||
|
font-weight: 700;
|
||||||
|
line-height: 1.65;
|
||||||
|
word-break: break-word;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gift-card-form__hint {
|
||||||
|
margin-top: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gift-card-form__case-note {
|
||||||
|
margin-top: 0.75rem;
|
||||||
|
color: #64748b;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
import { computed, inject, provide, ref, type InjectionKey } from 'vue'
|
||||||
|
import { message } from 'ant-design-vue'
|
||||||
|
import { registerCodeGiftCard } from '@/api/giftCard'
|
||||||
|
import { loading } from '@/utils'
|
||||||
|
|
||||||
|
export interface GiftCardPageContext {
|
||||||
|
form: ReturnType<typeof ref<{ code: string }>>
|
||||||
|
disableButton: ReturnType<typeof computed<boolean>>
|
||||||
|
registerGiftCard: () => Promise<void>
|
||||||
|
}
|
||||||
|
|
||||||
|
export const GIFT_CARD_PAGE_CONTEXT_KEY: InjectionKey<GiftCardPageContext> = Symbol('giftCardPageContext')
|
||||||
|
|
||||||
|
export function useGiftCardPage() {
|
||||||
|
const form = ref({ code: '' })
|
||||||
|
|
||||||
|
const disableButton = computed(() => {
|
||||||
|
if (loading.value) return true
|
||||||
|
return !form.value.code || form.value.code.trim().length === 0
|
||||||
|
})
|
||||||
|
|
||||||
|
async function registerGiftCard() {
|
||||||
|
try {
|
||||||
|
loading.value = true
|
||||||
|
await registerCodeGiftCard(form.value.code)
|
||||||
|
message.success('کد کارت هدیه با موفقیت ثبت شد')
|
||||||
|
form.value.code = ''
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const context: GiftCardPageContext = { form, disableButton, registerGiftCard }
|
||||||
|
provide(GIFT_CARD_PAGE_CONTEXT_KEY, context)
|
||||||
|
return context
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useGiftCardPageContext() {
|
||||||
|
const context = inject(GIFT_CARD_PAGE_CONTEXT_KEY)
|
||||||
|
if (!context) throw new Error('useGiftCardPageContext must be used within useGiftCardPage')
|
||||||
|
return context
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
<template>
|
||||||
|
<div class="dgift gift-card-page">
|
||||||
|
<div class="dgift__container">
|
||||||
|
<DesktopPageTopbar eyebrow="مالی" title="کارت هدیه" show-back sticky />
|
||||||
|
|
||||||
|
<div class="dgift-layout">
|
||||||
|
<section class="dgift-surface dgift-form">
|
||||||
|
<div class="dgift-form__header">
|
||||||
|
<div class="dgift-form__icon">
|
||||||
|
<BasicIcon icon="vuesax-linear:gift" size="28" />
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<h2 class="dgift-form__title">ثبت کد کارت هدیه</h2>
|
||||||
|
<p class="dgift-form__subtitle">کد دریافتی خود را وارد کنید تا اعتبار به حساب شما اضافه شود</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<GiftCardForm variant="desktop" />
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<aside class="dgift-surface dgift-guide">
|
||||||
|
<h3 class="dgift-guide__title">راهنمای استفاده</h3>
|
||||||
|
<ol class="dgift-guide__steps">
|
||||||
|
<li>کد کارت هدیه را از پیامک یا کارت فیزیکی دریافت کنید.</li>
|
||||||
|
<li>کد را بدون فاصله اضافی در فیلد مربوطه وارد کنید.</li>
|
||||||
|
<li>روی «ثبت کد» بزنید و پیام تأیید را بررسی کنید.</li>
|
||||||
|
</ol>
|
||||||
|
<div class="dgift-guide__note">
|
||||||
|
<BasicIcon icon="vuesax-linear:info-circle" size="18" />
|
||||||
|
<p>هر کد فقط یکبار قابل استفاده است و پس از ثبت موفق، موجودی کیف پول بهروزرسانی میشود.</p>
|
||||||
|
</div>
|
||||||
|
</aside>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
|
||||||
|
import DesktopPageTopbar from '@/layouts/components/DesktopPageTopbar.vue'
|
||||||
|
import GiftCardForm from '../components/GiftCardForm.vue'
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" src="./styles/desktop-gift-card.less"></style>
|
||||||
@@ -0,0 +1,144 @@
|
|||||||
|
/* Premium desktop gift card page */
|
||||||
|
|
||||||
|
.dgift {
|
||||||
|
min-height: 100%;
|
||||||
|
background: #f6f7f9;
|
||||||
|
color: #111827;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dgift__container {
|
||||||
|
max-width: 960px;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 28px 36px 40px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dgift-layout {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: minmax(0, 1fr) minmax(0, 300px);
|
||||||
|
gap: 20px;
|
||||||
|
align-items: start;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dgift-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);
|
||||||
|
}
|
||||||
|
|
||||||
|
.dgift-form {
|
||||||
|
padding: 28px;
|
||||||
|
|
||||||
|
&__header {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
|
gap: 16px;
|
||||||
|
margin-bottom: 24px;
|
||||||
|
padding-bottom: 20px;
|
||||||
|
border-bottom: 1px solid #eef0f3;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__icon {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 56px;
|
||||||
|
height: 56px;
|
||||||
|
border-radius: 14px;
|
||||||
|
background: rgba(167, 43, 119, 0.08);
|
||||||
|
color: var(--app-primary-color, #a72b77);
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__title {
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #111827;
|
||||||
|
margin: 0 0 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__subtitle {
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 1.6;
|
||||||
|
color: #6b7280;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__hint {
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 1.7;
|
||||||
|
color: #6b7280;
|
||||||
|
margin: 0 0 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__case-note {
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #9ca3af;
|
||||||
|
margin: 0 0 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__submit {
|
||||||
|
width: 100%;
|
||||||
|
min-height: 44px;
|
||||||
|
margin-top: 8px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.dgift-guide {
|
||||||
|
padding: 24px;
|
||||||
|
position: sticky;
|
||||||
|
top: 88px;
|
||||||
|
|
||||||
|
&__title {
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #111827;
|
||||||
|
margin: 0 0 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__steps {
|
||||||
|
margin: 0 0 20px;
|
||||||
|
padding: 0 20px 0 0;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 12px;
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 1.7;
|
||||||
|
color: #4b5563;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__note {
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
align-items: flex-start;
|
||||||
|
padding: 14px;
|
||||||
|
border-radius: 12px;
|
||||||
|
background: #f9fafb;
|
||||||
|
border: 1px solid #eef0f3;
|
||||||
|
color: #6b7280;
|
||||||
|
|
||||||
|
p {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 1.7;
|
||||||
|
}
|
||||||
|
|
||||||
|
.basic-icon {
|
||||||
|
color: var(--app-primary-color, #a72b77);
|
||||||
|
flex-shrink: 0;
|
||||||
|
margin-top: 2px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 1023.98px) {
|
||||||
|
.dgift-layout {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dgift-guide {
|
||||||
|
position: static;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,81 +1,23 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div class="gift-card-page-root">
|
||||||
<div class="bg-white py-3 px-3 text-black font-bold drop-shadow z-[1999] wrap-fix">کارت هدیه</div>
|
<DesktopGiftCardView v-show="isDesktop" />
|
||||||
<div class="px-5 pt-26 pb-2">
|
<MobileGiftCardView v-show="!isDesktop" />
|
||||||
<a-form :model="form" class="!mt-5" name="basic" @finish="registerGiftCard">
|
|
||||||
<div class="border-gray-200 border-1 rounded-xl p-5 trans h-40 relative">
|
|
||||||
<bg_main/>
|
|
||||||
<div class="z-100 relative">
|
|
||||||
<a-form-item :rules="[required()]" label="کد کارت هدیه" name="code">
|
|
||||||
<BasicInput
|
|
||||||
v-model:value="form.code"
|
|
||||||
place-holder="کد کارت هدیه را وارد کنید"
|
|
||||||
size="large"
|
|
||||||
type="text"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
<div class="font-bold text-xs mt-1">
|
|
||||||
کد کارت هدیه خود را در فیلد بالا وارد کنید و سپس دکمه ثبت را بزنید.
|
|
||||||
</div>
|
|
||||||
<div class="font-bold text-xs mt-3">
|
|
||||||
*حساس به حروف بزرگ و کوچک
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<a-form-item>
|
|
||||||
<BasicButton
|
|
||||||
:disabled="disableButton"
|
|
||||||
class="w-full py-2 mt-5"
|
|
||||||
html-type="submit"
|
|
||||||
type="primary"
|
|
||||||
>
|
|
||||||
<div>
|
|
||||||
<a-spin v-if="loading" size="small"/>
|
|
||||||
<div v-else>ثبت کد</div>
|
|
||||||
</div>
|
|
||||||
</BasicButton>
|
|
||||||
</a-form-item>
|
|
||||||
</a-form>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import {computed, ref} from 'vue'
|
import { useDesktopBreakpoint } from '@/layouts/composables/useAppLayout'
|
||||||
import {loading} from '@/utils'
|
import { useGiftCardPage } from './composables/useGiftCardPage'
|
||||||
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
|
import DesktopGiftCardView from './desktop/DesktopGiftCardView.vue'
|
||||||
import Bg_main from '@/components/bg_main.vue'
|
import MobileGiftCardView from './mobile/MobileGiftCardView.vue'
|
||||||
import {registerCodeGiftCard} from '@/api/giftCard'
|
|
||||||
import {message} from 'ant-design-vue'
|
|
||||||
import BasicInput from '@/components/BasicPacks/BasicInput.vue'
|
|
||||||
import {required} from '@/utils/inputRules'
|
|
||||||
|
|
||||||
const form = ref<{ code: string }>({
|
const isDesktop = useDesktopBreakpoint()
|
||||||
code: ''
|
useGiftCardPage()
|
||||||
})
|
|
||||||
|
|
||||||
const disableButton = computed(() => {
|
|
||||||
if (!loading.value) {
|
|
||||||
return !form.value.code || form.value.code.trim().length === 0
|
|
||||||
} else {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
async function registerGiftCard() {
|
|
||||||
try {
|
|
||||||
loading.value = true
|
|
||||||
await registerCodeGiftCard(form.value.code)
|
|
||||||
message.success('کد کارت هدیه با موفقیت ثبت شد')
|
|
||||||
form.value.code = ''
|
|
||||||
} catch (e: any) {
|
|
||||||
// message.error(e?.response?.data?.message || 'خطا در ثبت کد کارت هدیه')
|
|
||||||
} finally {
|
|
||||||
loading.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
.gift-card-page-root {
|
||||||
|
min-height: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
<template>
|
||||||
|
<div class="gift-card-mobile">
|
||||||
|
<MobilePageHeader title="کارت هدیه" show-back />
|
||||||
|
|
||||||
|
<div class="gift-card-mobile__content mpage-content px-5 pb-[calc(var(--app-bottom-chrome-height)+1rem)]">
|
||||||
|
<div class="gift-card-mobile__card border-gray-200 border-1 rounded-xl p-5 relative overflow-hidden">
|
||||||
|
<bg_main />
|
||||||
|
<div class="relative z-10">
|
||||||
|
<GiftCardForm variant="mobile" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import Bg_main from '@/components/bg_main.vue'
|
||||||
|
import MobilePageHeader from '@/layouts/components/MobilePageHeader.vue'
|
||||||
|
import GiftCardForm from '../components/GiftCardForm.vue'
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.gift-card-mobile__card {
|
||||||
|
min-height: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="h-35rem overflow-y-auto">
|
<div class="h-35rem overflow-y-auto px-5">
|
||||||
<div class=" !overflow-y-scroll bg-white py-3 text-primary font-bold flex justify-evenly">
|
<div class=" !overflow-y-scroll bg-white py-3 text-primary font-bold flex justify-evenly">
|
||||||
<!-- <div @click="isBuy = false" class="w-full text-center" :class="!isBuy?'text-primary':'text-gray-400'">خرید طلا</div>
|
<!-- <div @click="isBuy = false" class="w-full text-center" :class="!isBuy?'text-primary':'text-gray-400'">خرید طلا</div>
|
||||||
<div @click="isBuy = true" class="w-full text-center" :class="isBuy?'text-primary':'text-gray-400'">فروش طلا</div>-->
|
<div @click="isBuy = true" class="w-full text-center" :class="isBuy?'text-primary':'text-gray-400'">فروش طلا</div>-->
|
||||||
@@ -25,11 +25,14 @@
|
|||||||
<div class="w-full items-center flex flex-col">
|
<div class="w-full items-center flex flex-col">
|
||||||
<div class="text-gray-700 font-bold">{{ !isBuy ? 'قیمت فروش' : 'قیمت خرید' }}</div>
|
<div class="text-gray-700 font-bold">{{ !isBuy ? 'قیمت فروش' : 'قیمت خرید' }}</div>
|
||||||
<div class="flex gap-1 mt-3 text-xs items-center">
|
<div class="flex gap-1 mt-3 text-xs items-center">
|
||||||
<Vue3Odometer
|
<div class="gold-live-price">
|
||||||
:value="displayedGoldPrice"
|
<Vue3Odometer
|
||||||
:class="[!isBuy ? 'text-red-700' : 'text-green-700', 'o-text !text-2xl font-bold color-transition']"
|
:key="isBuy ? 'buy' : 'sell'"
|
||||||
style="font-family: iran-sans; direction: ltr"
|
:value="displayedGoldPrice"
|
||||||
/>
|
:class="[!isBuy ? 'text-red-700' : 'text-green-700', 'o-text !text-2xl font-bold color-transition']"
|
||||||
|
style="font-family: iran-sans; direction: ltr"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
ریال
|
ریال
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -48,14 +51,14 @@
|
|||||||
<bg_main/>
|
<bg_main/>
|
||||||
<div class="z-100 relative">
|
<div class="z-100 relative">
|
||||||
<a-form-item>
|
<a-form-item>
|
||||||
<BasicInput v-model:value="form.goldCash" addon-before="ریال" addon-bg-color="#a72b77"
|
<BasicInput v-model:value="form.goldCash" addon-before="ریال" addon-bg-color="var(--app-primary-color)"
|
||||||
addon-text-color="white"
|
addon-text-color="white"
|
||||||
place-holder="ارزش کل"
|
place-holder="ارزش کل"
|
||||||
size="large"
|
size="large"
|
||||||
type="price" @onchange="calculateGold" />
|
type="price" @onchange="calculateGold" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item :rules="[justNumber()]">
|
<a-form-item :rules="[justNumber()]">
|
||||||
<BasicInput v-model:value="form.goldValue" addon-before="گرم" addon-bg-color="#a72b77"
|
<BasicInput v-model:value="form.goldValue" addon-before="گرم" addon-bg-color="var(--app-primary-color)"
|
||||||
addon-text-color="white"
|
addon-text-color="white"
|
||||||
place-holder="مقدار طلا"
|
place-holder="مقدار طلا"
|
||||||
size="large" type="text" inputmode="decimal" @onchange="calculateCash" />
|
size="large" type="text" inputmode="decimal" @onchange="calculateCash" />
|
||||||
@@ -591,13 +594,10 @@ const formatter = (value: number) => {
|
|||||||
|
|
||||||
const price = computed((): Price => <Price>lastPrice.value ?? 0)
|
const price = computed((): Price => <Price>lastPrice.value ?? 0)
|
||||||
|
|
||||||
const displayedGoldPrice = ref<number>(0)
|
const displayedGoldPrice = computed(() => {
|
||||||
|
if (!lastPrice.value) return 0
|
||||||
watch([() => lastPrice.value, isBuy], () => {
|
return isBuy.value ? (lastPrice.value.buy ?? 0) : (lastPrice.value.sell ?? 0)
|
||||||
if (lastPrice.value) {
|
})
|
||||||
displayedGoldPrice.value = isBuy.value ? (lastPrice.value.buy ?? 0) : (lastPrice.value.sell ?? 0)
|
|
||||||
}
|
|
||||||
}, { immediate: true })
|
|
||||||
|
|
||||||
async function initPrice() {
|
async function initPrice() {
|
||||||
try {
|
try {
|
||||||
@@ -605,9 +605,6 @@ async function initPrice() {
|
|||||||
await setIntervalGetAllPrice()
|
await setIntervalGetAllPrice()
|
||||||
loading.value = true
|
loading.value = true
|
||||||
price.value = lastPrice.value
|
price.value = lastPrice.value
|
||||||
if (lastPrice.value) {
|
|
||||||
displayedGoldPrice.value = isBuy.value ? (lastPrice.value.buy ?? 0) : (lastPrice.value.sell ?? 0)
|
|
||||||
}
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e)
|
console.log(e)
|
||||||
} finally {
|
} finally {
|
||||||
@@ -650,7 +647,7 @@ async function ok() {
|
|||||||
|
|
||||||
<style lang="less">
|
<style lang="less">
|
||||||
.completeButtonStyle .van-dialog__confirm .van-button__content {
|
.completeButtonStyle .van-dialog__confirm .van-button__content {
|
||||||
background-color: #a72b77;
|
background-color: var(--app-primary-color);
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -683,4 +680,14 @@ async function ok() {
|
|||||||
right: 100%;
|
right: 100%;
|
||||||
transform: translate(100%, 0);
|
transform: translate(100%, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.gold-live-price {
|
||||||
|
:deep(.odometer) {
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.odometer-digit) {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -0,0 +1,208 @@
|
|||||||
|
<template>
|
||||||
|
<div
|
||||||
|
ref="headerRef"
|
||||||
|
class="app-header px-4 pb-2 top-0 wrap-fix background-color-transition"
|
||||||
|
:class="{ 'app-header--scrolled': isHeaderScrolled }"
|
||||||
|
>
|
||||||
|
<div class="flex justify-between my-2 items-center">
|
||||||
|
<div class="flex items-center gap-2" @click.stop="router.push({ name: 'user' })">
|
||||||
|
<div class="z-100000 rounded-full border-1 text-primary border-primary">
|
||||||
|
<Icon icon="vuesax-linear:user" size="20" />
|
||||||
|
</div>
|
||||||
|
<div class="text-primary color-transition font-bold">
|
||||||
|
{{ userStore.userInfo?.name }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="mhome-header-btn mhome-header-btn--logout"
|
||||||
|
@click="$emit('logout')"
|
||||||
|
>
|
||||||
|
<Icon icon="vuesax-linear:logout" size="18" />
|
||||||
|
<span>خروج</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { nextTick, onActivated, onMounted, onUnmounted, ref, watch } from 'vue'
|
||||||
|
import { useRoute } from 'vue-router'
|
||||||
|
import { useUserStore } from '@/store/userStore'
|
||||||
|
import router from '@/router'
|
||||||
|
import Icon from '@/components/BasicPacks/BasicIcon.vue'
|
||||||
|
|
||||||
|
const headerRef = ref<HTMLElement | null>(null)
|
||||||
|
const isHeaderScrolled = ref(false)
|
||||||
|
const route = useRoute()
|
||||||
|
|
||||||
|
const userStore = useUserStore()
|
||||||
|
|
||||||
|
let intersectionObserver: IntersectionObserver | null = null
|
||||||
|
let scrollTarget: HTMLElement | Window | null = null
|
||||||
|
|
||||||
|
function isScrollableOverflow(value: string) {
|
||||||
|
return value === 'auto' || value === 'scroll' || value === 'overlay'
|
||||||
|
}
|
||||||
|
|
||||||
|
function findScrollParent(el: HTMLElement | null): HTMLElement | null {
|
||||||
|
let node = el?.parentElement ?? null
|
||||||
|
|
||||||
|
while (node) {
|
||||||
|
const style = getComputedStyle(node)
|
||||||
|
const overflowY = style.overflowY
|
||||||
|
const overflow = style.overflow
|
||||||
|
|
||||||
|
if (isScrollableOverflow(overflowY) || isScrollableOverflow(overflow)) {
|
||||||
|
return node
|
||||||
|
}
|
||||||
|
|
||||||
|
node = node.parentElement
|
||||||
|
}
|
||||||
|
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
function resolveScrollRoot(): HTMLElement | null {
|
||||||
|
const header = headerRef.value
|
||||||
|
if (!header) return null
|
||||||
|
|
||||||
|
const chromeInner = header.closest('.main-with-bottom-chrome-inner')
|
||||||
|
if (chromeInner instanceof HTMLElement) {
|
||||||
|
return chromeInner
|
||||||
|
}
|
||||||
|
|
||||||
|
const fromParent = findScrollParent(header)
|
||||||
|
if (fromParent) {
|
||||||
|
return fromParent
|
||||||
|
}
|
||||||
|
|
||||||
|
const global = document.querySelector('.main-with-bottom-chrome-inner')
|
||||||
|
return global instanceof HTMLElement ? global : null
|
||||||
|
}
|
||||||
|
|
||||||
|
function resolveScrollSentinel(scrollRoot: HTMLElement | null): HTMLElement | null {
|
||||||
|
if (!scrollRoot) return null
|
||||||
|
|
||||||
|
const local = scrollRoot.querySelector('.app-header-scroll-sentinel')
|
||||||
|
if (local instanceof HTMLElement) {
|
||||||
|
return local
|
||||||
|
}
|
||||||
|
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateScrollStateFromPosition() {
|
||||||
|
if (!scrollTarget) return
|
||||||
|
|
||||||
|
const next =
|
||||||
|
scrollTarget instanceof Window
|
||||||
|
? scrollTarget.scrollY > 50
|
||||||
|
: scrollTarget.scrollTop > 50
|
||||||
|
|
||||||
|
isHeaderScrolled.value = next
|
||||||
|
}
|
||||||
|
|
||||||
|
function teardownScrollTracking() {
|
||||||
|
intersectionObserver?.disconnect()
|
||||||
|
intersectionObserver = null
|
||||||
|
|
||||||
|
scrollTarget?.removeEventListener('scroll', updateScrollStateFromPosition)
|
||||||
|
scrollTarget = null
|
||||||
|
}
|
||||||
|
|
||||||
|
function setupScrollTracking() {
|
||||||
|
teardownScrollTracking()
|
||||||
|
|
||||||
|
const scrollRoot = resolveScrollRoot()
|
||||||
|
const sentinel = resolveScrollSentinel(scrollRoot)
|
||||||
|
|
||||||
|
if (scrollRoot && sentinel && typeof IntersectionObserver !== 'undefined') {
|
||||||
|
intersectionObserver = new IntersectionObserver(
|
||||||
|
([entry]) => {
|
||||||
|
isHeaderScrolled.value = !entry?.isIntersecting
|
||||||
|
},
|
||||||
|
{
|
||||||
|
root: scrollRoot,
|
||||||
|
threshold: 0,
|
||||||
|
rootMargin: '-1px 0px 0px 0px',
|
||||||
|
},
|
||||||
|
)
|
||||||
|
intersectionObserver.observe(sentinel)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
scrollTarget = scrollRoot ?? window
|
||||||
|
scrollTarget.addEventListener('scroll', updateScrollStateFromPosition, { passive: true })
|
||||||
|
updateScrollStateFromPosition()
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
setupScrollTracking()
|
||||||
|
await nextTick()
|
||||||
|
setupScrollTracking()
|
||||||
|
requestAnimationFrame(() => setupScrollTracking())
|
||||||
|
})
|
||||||
|
|
||||||
|
onActivated(() => {
|
||||||
|
isHeaderScrolled.value = false
|
||||||
|
setupScrollTracking()
|
||||||
|
})
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => route.fullPath,
|
||||||
|
() => {
|
||||||
|
if (route.name === 'home') {
|
||||||
|
isHeaderScrolled.value = false
|
||||||
|
nextTick(() => setupScrollTracking())
|
||||||
|
}
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
onUnmounted(() => {
|
||||||
|
teardownScrollTracking()
|
||||||
|
})
|
||||||
|
|
||||||
|
defineEmits<{
|
||||||
|
logout: []
|
||||||
|
}>()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.app-header {
|
||||||
|
z-index: 1999;
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding-top: calc(0.5rem + var(--app-safe-top, env(safe-area-inset-top, 0px)));
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.app-header--scrolled {
|
||||||
|
background-color: rgba(255, 255, 255, 0.92);
|
||||||
|
box-shadow:
|
||||||
|
0 1px 3px 0 rgb(0 0 0 / 0.1),
|
||||||
|
0 1px 2px -1px rgb(0 0 0 / 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.mhome-header-btn {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 4px;
|
||||||
|
padding: 6px 10px;
|
||||||
|
border: 1px solid #e5e7eb;
|
||||||
|
border-radius: 8px;
|
||||||
|
background: #fff;
|
||||||
|
color: #0a1b37;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
font-family: inherit;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mhome-header-btn--logout {
|
||||||
|
color: #dc2626;
|
||||||
|
border-color: #fecaca;
|
||||||
|
background: #fef2f2;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<template>
|
||||||
|
<header class="dhome-topbar">
|
||||||
|
<div>
|
||||||
|
<p class="dhome-topbar__eyebrow">نمای کلی</p>
|
||||||
|
<h1 class="dhome-topbar__title">{{ userStore.userInfo?.name ?? 'کاربر' }}</h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="dhome-topbar__actions">
|
||||||
|
<button type="button" class="dhome-btn-ghost" @click="router.push({ name: 'user' })">
|
||||||
|
<BasicIcon icon="vuesax-linear:user" size="16" />
|
||||||
|
<span>حساب کاربری</span>
|
||||||
|
</button>
|
||||||
|
<button type="button" class="dhome-btn-ghost" @click="$emit('logout')">
|
||||||
|
<BasicIcon icon="vuesax-linear:logout" size="16" />
|
||||||
|
<span>خروج</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
|
||||||
|
import { useUserStore } from '@/store/userStore'
|
||||||
|
import router from '@/router'
|
||||||
|
|
||||||
|
defineEmits<{
|
||||||
|
logout: []
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const userStore = useUserStore()
|
||||||
|
</script>
|
||||||
@@ -1,63 +1,54 @@
|
|||||||
<template>
|
<template>
|
||||||
<div ref="skeletonRatio" class="h-fit">
|
<div ref="skeletonRatio" class="h-fit w-full min-h-[620px]">
|
||||||
<content-loader :width="skeletonSize.width" class="bg-white" height="100vh">
|
<content-loader
|
||||||
<rect :width="skeletonSize.width" height="5" rx="3" ry="3" x="0" y="0"/>
|
:width="skeletonWidth"
|
||||||
<rect :width="skeletonSize.width" height="5" rx="3" ry="3" x="0" y="84"/>
|
class="bg-white"
|
||||||
<rect :width="5" height="85" rx="3" ry="3" x="0" y="0"/>
|
:height="skeletonHeight"
|
||||||
<rect :width="5" :x="skeletonSize.width-5" height="85" rx="3" ry="3" y="0"/>
|
>
|
||||||
<rect :width="2" :x="skeletonSize.width/2" height="60" rx="3" ry="3" y="15"/>
|
<rect :width="skeletonWidth" height="5" rx="3" ry="3" x="0" y="0" />
|
||||||
<rect :width="skeletonSize.width/2-20" :x="10" height="20" rx="10" ry="10" y="15"/>
|
<rect :width="skeletonWidth" height="5" rx="3" ry="3" x="0" y="84" />
|
||||||
<rect :width="skeletonSize.width/2-20" :x="skeletonSize.width/2 + 10" height="20" rx="10" ry="10" y="15"/>
|
<rect width="5" height="85" rx="3" ry="3" x="0" y="0" />
|
||||||
<rect :width="skeletonSize.width/2-40" :x="20" height="10" rx="5" ry="5" y="40"/>
|
<rect width="5" :x="skeletonWidth - 5" height="85" rx="3" ry="3" y="0" />
|
||||||
<rect :width="skeletonSize.width/2-40" :x="skeletonSize.width/2 + 20" height="10" rx="5" ry="5" y="40"/>
|
<rect width="2" :x="skeletonWidth / 2" height="60" rx="3" ry="3" y="15" />
|
||||||
<rect :width="skeletonSize.width/2-30" :x="15" height="18" rx="10" ry="10" y="60"/>
|
<rect :width="halfWidth(20)" x="10" height="20" rx="10" ry="10" y="15" />
|
||||||
<rect :width="skeletonSize.width/2-30" :x="skeletonSize.width/2 + 15" height="18" rx="10" ry="10" y="60"/>
|
<rect :width="halfWidth(20)" :x="skeletonWidth / 2 + 10" height="20" rx="10" ry="10" y="15" />
|
||||||
<circle :cx="skeletonSize.width/4-skeletonSize.width/8" cy="145" r="20"/>
|
<rect :width="halfWidth(40)" x="20" height="10" rx="5" ry="5" y="40" />
|
||||||
<circle :cx="skeletonSize.width/4+skeletonSize.width/8" cy="145" r="20"/>
|
<rect :width="halfWidth(40)" :x="skeletonWidth / 2 + 20" height="10" rx="5" ry="5" y="40" />
|
||||||
<circle :cx="skeletonSize.width/2+ skeletonSize.width/8" cy="145" r="20"/>
|
<rect :width="halfWidth(30)" x="15" height="18" rx="10" ry="10" y="60" />
|
||||||
<circle :cx="skeletonSize.width - skeletonSize.width/8" cy="145" r="20"/>
|
<rect :width="halfWidth(30)" :x="skeletonWidth / 2 + 15" height="18" rx="10" ry="10" y="60" />
|
||||||
<rect :width="50" :x="skeletonSize.width/4-skeletonSize.width/8 - 25" height="15" rx="3" ry="3" y="170"/>
|
<circle :cx="skeletonWidth / 4 - skeletonWidth / 8" cy="145" r="20" />
|
||||||
<rect :width="50" :x="skeletonSize.width/4+skeletonSize.width/8 - 25" height="15" rx="3" ry="3" y="170"/>
|
<circle :cx="skeletonWidth / 4 + skeletonWidth / 8" cy="145" r="20" />
|
||||||
<rect :width="50" :x="skeletonSize.width/2+ skeletonSize.width/8 - 25" height="15" rx="3" ry="3" y="170"/>
|
<circle :cx="skeletonWidth / 2 + skeletonWidth / 8" cy="145" r="20" />
|
||||||
<rect :width="50" :x="skeletonSize.width - skeletonSize.width/8 - 25" height="15" rx="3" ry="3" y="170"/>
|
<circle :cx="skeletonWidth - skeletonWidth / 8" cy="145" r="20" />
|
||||||
<rect :width="skeletonSize.width - 45" :x="45" height="20" rx="3" ry="3" y="230"/>
|
<rect width="50" :x="skeletonWidth / 4 - skeletonWidth / 8 - 25" height="15" rx="3" ry="3" y="170" />
|
||||||
<rect :width="skeletonSize.width" :x="0" height="80" rx="3" ry="3" y="260"/>
|
<rect width="50" :x="skeletonWidth / 4 + skeletonWidth / 8 - 25" height="15" rx="3" ry="3" y="170" />
|
||||||
<rect :width="skeletonSize.width/2 - 5" :x="0" height="50" rx="3" ry="3" y="360"/>
|
<rect width="50" :x="skeletonWidth / 2 + skeletonWidth / 8 - 25" height="15" rx="3" ry="3" y="170" />
|
||||||
<rect :width="skeletonSize.width/2 - 5" :x="skeletonSize.width/2 + 5" height="50" rx="3" ry="3" y="360"/>
|
<rect width="50" :x="skeletonWidth - skeletonWidth / 8 - 25" height="15" rx="3" ry="3" y="170" />
|
||||||
<rect :width="skeletonSize.width" :x="0" height="170" rx="3" ry="3" y="440"/>
|
<rect :width="fullWidth(45)" x="45" height="20" rx="3" ry="3" y="230" />
|
||||||
<!-- <rect height="20" rx="3" ry="3" width="100" x="0" y="0"/>
|
<rect :width="skeletonWidth" x="0" height="80" rx="3" ry="3" y="260" />
|
||||||
<rect :width="skeletonSize.width/4 + 40" :x="skeletonSize.width/2" height="20" rx="3" ry="3" y="0"/>
|
<rect :width="halfWidth(10)" x="0" height="50" rx="3" ry="3" y="360" />
|
||||||
<rect height="20" rx="3" ry="3" width="80" x="0" y="30"/>
|
<rect :width="halfWidth(10)" :x="skeletonWidth / 2 + 5" height="50" rx="3" ry="3" y="360" />
|
||||||
<rect :x="skeletonSize.width - 40" height="40" rx="12" ry="12" width="40" y="0"/>
|
<rect :width="skeletonWidth" x="0" height="170" rx="3" ry="3" y="440" />
|
||||||
<rect :width="skeletonSize.width" :x="0" :y="skeletonSize.height-5" height="2" rx="12" ry="12"/>-->
|
|
||||||
<!-- <circle :cx="skeletonSize.width - 20" :cy="skeletonSize.height/2 - 10" r="20" />-->
|
|
||||||
<!-- <rect :x="10" y="20" rx="3" ry="3" :width="skeletonSize.width - 20" height="150"/>
|
|
||||||
<circle :cx="skeletonSize.width/2" cy="170" r="15" />
|
|
||||||
<rect :x="skeletonSize.width/2 - skeletonSize.width/3 -10" y="190" rx="3" ry="3" :width="skeletonSize.width/3 + skeletonSize.width/3 + 20" height="20"/>
|
|
||||||
<rect :x="skeletonSize.width/2 - skeletonSize.width/3 +20" y="220" rx="3" ry="3" :width="skeletonSize.width/3 + skeletonSize.width/3 - 40" height="20"/>-->
|
|
||||||
<!-- <rect x="90" y="0" rx="3" ry="3" width="80" height="20" />
|
|
||||||
<rect x="180" y="0" rx="3" ry="3" width="80" height="20" />
|
|
||||||
<rect x="270" y="0" rx="3" ry="3" width="80" height="20" ♥/>-->
|
|
||||||
</content-loader>
|
</content-loader>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import {reactive, ref, watch} from "vue";
|
import { computed, ref } from 'vue'
|
||||||
import {useElementSize} from "@vueuse/core";
|
import { useElementSize } from '@vueuse/core'
|
||||||
import {ContentLoader} from "vue-content-loader";
|
import { ContentLoader } from 'vue-content-loader'
|
||||||
|
|
||||||
const skeletonRatio = ref(null)
|
const skeletonHeight = 620
|
||||||
const skeletonSize = reactive(
|
const skeletonRatio = ref<HTMLElement | null>(null)
|
||||||
useElementSize(skeletonRatio, {width: 0, height: 0}, {box: 'border-box'})
|
const { width } = useElementSize(skeletonRatio, { width: 0, height: 0 }, { box: 'border-box' })
|
||||||
)
|
|
||||||
/*watch(skeletonSize, () => {
|
const skeletonWidth = computed(() => Math.max(width.value, 320))
|
||||||
console.log(skeletonSize)
|
|
||||||
})*/
|
function halfWidth(padding: number) {
|
||||||
|
return Math.max(skeletonWidth.value / 2 - padding, 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
function fullWidth(padding: number) {
|
||||||
|
return Math.max(skeletonWidth.value - padding, 0)
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
|
|
||||||
</style>
|
|
||||||
@@ -1,21 +1,21 @@
|
|||||||
<template>
|
<template>
|
||||||
<div v-if="props.ProductItem.wallet" class="bg-gradient-to-l from-primary rounded-lg p-px to-transparent ">
|
<div v-if="props.ProductItem.wallet" class="bg-gradient-to-l from-primary rounded-lg p-px to-transparent ">
|
||||||
<div class="flex flex-col gap-7 rounded-lg p-4 w-56 bg-white ">
|
<div class="flex flex-col gap-7 rounded-lg p-4 w-56 bg-white ">
|
||||||
<div class="flex justify-between items-center font-medium text-sm">
|
<div class="flex justify-between items-center font-medium text-sm">
|
||||||
<div class="text-primary">موجودی {{ props.ProductItem.title }}</div>
|
<div class="text-primary">موجودی {{ props.ProductItem.title }}</div>
|
||||||
<BasicIcon v-if="props.ProductItem.group_type=='گوی'" stroke-width="1" size="50" color="#a72b77" class="rotate-310" icon="vuesax-linear:grammerly"/>
|
<BasicIcon v-if="props.ProductItem.group_type=='گوی'" stroke-width="1" size="50" color="var(--app-primary-color)" class="rotate-310" icon="vuesax-linear:grammerly"/>
|
||||||
<BasicIcon v-else-if="props.ProductItem.group_type=='سکه'" stroke-width="1" size="50" color="#a72b77" class="rotate-310" icon="vuesax-linear:coin"/>
|
<BasicIcon v-else-if="props.ProductItem.group_type=='سکه'" stroke-width="1" size="50" color="var(--app-primary-color)" class="rotate-310" icon="vuesax-linear:coin"/>
|
||||||
<BasicIcon v-else-if="props.ProductItem.group_type=='شمش'" stroke-width="1" size="50" color="#a72b77" class="rotate-310" icon="vuesax-linear:slider-vertical"/>
|
<BasicIcon v-else-if="props.ProductItem.group_type=='شمش'" stroke-width="1" size="50" color="var(--app-primary-color)" class="rotate-310" icon="vuesax-linear:slider-vertical"/>
|
||||||
<BasicIcon v-else-if="props.ProductItem.group_type=='مکعب'" stroke-width="1" size="50" color="#a72b77" class="rotate-310" icon="vuesax-linear:keyboard"/>
|
<BasicIcon v-else-if="props.ProductItem.group_type=='مکعب'" stroke-width="1" size="50" color="var(--app-primary-color)" class="rotate-310" icon="vuesax-linear:keyboard"/>
|
||||||
<BasicIcon v-else-if="props.ProductItem.group_type=='آبشده'" stroke-width="1" size="50" color="#a72b77" class="rotate-310" icon="vuesax-linear:slider-vertical"/>
|
<BasicIcon v-else-if="props.ProductItem.group_type=='آبشده'" stroke-width="1" size="50" color="var(--app-primary-color)" class="rotate-310" icon="vuesax-linear:slider-vertical"/>
|
||||||
<BasicIcon v-else stroke-width="1" size="50" color="#a72b77" class="rotate-310" icon="vuesax-linear:slider-vertical"/>
|
<BasicIcon v-else stroke-width="1" size="50" color="var(--app-primary-color)" class="rotate-310" icon="vuesax-linear:slider-vertical"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex justify-between px-2 items-center ">
|
<div class="flex justify-between px-2 items-center ">
|
||||||
<BasicIcon v-if="props.ProductItem.group_type=='گوی'" stroke-width="1" size="26" color="#a72b77" class="rotate-310" icon="vuesax-linear:grammerly"/>
|
<BasicIcon v-if="props.ProductItem.group_type=='گوی'" stroke-width="1" size="26" color="var(--app-primary-color)" class="rotate-310" icon="vuesax-linear:grammerly"/>
|
||||||
<BasicIcon v-else-if="props.ProductItem.group_type=='سکه'" stroke-width="1" size="26" color="#a72b77" class="rotate-310" icon="vuesax-linear:coin"/>
|
<BasicIcon v-else-if="props.ProductItem.group_type=='سکه'" stroke-width="1" size="26" color="var(--app-primary-color)" class="rotate-310" icon="vuesax-linear:coin"/>
|
||||||
<BasicIcon v-else-if="props.ProductItem.group_type=='شمش'" stroke-width="1" size="26" color="#a72b77" class="rotate-310" icon="vuesax-linear:slider-vertical"/>
|
<BasicIcon v-else-if="props.ProductItem.group_type=='شمش'" stroke-width="1" size="26" color="var(--app-primary-color)" class="rotate-310" icon="vuesax-linear:slider-vertical"/>
|
||||||
<BasicIcon v-else-if="props.ProductItem.group_type=='مکعب'" stroke-width="1" size="26" color="#a72b77" class="rotate-310" icon="vuesax-linear:keyboard"/>
|
<BasicIcon v-else-if="props.ProductItem.group_type=='مکعب'" stroke-width="1" size="26" color="var(--app-primary-color)" class="rotate-310" icon="vuesax-linear:keyboard"/>
|
||||||
<BasicIcon v-else stroke-width="1" size="26" color="#a72b77" class="rotate-310" icon="vuesax-linear:slider-vertical"/> <div class="flex justify-between gap-2 items-center">
|
<BasicIcon v-else stroke-width="1" size="26" color="var(--app-primary-color)" class="rotate-310" icon="vuesax-linear:slider-vertical"/> <div class="flex justify-between gap-2 items-center">
|
||||||
<span v-if="props.ProductItem.group_type=='آبشده'" class="font-bold text-secondary">{{userWallet.walletInfo?.gold??0}}</span>
|
<span v-if="props.ProductItem.group_type=='آبشده'" class="font-bold text-secondary">{{userWallet.walletInfo?.gold??0}}</span>
|
||||||
<span v-else class="font-bold text-secondary">{{props?.ProductItem.wallet?.gold??0}}</span>
|
<span v-else class="font-bold text-secondary">{{props?.ProductItem.wallet?.gold??0}}</span>
|
||||||
<span class="text-gray-400">{{props?.ProductItem?.unit}}</span>
|
<span class="text-gray-400">{{props?.ProductItem?.unit}}</span>
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user