2 Commits
Author SHA1 Message Date
MojtabaSoumi 04dad5cce0 1405/04/18- 2026-07-09 15:42:45 +03:30
MojtabaSoumi f797f5616c 1405/04/17- 2026-07-08 16:03:22 +03:30
87 changed files with 1163 additions and 2029 deletions
-2
View File
@@ -64,8 +64,6 @@ declare module 'vue' {
Size: typeof import('./src/components/BasicPacks/BaseDatePicker/src/datePick/demo/size.vue')['default']
StartEnd: typeof import('./src/components/BasicPacks/BaseDatePicker/src/datePick/demo/start-end.vue')['default']
Suffix: typeof import('./src/components/BasicPacks/BaseDatePicker/src/datePick/demo/suffix.vue')['default']
SupportMessengerBrandIcon: typeof import('./src/components/SupportMessengerBrandIcon.vue')['default']
SupportMessengerPicker: typeof import('./src/components/SupportMessengerPicker.vue')['default']
Switchable: typeof import('./src/components/BasicPacks/BaseDatePicker/src/datePick/demo/switchable.vue')['default']
Text: typeof import('./src/components/BasicPacks/BaseDatePicker/src/datePick/demo/text.vue')['default']
Time: typeof import('./src/components/BasicPacks/BaseDatePicker/src/datePick/demo/time.vue')['default']
+2 -16
View File
@@ -326,15 +326,7 @@
}
function getVersionUrls() {
var protocol = getProtocol()
return [
'https://nerkh.gold/get_version',
'https://tablo.talasevin.ir/get_version',
'https://abshode-service.montgit.ir/server/get_version',
protocol + '//212.23.201.173:8381/get_version',
protocol + '//91.212.174.137:4040/server/get_version'
]
return ['https://nerkh.gold/get_version', 'https://tablo.talasevin.ir/get_version', 'https://abshode-service.montgit.ir/server/get_version']
}
function getConfigUrls() {
@@ -461,9 +453,6 @@
localStorage.setItem(VERSION_SUCCESS_URL_KEY, url)
return version
} catch (error) {
if (localStorage.getItem(VERSION_SUCCESS_URL_KEY) === url) {
localStorage.removeItem(VERSION_SUCCESS_URL_KEY)
}
console.warn('Version failed:', url, error)
return undefined
} finally {
@@ -507,9 +496,6 @@
url: url
}
} catch (error) {
if (localStorage.getItem(CONFIG_SUCCESS_URL_KEY) === url) {
localStorage.removeItem(CONFIG_SUCCESS_URL_KEY)
}
console.warn('Config failed:', url, 'round:', round, error)
}
}
@@ -640,7 +626,7 @@
renderRecovering('در حال دریافت تنظیمات جدید برنامه...')
var version = await loadRemoteVersion(5)
var freshConfigResult = await fetchFreshConfig(5)
var freshConfigResult = await fetchFreshConfig(2)
clearReadableCookies()
// clearLocalStorageExceptToken()
+67 -62
View File
@@ -1,21 +1,30 @@
<template>
<template>
<div class="desktopConfig w-full right-0 left-0">
<transition mode="out-in" name="fade">
<AConfigProvider
v-if="!showSplash"
:theme="{
token: {
colorPrimary: colors.primary,
colorLink: colors.primary,
colorLinkActive: colors.primary,
colorLinkHover: colors['primary-rgba']
colorPrimary: primaryColor,
colorLink: primaryColor,
colorLinkActive: primaryColor,
colorLinkHover: primaryColor
}
}"
direction="rtl"
>
<router-view v-slot="{ Component, route }">
<transition :name="route.meta.transition || 'fade'">
<component :is="Component" :key="route.fullPath" class="app-main" />
<!--
Key only the top-level matched route (e.g. main vs login), not fullPath.
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>
</router-view>
</AConfigProvider>
@@ -48,9 +57,8 @@
<div
v-if="showSupportButton && !showSplash"
id="support-button"
ref="supportButtonEl"
class="draggable-support-button"
:class="{ 'is-dragging': supportDragging, 'is-picker-open': supportPickerOpen }"
:class="{ 'is-dragging': supportDragging }"
:style="supportButtonStyle"
title="پشتیبانی"
@pointerdown="onSupportPointerDown"
@@ -64,13 +72,6 @@
</div>
</div>
<SupportMessengerPicker
v-model:open="supportPickerOpen"
:entries="supportMessengerEntries"
:anchor-el="supportButtonEl"
@select="openSupportMessengerEntry"
/>
<VersionUpdateModal />
</div>
</template>
@@ -79,24 +80,25 @@
import { colors } from './themeConfig'
import pkg from '../package.json'
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_pattern from '@/views/login/assets/img/pattern.svg'
import { LoadingOutlined } from '@ant-design/icons-vue'
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
import {
buildSupportMessengerUrl,
loadSupportMessengerFromSettings,
openSupportMessengerEntry,
resolveSupportMessengerEntries,
supportMessengerPickerOpen,
supportMessengerSettings,
} from '@/utils/supportMessenger'
import SupportMessengerPicker from '@/components/SupportMessengerPicker.vue'
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 logoFull from '@/assets/img/logo_full_.png'
const logoFull = getAppLogoFullUrl()
const VersionUpdateModal = defineAsyncComponent(
() => import('@/modules/version/VersionUpdateModal.vue')
@@ -110,44 +112,52 @@ const indicator = h(LoadingOutlined, {
})
const displayVersion = getDisplayAppVersion(pkg.version)
const showSplash = ref(true)
const primaryColor = getAppPrimaryColor(colors.primary || '#000000')
useApplyDesktopLayoutClass()
const supportButtonEl = ref<HTMLElement | null>(null)
const supportPickerOpen = supportMessengerPickerOpen
const supportMessengerEntries = computed(() =>
resolveSupportMessengerEntries(supportMessengerSettings.value),
const supportLink = computed(() =>
buildSupportMessengerUrl(
supportMessengerSettings.value.messenger,
supportMessengerSettings.value.messengerId
)
)
const showSupportButton = computed(() => supportMessengerEntries.value.length > 0)
const showSupportButton = computed(() => !!supportLink.value)
const primaryEntry = computed(() => supportMessengerEntries.value[0] ?? null)
const supportIcon = computed(() => primaryEntry.value?.icon ?? 'vuesax-linear:messages-2')
const supportAccentColor = computed(() =>
(primaryEntry.value?.accent ?? colors.primary) || '#334155',
)
let supportPickerOpenedAt = 0
function openSupportLink() {
const entries = supportMessengerEntries.value
if (entries.length === 0) return
if (entries.length === 1) {
void openSupportMessengerEntry(entries[0])
return
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 now = Date.now()
if (supportPickerOpen.value) {
if (now - supportPickerOpenedAt < 450) return
supportPickerOpen.value = false
return
})
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'
}
supportPickerOpen.value = true
supportPickerOpenedAt = now
}
})
const {
dragging: supportDragging,
@@ -163,15 +173,15 @@ const {
defaultRightOffset: 16,
})
function openSupportLinkHandler() {
openSupportLink()
function openSupportLink() {
if (!supportLink.value) return
window.open(supportLink.value, '_blank', 'noopener,noreferrer')
}
function handleSupportPointerUp(event: PointerEvent) {
const clicked = supportPointerUp(event)
if (!clicked) return
event.stopPropagation()
openSupportLinkHandler()
if (supportPointerUp(event)) {
openSupportLink()
}
}
onMounted(async () => {
@@ -185,7 +195,7 @@ onMounted(async () => {
<style lang="less">
.updateButton .van-dialog__confirm .van-button__text {
color: @primary-color !important;
color: var(--app-primary-color, #a72b77) !important;
font-weight: 600;
font-size: 15px;
}
@@ -236,9 +246,4 @@ onMounted(async () => {
#support-button.is-dragging .support-button-inner {
box-shadow: 0 10px 28px rgba(15, 23, 42, 0.22);
}
#support-button.is-picker-open .support-button-inner {
transform: scale(0.94);
box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
}
</style>
+70 -9
View File
@@ -2,6 +2,7 @@ import { computed, watch } from 'vue'
import router from '@/router'
import { authenticateWithFingerprint, getToken, isIphone, removeToken } from '@/utils'
import { useUserStore } from '@/store/userStore'
import { useWalletStore } from '@/store/walletStore'
import type { NavigationGuardNext, RouteLocationNormalized } from 'vue-router'
import { useAuthStore } from '@/store/useAuthStore'
import {
@@ -13,9 +14,48 @@ import {
setHasFingerPrint
} 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() {
const userStore = useUserStore()
const walletStore = useWalletStore()
const authStore = useAuthStore()
const isApple: boolean = isIphone()
@@ -28,13 +68,20 @@ export function setupRouterGuards() {
return
}
const tasks: Promise<unknown>[] = [
walletStore.getLimitedPrice(),
walletStore.getLimitedBuyGold(),
]
if (!userStore.userInfo) {
await userStore.getMyInfo()
tasks.push(userStore.getMyInfo())
}
await Promise.all(tasks)
}
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()
}
if (to.name !== 'login') {
@@ -43,9 +90,10 @@ export function setupRouterGuards() {
return next()
}
function goToHome(to: RouteLocationNormalized, next: NavigationGuardNext) {
if (to.name !== 'buyProduct') {
return next({ name: 'buyProduct' })
function goToLanding(to: RouteLocationNormalized, next: NavigationGuardNext) {
const landing = getDefaultLandingRoute()
if (to.name !== landing) {
return next({ name: landing })
}
return next()
}
@@ -55,6 +103,10 @@ export function setupRouterGuards() {
clearFingerTimeout()
setFingerTimeOut(to)
if (enforceProjectRouteAccess(to, next)) {
return
}
if (isFirst) {
isFirst = false
@@ -74,12 +126,15 @@ export function setupRouterGuards() {
}
} else {
if (to.name == 'login') {
goToHome(to, next)
return goToLanding(to, next)
}
if (enforceProjectRouteAccess(to, next)) {
return
}
return next()
}
} else {
if (['login', '404', 'buyProduct', 'productDetail', 'about', 'cart'].includes(to.name as string)) {
if (getGuestPublicRoutes().includes(to.name as string)) {
return next()
}
goToLogin(to, next)
@@ -88,18 +143,24 @@ export function setupRouterGuards() {
if (getFingerPosition()) {
if (getToken()) {
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()
}
if (['login', '404', 'buyProduct', 'productDetail', 'about', 'cart'].includes(to.name as string)) {
if (getGuestPublicRoutes().includes(to.name as string)) {
return next()
}
return next({ name: 'login' })
}
if (getToken() && !getHasFingerPrint()) {
if (enforceProjectRouteAccess(to, next)) {
return
}
next()
} else {
goToLogin(to, next)
+39 -9
View File
@@ -10,7 +10,6 @@
@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) '../../views/login/desktop/styles/desktop-login.less';
@import (less) '../../layouts/desktop/styles/desktop-inner-pages.less';
html {
@@ -62,6 +61,12 @@ body {
:root {
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;
@@ -165,7 +170,7 @@ body {
background-color: #fff;
//display: none;
outline: none;
border: 1px solid #a72b77 !important;
border: 1px solid var(--app-primary-color, #a72b77) !important;
}
}
@@ -363,24 +368,49 @@ body {
}
.ant-radio-group-solid
.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{
background-color: #a72b77 !important;
color: #e0be7f !important;
background-color: var(--app-primary-color, #a72b77) !important;
color: var(--app-tertiary-color, #e0be7f) !important;
}
.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 {
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{
padding: 0px !important;
}
.ant-radio-group-solid .ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled):hover{
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
View File
@@ -1,5 +1,6 @@
@prefixCls: 'noname';
/* مقادیر ثابت برای Ant Design Less (fade و توابع رنگ). تم واقعی در runtime با --app-primary-color ست می‌شود. */
@primary-color: #a72b77;
@secondary-color: #a72b77;
@App-primary-color: #a72b77;
Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

-7
View File
@@ -1,7 +0,0 @@
<svg viewBox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<rect width="48" height="48" rx="12" fill="#1CA0E2"/>
<g transform="translate(12 12)">
<path d="M14.4501 0.922337C14.4249 0.922337 14.3996 0.922337 14.3749 0.922337C13.9177 0.865759 13.4564 0.848106 12.9962 0.869568C12.3937 0.891042 11.7968 0.992415 11.2211 1.17103C10.5799 1.36599 9.98324 1.6851 9.46511 2.11021C9.27918 2.26684 9.10383 2.43563 8.94023 2.61545C8.62473 2.95789 8.39401 3.35478 8.19696 3.77245C8.09086 3.997 7.99543 4.22773 7.8955 4.45565C7.88203 4.48764 7.8708 4.5202 7.86014 4.55333C7.82589 4.66167 7.79558 4.77114 7.75853 4.87836C7.65492 5.2025 7.5737 5.53337 7.51545 5.86863C7.45552 6.17826 7.41539 6.4914 7.39532 6.80613C7.37904 7.03574 7.36669 7.2659 7.36613 7.49607C7.36593 7.89339 7.3888 8.29039 7.43461 8.68506C7.49075 9.19592 7.58787 9.70059 7.69341 10.2036C7.81298 10.7756 7.99094 11.3303 8.1644 11.8877C8.33787 12.4452 8.5394 12.9847 8.73757 13.5297C8.89756 13.9716 9.04576 14.4167 9.16702 14.8709C9.24027 15.1385 9.29245 15.4114 9.32309 15.6871C9.37053 16.0792 9.35422 16.4763 9.27481 16.8632C9.26358 16.9126 9.25179 16.9614 9.23719 17.0097C9.17854 17.206 9.10843 17.3987 9.02724 17.5868C8.97171 17.7142 8.90383 17.8359 8.82458 17.95C8.54294 18.3624 8.19617 18.7262 7.79782 19.0273C7.33066 19.3746 6.78803 19.6066 6.21418 19.7043C5.97198 19.7479 5.72653 19.7708 5.48046 19.7728C4.65255 19.785 3.84735 19.5021 3.20913 18.9745C3.06738 18.8636 2.93586 18.7402 2.81616 18.6057C2.79988 18.5866 2.78024 18.5704 2.76003 18.553C2.73982 18.5355 2.73701 18.5479 2.72578 18.553C2.70445 18.5423 2.69715 18.5198 2.68536 18.5019C2.53435 18.2655 2.37492 18.0348 2.23289 17.7923C2.02466 17.4393 1.83484 17.0758 1.66422 16.7032C1.4634 16.2612 1.29071 15.8068 1.14719 15.343C1.028 14.9577 0.929988 14.5662 0.853591 14.1703C0.802506 13.9081 0.760402 13.6437 0.730649 13.3776C0.707633 13.171 0.686862 12.9644 0.674512 12.7567C0.663846 12.6024 0.663846 12.448 0.655425 12.2942C0.647566 12.1645 0.644197 12.0354 0.647004 11.9062C0.650934 11.7204 0.654302 11.5341 0.666091 11.3488C0.679564 11.1349 0.696405 10.921 0.722229 10.7088C0.800805 10.0199 0.942301 9.33971 1.14495 8.67664C1.27499 8.25508 1.42887 7.84124 1.60584 7.43712C1.89207 6.78413 2.23982 6.15987 2.64438 5.57279C3.12563 4.87288 3.68354 4.22892 4.30774 3.65288C5.11591 2.9082 6.02747 2.28423 7.01414 1.80033C7.73201 1.44668 8.48602 1.17169 9.26302 0.980159C9.59984 0.898198 9.93667 0.829149 10.2814 0.776941C10.4554 0.750369 10.6303 0.728288 10.8062 0.710698C10.9943 0.691611 11.1829 0.681506 11.371 0.663542C11.4367 0.657367 11.5035 0.65849 11.5697 0.657367C11.9065 0.649508 12.2383 0.649508 12.5723 0.661297C12.7015 0.665788 12.83 0.681506 12.9586 0.69105C13.0338 0.696664 13.109 0.703962 13.1831 0.711259C13.4533 0.737083 13.7213 0.774508 13.987 0.823535C14.1229 0.848797 14.2587 0.875743 14.3951 0.901566C14.4154 0.901603 14.4349 0.908983 14.4501 0.922337Z" fill="#ffffff"/>
<path d="M5.25874 21.1173C5.27981 21.122 5.29921 21.1323 5.31488 21.1471C5.63283 21.3639 5.96476 21.5595 6.30852 21.7326C6.92863 22.0651 7.58142 22.3326 8.2565 22.5309C8.68006 22.6535 9.11143 22.7472 9.54766 22.8116C10.1444 22.8977 10.748 22.9264 11.3502 22.8974C11.7252 22.8804 12.0987 22.8397 12.4685 22.7756C12.6768 22.7403 12.8834 22.6976 13.0894 22.6516C13.6547 22.5202 14.2077 22.3411 14.7426 22.116C15.2004 21.927 15.6441 21.7057 16.0703 21.4536C16.5961 21.1443 17.0675 20.7507 17.4659 20.2887C17.8669 19.8343 18.2251 19.3438 18.5359 18.8235C19.0119 18.0108 19.35 17.1247 19.5362 16.2013C19.5979 15.8984 19.6419 15.5921 19.6682 15.2841C19.6987 14.9384 19.7084 14.5912 19.6974 14.2444C19.6623 13.1958 19.4489 12.1608 19.0664 11.1838C18.9917 10.9929 18.9131 10.8037 18.8351 10.614C18.8194 10.5763 18.8008 10.5399 18.7818 10.5017C18.4002 9.77858 17.9286 9.1067 17.3783 8.50205C17.0213 8.10516 16.6334 7.7397 16.2449 7.37481C15.9642 7.1132 15.6661 6.87687 15.3658 6.64109C15.1553 6.47267 14.938 6.31829 14.7365 6.1409C14.6708 6.07719 14.6006 6.01828 14.5265 5.96463C14.5033 5.94836 14.482 5.92953 14.4631 5.90849C14.3716 5.81306 14.2778 5.71931 14.1897 5.62106C13.9048 5.30938 13.7133 4.9238 13.6373 4.50841C13.5599 4.04993 13.605 3.57914 13.7681 3.14371C14.0347 2.46051 14.5209 2.00355 15.2063 1.7571C15.6623 1.58876 16.1576 1.55753 16.6311 1.66728C16.6586 1.67346 16.6873 1.67683 16.7148 1.68132C16.716 1.68322 16.7176 1.68484 16.7195 1.68607C16.7214 1.68729 16.7235 1.68809 16.7258 1.68841C16.728 1.68873 16.7303 1.68856 16.7325 1.68792C16.7346 1.68728 16.7366 1.68617 16.7383 1.68469C16.8039 1.70602 16.8668 1.73484 16.9258 1.77058C17.6094 2.10085 18.2582 2.4986 18.8626 2.95789C19.1186 3.1525 19.366 3.35834 19.6047 3.57541C19.8577 3.8037 20.1001 4.04303 20.3317 4.29341C21.5814 5.64007 22.4838 7.27123 22.9606 9.04547C23.0482 9.37163 23.1201 9.70059 23.1801 10.0324C23.2149 10.2277 23.2434 10.424 23.2655 10.6213C23.2885 10.8312 23.3087 11.0412 23.3216 11.2517C23.3312 11.3836 23.3345 11.5161 23.339 11.6486C23.3424 11.7608 23.3508 11.8686 23.3491 11.9792C23.3463 12.1998 23.3441 12.421 23.33 12.6411C23.3147 12.8858 23.2926 13.1304 23.2638 13.3748C23.0982 14.7647 22.6752 16.1116 22.0164 17.3466C21.8345 17.6892 21.6334 18.0213 21.4141 18.3413C21.3957 18.3665 21.3825 18.3952 21.3754 18.4255C21.3682 18.4559 21.3673 18.4874 21.3725 18.5181C21.3966 18.677 21.4185 18.8359 21.4404 18.9953C21.4623 19.1547 21.4837 19.3198 21.505 19.482C21.528 19.6566 21.551 19.8318 21.5735 20.0064C21.5886 20.1287 21.6016 20.2506 21.6167 20.3724C21.633 20.5071 21.6509 20.6413 21.6672 20.7754C21.6835 20.9096 21.6975 21.032 21.7127 21.16C21.7279 21.288 21.7413 21.4042 21.7565 21.526C21.7722 21.6574 21.789 21.7887 21.8053 21.919C21.8233 22.0627 21.8407 22.207 21.8581 22.3507C21.8733 22.4759 21.8873 22.6005 21.9019 22.7257C21.9097 22.7913 21.9182 22.857 21.926 22.9227C21.9339 22.9884 21.9182 23.0064 21.8463 22.9884C21.7851 22.9732 21.7245 22.9558 21.6639 22.9396L20.2486 22.5612C19.7995 22.4416 19.3538 22.3232 18.9069 22.2025C18.5662 22.111 18.226 22.0166 17.8858 21.9218C17.8224 21.9044 17.7578 21.8881 17.6949 21.8656C17.6773 21.8594 17.6585 21.8573 17.6399 21.8594C17.6213 21.8616 17.6035 21.8679 17.5877 21.878C17.3474 22.0172 17.0993 22.1424 16.8489 22.262C16.493 22.4309 16.1283 22.5808 15.7565 22.7111C15.361 22.8498 14.958 22.9664 14.5495 23.0602C14.3008 23.1164 14.051 23.1686 13.7984 23.204C13.6395 23.2264 13.4812 23.255 13.3218 23.2724C13.1467 23.291 12.9709 23.3073 12.7947 23.319C12.4674 23.3404 12.1395 23.3544 11.8117 23.3482C11.6444 23.3449 11.4775 23.3385 11.3109 23.3291C11.1599 23.3202 11.0089 23.3089 10.8585 23.2921C10.6429 23.2674 10.4273 23.241 10.2129 23.2068C9.96701 23.1675 9.72281 23.122 9.4831 23.067C8.84985 22.9227 8.23008 22.7246 7.63056 22.4747C7.28999 22.3321 6.9571 22.1735 6.63187 21.9987C6.17367 21.752 5.73289 21.4742 5.31264 21.1673C5.28962 21.1555 5.26492 21.1448 5.25874 21.1173Z" fill="#ffffff"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 6.7 KiB

-1
View File
@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 256 256"><defs><linearGradient id="SVG6DaOZcwt" x1="50%" x2="50%" y1="0%" y2="100%"><stop offset="0%" stop-color="#2aabee"/><stop offset="100%" stop-color="#229ed9"/></linearGradient></defs><path fill="url(#SVG6DaOZcwt)" d="M128 0C94.06 0 61.48 13.494 37.5 37.49A128.04 128.04 0 0 0 0 128c0 33.934 13.5 66.514 37.5 90.51C61.48 242.506 94.06 256 128 256s66.52-13.494 90.5-37.49c24-23.996 37.5-56.576 37.5-90.51s-13.5-66.514-37.5-90.51C194.52 13.494 161.94 0 128 0"/><path fill="#fff" d="M57.94 126.648q55.98-24.384 74.64-32.152c35.56-14.786 42.94-17.354 47.76-17.441c1.06-.017 3.42.245 4.96 1.49c1.28 1.05 1.64 2.47 1.82 3.467c.16.996.38 3.266.2 5.038c-1.92 20.24-10.26 69.356-14.5 92.026c-1.78 9.592-5.32 12.808-8.74 13.122c-7.44.684-13.08-4.912-20.28-9.63c-11.26-7.386-17.62-11.982-28.56-19.188c-12.64-8.328-4.44-12.906 2.76-20.386c1.88-1.958 34.64-31.748 35.26-34.45c.08-.338.16-1.598-.6-2.262c-.74-.666-1.84-.438-2.64-.258c-1.14.256-19.12 12.152-54 35.686c-5.1 3.508-9.72 5.218-13.88 5.128c-4.56-.098-13.36-2.584-19.9-4.708c-8-2.606-14.38-3.984-13.82-8.41c.28-2.304 3.46-4.662 9.52-7.072"/></svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

-1
View File
@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 256 258"><defs><linearGradient id="SVGK3KZq49U" x1="50%" x2="50%" y1="100%" y2="0%"><stop offset="0%" stop-color="#1faf38"/><stop offset="100%" stop-color="#60d669"/></linearGradient><linearGradient id="SVGefMkoEOd" x1="50%" x2="50%" y1="100%" y2="0%"><stop offset="0%" stop-color="#f9f9f9"/><stop offset="100%" stop-color="#fff"/></linearGradient></defs><path fill="url(#SVGK3KZq49U)" d="M5.463 127.456c-.006 21.677 5.658 42.843 16.428 61.499L4.433 252.697l65.232-17.104a123 123 0 0 0 58.8 14.97h.054c67.815 0 123.018-55.183 123.047-123.01c.013-32.867-12.775-63.773-36.009-87.025c-23.23-23.25-54.125-36.061-87.043-36.076c-67.823 0-123.022 55.18-123.05 123.004"/><path fill="url(#SVGefMkoEOd)" d="M1.07 127.416c-.007 22.457 5.86 44.38 17.014 63.704L0 257.147l67.571-17.717c18.618 10.151 39.58 15.503 60.91 15.511h.055c70.248 0 127.434-57.168 127.464-127.423c.012-34.048-13.236-66.065-37.3-90.15C194.633 13.286 162.633.014 128.536 0C58.276 0 1.099 57.16 1.071 127.416m40.24 60.376l-2.523-4.005c-10.606-16.864-16.204-36.352-16.196-56.363C22.614 69.029 70.138 21.52 128.576 21.52c28.3.012 54.896 11.044 74.9 31.06c20.003 20.018 31.01 46.628 31.003 74.93c-.026 58.395-47.551 105.91-105.943 105.91h-.042c-19.013-.01-37.66-5.116-53.922-14.765l-3.87-2.295l-40.098 10.513z"/><path fill="#fff" d="M96.678 74.148c-2.386-5.303-4.897-5.41-7.166-5.503c-1.858-.08-3.982-.074-6.104-.074c-2.124 0-5.575.799-8.492 3.984c-2.92 3.188-11.148 10.892-11.148 26.561s11.413 30.813 13.004 32.94c1.593 2.123 22.033 35.307 54.405 48.073c26.904 10.609 32.379 8.499 38.218 7.967c5.84-.53 18.844-7.702 21.497-15.139c2.655-7.436 2.655-13.81 1.859-15.142c-.796-1.327-2.92-2.124-6.105-3.716s-18.844-9.298-21.763-10.361c-2.92-1.062-5.043-1.592-7.167 1.597c-2.124 3.184-8.223 10.356-10.082 12.48c-1.857 2.129-3.716 2.394-6.9.801c-3.187-1.598-13.444-4.957-25.613-15.806c-9.468-8.442-15.86-18.867-17.718-22.056c-1.858-3.184-.199-4.91 1.398-6.497c1.431-1.427 3.186-3.719 4.78-5.578c1.588-1.86 2.118-3.187 3.18-5.311c1.063-2.126.531-3.986-.264-5.579c-.798-1.593-6.987-17.343-9.819-23.64"/></svg>

Before

Width:  |  Height:  |  Size: 2.1 KiB

@@ -26,7 +26,7 @@ const _attrs = computed(() => {
const props = withDefaults(defineProps<Props>(), {
value: '',
format: 'YYYY-MM-DD'
format: 'YYYY/MM/DD'
})
const emit = defineEmits<{
+1 -1
View File
@@ -2,7 +2,7 @@
<AButton :disabled="props.disabledB" :type="props.type" :size="props.size" :class="[prefixCls, _class]" :loading="props.loading">
<!-- py-1 px-2-->
<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 }]"
>
<slot v-if="$slots.default"></slot>
+6
View File
@@ -12,6 +12,7 @@
import icons from '@/components/BasicPacks/tools/icons/icons.json'
import {usePrefix} from "@/utils/usePrefix";
import {computed, onMounted, ref, withDefaults, defineProps} from "vue";
import { getAppPrimaryColor } from '@/config/brand-theme'
interface Props {
icon: string
@@ -28,6 +29,11 @@ const tempIcon = ref<string>()
const refIcon = ref<HTMLDivElement>()
tempIcon.value = icons[`${props.icon}`] as string
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
})
+15 -4
View File
@@ -37,6 +37,7 @@ import {usePrefix} from "@/utils/usePrefix";
import {computed} from "vue";
import {usePrice} from "@/components/BasicPacks/BasicPriceInput/src/utils/usePrice";
import {persianToEnglishDigits, shouldNormalizeInputDigits} from '@/utils/persianDigits';
import { getAppPrimaryColor } from '@/config/brand-theme'
//Props
interface Prop {
@@ -55,12 +56,22 @@ interface Prop {
placeHolder?: String
}
const addonBgColor = computed(() => props.addonBgColor)
const addonTextColor = computed(() => props.addonTextColor)
function resolveCssColor(value?: String | string | null) {
if (!value) return value
const raw = String(value).trim()
if (raw.includes('--app-primary-color') || raw === 'primary') {
return getAppPrimaryColor()
}
return raw
}
const props = withDefaults(defineProps<Prop>(), {
isPassword: false
})
const addonBgColorResolved = computed(() => resolveCssColor(props.addonBgColor) || getAppPrimaryColor())
const addonTextColorResolved = computed(() => resolveCssColor(props.addonTextColor) || 'white')
const emits = defineEmits(['update:value', 'onchange'])
const localValue = computed({
@@ -118,8 +129,8 @@ const {prefixCls} = usePrefix('input')
}
.ant-input-group-addon {
background-color: v-bind(addonBgColor);
color: v-bind(addonTextColor);
background-color: v-bind(addonBgColorResolved);
color: v-bind(addonTextColorResolved);
}
}
</style>
@@ -1 +1,17 @@
export { usePrice, usePriceWithoutType, useTowDecimal, useFormat } from '@/utils/usePrice'
export function usePrice(price: number, digit = true, unit = 'ریال') {
let _price = price.toString()
if (digit) {
_price = _price.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',')
}
return `${_price} ${unit}`
}
export function useTowDecimal(num: string | number): string | number {
const temp = num.toString().match(/^-?\d+(?:\.\d{0,2})?/)
if (temp && temp.length > 0) return temp[0]
return Math.round(+num * 100) / 100
}
export function useFormat(num: string | number, unit = '') {
return usePrice(Math.abs(+useTowDecimal(num)), true, unit)
}
+2 -2
View File
@@ -1,4 +1,4 @@
<template>
<template>
<div class="w-full">
<div>
{{ props.title }}
@@ -105,7 +105,7 @@ const handleChange = (e: any) => {
//padding: 5px;
/* .ant-select {
.ant-select-selector {
border-color: @primary-color;
border-color: var(--app-primary-color, #a72b77);
border-radius: @border-radius-base;
}
}*/
@@ -1,68 +0,0 @@
<template>
<span
class="support-brand-icon"
:class="{ 'support-brand-icon--eitaa': normalized === 'eitaa' }"
aria-hidden="true"
>
<img
v-if="logoSrc"
:src="logoSrc"
:alt="normalized"
class="support-brand-icon__img"
draggable="false"
/>
<svg v-else viewBox="0 0 48 48" xmlns="http://www.w3.org/2000/svg" class="support-brand-icon__svg">
<circle cx="24" cy="24" r="24" fill="#64748B" />
<path fill="#fff" d="M16 18h16v2H16v-2zm0 5h16v2H16v-2zm0 5h10v2H16v-2z" />
</svg>
</span>
</template>
<script lang="ts" setup>
import { computed } from 'vue'
import baleLogo from '@/assets/messengers/bale.png'
import eitaaLogo from '@/assets/messengers/eitaa.png'
import rubikaLogo from '@/assets/messengers/rubika.png'
import soroushLogo from '@/assets/messengers/soroush.svg'
import telegramLogo from '@/assets/messengers/telegram.svg'
import whatsappLogo from '@/assets/messengers/whatsapp.svg'
const LOGOS: Record<string, string> = {
bale: baleLogo,
telegram: telegramLogo,
whatsapp: whatsappLogo,
rubika: rubikaLogo,
eitaa: eitaaLogo,
soroush: soroushLogo,
}
const props = defineProps<{ messenger: string }>()
const normalized = computed(() => (props.messenger ?? '').trim().toLowerCase())
const logoSrc = computed(() => LOGOS[normalized.value])
</script>
<style scoped lang="less">
.support-brand-icon {
display: block;
width: 100%;
height: 100%;
border-radius: 50%;
overflow: hidden;
}
.support-brand-icon--eitaa {
background: #e37600;
.support-brand-icon__img {
filter: brightness(0) invert(1);
}
}
.support-brand-icon__img,
.support-brand-icon__svg {
display: block;
width: 100%;
height: 100%;
object-fit: cover;
}
</style>
-293
View File
@@ -1,293 +0,0 @@
<template>
<Teleport to="body">
<Transition name="support-picker-backdrop">
<div
v-if="open"
class="support-messenger-picker__backdrop"
:class="{ 'is-active': backdropActive }"
@click="onBackdropClick"
/>
</Transition>
<div
v-show="open || closing"
class="support-messenger-picker__stack"
:class="[
{ 'is-open': open },
expandUp ? 'support-messenger-picker__stack--up' : 'support-messenger-picker__stack--down',
]"
:style="stackStyle"
role="menu"
aria-label="انتخاب پیام‌رسان"
>
<button
v-for="(entry, index) in entries"
:key="`${entry.messenger}-${entry.id}`"
type="button"
class="support-messenger-picker__btn"
:style="{ '--i': index, '--total': entries.length }"
:title="entry.label"
:aria-label="entry.label"
@click.stop="select(entry)"
>
<SupportMessengerBrandIcon :messenger="entry.messenger" />
</button>
</div>
</Teleport>
</template>
<script lang="ts" setup>
import { nextTick, onBeforeUnmount, ref, watch } from 'vue'
import SupportMessengerBrandIcon from '@/components/SupportMessengerBrandIcon.vue'
import type { ResolvedSupportMessengerEntry } from '@/utils/supportMessenger'
const props = withDefaults(
defineProps<{
open: boolean
entries: ResolvedSupportMessengerEntry[]
anchorEl?: HTMLElement | null
}>(),
{
anchorEl: null,
},
)
const emit = defineEmits<{
'update:open': [value: boolean]
select: [entry: ResolvedSupportMessengerEntry]
}>()
const BTN_SIZE = 46
const GAP = 12
const STACK_GAP = 10
const CLOSE_MS = 220
const BACKDROP_GUARD_MS = 380
const stackStyle = ref<Record<string, string>>({})
const closing = ref(false)
const expandUp = ref(true)
const backdropActive = ref(false)
let closeTimer: ReturnType<typeof setTimeout> | null = null
let backdropTimer: ReturnType<typeof setTimeout> | null = null
function close() {
emit('update:open', false)
}
function select(entry: ResolvedSupportMessengerEntry) {
emit('select', entry)
close()
}
function clearTimers() {
if (closeTimer) {
clearTimeout(closeTimer)
closeTimer = null
}
if (backdropTimer) {
clearTimeout(backdropTimer)
backdropTimer = null
}
}
function onBackdropClick() {
if (!backdropActive.value) return
close()
}
function armBackdropGuard() {
backdropActive.value = false
if (backdropTimer) clearTimeout(backdropTimer)
backdropTimer = setTimeout(() => {
backdropActive.value = true
backdropTimer = null
}, BACKDROP_GUARD_MS)
}
async function reposition() {
await nextTick()
const anchor = props.anchorEl
const count = props.entries.length
if (!anchor || count === 0) {
expandUp.value = true
stackStyle.value = {
top: '50%',
left: '50%',
transform: 'translate(-50%, -50%)',
right: 'auto',
bottom: 'auto',
'--stack-rise': '56px',
}
return
}
const rect = anchor.getBoundingClientRect()
const stackHeight = count * BTN_SIZE + Math.max(0, count - 1) * GAP
const anchorCenterX = rect.left + rect.width / 2
const anchorCenterY = rect.top + rect.height / 2
const right = Math.max(12, window.innerWidth - anchorCenterX - BTN_SIZE / 2)
expandUp.value = anchorCenterY > window.innerHeight / 2
if (expandUp.value) {
const bottom = Math.max(12, window.innerHeight - rect.top + STACK_GAP)
stackStyle.value = {
right: `${right}px`,
bottom: `${bottom}px`,
left: 'auto',
top: 'auto',
transform: 'none',
'--stack-rise': `${Math.min(stackHeight + 6, 220)}px`,
}
} else {
const top = Math.max(12, rect.bottom + STACK_GAP)
stackStyle.value = {
right: `${right}px`,
top: `${top}px`,
left: 'auto',
bottom: 'auto',
transform: 'none',
'--stack-rise': `${Math.min(stackHeight + 6, 220)}px`,
}
}
}
watch(
() => props.open,
(isOpen) => {
clearTimers()
if (isOpen) {
closing.value = false
armBackdropGuard()
void reposition()
return
}
backdropActive.value = false
closing.value = true
const delay = CLOSE_MS + Math.max(0, props.entries.length - 1) * 28
closeTimer = setTimeout(() => {
closing.value = false
closeTimer = null
}, delay)
},
{ flush: 'post' },
)
watch(
() => [props.entries.length, props.anchorEl] as const,
() => {
if (props.open) void reposition()
},
)
function onViewportChange() {
if (props.open || closing.value) void reposition()
}
if (typeof window !== 'undefined') {
window.addEventListener('resize', onViewportChange, { passive: true })
window.addEventListener('scroll', onViewportChange, { passive: true, capture: true })
}
onBeforeUnmount(() => {
clearTimers()
if (typeof window === 'undefined') return
window.removeEventListener('resize', onViewportChange, { capture: true })
window.removeEventListener('scroll', onViewportChange, { capture: true })
})
</script>
<style scoped lang="less">
.support-messenger-picker__backdrop {
position: fixed;
inset: 0;
z-index: 5195;
background: rgba(15, 23, 42, 0.2);
pointer-events: none;
&.is-active {
pointer-events: auto;
}
}
.support-messenger-picker__stack {
position: fixed;
z-index: 5205;
display: flex;
align-items: center;
gap: 12px;
pointer-events: none;
}
.support-messenger-picker__stack--up {
flex-direction: column-reverse;
}
.support-messenger-picker__stack--down {
flex-direction: column;
}
.support-messenger-picker__btn {
--i: 0;
--total: 1;
--stack-rise: 56px;
pointer-events: auto;
width: 46px;
height: 46px;
padding: 0;
border: 0;
border-radius: 50%;
background: transparent;
cursor: pointer;
box-shadow: 0 6px 16px rgba(15, 23, 42, 0.2);
opacity: 0;
will-change: transform, opacity;
transition:
transform 0.22s cubic-bezier(0.2, 1, 0.3, 1),
opacity 0.16s ease,
box-shadow 0.16s ease;
transition-delay: calc(var(--i) * 38ms);
}
.support-messenger-picker__stack--up .support-messenger-picker__btn {
transform-origin: center bottom;
transform: translateY(calc(var(--stack-rise) * 0.55)) scale(0.2);
}
.support-messenger-picker__stack--down .support-messenger-picker__btn {
transform-origin: center top;
transform: translateY(calc(var(--stack-rise) * -0.55)) scale(0.2);
}
.support-messenger-picker__stack.is-open .support-messenger-picker__btn {
opacity: 1;
transform: translateY(0) scale(1);
}
.support-messenger-picker__stack:not(.is-open) .support-messenger-picker__btn {
transition-delay: calc((var(--total) - 1 - var(--i)) * 24ms);
transition-duration: 0.18s, 0.14s, 0.14s;
opacity: 0;
pointer-events: none;
}
.support-messenger-picker__stack--up:not(.is-open) .support-messenger-picker__btn {
transform: translateY(calc(var(--stack-rise) * 0.4)) scale(0.15);
}
.support-messenger-picker__stack--down:not(.is-open) .support-messenger-picker__btn {
transform: translateY(calc(var(--stack-rise) * -0.4)) scale(0.15);
}
.support-picker-backdrop-enter-active,
.support-picker-backdrop-leave-active {
transition: opacity 0.16s ease;
}
.support-picker-backdrop-enter-from,
.support-picker-backdrop-leave-to {
opacity: 0;
}
</style>
+2 -48
View File
@@ -4,56 +4,10 @@ type RawAppConfig = AppConfig & {
user?: Record<string, any>
}
const EMPTY_STRING_CONFIG_KEYS = new Set([
'color',
'secondary_color',
'background_color',
'theme_config',
])
function emptyStringToNull(value: unknown) {
if (typeof value === 'string' && value.trim() === '') {
return null
}
return value
}
function normalizeUserConfig(user?: Record<string, any>) {
if (!user || typeof user !== 'object') {
return user
}
const normalized: Record<string, any> = { ...user }
for (const key of EMPTY_STRING_CONFIG_KEYS) {
if (key in normalized) {
normalized[key] = emptyStringToNull(normalized[key])
}
}
return normalized
}
export function normalizeAppConfig(config: RawAppConfig): RawAppConfig {
if (!config || typeof config !== 'object') {
return {}
}
if (!config.user || typeof config.user !== 'object') {
return config
}
return {
...config,
user: normalizeUserConfig(config.user),
}
}
let appConfig: RawAppConfig | null = null
export function setAppConfig(config: RawAppConfig) {
appConfig = normalizeAppConfig(config || {})
appConfig = config || {}
window.__APP_CONFIG__ = appConfig
}
@@ -77,7 +31,7 @@ export function getTenantConfig() {
export function getConfig<T = any>(key: string, fallback?: T): T {
const config = getTenantConfig()
const value = emptyStringToNull(config?.[key])
const value = config?.[key]
return (value ?? fallback ?? null) as T
}
+9 -18
View File
@@ -1,7 +1,11 @@
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'
export function applyAppConfig() {
applyBrandTheme()
if (isPwaManifestReady()) return
setTitle()
@@ -13,10 +17,6 @@ function setTitle() {
document.title = getConfig('name_fa', 'در حال بارگذاری...')
}
function getLogoUrl() {
return getConfig<string>('avatar') || '/favicon.png'
}
function setFavicon() {
let faviconLink =
document.querySelector<HTMLLinkElement>("link[rel='icon']") ||
@@ -28,14 +28,14 @@ function setFavicon() {
document.head.appendChild(faviconLink)
}
const logoUrl = getLogoUrl()
const logoUrl = getAppIconUrl()
faviconLink.type = 'image/png'
faviconLink.href = logoUrl.startsWith('http') ? logoUrl : resolveRemoteLogo(logoUrl)
faviconLink.href = logoUrl
}
function setAppleTouchIconFallback() {
const logoUrl = getLogoUrl()
const logoUrl = getAppIconUrl()
if (!logoUrl) return
@@ -57,7 +57,7 @@ function setAppleTouchIconFallback() {
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']")
@@ -71,13 +71,4 @@ function setAppleTouchIconFallback() {
appleTitle.content = getConfig('name_fa', 'اپ مشتری')
}
function resolveRemoteLogo(path: string) {
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(/^\/+/, '')}`
}
export { resolveConfigAssetUrl }
+44
View File
@@ -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
}
+133
View File
@@ -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)
}
}
+13 -24
View File
@@ -1,9 +1,7 @@
import type { AppConfig } from '@/config/types'
import { normalizeAppConfig } from '@/config/app-config'
import { readCachedAppConfig, writeCachedAppConfig } from '@/config/config-cache'
const CONFIG_SUCCESS_URL_KEY = 'CONFIG_Success_URL'
export const CONFIG_RETRY_ROUNDS = 5
function getProtocol() {
return window.location.protocol === 'https:' ? 'https:' : 'http:'
@@ -31,12 +29,6 @@ export function sortConfigUrls(urls: string[]) {
})
}
function clearStaleConfigSuccessUrl(url: string) {
if (localStorage.getItem(CONFIG_SUCCESS_URL_KEY) === url) {
localStorage.removeItem(CONFIG_SUCCESS_URL_KEY)
}
}
async function fetchConfig(url: string, timeout = 3000): Promise<AppConfig> {
const controller = new AbortController()
const timeoutId = window.setTimeout(() => controller.abort(), timeout)
@@ -61,31 +53,28 @@ async function fetchConfig(url: string, timeout = 3000): Promise<AppConfig> {
throw new Error('Config response is not JSON')
}
return normalizeAppConfig(await response.json())
return await response.json()
} finally {
clearTimeout(timeoutId)
}
}
export async function fetchFreshAppConfig(rounds = CONFIG_RETRY_ROUNDS): Promise<AppConfig> {
export async function fetchFreshAppConfig(): Promise<AppConfig> {
const urls = sortConfigUrls(getConfigUrls())
for (let round = 1; round <= rounds; round++) {
for (let index = 0; index < urls.length; index++) {
const url = urls[index]
for (let index = 0; index < urls.length; index++) {
const url = urls[index]
try {
const timeout = index === urls.length - 1 ? 7000 : 4000
const config = await fetchConfig(url, timeout)
try {
const timeout = index === urls.length - 1 ? 5000 : 2500
const config = await fetchConfig(url, timeout)
localStorage.setItem(CONFIG_SUCCESS_URL_KEY, url)
writeCachedAppConfig(config)
localStorage.setItem(CONFIG_SUCCESS_URL_KEY, url)
writeCachedAppConfig(config)
return config
} catch (error) {
clearStaleConfigSuccessUrl(url)
console.warn(`Config failed from ${url}. Round: ${round}`, error)
}
return config
} catch (error) {
console.warn(`Config failed from ${url}`, error)
}
}
@@ -96,7 +85,7 @@ export async function loadAppConfig(): Promise<AppConfig> {
const cachedConfig = readCachedAppConfig()
if (cachedConfig) {
return normalizeAppConfig(cachedConfig)
return cachedConfig
}
return await fetchFreshAppConfig()
+9 -21
View File
@@ -9,24 +9,16 @@ type VersionResponse =
}
const VERSION_SUCCESS_URL_KEY = 'VERSION_Success_URL'
export const VERSION_RETRY_ROUNDS = 5
const VERSION_RETRY_ROUNDS = 5
let versionFetchPromise: Promise<string | null> | null = null
let cachedVersionResult: string | null | undefined
function getProtocol() {
return window.location.protocol === 'https:' ? 'https:' : 'http:'
}
function getVersionUrls() {
const protocol = getProtocol()
return [
'https://nerkh.gold/get_version',
'https://tablo.talasevin.ir/get_version',
'https://abshode-service.montgit.ir/server/get_version',
`${protocol}//212.23.201.173:8381/get_version`,
`${protocol}//91.212.174.137:4040/server/get_version`
'https://abshode-service.montgit.ir/server/get_version'
]
}
@@ -41,12 +33,6 @@ function sortVersionUrls(urls: string[]) {
return [lastSuccessUrl, ...others]
}
function clearStaleVersionSuccessUrl(url: string) {
if (localStorage.getItem(VERSION_SUCCESS_URL_KEY) === url) {
localStorage.removeItem(VERSION_SUCCESS_URL_KEY)
}
}
function readUserVersion(user: unknown) {
if (!user || typeof user !== 'object' || Array.isArray(user)) {
return ''
@@ -96,6 +82,7 @@ async function fetchVersion(url: string, timeout = 3500): Promise<string | null>
})
if (!response.ok) {
// Non-2xx/timeout should be treated as "request failed" and we may try the next URL.
throw new Error(`Version request failed with status ${response.status}`)
}
@@ -107,8 +94,10 @@ async function fetchVersion(url: string, timeout = 3500): Promise<string | null>
const version = normalizeVersionResponse(data)
// IMPORTANT: if the request returned 200/ok, we stop here even if we couldn't extract a version.
// This prevents unnecessary looping when the endpoint is "reachable" but returns an empty payload.
if (!version) {
throw new Error('Version response is empty')
return null
}
localStorage.setItem(VERSION_SUCCESS_URL_KEY, url)
@@ -129,11 +118,10 @@ async function fetchVersionWithRetry(rounds = VERSION_RETRY_ROUNDS): Promise<str
try {
const version = await fetchVersion(url, timeout)
if (version) {
return version
}
// fetchVersion only throws on real request failures (non-ok / timeout).
// If it returns null, we got HTTP 200 but empty version => stop immediately.
return version
} catch (error) {
clearStaleVersionSuccessUrl(url)
console.warn(`Version failed from ${url}. Round: ${round}`, error)
}
}
+123
View File
@@ -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'
}
+62 -3
View File
@@ -1,6 +1,12 @@
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' },
@@ -8,6 +14,14 @@ export const AUTH_PRIMARY_NAV: AppNavItem[] = [
{ 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' },
@@ -30,10 +44,55 @@ export const AUTH_SECONDARY_NAV: AppNavItem[] = [
{ 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[] {
return isAuthenticated ? AUTH_PRIMARY_NAV : GUEST_PRIMARY_NAV
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[] {
return isAuthenticated ? AUTH_SECONDARY_NAV : []
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)
}
+1 -1
View File
@@ -48,7 +48,7 @@ defineEmits<{
height: 18px;
padding: 0 4px;
border-radius: 999px;
background: #a72b77;
background: var(--app-primary-color, #a72b77);
color: #fff;
font-size: 10px;
font-weight: 700;
+5 -3
View File
@@ -1,7 +1,7 @@
<template>
<aside class="desktop-sidebar">
<div class="desktop-sidebar__brand">
<img :src="navLogo" alt="کشکول گلد" class="desktop-sidebar__logo" />
<img :src="navLogo" :alt="projectName" class="desktop-sidebar__logo" />
</div>
<nav class="desktop-sidebar__section" aria-label="منوی اصلی">
@@ -39,16 +39,18 @@
<script lang="ts" setup>
import { computed } from 'vue'
import logoFull from '@/assets/img/logo_full_.png'
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 = logoFull
const navLogo = getAppLogoFullUrl()
const projectName = getProjectDisplayName('کشکول گلد')
const primaryItems = computed(() => getPrimaryNavItems(authenticated.value))
const secondaryItems = computed(() => getSecondaryNavItems(authenticated.value))
const cartCount = computed(() => cartStore.itemCount || 0)
+4 -4
View File
@@ -1,4 +1,4 @@
.desktop-app-layout {
.desktop-app-layout {
display: flex;
flex-direction: row;
height: 100vh;
@@ -110,15 +110,15 @@
&:hover {
background: rgba(167, 43, 119, 0.06);
color: @primary-color;
color: var(--app-primary-color, #a72b77);
}
&--active {
background: rgba(167, 43, 119, 0.1);
color: @primary-color;
color: var(--app-primary-color, #a72b77);
.desktop-nav-item__icon {
color: @primary-color;
color: var(--app-primary-color, #a72b77);
}
}
}
@@ -1,4 +1,4 @@
/* Shared desktop layouts for inner pages */
/* Shared desktop layouts for inner pages */
.dinner {
min-height: 100%;
@@ -85,7 +85,7 @@
&__price {
font-size: 15px;
font-weight: 700;
color: @App-primary-color;
color: var(--app-primary-color, #a72b77);
}
}
@@ -114,7 +114,7 @@
&__total {
font-size: 20px;
font-weight: 700;
color: @App-primary-color;
color: var(--app-primary-color, #a72b77);
}
}
@@ -153,7 +153,7 @@
.dproduct-info__price {
font-size: 22px;
font-weight: 700;
color: @App-primary-color;
color: var(--app-primary-color, #a72b77);
}
.dproduct-info__desc {
+14 -3
View File
@@ -16,7 +16,12 @@
<div class="main_in">
<div class="text-white circle_in">
<div class="circle_into" @click="$emit('toggle-overflow')">
<img class="p-2" :src="navLogo" alt="" />
<img
class="p-2"
:class="{ 'nav-logo--white': isKashkool }"
:src="navLogo"
alt=""
/>
</div>
</div>
</div>
@@ -45,8 +50,9 @@ 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'
import logo from '@/assets/img/logo.png'
defineProps<{
navItemClass: (routeName: string) => string
@@ -58,7 +64,8 @@ defineEmits<{
}>()
const cartStore = useCartStore()
const navLogo = logo
const navLogo = getAppIconUrl()
const isKashkool = isKashkoolProject()
const cartCount = computed(() => cartStore.itemCount || 0)
const primaryItems = computed(() => getPrimaryNavItems(isToken()))
@@ -80,4 +87,8 @@ const rightTabs = computed(() => primaryItems.value.slice(2))
.tab__icon :deep(.ant-badge) {
color: inherit;
}
.nav-logo--white {
filter: brightness(0) invert(1);
}
</style>
+7 -76
View File
@@ -17,85 +17,15 @@
</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('user')"
@click="go(item.routeName)"
>
<div class="flex gap-2 items-center">
<BasicIcon icon="vuesax-linear:user" size="16" class="absolute right-2" />
<div>حساب کاربری</div>
</div>
</BasicButton>
<BasicButton
v-if="authenticated"
icon-size="16"
class="!font-bold w-15rem"
@click="go('physicalReceive')"
>
<div class="flex gap-2 items-center">
<BasicIcon icon="vuesax-linear:direct-inbox" size="16" class="absolute right-2" />
<div>دریافت طلای فیزیکی</div>
</div>
</BasicButton>
<BasicButton
v-if="authenticated"
icon-size="16"
class="!font-bold w-15rem"
@click="go('notifyTrigger')"
>
<div class="flex gap-2 items-center">
<BasicIcon icon="vuesax-linear:bill" size="16" class="absolute right-2" />
<div>هشدار قیمت</div>
</div>
</BasicButton>
<BasicButton
v-if="authenticated"
icon-size="16"
class="!font-bold w-15rem"
@click="go('buyProduct')"
>
<div class="flex gap-2 items-center">
<BasicIcon icon="vuesax-linear:coin" size="16" class="absolute right-2" />
<div>خرید محصول</div>
</div>
</BasicButton>
<!-- <BasicButton-->
<!-- v-if="authenticated"-->
<!-- icon-size="16"-->
<!-- class="!font-bold w-15rem"-->
<!-- @click="go('list')"-->
<!-- >-->
<!-- <div class="flex gap-2 items-center">-->
<!-- <BasicIcon icon="vuesax-linear:receipt-item" size="16" class="absolute right-2" />-->
<!-- <div>لیست دریافتی ها</div>-->
<!-- </div>-->
<!-- </BasicButton>-->
<BasicButton
v-if="authenticated"
icon-size="16"
class="!font-bold w-15rem"
@click="go('giftCard')"
>
<div class="flex gap-2 items-center">
<BasicIcon icon="vuesax-linear:gift" size="16" class="absolute right-2" />
<div>ثبت کارت هدیه</div>
</div>
</BasicButton>
<BasicButton icon-size="16" class="!font-bold w-15rem" @click="go('about')">
<div class="flex gap-2 items-center">
<BasicIcon icon="vuesax-linear:info-circle" size="16" class="absolute right-2" />
<div>درباره ما</div>
</div>
</BasicButton>
<BasicButton
v-if="authenticated"
icon-size="16"
class="!font-bold w-15rem"
@click="go('rules')"
>
<div class="flex gap-2 items-center">
<BasicIcon icon="vuesax-linear:task" size="16" class="absolute right-2" />
<div>قوانین و مقررات</div>
<BasicIcon :icon="item.icon" size="16" class="absolute right-2" />
<div>{{ item.label }}</div>
</div>
</BasicButton>
</div>
@@ -109,6 +39,7 @@ 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
@@ -119,7 +50,7 @@ const emit = defineEmits<{
navigate: [routeName: string]
}>()
const authenticated = computed(() => isToken())
const menuItems = computed(() => getOverflowMenuItems(isToken()))
function go(routeName: string) {
emit('navigate', routeName)
+4 -4
View File
@@ -1,4 +1,4 @@
.bottom-appbar {
.bottom-appbar {
z-index: var(--app-z-nav, 5000);
position: fixed;
bottom: 0;
@@ -43,7 +43,7 @@
&.text-primary .tab__icon,
&.text-primary .tab__icon .ant-badge {
color: @primary-color;
color: var(--app-primary-color, #a72b77);
}
&.text-gray-400 .tab__icon,
@@ -68,11 +68,11 @@
display: flex;
justify-content: center;
align-items: center;
background-color: #a72b77;
background-color: var(--app-primary-color, #a72b77);
.circle_into {
overflow: hidden;
background-color: @primary-color;
background-color: var(--app-primary-color, #a72b77);
border-radius: 50%;
width: 56px;
height: 56px;
-7
View File
@@ -172,10 +172,3 @@ html.app-layout--desktop .app-splash-screen {
left: 0 !important;
width: 100vw !important;
}
html.app-layout--desktop .login-page-root {
width: 100%;
height: 100%;
min-height: 0;
overflow: hidden;
}
+3 -3
View File
@@ -1,4 +1,4 @@
/* Shared mobile page chrome (inner pages — not home .app-header) */
/* Shared mobile page chrome (inner pages — not home .app-header) */
:root {
--mpage-header-bar: 2.75rem;
@@ -31,7 +31,7 @@
padding: 0.75rem;
padding-top: calc(0.75rem + var(--app-safe-top, env(safe-area-inset-top, 0px)));
background: #fff;
color: @primary-color;
color: var(--app-primary-color, #a72b77);
font-size: 1rem;
font-weight: 700;
line-height: 1.5;
@@ -67,7 +67,7 @@
z-index: 1999;
padding: 0.75rem;
background: #fff;
color: @primary-color;
color: var(--app-primary-color, #a72b77);
font-weight: 700;
}
-1
View File
@@ -8,7 +8,6 @@ export interface Order {
sts_str?: string
payment_sts?: number
payment_amount?: number
target_cash?: number
service_charge_price?: number
total_fee?: number
total_price?: number
-9
View File
@@ -17,25 +17,16 @@ export interface Product {
percent_fee_sell: number | undefined
cash_fee_buy: number | undefined
cash_fee_sell: number | undefined
cash_fee_buy_is_percent?: boolean | null
cash_fee_sell_is_percent?: boolean | null
reading_method: any
created_at: any
updated_at: any
deleted_at: any
price?:number | undefined
price_profit?: number | null
price_offset_percent?: number | null
sellPrice?:number | undefined
description: string
wallet: Wallet
similar?:Product[]
inventory:number
app_price?: boolean | number | null
direct_price?: number | null
trade_by_quantity?: boolean | number | null
use_last_price_if_zero?: boolean | null
reference_provider_active?: boolean | null
}
export interface PInventory {
+2 -1
View File
@@ -1,4 +1,5 @@
import {createRouter, createWebHistory} from 'vue-router'
import { getDefaultLandingRoute } from '@/config/project-profile'
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
@@ -17,7 +18,7 @@ const router = createRouter({
{
path: `/`,
name: 'main',
redirect: {name: 'buyProduct'},
redirect: () => ({ name: getDefaultLandingRoute() }),
component: () => import('../views/base/index.vue'),
children: [
{
+42 -2
View File
@@ -1,9 +1,15 @@
import { ref } from 'vue'
import { type ComputedRef, ref } from 'vue'
import {defineStore} from "pinia";
import {getMe} from "@/api/me";
import type {User} from "@/models/login";
import type {Wallet} from "@/models/wallet";
import {getWallet} from "@/api/wallet";
import type {Const} from "@/models/const";
import {getConstByKey} from "@/api/const";
export const useWalletStore = defineStore('wallet', () => {
const walletInfo = ref<Wallet | undefined>(undefined)
const limitedPrice = ref<Const[]>()
const limitedBuyGold = ref<Const[]>()
async function getMyWallet() {
try {
@@ -13,6 +19,40 @@ export const useWalletStore = defineStore('wallet', () => {
console.log(e)
}
}
async function getLimitedPrice(){
try {
limitedPrice.value = await getConstByKey('limited_price')
return limitedPrice.value
}catch (e) {
console.log(e)
}
}
return { walletInfo, getMyWallet }
async function getLimitedBuyGold(){
try {
limitedBuyGold.value = await getConstByKey('first_customer_wallet_value')
return limitedBuyGold.value
}catch (e) {
console.log(e)
}
}
/* const permissions: ComputedRef<string[]> = computed(() => {
const permissions: string[] = get(userInfo.value, 'permission', [])
const excludes: string[] = get(userInfo.value, 'exclude', [])
return permissions.filter((item) => !excludes.includes(item))
})*/
/*
function canAccess(permissionKey: string) {
if (isAdmin.value) return true
return permissions.value.includes(permissionKey)
}
*/
/*
const isAdmin = computed(() => {
return userInfo.value?.is_admin
})*/
return { walletInfo, getMyWallet, getLimitedPrice, getLimitedBuyGold, limitedPrice, limitedBuyGold/* permissions, canAccess, isAdmin*/ }
})
+28
View File
@@ -6,3 +6,31 @@ export function getConfigApp(key: string) {
}
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'
+6 -14
View File
@@ -15,7 +15,7 @@ let lastSubscribers = 0
export const price = ref<Price>()
export const lastPrice = ref<Price>()
export const olderPrice = ref<number | null>(null)
export const olderPrice = ref<number | undefined>(0)
let lastPriceSourceAt = 0
let consecutivePriceFetchFailures = 0
@@ -162,17 +162,13 @@ export async function getLastPrices(): Promise<boolean> {
export function applyLastPricePayload(dataLast: Price) {
const normalized = normalizePriceResponse(dataLast)
const nextBuy = getTradeBuyPrice(normalized)
const prevBuy = getTradeBuyPrice(lastPrice.value)
if (prevBuy > 0 && nextBuy > 0 && prevBuy !== nextBuy) {
olderPrice.value = prevBuy
if (lastPrice.value?.price_last != normalized.price_last) {
olderPrice.value = lastPrice.value?.price_last
}
lastPrice.value = normalized
price.value = {
...normalized,
buy: nextBuy,
buy: getTradeBuyPrice(normalized),
sell: getTradeSellPrice(normalized),
}
@@ -181,13 +177,9 @@ export function applyLastPricePayload(dataLast: Price) {
}
}
/** تغییر درصدی نسبت به قیمت خرید قبلی (آخرین به‌روزرسانی) */
export function percentPriceChanged() {
const currentBuy = getTradeBuyPrice(lastPrice.value)
const prevBuy = olderPrice.value
if (!currentBuy || prevBuy == null || prevBuy <= 0 || prevBuy === currentBuy) {
if (!olderPrice.value) {
return 0
}
return ((currentBuy - prevBuy) * 100) / prevBuy
return ((lastPrice.value?.price_last! - olderPrice.value) * 100) / olderPrice.value
}
+1 -3
View File
@@ -39,13 +39,11 @@ export function getProductDisplayImage(product?: {
return resolveProductImageSrc(product)
}
import { formatGoldAmount } from '@/utils/usePrice'
export function formatMetalTotal(
metal: WalletMetalTotal,
inventoryCards: WalletInventoryCard[]
): string {
return `${formatGoldAmount(resolveSummaryMetalWeight(metal, inventoryCards))}${metal.unit}`
return `${resolveSummaryMetalWeight(metal, inventoryCards)}${metal.unit}`
}
export function resolveAssetsRialValue(
-54
View File
@@ -1,54 +0,0 @@
export type ProductCashFeeSource = {
cash_fee_buy?: number | null
cash_fee_sell?: number | null
cash_fee_buy_is_percent?: boolean | null
cash_fee_sell_is_percent?: boolean | null
}
/** 0.5 => 0.5% ، 5 => 5% */
export function resolveCashFeePercentRatio(percentValue?: number | null) {
const offset = Number(percentValue ?? 0)
if (!offset || !Number.isFinite(offset)) {
return 0
}
return offset / 100
}
export function resolveProductCashFeeRial(
feeValue: number | null | undefined,
isPercent: boolean | null | undefined,
basePriceRial: number,
) {
const raw = Number(feeValue ?? 0)
if (!raw || !Number.isFinite(raw)) {
return 0
}
if (!isPercent) {
return Math.round(raw)
}
const base = Number(basePriceRial)
if (!base || base <= 0) {
return 0
}
return Math.round(Math.abs(base * resolveCashFeePercentRatio(raw)))
}
export function resolveProductCashFeeBuyRial(product: ProductCashFeeSource, basePriceRial: number) {
return resolveProductCashFeeRial(
product.cash_fee_buy,
product.cash_fee_buy_is_percent,
basePriceRial,
)
}
export function resolveProductCashFeeSellRial(product: ProductCashFeeSource, basePriceRial: number) {
return resolveProductCashFeeRial(
product.cash_fee_sell,
product.cash_fee_sell_is_percent,
basePriceRial,
)
}
-87
View File
@@ -1,87 +0,0 @@
/** دسته‌بندی یکسان محصول — هم‌تراز با khaneghi_user */
export const PRODUCT_CATEGORY_ABSHODE = 'آبشده'
export const LEGACY_GROUP_KATOD = 'کاتد مس'
export const LEGACY_MELTED_GROUP_TYPES = [LEGACY_GROUP_KATOD] as const
export function normalizeProductGroupType(groupType?: string | null) {
return (groupType ?? '').trim()
}
/** محصول آبشده‌ای — قیمت از مظنه اپ (مگر قیمت ثابت / مرجع) */
export function isMeltedTradeGroup(groupType?: string | null) {
const group = normalizeProductGroupType(groupType)
return group === PRODUCT_CATEGORY_ABSHODE
|| LEGACY_MELTED_GROUP_TYPES.includes(group as typeof LEGACY_MELTED_GROUP_TYPES[number])
}
export interface QuantityTradeProductSource {
group_type?: string | null
trade_by_quantity?: boolean | number | null
}
export function usesQuantityTrade(product?: QuantityTradeProductSource | null) {
if (!product) {
return false
}
return product.trade_by_quantity === true || Number(product.trade_by_quantity) === 1
}
export function isMetalCommodityGroup(groupType?: string | null) {
const group = normalizeProductGroupType(groupType)
return group === 'مس' || group === 'نقره'
}
export type MeltedPriceSource = 'app' | 'fixed' | 'reference'
export function resolveMeltedPriceSource(product?: {
reading_method?: string | null
direct_price?: number | null
} | null): MeltedPriceSource {
if (product?.reading_method) {
return 'reference'
}
if (Number(product?.direct_price) === 1) {
return 'fixed'
}
return 'app'
}
/** محصول با پرچم صریح «قیمت اپ» */
export function isAppPriceProduct(product?: {
app_price?: boolean | number | null
reading_method?: string | null
} | null) {
if (!product || product.reading_method) {
return false
}
return product.app_price === true || Number(product.app_price) === 1
}
export function isMeltedProductUsingAppPrice(product?: {
group_type?: string | null
reading_method?: string | null
direct_price?: number | null
trade_by_quantity?: boolean | number | null
price?: number | null
} | null) {
if (!product || resolveMeltedPriceSource(product) !== 'app') {
return false
}
if (isMeltedTradeGroup(product.group_type)) {
return true
}
if (!usesQuantityTrade(product)) {
return false
}
if (Number(product.direct_price) === 1) {
return false
}
return Number(product.price ?? 0) <= 0
}
+36 -201
View File
@@ -1,257 +1,93 @@
import type { Product } from '@/models/products'
import { getTradeBuyPrice, getTradeSellPrice, lastPrice } from '@/utils/price'
import { resolveProductCashFeeBuyRial, resolveProductCashFeeSellRial } from '@/utils/productCashFee'
import {
isAppPriceProduct,
isMeltedProductUsingAppPrice,
isMeltedTradeGroup,
isMetalCommodityGroup,
usesQuantityTrade,
} from '@/utils/productCategories'
/**
* قیمت‌گیری محصول — هم‌تراز با khaneghi_user:
* آبشده / قیمت‌اپ از مظنه زنده؛ قیمت ثابت و مرجع از سرور.
* قیمت‌گیری ماژولار محصول در حالت فروشگاهی (is_store=true).
*
* منبع حقیقت قیمت و وضعیت نمایش، سرور است: `/customer/product/list` و رویداد SSE
* `list` هر دو قیمت هر محصول (`price`/`price_profit`) و `show` را محاسبه‌شده می‌فرستند.
* این ماژول فقط همان قیمت سرور را می‌خواند و فقط برای آبشده وقتی قیمت سرور صفر است
* به قیمت زندهٔ مرجع (`lastPrice`) fallback می‌کند — هیچ‌جا قیمت سرور بازنویسی نمی‌شود.
*/
function productUsesLastPriceIfZero(product: Product): boolean {
return Boolean(product.use_last_price_if_zero)
const MELTED_GROUP = 'آبشده'
export function isMeltedProduct(product?: Product | null): boolean {
return product?.group_type === MELTED_GROUP
}
function hasReferenceReadingMethod(product: Product): boolean {
return Boolean(product.reading_method)
}
function hasProductUnitWeight(product?: Product | null) {
if (!product || isMeltedTradeGroup(product.group_type)) {
return false
}
return Number(product.amount ?? 0) > 0
}
function productPriceAmountFactor(product?: Product | null) {
if (!product || product.reading_method) {
return 1
}
if (isAppPriceProduct(product)) {
const amount = Number(product.amount ?? 0)
return amount > 0 ? amount : 1
}
if (hasProductUnitWeight(product) && Number(product.direct_price ?? 0) === 0) {
const amount = Number(product.amount ?? 0)
return amount > 0 ? amount : 1
}
return 1
}
function getReferenceProductBaseBuyPrice(product: Product): number {
const storedUnit = Number(product.price ?? 0)
const useLast = productUsesLastPriceIfZero(product)
if (!useLast) {
return storedUnit > 0 ? storedUnit : 0
}
return storedUnit
}
export function resolvePriceOffsetRatio(offsetPercent?: number | null) {
const offset = Number(offsetPercent ?? 0)
if (!offset) {
return 0
}
if (Math.abs(offset) > 0 && Math.abs(offset) < 1) {
return offset
}
return offset / 100
}
export function applyPriceOffsetPercent(basePrice: number, offsetPercent?: number | null) {
const ratio = resolvePriceOffsetRatio(offsetPercent)
if (!ratio) {
return basePrice
}
return Math.round(basePrice * (1 + ratio))
}
/** قیمت پایه بدون کارمزد */
/** قیمت پایهٔ خرید (بدون کارمزد) — قیمت سرور، با fallback زندهٔ آبشده وقتی سرور صفر است */
export function getProductBaseBuyPrice(product?: Product | null): number {
if (!product) {
return 0
}
if (isMeltedProductUsingAppPrice(product) || isAppPriceProduct(product)) {
const apiPrice = Number(product.price ?? 0)
const useLast = productUsesLastPriceIfZero(product)
if (!useLast) {
const liveBuy = getTradeBuyPrice(lastPrice.value)
if (liveBuy > 0) {
return applyPriceOffsetPercent(liveBuy, product.price_offset_percent)
}
return 0
}
if (apiPrice > 0) {
return apiPrice
}
const serverPrice = Number(product.price ?? 0)
if (serverPrice > 0) {
return serverPrice
}
if (isMeltedProduct(product)) {
const liveBuy = getTradeBuyPrice(lastPrice.value)
if (liveBuy > 0) {
return applyPriceOffsetPercent(liveBuy, product.price_offset_percent)
const amount = Number(product.amount ?? 0)
return amount > 0 ? liveBuy * amount : liveBuy
}
return 0
}
if (isMeltedTradeGroup(product.group_type)) {
return Number(product.price ?? 0)
}
if (isMetalCommodityGroup(product.group_type)) {
return Number(product.price_profit ?? 0) + Number(product.price ?? 0)
}
if (hasReferenceReadingMethod(product)) {
return getReferenceProductBaseBuyPrice(product)
}
return Number(product.price ?? 0)
return 0
}
/** قیمت خرید نمایشی */
/** قیمت خرید نمایشی محصول (همان مقداری که در لیست و صفحهٔ محصول نشان داده می‌شود) */
export function getProductBuyPrice(product?: Product | null): number {
if (!product) {
return 0
}
const base = getProductBaseBuyPrice(product)
if (base <= 0) {
return 0
}
const fee = resolveProductCashFeeBuyRial(product, base)
const withFee = base + fee
if (isAppPriceProduct(product)) {
return withFee * productPriceAmountFactor(product)
}
if (
isMeltedProductUsingAppPrice(product)
|| isMeltedTradeGroup(product.group_type)
|| isMetalCommodityGroup(product.group_type)
) {
return withFee
}
if (usesQuantityTrade(product) && hasProductUnitWeight(product)) {
return withFee * productPriceAmountFactor(product)
}
if (usesQuantityTrade(product)) {
return withFee
}
return withFee * productPriceAmountFactor(product)
return base + Number(product?.cash_fee_buy ?? 0)
}
/** قیمت پایه فروش */
/** قیمت پایهٔ فروش (بدون کارمزد) — قیمت فروش سرور، با fallback زندهٔ آبشده */
export function getProductBaseSellPrice(product?: Product | null): number {
if (!product) {
return 0
}
if (isMeltedProductUsingAppPrice(product) || isAppPriceProduct(product)) {
const apiPrice = Number(product.price ?? 0)
const useLast = productUsesLastPriceIfZero(product)
if (!useLast) {
const liveSell = getTradeSellPrice(lastPrice.value)
if (liveSell > 0) {
return applyPriceOffsetPercent(liveSell, product.price_offset_percent)
}
return 0
}
if (apiPrice > 0) {
return apiPrice
}
const liveSell = getTradeSellPrice(lastPrice.value)
if (liveSell > 0) {
return applyPriceOffsetPercent(liveSell, product.price_offset_percent)
}
return 0
}
if (isMeltedTradeGroup(product.group_type)) {
return Number(product.sellPrice ?? product.price ?? 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 {
if (!product) {
return 0
}
const base = getProductBaseSellPrice(product)
if (base <= 0) {
return 0
}
if (isAppPriceProduct(product)) {
const withFee = base - resolveProductCashFeeSellRial(product, base)
return withFee * productPriceAmountFactor(product)
}
if (isMeltedProductUsingAppPrice(product) || isMeltedTradeGroup(product.group_type)) {
return base - resolveProductCashFeeSellRial(product, base)
}
if (usesQuantityTrade(product) && hasProductUnitWeight(product)) {
const withFee = base - resolveProductCashFeeSellRial(product, base)
return withFee * productPriceAmountFactor(product)
}
if (usesQuantityTrade(product)) {
return base - resolveProductCashFeeSellRial(product, base)
}
return base - resolveProductCashFeeSellRial(product, base)
return base - Number(product?.cash_fee_sell ?? 0)
}
/** محصول وقتی قیمت پایهٔ معتبری ندارد، غیرفعال (غیرقابل معامله) است */
export function isProductPriceInactive(product?: Product | null): boolean {
if (!product) {
return true
}
if (
hasReferenceReadingMethod(product)
&& !productUsesLastPriceIfZero(product)
&& product.reference_provider_active === false
) {
return true
}
return getProductBaseBuyPrice(product) <= 0
}
/**
* نمایش محصول در فروشگاه — اولویت با `show` سرور.
* آبشدهٔ قیمت‌اپ با مظنه زنده حتی اگر show هنوز false باشد.
* فقط برای آبشده‌ای که قیمت سرورش هنوز نرسیده، با قیمت زنده تکمیل می‌کنیم.
*/
export function isProductVisible(product?: Product | null): boolean {
if (!product || product.active === false) {
@@ -262,7 +98,6 @@ export function isProductVisible(product?: Product | null): boolean {
return true
}
return isMeltedProductUsingAppPrice(product) && getProductBaseBuyPrice(product) > 0
// سازگاری: آبشده‌ای که سرور هنوز قیمت نداده ولی قیمت زنده موجود است
return isMeltedProduct(product) && getProductBaseBuyPrice(product) > 0
}
export { isMeltedTradeGroup, isMeltedProductUsingAppPrice } from '@/utils/productCategories'
-206
View File
@@ -1,206 +0,0 @@
import { ref } from 'vue'
import { getSettings } from '@/api/configuration'
export const serviceFeePercentage = ref<number>(0.01)
/** true = مبالغ رند: فروش → ریال دقیق (کارمزد از طلا)؛ خرید → وزن دقیق (کارمزد از ریال) */
export const feeDeductFromGold = ref(false)
/** آخرین فیلدی که کاربر مستقیم ویرایش کرده — مبنای به‌روزرسانی هنگام تغییر قیمت */
export type TradeInputLock = 'gram' | 'rial' | null
/** حداکثر اعشار ذخیره/ارسال به سرور (مطابق orders.amount) */
export const TRADE_GRAM_STORAGE_DECIMALS = 10
/** حداکثر اعشار نمایش به کاربر در اپ */
export const TRADE_GRAM_DISPLAY_DECIMALS = 8
export function normalizeOrderGoldAmount(grams?: number | null): number {
const value = Number(grams ?? 0)
if (!Number.isFinite(value) || value === 0) return 0
return parseFloat(value.toFixed(TRADE_GRAM_STORAGE_DECIMALS))
}
export function formatTradeGramDisplay(grams?: number | null): number {
const value = Number(grams ?? 0)
if (!Number.isFinite(value)) return 0
return parseFloat(value.toFixed(TRADE_GRAM_DISPLAY_DECIMALS))
}
function feeRate() {
return Number(serviceFeePercentage.value)
}
export async function loadServiceFeeFromSettings() {
try {
const settings = await getSettings()
if (settings && Array.isArray(settings)) {
const feeSetting = settings.find(
(s) => s?.key === 'fee_service_charge_percentage' && s?.is_active === true
)
if (feeSetting?.value !== undefined && feeSetting?.value !== null) {
serviceFeePercentage.value = Number(feeSetting.value)
}
const feeModeSetting = settings.find(
(s) => s?.key === 'fee_deduct_from_gold' && s?.is_active === true
)
if (feeModeSetting?.value !== undefined && feeModeSetting?.value !== null) {
const raw = String(feeModeSetting.value).trim().toLowerCase()
feeDeductFromGold.value = raw === 'true' || raw === '1'
} else {
feeDeductFromGold.value = false
}
}
} catch (e) {
console.log(e)
}
}
export function calcFeeInGrams(goldValue?: number | null) {
return parseFloat(((goldValue ?? 0) * Number(serviceFeePercentage.value)).toFixed(4))
}
/** گرم معادل برای دریافت دقیق مبلغ ریالی در فروش */
export function calcGoldAmountFromTargetRial(rialAmount: number, unitPriceRial: number) {
if (!rialAmount || !unitPriceRial) return 0
return normalizeOrderGoldAmount(rialAmount / unitPriceRial)
}
/** وقتی کاربر گرم را قفل کرده — ریال نمایشی/قابل پرداخت از همان گرم */
export function calcRialFromLockedGram(displayGram: number, unitPriceRial: number, isBuy: boolean) {
const grams = Number(displayGram)
const unit = Number(unitPriceRial)
if (!grams || !unit) return 0
const fee = feeRate()
if (isBuy) {
if (feeDeductFromGold.value) {
return Math.round(grams * unit * (1 + fee))
}
return Math.round(grams * unit)
}
if (feeDeductFromGold.value) {
return Math.round(grams * unit)
}
return Math.round(grams * unit * (1 - fee))
}
/** وقتی کاربر ریال را قفل کرده — گرم نمایشی از همان مبلغ */
export function calcGramFromLockedRial(rialAmount: number, unitPriceRial: number, isBuy: boolean) {
const rial = Number(rialAmount)
const unit = Number(unitPriceRial)
if (!rial || !unit) return 0
const fee = feeRate()
if (isBuy) {
if (feeDeductFromGold.value) {
return rial / (unit * (1 + fee))
}
return (rial / unit) * (1 - fee)
}
if (feeDeductFromGold.value) {
return rial / unit
}
return rial / (unit * (1 - fee))
}
/** مبلغ ریالی قفل‌شده توسط کاربر — برای ارسال به سرور */
export function calcTradeTargetCash(
goldCash?: number | null,
inputLock?: TradeInputLock,
): number | undefined {
if (inputLock !== 'rial') return undefined
const cash = Number(goldCash ?? 0)
if (cash <= 0) return undefined
return Math.round(cash)
}
/** مبلغ نهایی قابل پرداخت (خرید) یا دریافت (فروش) به ریال */
export function calcPayablePriceRial(
finalPriceRial: number,
feeInRial: number,
isBuy: boolean,
targetRialCash?: number | null
) {
if (targetRialCash != null && Number(targetRialCash) > 0) {
return Number(targetRialCash)
}
if (feeDeductFromGold.value) {
if (isBuy) return finalPriceRial + feeInRial
return finalPriceRial
}
return isBuy ? finalPriceRial : Math.max(0, finalPriceRial - feeInRial)
}
/** وزن ارسالی به سرور */
export function calcOrderGoldAmount(
goldValue?: number | null,
goldCash?: number | null,
unitPriceRial?: number,
isBuy?: boolean,
inputLock?: TradeInputLock
) {
const gold = Number(goldValue ?? 0)
const cash = Number(goldCash ?? 0)
const unit = Number(unitPriceRial ?? 0)
if (isBuy && inputLock === 'rial' && cash > 0 && unit > 0) {
if (feeDeductFromGold.value) {
const fee = feeRate()
return normalizeOrderGoldAmount(cash / (unit * (1 + fee)))
}
return normalizeOrderGoldAmount(cash / unit)
}
if (!isBuy && feeDeductFromGold.value) {
if (inputLock === 'rial' && cash > 0 && unit > 0) {
return calcGoldAmountFromTargetRial(cash, unit)
}
if (inputLock !== 'rial') {
return normalizeOrderGoldAmount(gold)
}
const targetCash = calcSellTargetCash(goldCash, goldValue, unitPriceRial, inputLock)
if (targetCash != null && unit > 0) {
return calcGoldAmountFromTargetRial(targetCash, unit)
}
}
return normalizeOrderGoldAmount(gold)
}
/** مبلغ ریالی دقیق دریافتی در فروش (فقط وقتی کاربر با ریال وارد کرده) */
export function calcSellTargetCash(
goldCash?: number | null,
goldValue?: number | null,
unitPriceRial?: number,
inputLock?: TradeInputLock
) {
if (!feeDeductFromGold.value) return undefined
if (inputLock === 'gram') return undefined
const cash = Number(goldCash ?? 0)
if (cash <= 0) return undefined
if (inputLock === 'rial') return Math.round(cash)
const gold = Number(goldValue ?? 0)
const unit = Number(unitPriceRial ?? 0)
if (gold > 0 && unit > 0) {
const derived = Math.round(gold * unit)
if (Math.abs(derived - Math.round(cash)) <= 1) return undefined
}
return Math.round(cash)
}
/** کل طلای کسرشونده از کیف در فروش (شامل کارمزد وقتی fee_deduct_from_gold روشن است) */
export function calcSellGoldDebit(goldValue?: number | null, feeInGrams?: number | null) {
const gold = Number(goldValue ?? 0)
const fee = Number(feeInGrams ?? 0)
if (feeDeductFromGold.value) {
return parseFloat((gold + fee).toFixed(4))
}
return gold
}
+5 -124
View File
@@ -9,111 +9,28 @@ export type SupportMessengerType =
| 'eitaa'
| 'soroush'
export interface SupportMessengerEntry {
messenger: string
id: string
}
export interface SupportMessengerSettings {
messengers?: SupportMessengerEntry[]
messenger?: SupportMessengerType | string
messengerId?: string
messengerText?: string
}
export interface SupportMessengerMeta {
label: string
icon: string
accent: string
}
export interface ResolvedSupportMessengerEntry extends SupportMessengerEntry {
label: string
icon: string
accent: string
url: string
}
export const supportMessengerSettings = ref<SupportMessengerSettings>({})
export const supportMessengerPickerOpen = ref(false)
const VALID_SUPPORT_MESSENGERS = new Set([
'bale',
'telegram',
'whatsapp',
'rubika',
'eitaa',
'soroush',
])
export const SUPPORT_MESSENGER_META: Record<string, SupportMessengerMeta> = {
bale: { label: 'بله', icon: 'vuesax-linear:messages-2', accent: '#16a34a' },
telegram: { label: 'تلگرام', icon: 'vuesax-linear:send-2', accent: '#0ea5e9' },
whatsapp: { label: 'واتساپ', icon: 'vuesax-linear:whatsapp', accent: '#22c55e' },
rubika: { label: 'روبیکا', icon: 'vuesax-linear:messages-2', accent: '#7c3aed' },
eitaa: { label: 'ایتا', icon: 'vuesax-linear:messages-2', accent: '#f59e0b' },
soroush: { label: 'سروش', icon: 'vuesax-linear:messages-2', accent: '#2563eb' },
}
function getSupportSettingValue(
settings: Array<{ key?: string; value?: unknown }>,
key: string,
settings: Array<{ key?: string; is_active?: boolean | number; value?: unknown }>,
key: string
) {
const setting = settings.find((item) => item?.key === key)
if (!setting) return ''
const value = setting.value
if (value === undefined || value === null) return ''
return String(value).trim()
}
export function parseSupportMessengersJson(raw?: string | null): SupportMessengerEntry[] {
const value = (raw ?? '').trim()
if (!value) return []
try {
const decoded = JSON.parse(value)
if (!Array.isArray(decoded)) return []
return decoded
.map((row) => ({
messenger: String(row?.messenger ?? '').trim().toLowerCase(),
id: String(row?.id ?? '').trim(),
}))
.filter((row) => VALID_SUPPORT_MESSENGERS.has(row.messenger) && row.id !== '')
} catch {
return []
}
}
export function resolveSupportMessengersFromSettings(
settings: Array<{ key?: string; value?: unknown }>,
): SupportMessengerEntry[] {
const fromJson = parseSupportMessengersJson(getSupportSettingValue(settings, 'support_messengers'))
if (fromJson.length > 0) return fromJson
const legacyMessenger = getSupportSettingValue(settings, 'support_messenger').toLowerCase()
const legacyId = getSupportSettingValue(settings, 'support_messenger_id')
if (!legacyId) return []
const messenger = legacyMessenger || 'bale'
if (!VALID_SUPPORT_MESSENGERS.has(messenger)) return []
return [{ messenger, id: legacyId }]
}
export function resolveSupportMessengerMeta(messenger?: string): SupportMessengerMeta {
const type = (messenger ?? '').trim().toLowerCase()
return SUPPORT_MESSENGER_META[type] ?? {
label: 'پشتیبانی',
icon: 'vuesax-linear:headphone',
accent: '#334155',
}
}
export function buildSupportMessengerUrl(
messenger?: string,
messengerId?: string,
) {
export function buildSupportMessengerUrl(messenger?: string, messengerId?: string) {
const id = (messengerId ?? '').trim()
if (!id) return ''
@@ -145,48 +62,12 @@ export function buildSupportMessengerUrl(
}
}
export function resolveSupportMessengerEntries(
settings?: SupportMessengerSettings,
): ResolvedSupportMessengerEntry[] {
const resolved = settings ?? supportMessengerSettings.value
const source = resolved.messengers?.length
? resolved.messengers
: resolveLegacySingleMessenger(resolved)
return source
.map((entry) => {
const meta = resolveSupportMessengerMeta(entry.messenger)
const url = buildSupportMessengerUrl(entry.messenger, entry.id)
if (!url) return null
return { ...entry, ...meta, url }
})
.filter((entry): entry is ResolvedSupportMessengerEntry => entry !== null)
}
function resolveLegacySingleMessenger(settings: SupportMessengerSettings): SupportMessengerEntry[] {
const messenger = (settings.messenger ?? '').trim().toLowerCase()
const id = (settings.messengerId ?? '').trim()
if (!messenger || !id) return []
if (!VALID_SUPPORT_MESSENGERS.has(messenger)) return []
return [{ messenger, id }]
}
export async function openSupportMessengerEntry(entry: ResolvedSupportMessengerEntry | SupportMessengerEntry) {
const url = 'url' in entry && entry.url
? entry.url
: buildSupportMessengerUrl(entry.messenger, entry.id)
if (!url) return false
window.open(url, '_blank', 'noopener,noreferrer')
return true
}
export async function loadSupportMessengerFromSettings() {
try {
const settings = await getSettings()
if (!settings || !Array.isArray(settings)) return
supportMessengerSettings.value = {
messengers: resolveSupportMessengersFromSettings(settings),
messenger: getSupportSettingValue(settings, 'support_messenger'),
messengerId: getSupportSettingValue(settings, 'support_messenger_id'),
messengerText: getSupportSettingValue(settings, 'support_messenger_text'),
+16 -90
View File
@@ -1,46 +1,24 @@
function formatGroupedPrice(price: string | number | null | undefined, digit: boolean) {
let value = price === null || price === undefined ? '' : String(price)
if (digit) {
value = value.replace(/\B(?=(\d{3})+(?!\d))/g, ',')
}
return value
}
/** مبلغ ریالی — بدون اعشار، گرد به بالا */
export function ceilRial(price?: number | string | null): number {
const num = Number(price ?? 0)
if (!Number.isFinite(num)) {
return 0
}
return Math.ceil(num)
}
export function formatNumber(value: string | number | null | undefined, grouped = false): string {
return formatGroupedPrice(value, grouped)
}
export function usePrice(price: number, digit = true, unit = 'ریال') {
const formatted = formatGroupedPrice(ceilRial(price), digit)
return `${formatted} ${unit}`
price= price??0
let _price = price.toString()
if (digit) {
_price = _price.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',')
}
return `${_price} ${unit}`
}
export function usePriceWithoutType(price?: number, digit = true) {
return formatGroupedPrice(ceilRial(price), digit)
export function usePriceWithoutType(price?: number, digit = true, unit = 'ریال') {
let _price = price?.toString()
if (digit) {
_price = _price?.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',')
}
return `${_price}`
}
export function useTowDecimal(num: string | number): string | number {
const temp = num.toString().match(/^-?\d+(?:\.\d{0,2})?/)
if (temp && temp.length > 0) return formatGroupedPrice(temp[0], false)
return formatGroupedPrice(Math.round(+num * 100) / 100, false)
}
export function formatSignedPercentChange(value: number): string {
if (!value) return '0%'
const formatted = useTowDecimal(Math.abs(value))
const prefix = value > 0 ? '+' : '-'
return `${prefix}${formatted}%`
if (temp && temp.length > 0) return temp[0]
return Math.round(+num * 100) / 100
}
export function useFormat(num: string | number, unit = '') {
@@ -50,26 +28,11 @@ export function useFormat(num: string | number, unit = '') {
type TransactionPriceSource = {
cash?: number | null
gold?: number | null
type?: number | null
order?: {
price?: number | null
total_price?: number | null
amount?: number | null
sts?: number | null
sts_str?: string | number | null
payment_sts?: number | null
} | null
withdraw?: {
sts?: number | null
sts_str?: string | number | null
} | null
order_id?: number | null
}
const ORDER_STATUS_LABELS: Record<number, string> = {
1: 'باز',
2: 'موفق',
3: 'ناموفق',
}
export function getTransactionTradePrice(item: TransactionPriceSource): number {
@@ -94,38 +57,6 @@ export function getTransactionTradePrice(item: TransactionPriceSource): number {
return 0
}
export function resolveTransactionStatusLabel(item?: TransactionPriceSource | null): string {
if (!item) return ''
const raw = item.order?.sts_str ?? item.withdraw?.sts_str
if (typeof raw === 'string') {
const trimmed = raw.trim()
if (trimmed && trimmed !== 'بدون مقدار') {
return trimmed
}
}
if (typeof raw === 'number' || (typeof raw === 'string' && /^\d+$/.test(String(raw).trim()))) {
const mapped = ORDER_STATUS_LABELS[Number(raw)]
if (mapped) return mapped
}
const sts = item.order?.sts ?? item.withdraw?.sts
if (sts != null && ORDER_STATUS_LABELS[Number(sts)]) {
return ORDER_STATUS_LABELS[Number(sts)]
}
if (item.order_id && Number(item.order?.payment_sts) === 4) {
return 'موفق'
}
if (item.order_id && (item.type === 1 || item.type === 2 || item.type === 10)) {
return 'موفق'
}
return ''
}
export function getTransactionGoldAmount(item: TransactionPriceSource): number {
const gold = Number(item.gold) || 0
if (Math.abs(gold) > 0) {
@@ -143,13 +74,8 @@ export function getTransactionGoldAmount(item: TransactionPriceSource): number {
return gold
}
export function formatGoldAmount(amount?: number | null, decimals = 8): string {
export function formatGoldAmount(amount?: number | null): string {
const num = Number(amount)
if (!Number.isFinite(num)) return '0'
return formatGroupedPrice(Number(num.toFixed(decimals)), false)
}
/** وزن فلز (گرم) — بدون گرد کردن به بالا */
export function formatWeightAmount(amount?: number | null): string {
return formatGoldAmount(amount)
return String(Number(num.toFixed(3)))
}
@@ -1,4 +1,4 @@
/* Premium desktop about page */
/* Premium desktop about page */
.dabout {
min-height: 100%;
@@ -95,7 +95,7 @@
height: 56px;
border-radius: 14px;
background: rgba(9, 61, 81, 0.08);
color: @App-primary-color;
color: var(--app-primary-color, #a72b77);
flex-shrink: 0;
}
@@ -125,7 +125,7 @@
border: 1px solid rgba(9, 61, 81, 0.15);
border-radius: 12px;
background: rgba(9, 61, 81, 0.03);
color: @App-primary-color;
color: var(--app-primary-color, #a72b77);
}
&__divider {
@@ -1,4 +1,4 @@
<template>
<template>
<div class="dinner cart-page">
<div class="dinner__container">
<DesktopPageTopbar title="سبد خرید" show-back>
@@ -174,7 +174,7 @@ const {
.dcart-summary__discount-link {
border: none;
background: transparent;
color: @App-primary-color;
color: var(--app-primary-color, #a72b77);
font-size: 13px;
text-decoration: underline;
cursor: pointer;
@@ -1,4 +1,4 @@
<template>
<template>
<div class="dinner earn-money-page">
<div class="dinner__container">
<DesktopPageTopbar title="کسب درآمد" show-back />
@@ -94,7 +94,7 @@ const { data, userStore, isTransaction, setIsTransaction, copyCode, shareCode }
&--active {
background: #fff;
color: @App-primary-color;
color: var(--app-primary-color, #a72b77);
box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}
}
@@ -1,4 +1,4 @@
<template>
<template>
<div>
<div class="bg-white w-full py-3 px-3 text-primary font-bold drop-shadow flex">
<div @click="router.back()">
@@ -7,7 +7,7 @@
<div class="mr-2">کسب درآمد</div>
</div>
<div class="p-4">
<div class="p-3 border-solid border-1 rounded-[8px] border-[#a72b77]">
<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" />
@@ -1,4 +1,4 @@
/* Premium desktop fund page */
/* Premium desktop fund page */
.dfund {
min-height: 100%;
@@ -73,7 +73,7 @@
overflow: hidden;
border-radius: 16px;
margin-bottom: 24px;
background: @App-primary-color;
background: var(--app-primary-color, #a72b77);
color: #fff;
&--bazretala {
@@ -339,7 +339,7 @@
.dfund-info__balance-value {
font-size: 28px;
font-weight: 700;
color: @App-primary-color;
color: var(--app-primary-color, #a72b77);
}
.dfund-info__balance-unit {
@@ -495,8 +495,8 @@
cursor: pointer;
&--active {
background: @App-primary-color;
border-color: @App-primary-color;
background: var(--app-primary-color, #a72b77);
border-color: var(--app-primary-color, #a72b77);
color: #fff;
}
}
@@ -39,10 +39,7 @@ export function useFundInfoPage() {
try {
loading.value = true
items.value = []
Object.assign(pagination.value, {
wallet_id: info.value.wallet.id,
product_id: infoId.value ?? undefined,
})
Object.assign(pagination.value, { wallet_id: info.value.wallet.id })
tableOutput.value = await getFundTransactionTable(pagination.value)
items.value.push(...(tableOutput.value?.rows ?? []))
} catch (e) {
@@ -1,4 +1,4 @@
/* Premium desktop gift card page */
/* Premium desktop gift card page */
.dgift {
min-height: 100%;
@@ -47,7 +47,7 @@
height: 56px;
border-radius: 14px;
background: rgba(167, 43, 119, 0.08);
color: @App-primary-color;
color: var(--app-primary-color, #a72b77);
flex-shrink: 0;
}
@@ -126,7 +126,7 @@
}
.basic-icon {
color: @App-primary-color;
color: var(--app-primary-color, #a72b77);
flex-shrink: 0;
margin-top: 2px;
}
+107 -160
View File
@@ -1,4 +1,4 @@
<template>
<template>
<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 @click="isBuy = false" class="w-full text-center" :class="!isBuy?'text-primary':'text-gray-400'">خرید طلا</div>
@@ -24,9 +24,14 @@
<img :src="img1" alt="" class="h-[88px] absolute">
<div class="w-full items-center flex flex-col">
<div class="text-gray-700 font-bold">{{ !isBuy ? 'قیمت فروش' : 'قیمت خرید' }}</div>
<div v-if="price" class="flex gap-1 mt-3 text-xs items-center">
<div :class="!isBuy ? 'text-red-700' : 'text-green-700'" class="font-bold text-2xl color-transition">
{{ usePriceWithoutType(goldPriceValue) }}
<div class="flex gap-1 mt-3 text-xs items-center">
<div class="gold-live-price">
<Vue3Odometer
:key="isBuy ? 'buy' : 'sell'"
: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>
@@ -35,20 +40,25 @@
<div v-else class="w-full h-[88px]">
<GoldSkeleton class="w-full" />
</div>
<div v-if="limitedPrice !== undefined && userStore?.userInfo.trade_active !== 1"
class="text-red text-xs flex gap-1 items-center justify-center my-2">
<Icon icon="vuesax-linear:info-circle" size="16" />
حداقل مبلغ اولیه برای ثبت سفارش {{ usePriceWithoutType(limitedPrice.value as number ?? 0) }} ریال می باشد.
</div>
</a-spin>
<a-form :model="form" class="!mt-5" name="basic" @finish="okConfirm()">
<div class="border-gray-200 border-1 rounded-xl p-5 h-58 relative">
<bg_main/>
<div class="z-100 relative">
<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"
place-holder="ارزش کل"
size="large"
type="price" @onchange="calculateGold" />
</a-form-item>
<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"
place-holder="مقدار طلا"
size="large" type="text" inputmode="decimal" @onchange="calculateCash" />
@@ -56,7 +66,7 @@
<!-- {{walletStore?.walletInfo?.gold}}-->
<Transition mode="out-in" name="fade">
<div v-if="!isBuy" class="font-bold text-xs">
<div> {{ `موجودی کیف طلا: ${formatGoldAmount(walletStore?.walletInfo?.gold ?? 0)} گرم` }}</div>
<div> {{ `موجودی کیف طلا: ${walletStore?.walletInfo?.gold ?? 0} گرم` }}</div>
<!-- <div v-if="walletStore?.walletInfo?.gold_block !== 0">
{{ `موجودی قابل برداشت طلا: ${walletStore?.walletInfo?.gold_block ?? 0} گرم` }}
</div>-->
@@ -78,6 +88,13 @@
@change="percentChange" />
</a-form-item>
</Transition>
<Transition mode="out-in" name="fade">
<div v-if="priceErrorVisible" class="flex gap-1 items-center text-xs mt-[-15px] text-blue-600">
<BasicIcon icon="vuesax-linear:info-circle" />
ارزش کل وارد شده بر حسب گرم طلا محاسبه خواهد شد و قیمت وارد شده معادل {{ usePrice(parseInt(finalPrice.toFixed(0))) }} می
باشد!
</div>
</Transition>
</div>
</div>
<GoldLoading v-model:show="infoVisible" />
@@ -94,11 +111,10 @@
<div v-else>{{ !isBuy ? 'فروش' : 'خرید' }}</div>
</div>
</BasicButton>
<div v-if="!isBuy && sellGoldDebit > (walletStore?.walletInfo?.gold ?? 0)"
<div v-if="!isBuy && form.goldValue > walletStore?.walletInfo?.gold"
class="text-red-700 text-xs font-bold mt-2">
مقدار گرم طلای وارد شده جهت فروش ({{ form.goldValue }}گرم) بیشتر از مقدار موجودی شما
({{ walletStore?.walletInfo?.gold }}گرم) می باشد.
<span v-if="feeDeductFromGold"> (با احتساب {{ feeInGrams }} گرم کارمزد، مجموعاً {{ sellGoldDebit }} گرم کسر می‌شود)</span>
</div>
<!-- <div>{{form?.goldValue? true: false}}</div>-->
<div v-if="isBuy? ((form?.goldValue || form.goldValue === 0)? form?.goldCash < 500000: false) : false"
@@ -112,7 +128,7 @@
<div class="flex justify-between items-center">
<div>کارمزد:</div>
<div class="flex gap-2 items-center">
<div class="">{{ feeInGrams }}</div>
<div class="">{{ parseFloat(((form.goldValue ?? 0) * 0.01).toFixed(4)) }}</div>
<!-- <div class="font-bold text-2xl">{{ 0 }}</div>-->
<div>
گرم
@@ -138,39 +154,25 @@
<div class="flex justify-between ">
<div>وزن:</div>
<div class="flex items-center">
<div class="font-bold">{{ displayTradeGoldAmount }}</div>
<div class="font-bold">{{ form.goldValue }}</div>
<div class="text-xs mr-1">گرم</div>
</div>
</div>
<div class="flex justify-between mt-3">
<div>مظنه:</div>
<div class="flex items-center">
<div class="font-bold">{{ usePriceWithoutType(Math.round(goldPriceValue)) }}</div>
<div class="font-bold">{{ usePriceWithoutType(isBuy ? price.buy ?? 0 : price.sell ?? 0) }}</div>
<div class="text-xs mr-1">ریال</div>
</div>
</div>
<div class="flex justify-between mt-3">
<div>کارمزد:</div>
<div class="flex items-center gap-2">
<div class="font-bold text-xl">{{ feeInGrams }}</div>
<div class="font-bold text-xl">{{ parseFloat(((form.goldValue ?? 0) * 0.01).toFixed(4)) }}</div>
<div class="text-xs mr-1">گرم</div>
</div>
</div>
<div >(معادل {{ equivalentPrice }} ریال)</div>
<div v-if="isBuy && feeDeductFromGold" class="flex justify-between mt-3">
<div>طلا دریافتی:</div>
<div class="flex items-center">
<div class="font-bold">{{ displayTradeGoldAmount }}</div>
<div class="text-xs mr-1">گرم (دقیق — کارمزد از ریال)</div>
</div>
</div>
<div v-if="!isBuy && feeDeductFromGold" class="flex justify-between mt-3">
<div>کسر از کیف طلا:</div>
<div class="flex items-center">
<div class="font-bold">{{ sellGoldDebit }}</div>
<div class="text-xs mr-1">گرم</div>
</div>
</div>
<div class="flex justify-between mt-3">
<div>{{ isBuy ? 'قیمت قابل پرداخت:' : 'مبلغ دریافتی:' }}</div>
<div class="flex items-center">
@@ -201,10 +203,10 @@
import { computed, onMounted, onUnmounted, ref, watch } from 'vue'
import img1 from '@/assets/img/home_ly2.svg'
import { usePrice, usePriceWithoutType, formatGoldAmount } from '@/utils/usePrice'
import { usePrice, usePriceWithoutType } from '@/utils/usePrice'
import BasicInput from '@/components/BasicPacks/BasicInput.vue'
import type { Gold } from '@/models/gold'
import { isIphone, loading, loadingMore } from '@/utils'
import { isIphone, loading, loadingMore, toFixedDownThreeChar } from '@/utils'
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
import router from '@/router'
import { useWalletStore } from '@/store/walletStore'
@@ -226,27 +228,12 @@ import type { Transaction } from '@/models/transaction'
import type { TableEngineInput, TableOutput } from '@/models/table'
import { useInfiniteScroll } from '@vueuse/core'
import { getTransactionTable } from '@/api/transaction'
import { getLastPrices, getTradeBuyPrice, getTradeSellPrice, lastPrice, setIntervalGetAllPrice, stopPriceInterval } from '@/utils/price'
import { isStoreClosed, getStoreClosedMessage } from '@/utils/storeHours'
import { getLastPrices, lastPrice, setIntervalGetAllPrice, stopPriceInterval } from '@/utils/price'
import type { Product } from '@/models/products'
import { useFundUserStore } from '@/store/fundStore'
import {
calcFeeInGrams,
calcGramFromLockedRial,
calcOrderGoldAmount,
calcPayablePriceRial,
calcRialFromLockedGram,
calcSellGoldDebit,
calcSellTargetCash,
calcTradeTargetCash,
feeDeductFromGold,
formatTradeGramDisplay,
loadServiceFeeFromSettings,
normalizeOrderGoldAmount,
serviceFeePercentage,
type TradeInputLock,
} from '@/utils/serviceFee'
import Bg_main from '@/components/bg_main.vue'
import Vue3Odometer from 'vue3-odometer'
import 'odometer/themes/odometer-theme-default.css'
const infoVisible = ref(false)
const walletStore = useWalletStore()
const userStore = useUserStore()
@@ -255,6 +242,7 @@ const confirmAction = ref<boolean>(false)
const noCompleteVisible = ref<boolean>(false)
const buyItems = ref<Transaction[]>([])
const sellItems = ref<Transaction[]>([])
const priceErrorVisible = ref<boolean>(false)
const buyTableOutput = ref<TableOutput<Transaction> | null>(null)
const sellTableOutput = ref<TableOutput<Transaction> | null>(null)
const el = ref()
@@ -265,7 +253,6 @@ interface Prop {
const props = withDefaults(defineProps<Prop>(), {})
const isBuy = ref<boolean>(true)
const inputLock = ref<TradeInputLock>(null)
const buyPagination = ref<TableEngineInput>({
filters: [{
@@ -286,52 +273,20 @@ const sellPagination = ref<TableEngineInput>({
}], limit: 6, page: 0
})
const unitPrice = computed(() =>
isBuy.value ? getTradeBuyPrice(lastPrice.value) : getTradeSellPrice(lastPrice.value)
)
const orderGoldAmount = computed(() =>
calcOrderGoldAmount(
form.value?.goldValue,
form.value?.goldCash,
unitPrice.value,
isBuy.value,
inputLock.value
)
)
const feeInGrams = computed(() => calcFeeInGrams(orderGoldAmount.value))
const finalPrice = computed(() => orderGoldAmount.value * unitPrice.value)
const feeInRial = computed(() => unitPrice.value * feeInGrams.value)
const equivalentPrice = computed(() => usePriceWithoutType(feeInRial.value.toFixed(0)))
const payablePrice = computed(() =>
calcPayablePriceRial(
finalPrice.value,
feeInRial.value,
isBuy.value,
inputLock.value === 'rial' ? form.value?.goldCash : undefined
)
)
const sellGoldDebit = computed(() => calcSellGoldDebit(orderGoldAmount.value, feeInGrams.value))
const displayTradeGoldAmount = computed(() =>
formatTradeGramDisplay(orderGoldAmount.value)
)
const priceUnavailable = computed(() => {
const unit = unitPrice.value
return !unit || Number.isNaN(unit) || unit <= 0
})
const finalPrice = computed(() => (form.value?.goldValue * (isBuy.value ? price.value?.buy ?? 0 : price.value?.sell ?? 0)))
// const payablePrice = computed(() => finalPrice.value + finalPrice.value * 0.007)
const payablePrice = computed(() => finalPrice.value)
const equivalentPrice = computed(() => usePriceWithoutType(((isBuy ? price.value?.buy ?? 0 : price.value?.sell ?? 0) * (parseFloat(((form.value?.goldValue ?? 0) * 0.01).toFixed(4))) ).toFixed(0)) )
const disableTransaction = computed(() =>
loading.value ||
isStoreClosed() ||
form.value?.goldValue === undefined ||
form.value?.goldValue === '' ||
form.value?.goldCash === '' ||
form.value?.goldCash === undefined ||
(isBuy.value ? (form.value?.goldCash ?? 0) < 500000 : (form.value?.goldValue ?? 0) < 0.001) ||
(!isBuy.value && sellGoldDebit.value > (walletStore?.walletInfo?.gold ?? 0)) ||
(isBuy.value && payablePrice.value > (walletStore?.walletInfo?.cash ?? 0)) ||
priceUnavailable.value)
(!isBuy.value && form.value.goldValue > walletStore?.walletInfo?.gold) ||
price.value?.buy === undefined)
function refreshTable() {
sellItems.value = []
@@ -433,7 +388,6 @@ onMounted(async () => {
break
}
await initPrice()
await loadServiceFeeFromSettings()
/* await initSellTable()
await initBuyTable()*/
})
@@ -528,18 +482,20 @@ onUnmounted(() => {
})
function percentChange(val: number) {
if (val !== 0) {
if (val !== 0)
if (isBuy.value) {
form.value.goldCash = unitCashCalculator.value * val
calculateGold(form.value.goldCash)
calculateCash(form.value.goldValue)
} else {
form.value.goldValue = formatTradeGramDisplay(parseFloat(String(unitGoldCalculator.value * val)))
// console.log((unitGoldCalculator.value * val).toFixed(2))
// form.value.goldValue = parseFloat((unitGoldCalculator.value * val).toFixed(2))
form.value.goldValue = toFixedDownThreeChar(parseFloat(unitGoldCalculator.value * val))
calculateCash(form.value.goldValue)
}
} else {
else {
form.value.goldValue = undefined
form.value.goldCash = undefined
inputLock.value = null
}
}
@@ -552,61 +508,55 @@ const unitCashCalculator = computed(() => {
return (walletStore?.walletInfo?.cash ?? 0) / 100
})
function syncFormWithLatestPrice() {
const unit = unitPrice.value
if (!unit || Number.isNaN(unit) || !inputLock.value) return
if (inputLock.value === 'gram') {
const goldValue = form.value.goldValue
if (goldValue !== undefined && goldValue !== null && goldValue !== '' && !isNaN(Number(goldValue))) {
calculateCash(Number(goldValue))
}
return
}
const goldCash = form.value.goldCash
if (goldCash !== undefined && goldCash !== null && goldCash !== '' && !isNaN(Number(goldCash))) {
calculateGold(Number(goldCash))
}
}
watch(
() => [unitPrice.value, isBuy.value],
() => {
syncFormWithLatestPrice()
}
)
watch([feeDeductFromGold, () => serviceFeePercentage.value], () => {
syncFormWithLatestPrice()
const limitedPrice = computed(() => {
if (walletStore.limitedPrice)
return walletStore?.limitedPrice[0]
})
function calculateCash(val: number) {
inputLock.value = 'gram'
const unit = unitPrice.value
if (!unit || Number.isNaN(unit)) return
if (val === undefined || val === null || Number.isNaN(val)) {
form.value.goldCash = undefined
inputLock.value = null
return
priceErrorVisible.value = false
// console.log(val)
if (price.value) {
if (isBuy.value) {
if (val) form.value.goldCash = parseFloat((val * price?.value?.buy).toFixed(0))
else form.value.goldCash = undefined
} else {
if (val) form.value.goldCash = parseFloat((val * price?.value?.sell).toFixed(0))
else form.value.goldCash = undefined
}
}
form.value.goldCash = calcRialFromLockedGram(val, unit, isBuy.value)
}
function calculateGold(val: number) {
inputLock.value = 'rial'
const unit = unitPrice.value
if (!unit || Number.isNaN(unit)) return
if (val) {
form.value.goldValue = formatTradeGramDisplay(calcGramFromLockedRial(val, unit, isBuy.value))
} else if (val.toString() === '') {
form.value.goldValue = undefined
inputLock.value = null
} else {
form.value.goldValue = 0
// console.log(val)
// form.value.goldCash = usePriceWithoutType(form.value.goldCash)
if (price.value) {
if (isBuy.value) {
if (val) {
form.value.goldValue = toFixedDownThreeChar(parseFloat(val / price?.value?.buy))
if (parseInt(finalPrice.value) > 0) priceErrorVisible.value = true
if (parseInt(finalPrice.value) === 0) priceErrorVisible.value = false
} else if (val.toString() === '') {
form.value.goldValue = undefined
priceErrorVisible.value = false
} else {
form.value.goldValue = 0
priceErrorVisible.value = false
}
} else {
if (val) {
form.value.goldValue = toFixedDownThreeChar(parseFloat((val / price?.value?.sell)))
if (parseInt(finalPrice.value) > 0) priceErrorVisible.value = true
if (parseInt(finalPrice.value) === 0) priceErrorVisible.value = false
} else if (val.toString() === '') {
// console.log('sasasasasasa')
form.value.goldValue = undefined
priceErrorVisible.value = false
} else {
form.value.goldValue = 0
priceErrorVisible.value = false
}
}
}
}
@@ -628,7 +578,7 @@ function setIsBuy(val: boolean) {
form.value.goldValue = undefined
form.value.goldCash = undefined
form.value.percentWallet = 0
inputLock.value = null
priceErrorVisible.value = false
// console.log(bganim.value.classList)
// bganim?.value?.classList.add(val?'right':'left')
// bganim?.value?.style.transform = `translateX(${val ? '0' : '-100'});`
@@ -644,7 +594,10 @@ const formatter = (value: number) => {
const price = computed((): Price => <Price>lastPrice.value ?? 0)
const goldPriceValue = computed(() => unitPrice.value)
const displayedGoldPrice = computed(() => {
if (!lastPrice.value) return 0
return isBuy.value ? (lastPrice.value.buy ?? 0) : (lastPrice.value.sell ?? 0)
})
async function initPrice() {
try {
@@ -660,32 +613,17 @@ async function initPrice() {
}
function okConfirm() {
if (isStoreClosed()) {
message.warning(getStoreClosedMessage())
return
}
confirmAction.value = true
}
async function ok() {
if (isStoreClosed()) {
message.warning(getStoreClosedMessage())
return
}
try {
loading.value = true
infoVisible.value = true
await createOrder({
direction: isBuy.value ? 1 : 2,
price: Math.round(unitPrice.value),
amount: normalizeOrderGoldAmount(orderGoldAmount.value),
target_cash: calcTradeTargetCash(form.value.goldCash, inputLock.value)
?? calcSellTargetCash(
form.value.goldCash,
form.value.goldValue,
unitPrice.value,
inputLock.value
),
price: isBuy.value ? price.value?.buy : price.value?.sell,
amount: form.value.goldValue ?? 0
})
await walletStore.getMyWallet()
await router.push({ name: 'transactions' })
@@ -694,7 +632,6 @@ async function ok() {
goldCash: undefined,
percentWallet: undefined
}
inputLock.value = null
// refreshTable()
message.success('سفارش شما با موفقیت انجام شد')
await fundStore.getMyFund()
@@ -710,7 +647,7 @@ async function ok() {
<style lang="less">
.completeButtonStyle .van-dialog__confirm .van-button__content {
background-color: #a72b77;
background-color: var(--app-primary-color);
color: white;
}
@@ -743,4 +680,14 @@ async function ok() {
right: 100%;
transform: translate(100%, 0);
}
.gold-live-price {
:deep(.odometer) {
line-height: 1;
}
:deep(.odometer-digit) {
overflow: hidden;
}
}
</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 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="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-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="#a72b77" 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="#a72b77" 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-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="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="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="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="var(--app-primary-color)" 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 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-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="#a72b77" 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 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-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="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="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="var(--app-primary-color)" class="rotate-310" icon="vuesax-linear:keyboard"/>
<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-else class="font-bold text-secondary">{{props?.ProductItem.wallet?.gold??0}}</span>
<span class="text-gray-400">{{props?.ProductItem?.unit}}</span>
@@ -8,7 +8,7 @@
<template v-else-if="userStore.userInfo">
<section class="dhome-hero-row">
<div class="dhome-surface dhome-hero-price">
<span class="dhome-label">قیمت خرید از کشکول گلد</span>
<span class="dhome-label">قیمت خرید از {{ projectName }}</span>
<div class="dhome-hero-price__value-row">
<span
v-if="percentPriceChanged() !== 0"
@@ -160,7 +160,7 @@ import { useUserStore } from '@/store/userStore'
import { useWalletStore } from '@/store/walletStore'
import { useWalletAssets } from '@/composables/useWalletAssets'
import { resolveAssetsRialValue } from '@/utils/productAssets'
import { usePrice, usePriceWithoutType, useTowDecimal, formatGoldAmount } from '@/utils/usePrice'
import { usePrice, usePriceWithoutType, useTowDecimal } from '@/utils/usePrice'
import {
getLastPrices,
getTradeBuyPrice,
@@ -174,11 +174,15 @@ import DesktopHomeTopbar from '@/views/base/home/components/DesktopHomeTopbar.vu
import HomeSkeleton from '@/views/base/home/components/HomeSkeleton.vue'
import bannerImg from '@/assets/img/banner/2.png'
import { message } from 'ant-design-vue'
import { getProjectDisplayName, hasAbshodeTrading } from '@/config/project-profile'
import { getAppPrimaryColor } from '@/config/brand-theme'
const emit = defineEmits<{ logout: []; openBalance: [] }>()
const userStore = useUserStore()
const walletStore = useWalletStore()
const { assetsSummary, loadWalletAssets } = useWalletAssets()
const projectName = getProjectDisplayName('کشکول گلد')
const primaryColor = getAppPrimaryColor()
const goldVal = ref<number | undefined>()
const selection = ref<'DAILY' | 'WEEKLY' | 'MONTHLY'>('DAILY')
@@ -189,7 +193,7 @@ const priceChartOptions = ref({
dataLabels: { enabled: false },
yaxis: { show: false },
xaxis: { type: 'datetime', labels: { show: false }, axisBorder: { show: false } },
colors: ['#a72b77'],
colors: [primaryColor],
fill: {
type: 'gradient',
gradient: { shadeIntensity: 1, opacityFrom: 0.7, opacityTo: 0.9, stops: [0, 100] },
@@ -210,23 +214,40 @@ const balanceLabel = computed(() => {
}
const metal = primaryMetalTotal.value
if (metal && Number(metal.total_weight) > 0) {
return `${formatGoldAmount(metal.total_weight)} ${metal.unit}`
return `${Number(metal.total_weight).toFixed(3)} ${metal.unit}`
}
const fallback = walletStore.walletInfo?.gold_sum ?? userStore.userInfo?.wallet?.count_gold ?? 0
return `${formatGoldAmount(fallback)} گرم`
return `${Number(fallback).toFixed(3)} گرم`
})
const totalRialDisplay = computed(() =>
resolveAssetsRialValue(assetsSummary.value, getTradeBuyPrice(price.value) || Number(goldVal.value ?? 0))
)
const mainActions = [
{ name: 'buySell', icon: 'vuesax-linear:money-receive', label: 'خرید و فروش', handler: () => router.push({ name: 'gold' }) },
{ name: 'deposit', icon: 'vuesax-linear:card-add', label: 'واریز نقدی', handler: () => router.push({ name: 'wallet', query: { state: 'deposit' } }) },
{ name: 'balance', icon: 'vuesax-linear:receipt-item', label: 'موجودی', handler: () => emitBalance() },
{ name: 'fund', icon: 'vuesax-linear:archive-1', label: 'دارایی ها', handler: () => router.push({ name: 'fund' }) },
{ name: 'earn', icon: 'vuesax-linear:dollar-circle', label: 'کسب درآمد', handler: () => router.push({ name: 'earnMoney' }) },
]
const mainActions = computed(() => {
const actions = [
{ name: 'deposit', icon: 'vuesax-linear:card-add', label: 'واریز نقدی', handler: () => router.push({ name: 'wallet', query: { state: 'deposit' } }) },
{ name: 'balance', icon: 'vuesax-linear:receipt-item', label: 'موجودی', handler: () => emitBalance() },
{ name: 'fund', icon: 'vuesax-linear:archive-1', label: 'دارایی ها', handler: () => router.push({ name: 'fund' }) },
]
if (hasAbshodeTrading()) {
actions.unshift({
name: 'buySell',
icon: 'vuesax-linear:money-receive',
label: 'خرید و فروش',
handler: () => router.push({ name: 'gold' }),
})
actions.push({
name: 'earn',
icon: 'vuesax-linear:dollar-circle',
label: 'کسب درآمد',
handler: () => router.push({ name: 'earnMoney' }),
})
}
return actions
})
function emitBalance() {
emit('openBalance')
@@ -62,7 +62,7 @@ const metrics = computed<MetricItem[]>(() => {
label: metal.label,
value: formatMetalTotal(metal),
metal,
showInfo: true,
showInfo: index === 0,
onInfo: 'gold',
})
})
@@ -1,15 +1,36 @@
<script setup lang="ts">
import { inject } from 'vue'
import { computed, inject } from 'vue'
import { useUserStore } from '@/store/userStore'
import { usePriceWithoutType } from '@/utils/usePrice'
import { isBoursecuProject } from '@/utils/config'
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
import { HOME_PAGE_CONTEXT_KEY } from '../../composables/useHomePage'
const ctx = inject(HOME_PAGE_CONTEXT_KEY)!
const userStore = useUserStore()
const isBoursecu = isBoursecuProject()
const showLimitedPrice = computed(
() =>
ctx.limitedPrice.value !== undefined &&
userStore.userInfo?.trade_active !== 1,
)
const limitedPriceText = computed(() =>
usePriceWithoutType(Number(ctx.limitedPrice.value?.value ?? 0)),
)
</script>
<template>
<div v-if="!isBoursecu && ctx.showClosedMessage.value" class="dhome-alerts">
<div v-if="showLimitedPrice || ctx.showClosedMessage.value" class="dhome-alerts">
<div v-if="showLimitedPrice" class="dhome-alert dhome-alert--warning">
<BasicIcon icon="vuesax-linear:info-circle" size="14" />
<span>
حداقل مبلغ اولیه برای ثبت سفارش {{ limitedPriceText }} ریال می‌باشد.
</span>
</div>
<div
v-if="!isBoursecu && ctx.showClosedMessage.value"
class="dhome-alert dhome-alert--info"
v-html="ctx.closedMessage.value"
/>
@@ -1,4 +1,4 @@
/* Premium desktop home — SaaS dashboard design tokens */
/* Premium desktop home — SaaS dashboard design tokens */
.dhome {
min-height: 100%;
@@ -420,7 +420,7 @@
height: 36px;
border-radius: 10px;
background: #f3f4f6;
color: @App-primary-color;
color: var(--app-primary-color, #a72b77);
flex-shrink: 0;
transition: background 0.15s ease;
overflow: visible;
@@ -498,7 +498,7 @@
height: 40px;
border-radius: 12px;
background: #ffffff;
color: @App-primary-color;
color: var(--app-primary-color, #a72b77);
box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}
@@ -628,7 +628,7 @@
transition: background 0.15s ease, color 0.15s ease;
&--active {
background: @App-primary-color;
background: var(--app-primary-color, #a72b77);
color: #fff;
font-weight: 600;
}
+48 -15
View File
@@ -11,9 +11,18 @@
v-if="!loading"
class="bg-white w-full md:w-auto h-fit px-5 m-[-1px]"
>
<div
v-if="limitedPrice !== undefined && userStore?.userInfo.trade_active !== 1"
class="text-red text-xs flex gap-1 items-center justify-center mb-2"
>
<Icon icon="vuesax-linear:info-circle" size="16" />
حداقل مبلغ اولیه برای ثبت سفارش
{{ usePriceWithoutType(parseInt(limitedPrice.value) ?? 0) }} ریال می باشد.
</div>
<div
class="px-5 py-5 shadow-lg rounded-2xl text-white relative overflow-hidden shadow-lg"
style=" background: linear-gradient(145deg, #a72b77 0%, #711d4d 40%, #a72b77 100%); "
:style="{ background: `linear-gradient(145deg, ${primaryColor} 0%, ${primaryDark} 40%, ${primaryColor} 100%)` }"
>
<div
class="absolute inset-0 opacity-20"
@@ -23,14 +32,19 @@
<div class="relative z-10">
<div class="flex font-bold text-lg items-center gap-2 mb-3">
<img src='@/assets/img/logo.png' alt='' class='h-8 drop-shadow-md' />
<div class="tracking-wide">کشکول گلد </div>
<img
:src="appIconUrl"
alt=""
class="h-8 drop-shadow-md"
:class="{ 'home-brand-logo--white': isKashkool }"
/>
<div class="tracking-wide">{{ projectName }}</div>
</div>
<div class="flex justify-between items-end mb-3">
<div class="text-sm" />
<div>
<div class="text-xs opacity-75" style="justify-self: end;">شناسه شما در کشکول گلد</div>
<div class="text-xs opacity-75" style="justify-self: end;">شناسه شما در {{ projectName }}</div>
<div class="flex">
<div v-if="userStore?.userInfo?.virtual_card_number" class="ml-2 " @click.stop="copyCode()">
<BasicIcon
@@ -75,7 +89,7 @@
>
<div
class="rounded-full w-[42px] h-[42px] bg-primary flex items-center justify-center"
style="border: solid 1px #a72b77"
style="border: solid 1px var(--app-primary-color, #a72b77)"
>
<Icon class="text-tertiary" icon="vuesax-linear:money-send" />
@@ -83,13 +97,14 @@
<div class="text-primary">فروش</div>
</div>-->
<div
v-if="showAbshodeTrading"
class="text-center w-full flex-flex-col items-center home_appear_fade_in_up"
style="text-align: -webkit-center"
@click="router.push({ name: 'gold' })"
>
<div
class="rounded-full w-[50px] h-[50px] bg-primary flex items-center justify-center"
style="border: solid 1px #a72b77"
style="border: solid 1px var(--app-primary-color, #a72b77)"
>
<Icon class="text-white" icon="vuesax-linear:money-receive" />
@@ -103,7 +118,7 @@
>
<div
class="rounded-full w-[50px] h-[50px] bg-primary flex items-center justify-center"
style="border: solid 1px #a72b77"
style="border: solid 1px var(--app-primary-color, #a72b77)"
>
<Icon class="text-white" icon="vuesax-linear:card-add" />
@@ -117,7 +132,7 @@
>
<div
class="rounded-full w-[50px] h-[50px] bg-primary flex items-center justify-center "
style="border: solid 1px #a72b77"
style="border: solid 1px var(--app-primary-color, #a72b77)"
>
<Icon class="text-white" icon="vuesax-linear:receipt-item" />
</div>
@@ -130,20 +145,21 @@
>
<div
class="rounded-full w-[50px] h-[50px] bg-primary flex items-center justify-center"
style=" border: solid 1px #a72b77"
style=" border: solid 1px var(--app-primary-color, #a72b77)"
>
<Icon class="text-white font-bold" icon="vuesax-linear:archive-1" />
</div>
<div class="text-primary">دارایی ها</div>
</div>
<div
v-if="showAbshodeTrading"
class="text-center w-full flex-flex-col items-center home_appear_fade_in_down"
style="text-align: -webkit-center"
@click="router.push({ name: 'earnMoney' })"
>
<div
class="rounded-full w-[50px] h-[50px] bg-primary flex items-center justify-center"
style=" border: solid 1px #a72b77"
style=" border: solid 1px var(--app-primary-color, #a72b77)"
>
<Icon class="text-white font-bold" icon="vuesax-linear:dollar-circle" />
@@ -245,7 +261,7 @@
>
<div class="w-full items-center flex flex-col">
<div class="text-gray-600">قیمت خرید از کشکول گلد</div>
<div class="text-gray-600">قیمت خرید از {{ projectName }}</div>
<div v-if="price" class="flex gap-1 mt-3 text-xs items-center">
<!-- <div id="odometer" class="font-bold text-2xl odometer animated fadeIn">
&lt;!&ndash; {{ usePriceWithoutType(useCounterAnim(price.price_last) ?? 0) }}&ndash;&gt;
@@ -457,7 +473,7 @@ import { Swiper, SwiperSlide } from 'swiper/vue';
import 'swiper/swiper-bundle.css';
import img2 from '@/assets/img/banner/2.png'
import Icon from '@/components/BasicPacks/BasicIcon.vue'
import { usePrice, usePriceWithoutType, useTowDecimal, formatGoldAmount } from '../../../utils/usePrice'
import { usePrice, usePriceWithoutType, useTowDecimal } from '../../../utils/usePrice'
import {computed, createVNode, onActivated, onMounted, onUnmounted, ref, watch} from 'vue'
import router from '@/router'
import * as echarts from 'echarts'
@@ -489,6 +505,9 @@ import type { PInventory, Product } from '@/models/products'
import { useWalletAssets } from '@/composables/useWalletAssets'
import { resolveAssetsRialValue } from '@/utils/productAssets'
import { useDesktopBreakpoint } from '@/layouts/composables/useAppLayout'
import { getProjectDisplayName, hasAbshodeTrading, isKashkoolProject } from '@/config/project-profile'
import { getAppIconUrl } from '@/config/brand-assets'
import { getAppPrimaryColor, getAppPrimaryDark } from '@/config/brand-theme'
import { message, Modal } from 'ant-design-vue'
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
import BasicModal from '@/components/BasicPacks/BasicModal.vue'
@@ -498,6 +517,12 @@ import AppHeader from '@/views/base/home/components/AppHeader.vue'
const userStore = useUserStore()
const walletStore = useWalletStore()
const isDesktop = useDesktopBreakpoint()
const projectName = getProjectDisplayName('کشکول گلد')
const showAbshodeTrading = hasAbshodeTrading()
const isKashkool = isKashkoolProject()
const appIconUrl = getAppIconUrl()
const primaryColor = getAppPrimaryColor()
const primaryDark = getAppPrimaryDark()
const chartLoading = ref<boolean>(false)
const openModal = ref<boolean>(false)
const wholeBalanceVisible = ref<boolean>(false)
@@ -526,14 +551,14 @@ const balanceLabel = computed(() => {
const metal = primaryMetalTotal.value
if (metal && Number(metal.total_weight) > 0) {
return `${formatGoldAmount(metal.total_weight)} ${metal.unit}`
return `${Number(metal.total_weight).toFixed(3)} ${metal.unit}`
}
const fallback =
walletStore.walletInfo?.gold_sum ??
userStore.userInfo?.wallet?.count_gold ??
0
return `${formatGoldAmount(fallback)} گرم`
return `${Number(fallback).toFixed(3)} گرم`
})
const totalRialDisplay = computed(() =>
@@ -708,7 +733,7 @@ const priceChartOptions = ref({
show: false
}
},
colors: ['#a72b77'],
colors: [primaryColor],
fill: {
type: 'gradient',
gradient: {
@@ -743,6 +768,10 @@ const updateData = (timeline) => {
fetchPrices()
}
const limitedPrice = computed(() => {
if (walletStore.limitedPrice) return walletStore?.limitedPrice[0]
})
const test_series = [
{
name: 'candle',
@@ -965,4 +994,8 @@ apexchart {
padding: 0 !important;
margin: 0 !important;
}
.home-brand-logo--white {
filter: brightness(0) invert(1);
}
</style>
+2 -2
View File
@@ -1,7 +1,7 @@
<template>
<template>
<div class="">
<!-- <div class="bg-primary h-30 mt-[-3rem] z-100000000000"></div>-->
<div class="fixed h-[60vh] bg-[#a72b77] w-screen">
<div class="fixed h-[60vh] bg-primary w-screen">
<div class="flex w-full justify-around mt-18">
<div class="text-center">
<div class="text-[#E5D7CE] text-xs ">موجودی کیف طلا</div>
+2 -2
View File
@@ -1,4 +1,4 @@
<template>
<template>
<div class="h-35rem overflow-y-auto">
<!-- <div class="bg-primary h-30 mt-[-3rem] z-100000000000"></div>-->
<div class="h-[60vh] bg-primary wrap-fix">
@@ -620,7 +620,7 @@ const priceChartOptions = ref({
show: false
}
},
colors: ['#a72b77'],
colors: ['var(--app-primary-color)'],
fill: {
type: 'gradient',
gradient: {
+1
View File
@@ -2,6 +2,7 @@
export type HomeLayoutId = 'default' | 'boursecu'
export type HomeSectionId =
| 'limitedPriceAlert'
| 'garoosiAssets'
| 'mainActions'
| 'boursecuQuickActions'
@@ -1,4 +1,4 @@
<template>
<template>
<div>
<div class="flex">
<div class="bg-gray-100 m-2 rounded-lg w-18 h-18 flex justify-center p-1 shrink-0">
@@ -25,7 +25,7 @@
<BasicInput
v-model:value="item.count"
:addon-before="item.product.unit"
addon-bg-color="#a72b77"
addon-bg-color="var(--app-primary-color)"
addon-text-color="white"
type="text"
inputmode="numeric"
@@ -1,4 +1,4 @@
<template>
<template>
<div class="h-35rem overflow-y-auto">
<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>
@@ -42,6 +42,11 @@
<div v-else class="w-full h-[88px]">
<GoldSkeleton class="w-full" />
</div>
<div v-if="limitedPrice !== undefined && userStore?.userInfo.trade_active !== 1"
class="text-red text-xs flex gap-1 items-center justify-center my-2">
<Icon icon="vuesax-linear:info-circle" size="16" />
حداقل مبلغ اولیه برای ثبت سفارش {{ usePriceWithoutType(limitedPrice.value as number ?? 0) }} ریال می باشد.
</div>
<!-- </a-spin>-->
<a-form ref="refInput" :model="form" class="!mt-5" name="basic" @finish="okConfirm()">
<div class="border-gray-200 border-1 rounded-xl p-5 relative">
@@ -60,7 +65,7 @@
<a-form-item v-if="isBuy" name="goldValue"
:rules="[justNumber2(props?.ProductItem?.price , form.method , props?.ProductItem?.amount, true)]">
<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"
place-holder="تعداد"
size="large" type="number" inputmode="number" @onchange="calculateCash" />
@@ -68,7 +73,7 @@
<a-form-item v-else name="goldValue"
:rules="[justNumber3(props?.ProductItem?.sellPrice, productNum ,false)]">
<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"
place-holder="تعداد"
size="large" type="number" inputmode="number" @onchange="calculateCash" />
@@ -500,6 +505,11 @@ const unitCashCalculator = computed(() => {
return (walletStore?.walletInfo?.cash ?? 0) / 100
})
const limitedPrice = computed(() => {
if (walletStore.limitedPrice)
return walletStore?.limitedPrice[0]
})
function calculateCash(val: number) {
priceErrorVisible.value = false
@@ -684,7 +694,7 @@ watch(form.value.goldValue, () => {
background: blue;
}*/
.completeButtonStyle .van-dialog__confirm .van-button__content {
background: #a72b77;
background: var(--app-primary-color);
color: white;
}
@@ -10,7 +10,7 @@
<div class="w-full flex justify-between" v-for="item in props.item.transaction">
<div class="flex items-center gap-1">
<div class="w-7 h-7 flex justify-center rounded-lg bg-gray-100 ">
<ProductImage :product="item.product" img-class="p-1 max-h-full max-w-full object-contain" />
<img width="30" class="p-1" :src="item.product.group_type=='گوی'?goyImg:mokaabImg">
</div>
<div class="text-xs">{{ item?.title }}</div>
</div>
@@ -38,7 +38,8 @@
<script setup lang="ts">
import type {Physicalreceive} from "@/models/physicalreceive";
import {toJalali} from "../../../../utils/useDateTime";
import ProductImage from "@/components/ProductImage.vue";
import goyImg from "@/assets/img/goyImg.svg"
import mokaabImg from "@/assets/img/mokaabImg.svg"
interface Prop {
item: Physicalreceive
@@ -1,4 +1,4 @@
/* Premium desktop price trigger page */
/* Premium desktop price trigger page */
.dptr {
min-height: 100%;
@@ -87,8 +87,8 @@
transition: border-color 0.15s ease, color 0.15s ease;
&:hover {
border-color: @App-primary-color;
color: @App-primary-color;
border-color: var(--app-primary-color, #a72b77);
color: var(--app-primary-color, #a72b77);
}
}
}
@@ -251,7 +251,7 @@
margin-top: 4px;
border: none;
border-radius: 10px;
background: @App-primary-color;
background: var(--app-primary-color, #a72b77);
color: #fff;
font-size: 13px;
font-weight: 600;
@@ -1,4 +1,4 @@
<template>
<template>
<div class="h-35rem overflow-y-auto">
<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>
@@ -38,6 +38,11 @@
<div v-else class="w-full h-[88px]">
<GoldSkeleton class="w-full" />
</div>
<div v-if="limitedPrice !== undefined && userStore?.userInfo.trade_active !== 1"
class="text-red text-xs flex gap-1 items-center justify-center my-2">
<Icon icon="vuesax-linear:info-circle" size="16" />
حداقل مبلغ اولیه برای ثبت سفارش {{ usePriceWithoutType(limitedPrice.value as number ?? 0) }} ریال می باشد.
</div>
<!-- </a-spin>-->
<a-form ref="refInput" :model="form" class="!mt-5" name="basic" @finish="okConfirm()" @finishFailed="(errorInfo) => { console.log('Form submit failed:', errorInfo); console.log('Error fields details:', JSON.stringify(errorInfo.errorFields, null, 2)); if (errorInfo.errorFields && errorInfo.errorFields.length > 0) { const firstError = errorInfo.errorFields[0]; console.log('First error field:', firstError.name, 'errors:', firstError.errors); message.error(firstError.errors?.[0] || 'لطفا تمام فیلدها را به درستی پر کنید') } }">
<div class="border-gray-200 border-1 rounded-xl p-5 relative">
@@ -56,14 +61,14 @@
<a-form-item v-if="isBuy" name="goldValue"
:rules="[justNumber4(props?.ProductItem?.price , form.method , props?.ProductItem?.amount, true, form.gateway)]">
<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"
place-holder="تعداد"
size="large" type="number" inputmode="number" @onchange="calculateCash" />
</a-form-item>
<a-form-item v-else name="goldValue"
:rules="[justNumber3(props?.ProductItem?.sellPrice, productNum ,false)]">
<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"
place-holder="تعداد"
size="large" type="number" inputmode="number" @onchange="calculateCash" />
@@ -547,6 +552,11 @@ const unitCashCalculator = computed(() => {
return (walletStore?.walletInfo?.cash ?? 0) / 100
})
const limitedPrice = computed(() => {
if (walletStore.limitedPrice)
return walletStore?.limitedPrice[0]
})
function calculateCash(val: number) {
priceErrorVisible.value = false
console.log("val",val,props?.ProductItem)
@@ -763,7 +773,7 @@ async function ok() {
background: blue;
}*/
.completeButtonStyle .van-dialog__confirm .van-button__content {
background: #a72b77;
background: var(--app-primary-color);
color: white;
}
@@ -1,4 +1,4 @@
<template>
<template>
<div class="h-35rem overflow-y-auto">
<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>
@@ -61,14 +61,14 @@
<a-form-item v-if="isBuy" name="goldValue"
:rules="[justNumber2(props?.ProductItem?.price , form.method , props?.ProductItem?.amount, true, form.gateway)]">
<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"
place-holder="تعداد"
size="large" type="number" inputmode="number" @onchange="calculateCash" />
</a-form-item>
<a-form-item v-else name="goldValue"
:rules="[justNumber3(props?.ProductItem?.sellPrice, productNum ,false)]">
<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"
place-holder="تعداد"
size="large" type="number" inputmode="number" @onchange="calculateCash" />
@@ -749,7 +749,7 @@ async function ok() {
background: blue;
}*/
.completeButtonStyle .van-dialog__confirm .van-button__content {
background: #a72b77;
background: var(--app-primary-color);
color: white;
}
@@ -1,4 +1,4 @@
/* Premium desktop rules page */
/* Premium desktop rules page */
.drules {
min-height: 100%;
@@ -46,7 +46,7 @@
height: 56px;
border-radius: 14px;
background: rgba(167, 43, 119, 0.08);
color: @App-primary-color;
color: var(--app-primary-color, #a72b77);
flex-shrink: 0;
}
@@ -69,7 +69,7 @@
border: 1px solid rgba(167, 43, 119, 0.15);
border-radius: 12px;
background: rgba(167, 43, 119, 0.03);
color: @App-primary-color;
color: var(--app-primary-color, #a72b77);
&__title {
font-size: 16px;
@@ -1,4 +1,4 @@
/* Premium desktop transactions page */
/* Premium desktop transactions page */
.dtxn {
min-height: 100%;
@@ -44,8 +44,8 @@
}
&--active {
background: @App-primary-color;
border-color: @App-primary-color;
background: var(--app-primary-color, #a72b77);
border-color: var(--app-primary-color, #a72b77);
color: #fff;
}
}
@@ -1,4 +1,4 @@
/* Premium desktop user account page */
/* Premium desktop user account page */
.duser {
min-height: 100%;
@@ -93,7 +93,7 @@
height: 64px;
border-radius: 16px;
background: linear-gradient(135deg, #f0f4ff 0%, #e8eeff 100%);
color: @App-primary-color;
color: var(--app-primary-color, #a72b77);
flex-shrink: 0;
}
@@ -174,8 +174,8 @@
&--primary {
width: 100%;
background: @App-primary-color;
border-color: @App-primary-color;
background: var(--app-primary-color, #a72b77);
border-color: var(--app-primary-color, #a72b77);
color: #fff;
&:hover {
@@ -1,4 +1,4 @@
<template>
<template>
<div class="dwallet">
<div class="dwallet__container">
<DesktopPageTopbar
@@ -45,7 +45,7 @@
<BasicInput
v-model:value="form.value"
addon-before="ریال"
addon-bg-color="#a72b77"
addon-bg-color="var(--app-primary-color)"
addon-text-color="white"
place-holder="مبلغ"
size="large"
@@ -1,4 +1,4 @@
/* Premium desktop wallet page */
/* Premium desktop wallet page */
.dwallet {
min-height: 100%;
@@ -75,7 +75,7 @@
&--active {
background: #fff;
color: @App-primary-color;
color: var(--app-primary-color, #a72b77);
box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}
}
@@ -182,8 +182,8 @@
transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
&:hover {
border-color: @App-primary-color;
color: @App-primary-color;
border-color: var(--app-primary-color, #a72b77);
color: var(--app-primary-color, #a72b77);
background: #fff;
}
}
@@ -255,13 +255,13 @@
transition: border-color 0.15s ease, color 0.15s ease;
&:hover {
border-color: @App-primary-color;
color: @App-primary-color;
border-color: var(--app-primary-color, #a72b77);
color: var(--app-primary-color, #a72b77);
}
&--primary {
background: @App-primary-color;
border-color: @App-primary-color;
background: var(--app-primary-color, #a72b77);
border-color: var(--app-primary-color, #a72b77);
color: #fff;
padding: 10px 16px;
@@ -1,4 +1,4 @@
<template>
<template>
<div>
<div class="absolute inset-0 bg-cover bg-center opacity-60" :style="{ backgroundImage: `url(${img})` }"></div>
<div class="mpage-header wrap-fix z-[1999]">کیف پول</div>
@@ -38,7 +38,7 @@
<BasicInput
v-model:value="form.value"
addon-before="ریال"
addon-bg-color="#a72b77"
addon-bg-color="var(--app-primary-color)"
addon-text-color="white"
place-holder="مبلغ"
size="large"
+12 -3
View File
@@ -1,4 +1,4 @@
<template>
<template>
<div class="w-full flex flex-col">
<img :src="logo" alt="" class="z-100 rounded-full aspect-square self-center w-42 " STYLE="margin-bottom: 60px">
@@ -151,9 +151,11 @@ import { loginCustomer, verifyToken } from '@/api/login'
import router from '@/router'
import { useUserStore } from '@/store/userStore'
import { useWalletStore } from '@/store/walletStore'
import logo from '@/assets/img/logo_full_.png'
import { getAppLogoFullUrl } from '@/config/brand-assets'
import { fingerPosition, setTruth } from '@/main'
const logo = getAppLogoFullUrl()
const { time, onFinish, reset } = useCountdownTimer('00:02:00', 'mm:ss')
const enableSendAgainCode = ref<boolean>(false)
@@ -190,6 +192,13 @@ function setIsSMS(val: boolean) {
if (!val) stepTwoVerify.value = false
userFormState.token = ''
userFormState.password = ''
// console.log(bganim.value.classList)
// bganim?.value?.classList.add(val?'right':'left')
// bganim?.value?.style.transform = `translateX(${val ? '0' : '-100'});`
// bganim?.value?.style.animationDirection = val? 'normal':'reverse'
// val? bganim?.value?.classList?.add("move") : bganim?.value?.classList?.remove("move")
// const el = bganim.value?.
// el.
}
async function enterFingerPrint() {
@@ -428,7 +437,7 @@ const getcode=()=>{
</div>
</BasicButton>
<div class="flex gap-1 justify-center mt-5 text-xs" @click="$emit('register',true)">اگر حساب کاربری ندارید
<div class="font-bold text-[#a72b77]">از این قسمت</div>
<div class="font-bold text-primary">از این قسمت</div>
ثبت نام کنید.
</div>
</a-form-item>
+3 -1
View File
@@ -125,7 +125,9 @@ import registerDelayImage from '@/assets/img/registerDelay.svg'
import DialogVantOneButton from '@/components/DialogVantOneButton.vue'
import { registerCustomer } from '@/api/login'
import router from '@/router'
import logo from "@/assets/img/logo_full_.png";
import { getAppLogoFullUrl } from '@/config/brand-assets'
const logo = getAppLogoFullUrl()
// const stepTwoVerify = ref<boolean>(false)
@@ -1,21 +0,0 @@
import { onMounted, ref } from 'vue'
import router from '@/router'
export function useLoginPage() {
const enterType = ref(false)
function setEnterType(val: boolean) {
enterType.value = val
}
onMounted(() => {
if (router.currentRoute.value.query.id) {
enterType.value = true
}
})
return {
enterType,
setEnterType,
}
}
@@ -1,50 +0,0 @@
<template>
<div class="dlogin login-page">
<div class="dlogin__bg" aria-hidden="true">
<div class="dlogin__bg-top">
<img :src="img_topGradiant" alt="" class="dlogin__bg-cover" />
<img :src="img_pattern" alt="" class="dlogin__bg-pattern" />
</div>
<div class="dlogin__bg-bottom">
<img :src="img_bottomGradiant" alt="" class="dlogin__bg-cover" />
<img :src="img_pattern" alt="" class="dlogin__bg-pattern" />
</div>
</div>
<div class="dlogin__container">
<div class="dlogin__card">
<transition mode="out-in" name="fade">
<Login v-if="!enterType" class="dlogin__form" @register="setEnterType" />
<Register v-else class="dlogin__form" @register="setEnterType" />
</transition>
</div>
<button type="button" class="dlogin__back" @click="router.push({ name: 'buyProduct' })">
بازگشت به فروشگاه
</button>
</div>
</div>
</template>
<script lang="ts" setup>
import Login from '@/views/login/components/Login.vue'
import Register from '@/views/login/components/Register.vue'
import img_topGradiant from '../assets/img/gr_top_white.svg'
import img_bottomGradiant from '../assets/img/gr_bottom_white.svg'
import img_pattern from '../assets/img/pattern.svg'
import router from '@/router'
defineProps<{
enterType: boolean
}>()
const emit = defineEmits<{
register: [val: boolean]
}>()
function setEnterType(val: boolean) {
emit('register', val)
}
</script>
<style lang="less" src="./styles/desktop-login.less"></style>
@@ -1,114 +0,0 @@
html.app-layout--desktop {
.login-page-root {
height: 100%;
min-height: 0;
overflow: hidden;
}
.dlogin {
position: relative;
display: flex;
align-items: center;
justify-content: center;
min-height: 100vh;
height: 100%;
padding: 32px 24px;
box-sizing: border-box;
overflow-y: auto;
background: #fff;
}
.dlogin__bg {
position: absolute;
inset: 0;
overflow: hidden;
pointer-events: none;
}
.dlogin__bg-top,
.dlogin__bg-bottom {
position: absolute;
left: 0;
right: 0;
height: 34%;
overflow: hidden;
}
.dlogin__bg-top {
top: 0;
}
.dlogin__bg-bottom {
bottom: 0;
}
.dlogin__bg-cover {
position: absolute;
inset: 0;
z-index: 1;
width: 100%;
height: 100%;
object-fit: cover;
}
.dlogin__bg-pattern {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
object-fit: none;
}
.dlogin__container {
position: relative;
z-index: 2;
display: flex;
flex-direction: column;
align-items: center;
width: 100%;
max-width: 460px;
gap: 20px;
}
.dlogin__card {
width: 100%;
max-height: calc(100vh - 120px);
padding: 36px 32px 28px;
border-radius: 20px;
background: rgba(255, 255, 255, 0.96);
border: 1px solid rgba(15, 23, 42, 0.06);
box-shadow:
0 18px 48px rgba(15, 23, 42, 0.08),
0 2px 8px rgba(15, 23, 42, 0.04);
backdrop-filter: blur(8px);
box-sizing: border-box;
overflow-y: auto;
overscroll-behavior: contain;
}
.dlogin__form {
width: 100%;
}
.dlogin__form img {
width: 132px !important;
height: auto;
margin-bottom: 28px !important;
}
.dlogin__back {
border: none;
background: transparent;
color: @primary-color;
font-size: 14px;
font-weight: 600;
font-family: inherit;
cursor: pointer;
padding: 8px 12px;
transition: opacity 0.2s ease;
&:hover {
opacity: 0.8;
}
}
}
+37 -34
View File
@@ -1,46 +1,49 @@
<template>
<div class="login-page-root">
<DesktopLoginView
v-show="isDesktop"
:enter-type="enterType"
@register="setEnterType"
/>
<MobileLoginView
v-show="!isDesktop"
:enter-type="enterType"
@register="setEnterType"
/>
<div class="flex items-center h-[92vh] justify-center ">
<!-- <PhoneVerify/>-->
<div class="fixed top-0 right-0 left-0 h-1/3 w-screen flex">
<img :src="img_topGradiant" alt="" class="absolute z-10 w-screen h-full object-cover">
<img :src="img_pattern" alt="" class="absolute w-screen h-full object-none">
</div>
<div class="fixed bottom-0 right-0 left-0 h-1/3 w-screen">
<img :src="img_bottomGradiant" alt="" class="absolute z-10 w-screen h-full object-cover">
<img :src="img_pattern" alt="" class="absolute w-screen h-full object-none">
</div>
<div class="z-1000 w-full p-5">
<transition mode="out-in" name="fade">
<Login v-if="!enterType" @register="setEnterType"/>
<Register v-else @register="setEnterType"/>
</transition>
<div class="text-center text-primary font-500" @click="router.push({name:'buyProduct'})">بازگشت به فروشگاه</div>
</div>
</div>
</template>
<script lang="ts" setup>
import { onUnmounted, watch } from 'vue'
import { useDesktopBreakpoint } from '@/layouts/composables/useAppLayout'
import { useLoginPage } from './composables/useLoginPage'
import DesktopLoginView from './desktop/DesktopLoginView.vue'
import MobileLoginView from './mobile/MobileLoginView.vue'
const NO_SIDEBAR_CLASS = 'app-layout--desktop-no-sidebar'
const isDesktop = useDesktopBreakpoint()
const { enterType, setEnterType } = useLoginPage()
import Login from "@/views/login/components/Login.vue";
import Register from "@/views/login/components/Register.vue";
import { onMounted, ref } from 'vue'
import img_topGradiant from './assets/img/gr_top_white.svg'
import img_bottomGradiant from './assets/img/gr_bottom_white.svg'
import img_pattern from './assets/img/pattern.svg'
import router from '@/router'
watch(
isDesktop,
(desktop) => {
document.documentElement.classList.toggle(NO_SIDEBAR_CLASS, desktop)
},
{ immediate: true }
)
const enterType = ref<boolean>(false)
onUnmounted(() => {
document.documentElement.classList.remove(NO_SIDEBAR_CLASS)
function setEnterType(val: boolean) {
enterType.value = val
}
onMounted(() => {
if (router.currentRoute.value.query.id)
enterType.value = true
})
</script>
<style scoped>
.login-page-root {
width: 100%;
min-height: 100%;
height: 100%;
}
<style>
</style>
@@ -1,42 +0,0 @@
<template>
<div class="login-page flex items-center h-[92vh] justify-center">
<div class="fixed top-0 right-0 left-0 h-1/3 w-screen flex">
<img :src="img_topGradiant" alt="" class="absolute z-10 w-screen h-full object-cover" />
<img :src="img_pattern" alt="" class="absolute w-screen h-full object-none" />
</div>
<div class="fixed bottom-0 right-0 left-0 h-1/3 w-screen">
<img :src="img_bottomGradiant" alt="" class="absolute z-10 w-screen h-full object-cover" />
<img :src="img_pattern" alt="" class="absolute w-screen h-full object-none" />
</div>
<div class="z-1000 w-full p-5">
<transition mode="out-in" name="fade">
<Login v-if="!enterType" @register="setEnterType" />
<Register v-else @register="setEnterType" />
</transition>
<div class="text-center text-primary font-500" @click="router.push({ name: 'buyProduct' })">
بازگشت به فروشگاه
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import Login from '@/views/login/components/Login.vue'
import Register from '@/views/login/components/Register.vue'
import img_topGradiant from '../assets/img/gr_top_white.svg'
import img_bottomGradiant from '../assets/img/gr_bottom_white.svg'
import img_pattern from '../assets/img/pattern.svg'
import router from '@/router'
defineProps<{
enterType: boolean
}>()
const emit = defineEmits<{
register: [val: boolean]
}>()
function setEnterType(val: boolean) {
emit('register', val)
}
</script>
+3 -3
View File
@@ -11,9 +11,9 @@ export default defineConfig({
],
theme: {
colors: {
"primary": "#a72b77",
"secondary": "#ffffff",
"tertiary": "#e0be7f"
"primary": "var(--app-primary-color, #a72b77)",
"secondary": "var(--app-secondary-color, #ffffff)",
"tertiary": "var(--app-tertiary-color, #e0be7f)"
}
},
presets: [