Compare commits
5
Commits
main-test
...
mian-test2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
12382656e8 | ||
|
|
51e3c3f0cb | ||
|
|
e4d92831c2 | ||
|
|
3561e8ae07 | ||
|
|
ce8029919c |
Binary file not shown.
+16
-2
@@ -326,7 +326,15 @@
|
||||
}
|
||||
|
||||
function getVersionUrls() {
|
||||
return ['https://nerkh.gold/get_version', 'https://tablo.talasevin.ir/get_version', 'https://abshode-service.montgit.ir/server/get_version']
|
||||
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'
|
||||
]
|
||||
}
|
||||
|
||||
function getConfigUrls() {
|
||||
@@ -453,6 +461,9 @@
|
||||
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 {
|
||||
@@ -496,6 +507,9 @@
|
||||
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)
|
||||
}
|
||||
}
|
||||
@@ -626,7 +640,7 @@
|
||||
renderRecovering('در حال دریافت تنظیمات جدید برنامه...')
|
||||
|
||||
var version = await loadRemoteVersion(5)
|
||||
var freshConfigResult = await fetchFreshConfig(2)
|
||||
var freshConfigResult = await fetchFreshConfig(5)
|
||||
|
||||
clearReadableCookies()
|
||||
// clearLocalStorageExceptToken()
|
||||
|
||||
+18
-12
@@ -3,14 +3,7 @@
|
||||
<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']
|
||||
}
|
||||
}"
|
||||
:theme="antDesignTheme"
|
||||
direction="rtl"
|
||||
>
|
||||
<router-view v-slot="{ Component, route }">
|
||||
@@ -68,10 +61,9 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { colors } from './themeConfig'
|
||||
import pkg from '../package.json'
|
||||
import { getDisplayAppVersion } from '@/config/config-cache'
|
||||
import { computed, defineAsyncComponent, h, onMounted, ref } from 'vue'
|
||||
import pkg from '../package.json'
|
||||
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'
|
||||
@@ -83,6 +75,7 @@ import {
|
||||
} from '@/utils/supportMessenger'
|
||||
import { useDraggableFloatingButton } from '@/utils/useDraggableFloatingButton'
|
||||
import { useApplyDesktopLayoutClass } from '@/layouts/composables/useAppLayout'
|
||||
import { getProjectBranding } from '@/utils/project'
|
||||
|
||||
import img_bottomGradiant from '@/views/login/assets/img/gr_bottom_white.svg'
|
||||
import logoFull from '@/assets/img/logo_full_.png'
|
||||
@@ -100,6 +93,19 @@ const indicator = h(LoadingOutlined, {
|
||||
const displayVersion = getDisplayAppVersion(pkg.version)
|
||||
const showSplash = ref(true)
|
||||
|
||||
const antDesignTheme = computed(() => {
|
||||
const primary = getProjectBranding().accentColor
|
||||
|
||||
return {
|
||||
token: {
|
||||
colorPrimary: primary,
|
||||
colorLink: primary,
|
||||
colorLinkActive: primary,
|
||||
colorLinkHover: primary,
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
useApplyDesktopLayoutClass()
|
||||
|
||||
const supportLink = computed(() =>
|
||||
@@ -141,7 +147,7 @@ const supportAccentColor = computed(() => {
|
||||
case 'soroush':
|
||||
return '#2563eb'
|
||||
default:
|
||||
return colors.primary || '#334155'
|
||||
return getProjectBranding().accentColor
|
||||
}
|
||||
})
|
||||
|
||||
@@ -181,7 +187,7 @@ onMounted(async () => {
|
||||
|
||||
<style lang="less">
|
||||
.updateButton .van-dialog__confirm .van-button__text {
|
||||
color: @primary-color !important;
|
||||
color: @theme-primary !important;
|
||||
font-weight: 600;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
+9
-13
@@ -2,7 +2,6 @@ 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 {
|
||||
@@ -14,10 +13,10 @@ import {
|
||||
setHasFingerPrint
|
||||
} from '@/app/authBoot'
|
||||
import { recoverMobileViewportAfterAuth } from '@/layouts/composables/useMobileScrollReset'
|
||||
import { getProjectDefaultRoute, isGhatreProject } from '@/utils/project'
|
||||
|
||||
export function setupRouterGuards() {
|
||||
const userStore = useUserStore()
|
||||
const walletStore = useWalletStore()
|
||||
const authStore = useAuthStore()
|
||||
|
||||
const isApple: boolean = isIphone()
|
||||
@@ -30,16 +29,9 @@ export function setupRouterGuards() {
|
||||
return
|
||||
}
|
||||
|
||||
const tasks: Promise<unknown>[] = [
|
||||
walletStore.getLimitedPrice(),
|
||||
walletStore.getLimitedBuyGold(),
|
||||
]
|
||||
|
||||
if (!userStore.userInfo) {
|
||||
tasks.push(userStore.getMyInfo())
|
||||
await userStore.getMyInfo()
|
||||
}
|
||||
|
||||
await Promise.all(tasks)
|
||||
}
|
||||
|
||||
function goToLogin(to: RouteLocationNormalized, next: NavigationGuardNext) {
|
||||
@@ -53,13 +45,17 @@ export function setupRouterGuards() {
|
||||
}
|
||||
|
||||
function goToHome(to: RouteLocationNormalized, next: NavigationGuardNext) {
|
||||
if (to.name !== 'buyProduct') {
|
||||
return next({ name: 'buyProduct' })
|
||||
const defaultRoute = getProjectDefaultRoute()
|
||||
if (to.name !== defaultRoute) {
|
||||
return next({ name: defaultRoute })
|
||||
}
|
||||
return next()
|
||||
}
|
||||
|
||||
router.beforeEach(async (to, from, next) => {
|
||||
if (to.name === 'home' && isGhatreProject()) {
|
||||
return next({ name: 'buyProduct' })
|
||||
}
|
||||
authStore.setLoading(true)
|
||||
clearFingerTimeout()
|
||||
setFingerTimeOut(to)
|
||||
@@ -97,7 +93,7 @@ export function setupRouterGuards() {
|
||||
if (getFingerPosition()) {
|
||||
if (getToken()) {
|
||||
if (to.name === 'login') {
|
||||
return next({ name: from.name || 'buyProduct' })
|
||||
return next({ name: from.name || getProjectDefaultRoute() })
|
||||
}
|
||||
return next()
|
||||
}
|
||||
|
||||
@@ -61,6 +61,8 @@ body {
|
||||
|
||||
:root {
|
||||
color-scheme: only light;
|
||||
--app-primary-color: #a72b77;
|
||||
--project-hero-gradient: linear-gradient(145deg, #a72b77 0%, #711d4d 40%, #a72b77 100%);
|
||||
--app-safe-top: env(safe-area-inset-top, 0px);
|
||||
--app-safe-bottom: env(safe-area-inset-bottom, 0px);
|
||||
--app-credit-bar-inner: 0px;
|
||||
@@ -78,6 +80,16 @@ body {
|
||||
--app-z-modal: 5500;
|
||||
}
|
||||
|
||||
:root[data-project='ghatre'] {
|
||||
--app-primary-color: #521620;
|
||||
--project-hero-gradient: linear-gradient(145deg, #521620 0%, #7a2a1e 40%, #521620 100%);
|
||||
}
|
||||
|
||||
:root[data-project='kashkool'] {
|
||||
--app-primary-color: #a72b77;
|
||||
--project-hero-gradient: linear-gradient(145deg, #a72b77 0%, #711d4d 40%, #a72b77 100%);
|
||||
}
|
||||
|
||||
.ant-form-item {
|
||||
margin-bottom: 10px !important;
|
||||
|
||||
@@ -164,7 +176,7 @@ body {
|
||||
background-color: #fff;
|
||||
//display: none;
|
||||
outline: none;
|
||||
border: 1px solid #a72b77 !important;
|
||||
border: 1px solid var(--app-primary-color, #a72b77) !important;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -362,18 +374,18 @@ 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;
|
||||
background-color: var(--app-primary-color, #a72b77) !important;
|
||||
color: #e0be7f !important;
|
||||
}
|
||||
.ant-slider-track{
|
||||
background-color: #a72b77 !important;
|
||||
background-color: var(--app-primary-color, #a72b77) !important;
|
||||
|
||||
}
|
||||
.ant-slider-handle {
|
||||
background-color: #a72b77 !important;
|
||||
background-color: var(--app-primary-color, #a72b77) !important;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
@primary-color: #a72b77;
|
||||
@secondary-color: #a72b77;
|
||||
@App-primary-color: #a72b77;
|
||||
@theme-primary: var(--app-primary-color, #a72b77);
|
||||
@prefixCls-font-family: 'iran-sans';
|
||||
@prefixCls-background-color: #fff;
|
||||
|
||||
|
||||
@@ -1,17 +1 @@
|
||||
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)
|
||||
}
|
||||
export { usePrice, usePriceWithoutType, useTowDecimal, useFormat } from '@/utils/usePrice'
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
import { computed } from 'vue'
|
||||
import {
|
||||
getProjectBranding,
|
||||
getProjectId,
|
||||
isBoursecuProject,
|
||||
isGhatreProject,
|
||||
isKashkoolProject,
|
||||
type ProjectBranding,
|
||||
type ProjectId,
|
||||
} from '@/utils/project'
|
||||
|
||||
export function useProject() {
|
||||
const projectId = computed<ProjectId>(() => getProjectId())
|
||||
const branding = computed<ProjectBranding>(() => getProjectBranding())
|
||||
|
||||
const isGhatre = computed(() => isGhatreProject())
|
||||
const isKashkool = computed(() => isKashkoolProject())
|
||||
const isBoursecu = computed(() => isBoursecuProject())
|
||||
|
||||
const projectNameFa = computed(() => branding.value.nameFa)
|
||||
const heroGradient = computed(() => branding.value.heroGradient)
|
||||
const accentColor = computed(() => branding.value.accentColor)
|
||||
const fundLabel = computed(() => branding.value.fundLabel)
|
||||
const showHomeRoute = computed(() => branding.value.showHomeRoute)
|
||||
const defaultRoute = computed(() => branding.value.defaultRoute)
|
||||
|
||||
return {
|
||||
projectId,
|
||||
branding,
|
||||
isGhatre,
|
||||
isKashkool,
|
||||
isBoursecu,
|
||||
projectNameFa,
|
||||
heroGradient,
|
||||
accentColor,
|
||||
fundLabel,
|
||||
showHomeRoute,
|
||||
defaultRoute,
|
||||
}
|
||||
}
|
||||
@@ -15,14 +15,33 @@ export function getRawAppConfig() {
|
||||
return appConfig ?? window.__APP_CONFIG__ ?? null
|
||||
}
|
||||
|
||||
function isPlainObject(value: unknown): value is Record<string, any> {
|
||||
return typeof value === 'object' && value !== null && !Array.isArray(value)
|
||||
}
|
||||
|
||||
export function getTenantConfig() {
|
||||
const rawConfig = getRawAppConfig()
|
||||
if (!rawConfig) return {}
|
||||
|
||||
if (rawConfig?.user && typeof rawConfig.user === 'object') {
|
||||
return rawConfig.user
|
||||
const user = rawConfig.user
|
||||
|
||||
if (isPlainObject(user)) {
|
||||
return {
|
||||
...user,
|
||||
name: rawConfig.name ?? user.name,
|
||||
name_fa: rawConfig.name_fa ?? user.name_fa,
|
||||
}
|
||||
}
|
||||
|
||||
if (rawConfig && Object.keys(rawConfig).length > 0) {
|
||||
if (Array.isArray(user) && isPlainObject(user[0])) {
|
||||
return {
|
||||
...user[0],
|
||||
name: rawConfig.name ?? user[0].name,
|
||||
name_fa: rawConfig.name_fa ?? user[0].name_fa,
|
||||
}
|
||||
}
|
||||
|
||||
if (Object.keys(rawConfig).length > 0) {
|
||||
return rawConfig
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,37 @@
|
||||
import { getConfig } from '@/config/app-config'
|
||||
import { isPwaManifestReady } from '@/modules/pwa/manifest'
|
||||
import { getProjectBranding } from '@/utils/project'
|
||||
|
||||
export function applyAppConfig() {
|
||||
if (isPwaManifestReady()) return
|
||||
applyProjectTheme()
|
||||
|
||||
if (isPwaManifestReady()) {
|
||||
setTitle()
|
||||
return
|
||||
}
|
||||
|
||||
setTitle()
|
||||
setFavicon()
|
||||
setAppleTouchIconFallback()
|
||||
}
|
||||
|
||||
function applyProjectTheme() {
|
||||
const branding = getProjectBranding()
|
||||
const root = document.documentElement
|
||||
const primary = branding.accentColor
|
||||
|
||||
root.style.setProperty('--project-accent', primary)
|
||||
root.style.setProperty('--project-hero-gradient', branding.heroGradient)
|
||||
root.style.setProperty('--app-primary-color', primary)
|
||||
root.style.setProperty('--primary-color', primary)
|
||||
root.dataset.project = branding.id
|
||||
|
||||
const secondaryColor = getConfig<string>('secondary_color')
|
||||
if (secondaryColor) {
|
||||
root.style.setProperty('--secondary-color', secondaryColor)
|
||||
}
|
||||
}
|
||||
|
||||
function setTitle() {
|
||||
document.title = getConfig('name_fa', 'در حال بارگذاری...')
|
||||
}
|
||||
|
||||
+31
-16
@@ -2,6 +2,7 @@ import type { AppConfig } from '@/config/types'
|
||||
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:'
|
||||
@@ -29,6 +30,12 @@ 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)
|
||||
@@ -59,22 +66,25 @@ async function fetchConfig(url: string, timeout = 3000): Promise<AppConfig> {
|
||||
}
|
||||
}
|
||||
|
||||
export async function fetchFreshAppConfig(): Promise<AppConfig> {
|
||||
export async function fetchFreshAppConfig(rounds = CONFIG_RETRY_ROUNDS): Promise<AppConfig> {
|
||||
const urls = sortConfigUrls(getConfigUrls())
|
||||
|
||||
for (let index = 0; index < urls.length; index++) {
|
||||
const url = urls[index]
|
||||
for (let round = 1; round <= rounds; round++) {
|
||||
for (let index = 0; index < urls.length; index++) {
|
||||
const url = urls[index]
|
||||
|
||||
try {
|
||||
const timeout = index === urls.length - 1 ? 5000 : 2500
|
||||
const config = await fetchConfig(url, timeout)
|
||||
try {
|
||||
const timeout = index === urls.length - 1 ? 7000 : 4000
|
||||
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) {
|
||||
console.warn(`Config failed from ${url}`, error)
|
||||
return config
|
||||
} catch (error) {
|
||||
clearStaleConfigSuccessUrl(url)
|
||||
console.warn(`Config failed from ${url}. Round: ${round}`, error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,11 +92,16 @@ export async function fetchFreshAppConfig(): Promise<AppConfig> {
|
||||
}
|
||||
|
||||
export async function loadAppConfig(): Promise<AppConfig> {
|
||||
const cachedConfig = readCachedAppConfig()
|
||||
try {
|
||||
return await fetchFreshAppConfig()
|
||||
} catch (error) {
|
||||
const cachedConfig = readCachedAppConfig()
|
||||
|
||||
if (cachedConfig) {
|
||||
return cachedConfig
|
||||
if (cachedConfig) {
|
||||
console.warn('Using cached app config because fresh fetch failed', error)
|
||||
return cachedConfig
|
||||
}
|
||||
|
||||
throw error
|
||||
}
|
||||
|
||||
return await fetchFreshAppConfig()
|
||||
}
|
||||
|
||||
@@ -9,16 +9,24 @@ type VersionResponse =
|
||||
}
|
||||
|
||||
const VERSION_SUCCESS_URL_KEY = 'VERSION_Success_URL'
|
||||
const VERSION_RETRY_ROUNDS = 5
|
||||
export 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'
|
||||
'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`
|
||||
]
|
||||
}
|
||||
|
||||
@@ -33,6 +41,12 @@ 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 ''
|
||||
@@ -82,7 +96,6 @@ 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}`)
|
||||
}
|
||||
|
||||
@@ -94,10 +107,8 @@ 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) {
|
||||
return null
|
||||
throw new Error('Version response is empty')
|
||||
}
|
||||
|
||||
localStorage.setItem(VERSION_SUCCESS_URL_KEY, url)
|
||||
@@ -118,10 +129,11 @@ async function fetchVersionWithRetry(rounds = VERSION_RETRY_ROUNDS): Promise<str
|
||||
|
||||
try {
|
||||
const version = await fetchVersion(url, timeout)
|
||||
// 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
|
||||
if (version) {
|
||||
return version
|
||||
}
|
||||
} catch (error) {
|
||||
clearStaleVersionSuccessUrl(url)
|
||||
console.warn(`Version failed from ${url}. Round: ${round}`, error)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type { AppNavItem } from '../types'
|
||||
import { getProjectBranding, isGhatreProject } from '@/utils/project'
|
||||
|
||||
/** تبهای پایین موبایل — کاربر لاگینشده */
|
||||
/** تبهای پایین موبایل — کاربر لاگینشده (کشکول) */
|
||||
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 +9,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' },
|
||||
@@ -31,9 +40,16 @@ export const AUTH_SECONDARY_NAV: AppNavItem[] = [
|
||||
]
|
||||
|
||||
export function getPrimaryNavItems(isAuthenticated: boolean): AppNavItem[] {
|
||||
return isAuthenticated ? AUTH_PRIMARY_NAV : GUEST_PRIMARY_NAV
|
||||
if (!isAuthenticated) return GUEST_PRIMARY_NAV
|
||||
return isGhatreProject() ? GHATRE_AUTH_PRIMARY_NAV : AUTH_PRIMARY_NAV
|
||||
}
|
||||
|
||||
export function getSecondaryNavItems(isAuthenticated: boolean): AppNavItem[] {
|
||||
return isAuthenticated ? AUTH_SECONDARY_NAV : []
|
||||
if (!isAuthenticated) return []
|
||||
|
||||
const fundLabel = getProjectBranding().fundLabel
|
||||
|
||||
return AUTH_SECONDARY_NAV.map((item) =>
|
||||
item.id === 'fund' ? { ...item, label: fundLabel } : item
|
||||
)
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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="projectNameFa" class="desktop-sidebar__logo" />
|
||||
</div>
|
||||
|
||||
<nav class="desktop-sidebar__section" aria-label="منوی اصلی">
|
||||
@@ -45,7 +45,9 @@ import { useCartStore } from '@/store/cartStore'
|
||||
import { getPrimaryNavItems, getSecondaryNavItems } from '../config/navigation'
|
||||
import { useAppNavigation } from '../composables/useAppNavigation'
|
||||
import DesktopNavItem from './DesktopNavItem.vue'
|
||||
import { useProject } from '@/composables/useProject'
|
||||
|
||||
const { projectNameFa } = useProject()
|
||||
const cartStore = useCartStore()
|
||||
const authenticated = computed(() => isToken())
|
||||
const navLogo = logoFull
|
||||
|
||||
@@ -110,15 +110,15 @@
|
||||
|
||||
&:hover {
|
||||
background: rgba(167, 43, 119, 0.06);
|
||||
color: @primary-color;
|
||||
color: @theme-primary;
|
||||
}
|
||||
|
||||
&--active {
|
||||
background: rgba(167, 43, 119, 0.1);
|
||||
color: @primary-color;
|
||||
color: @theme-primary;
|
||||
|
||||
.desktop-nav-item__icon {
|
||||
color: @primary-color;
|
||||
color: @theme-primary;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@
|
||||
&__price {
|
||||
font-size: 15px;
|
||||
font-weight: 700;
|
||||
color: @App-primary-color;
|
||||
color: @theme-primary;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@
|
||||
&__total {
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
color: @App-primary-color;
|
||||
color: @theme-primary;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@
|
||||
.dproduct-info__price {
|
||||
font-size: 22px;
|
||||
font-weight: 700;
|
||||
color: @App-primary-color;
|
||||
color: @theme-primary;
|
||||
}
|
||||
|
||||
.dproduct-info__desc {
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
&.text-primary .tab__icon,
|
||||
&.text-primary .tab__icon .ant-badge {
|
||||
color: @primary-color;
|
||||
color: @theme-primary;
|
||||
}
|
||||
|
||||
&.text-gray-400 .tab__icon,
|
||||
@@ -68,11 +68,11 @@
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background-color: #a72b77;
|
||||
background-color: @theme-primary;
|
||||
|
||||
.circle_into {
|
||||
overflow: hidden;
|
||||
background-color: @primary-color;
|
||||
background-color: @theme-primary;
|
||||
border-radius: 50%;
|
||||
width: 56px;
|
||||
height: 56px;
|
||||
|
||||
@@ -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: @theme-primary;
|
||||
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: @theme-primary;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ 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
|
||||
|
||||
+2
-7
@@ -1,4 +1,5 @@
|
||||
import {createRouter, createWebHistory} from 'vue-router'
|
||||
import { getProjectDefaultRoute } from '@/utils/project'
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(import.meta.env.BASE_URL),
|
||||
@@ -8,16 +9,10 @@ const router = createRouter({
|
||||
name: 'login',
|
||||
component: () => import('../views/login/index.vue')
|
||||
},
|
||||
/* {
|
||||
path: '/',
|
||||
name: 'null',
|
||||
redirect: {name: 'home'},
|
||||
// component: () => import('../views/login/index.vue')
|
||||
},*/
|
||||
{
|
||||
path: `/`,
|
||||
name: 'main',
|
||||
redirect: {name: 'buyProduct'},
|
||||
redirect: () => ({ name: getProjectDefaultRoute() }),
|
||||
component: () => import('../views/base/index.vue'),
|
||||
children: [
|
||||
{
|
||||
|
||||
@@ -1,15 +1,9 @@
|
||||
import { type ComputedRef, ref } from 'vue'
|
||||
import { 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 {
|
||||
@@ -19,40 +13,6 @@ 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)
|
||||
}
|
||||
}
|
||||
|
||||
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*/ }
|
||||
return { walletInfo, getMyWallet }
|
||||
})
|
||||
|
||||
+17
-6
@@ -1,8 +1,19 @@
|
||||
export function getConfigApp(key: string) {
|
||||
const config = window.__APP_CONFIG__ ? window.__APP_CONFIG__.user : {}
|
||||
import { getTenantConfig } from '@/config/app-config'
|
||||
|
||||
if (config) {
|
||||
return config[key]
|
||||
}
|
||||
return null
|
||||
export function getConfigApp(key: string) {
|
||||
const config = getTenantConfig()
|
||||
const value = config?.[key]
|
||||
|
||||
return value ?? null
|
||||
}
|
||||
|
||||
export {
|
||||
getProjectId,
|
||||
getProjectBranding,
|
||||
getProjectDefaultRoute,
|
||||
isGhatreProject,
|
||||
isKashkoolProject,
|
||||
isBoursecuProject,
|
||||
} from '@/utils/project'
|
||||
|
||||
export type { ProjectId, ProjectBranding } from '@/utils/project'
|
||||
|
||||
@@ -39,11 +39,13 @@ export function getProductDisplayImage(product?: {
|
||||
return resolveProductImageSrc(product)
|
||||
}
|
||||
|
||||
import { formatGoldAmount } from '@/utils/usePrice'
|
||||
|
||||
export function formatMetalTotal(
|
||||
metal: WalletMetalTotal,
|
||||
inventoryCards: WalletInventoryCard[]
|
||||
): string {
|
||||
return `${resolveSummaryMetalWeight(metal, inventoryCards)}${metal.unit}`
|
||||
return `${formatGoldAmount(resolveSummaryMetalWeight(metal, inventoryCards))}${metal.unit}`
|
||||
}
|
||||
|
||||
export function resolveAssetsRialValue(
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
function normalizeGroupType(value: unknown): string {
|
||||
return String(value ?? '').trim().toLowerCase()
|
||||
}
|
||||
|
||||
export function isKatodMesGroup(groupType: unknown): boolean {
|
||||
const type = normalizeGroupType(groupType)
|
||||
return type.includes('کاتد') || type.includes('katod')
|
||||
}
|
||||
|
||||
export function isMaftolMesGroup(groupType: unknown): boolean {
|
||||
const type = normalizeGroupType(groupType)
|
||||
return type.includes('مفتول') || type.includes('maftol')
|
||||
}
|
||||
|
||||
export function isShamshMesGroup(groupType: unknown, title?: unknown): boolean {
|
||||
const type = normalizeGroupType(groupType)
|
||||
const name = normalizeGroupType(title)
|
||||
|
||||
return (
|
||||
type.includes('شمش') ||
|
||||
type.includes('shamsh') ||
|
||||
name.includes('شمش') ||
|
||||
name.includes('shamsh')
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,155 @@
|
||||
import { getRawAppConfig } from '@/config/app-config'
|
||||
import type { AppConfig } from '@/config/types'
|
||||
|
||||
export type ProjectId = 'ghatre' | 'kashkool' | 'boursecu'
|
||||
|
||||
export interface ProjectBranding {
|
||||
id: ProjectId
|
||||
nameFa: string
|
||||
heroGradient: string
|
||||
accentColor: string
|
||||
borderAccent: string
|
||||
fundLabel: string
|
||||
fundHeroBg: string
|
||||
idCardLabel: string
|
||||
buyPriceLabel: string
|
||||
defaultRoute: string
|
||||
showHomeRoute: boolean
|
||||
referralDomain: string
|
||||
}
|
||||
|
||||
const PROJECT_BRANDING: Record<ProjectId, ProjectBranding> = {
|
||||
ghatre: {
|
||||
id: 'ghatre',
|
||||
nameFa: 'قطره',
|
||||
heroGradient: 'linear-gradient(145deg, #521620 0%, #7a2a1e 40%, #521620 100%)',
|
||||
accentColor: '#521620',
|
||||
borderAccent: '#521620',
|
||||
fundLabel: 'قلک',
|
||||
fundHeroBg: '#EFCED9',
|
||||
idCardLabel: 'شناسه شما در قطره',
|
||||
buyPriceLabel: 'قیمت خرید از قطره',
|
||||
defaultRoute: 'buyProduct',
|
||||
showHomeRoute: false,
|
||||
referralDomain: 'ghatre.gold',
|
||||
},
|
||||
kashkool: {
|
||||
id: 'kashkool',
|
||||
nameFa: 'کشکول',
|
||||
heroGradient: 'linear-gradient(145deg, #a72b77 0%, #711d4d 40%, #a72b77 100%)',
|
||||
accentColor: '#a72b77',
|
||||
borderAccent: '#a72b77',
|
||||
fundLabel: 'دارایی ها',
|
||||
fundHeroBg: '',
|
||||
idCardLabel: 'شناسه شما در کشکول',
|
||||
buyPriceLabel: 'قیمت خرید از کشکول',
|
||||
defaultRoute: 'home',
|
||||
showHomeRoute: true,
|
||||
referralDomain: 'kh.kashkolgold.ir',
|
||||
},
|
||||
boursecu: {
|
||||
id: 'boursecu',
|
||||
nameFa: 'بورسکو',
|
||||
heroGradient: 'linear-gradient(145deg, #1e2229 0%, #374151 40%, #1e2229 100%)',
|
||||
accentColor: '#1e2229',
|
||||
borderAccent: '#1e2229',
|
||||
fundLabel: 'دارایی ها',
|
||||
fundHeroBg: '',
|
||||
idCardLabel: 'شناسه شما',
|
||||
buyPriceLabel: 'قیمت خرید',
|
||||
defaultRoute: 'home',
|
||||
showHomeRoute: true,
|
||||
referralDomain: '',
|
||||
},
|
||||
}
|
||||
|
||||
function normalizeProjectName(value: unknown): string {
|
||||
return String(value ?? '')
|
||||
.trim()
|
||||
.toLowerCase()
|
||||
.replace(/\s+/g, '')
|
||||
}
|
||||
|
||||
export function resolveProjectNameFromConfig(raw: AppConfig | null | undefined): string {
|
||||
if (!raw) return ''
|
||||
|
||||
const candidates: unknown[] = [
|
||||
raw.name,
|
||||
typeof raw.user === 'object' && raw.user !== null && !Array.isArray(raw.user)
|
||||
? (raw.user as Record<string, unknown>).name
|
||||
: undefined,
|
||||
Array.isArray(raw.user) && raw.user[0] && typeof raw.user[0] === 'object'
|
||||
? (raw.user[0] as Record<string, unknown>).name
|
||||
: undefined,
|
||||
]
|
||||
|
||||
for (const value of candidates) {
|
||||
const normalized = normalizeProjectName(value)
|
||||
if (normalized) return normalized
|
||||
}
|
||||
|
||||
return ''
|
||||
}
|
||||
|
||||
function getProjectNameRaw(): string {
|
||||
return resolveProjectNameFromConfig(getRawAppConfig())
|
||||
}
|
||||
|
||||
function matchesProjectName(name: string, aliases: string[]): boolean {
|
||||
return aliases.some((alias) => name.includes(normalizeProjectName(alias)))
|
||||
}
|
||||
|
||||
export function getProjectId(): ProjectId {
|
||||
const name = getProjectNameRaw()
|
||||
|
||||
if (name === 'ghatreh') {
|
||||
return 'ghatre'
|
||||
}
|
||||
|
||||
if (name === 'kashkolgold') {
|
||||
return 'kashkool'
|
||||
}
|
||||
|
||||
if (matchesProjectName(name, ['boursecu', 'bourse', 'بورسکو', 'بورس'])) {
|
||||
return 'boursecu'
|
||||
}
|
||||
|
||||
if (matchesProjectName(name, ['ghatre', 'qatre', 'قطره'])) {
|
||||
return 'ghatre'
|
||||
}
|
||||
|
||||
if (matchesProjectName(name, ['kashkool', 'kashkol', 'کشکول'])) {
|
||||
return 'kashkool'
|
||||
}
|
||||
|
||||
return 'kashkool'
|
||||
}
|
||||
|
||||
export function isGhatreProject(): boolean {
|
||||
return getProjectId() === 'ghatre'
|
||||
}
|
||||
|
||||
export function isKashkoolProject(): boolean {
|
||||
return getProjectId() === 'kashkool'
|
||||
}
|
||||
|
||||
export function isBoursecuProject(): boolean {
|
||||
return getProjectId() === 'boursecu'
|
||||
}
|
||||
|
||||
export function getProjectBranding(): ProjectBranding {
|
||||
const id = getProjectId()
|
||||
const defaults = PROJECT_BRANDING[id]
|
||||
|
||||
return {
|
||||
...defaults,
|
||||
nameFa: defaults.nameFa,
|
||||
accentColor: defaults.accentColor,
|
||||
borderAccent: defaults.borderAccent,
|
||||
heroGradient: defaults.heroGradient,
|
||||
}
|
||||
}
|
||||
|
||||
export function getProjectDefaultRoute(): string {
|
||||
return getProjectBranding().defaultRoute
|
||||
}
|
||||
@@ -0,0 +1,206 @@
|
||||
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
|
||||
}
|
||||
+88
-14
@@ -1,24 +1,46 @@
|
||||
export function usePrice(price: number, digit = true, unit = 'ریال') {
|
||||
price= price??0
|
||||
let _price = price.toString()
|
||||
function formatGroupedPrice(price: string | number | null | undefined, digit: boolean) {
|
||||
let value = price === null || price === undefined ? '' : String(price)
|
||||
if (digit) {
|
||||
_price = _price.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',')
|
||||
value = value.replace(/\B(?=(\d{3})+(?!\d))/g, ',')
|
||||
}
|
||||
return `${_price} ${unit}`
|
||||
return value
|
||||
}
|
||||
|
||||
export function usePriceWithoutType(price?: number, digit = true, unit = 'ریال') {
|
||||
let _price = price?.toString()
|
||||
if (digit) {
|
||||
_price = _price?.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',')
|
||||
/** مبلغ ریالی — بدون اعشار، گرد به بالا */
|
||||
export function ceilRial(price?: number | string | null): number {
|
||||
const num = Number(price ?? 0)
|
||||
if (!Number.isFinite(num)) {
|
||||
return 0
|
||||
}
|
||||
return `${_price}`
|
||||
|
||||
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}`
|
||||
}
|
||||
|
||||
export function usePriceWithoutType(price?: number, digit = true) {
|
||||
return formatGroupedPrice(ceilRial(price), digit)
|
||||
}
|
||||
|
||||
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
|
||||
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}%`
|
||||
}
|
||||
|
||||
export function useFormat(num: string | number, unit = '') {
|
||||
@@ -28,11 +50,26 @@ 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 {
|
||||
@@ -57,6 +94,38 @@ 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) {
|
||||
@@ -74,8 +143,13 @@ export function getTransactionGoldAmount(item: TransactionPriceSource): number {
|
||||
return gold
|
||||
}
|
||||
|
||||
export function formatGoldAmount(amount?: number | null): string {
|
||||
export function formatGoldAmount(amount?: number | null, decimals = 8): string {
|
||||
const num = Number(amount)
|
||||
if (!Number.isFinite(num)) return '0'
|
||||
return String(Number(num.toFixed(3)))
|
||||
return formatGroupedPrice(Number(num.toFixed(decimals)), false)
|
||||
}
|
||||
|
||||
/** وزن فلز (گرم) — بدون گرد کردن به بالا */
|
||||
export function formatWeightAmount(amount?: number | null): string {
|
||||
return formatGoldAmount(amount)
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
height: 56px;
|
||||
border-radius: 14px;
|
||||
background: rgba(9, 61, 81, 0.08);
|
||||
color: @App-primary-color;
|
||||
color: @theme-primary;
|
||||
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: @theme-primary;
|
||||
}
|
||||
|
||||
&__divider {
|
||||
|
||||
@@ -6,6 +6,7 @@ import { useWalletAssets } from '@/composables/useWalletAssets'
|
||||
import type { WalletMetalTotal } from '@/models/walletAssets'
|
||||
import { fundPageInventoryCards, formatMetalTotal as buildMetalTotalLabel } from '@/utils/productAssets'
|
||||
import { getLastPrices } from '@/utils/price'
|
||||
import { getProjectBranding, isGhatreProject } from '@/utils/project'
|
||||
import img from '@/assets/img/user_ly1.svg'
|
||||
import empty from '@/assets/img/cash_empty.svg'
|
||||
|
||||
@@ -20,6 +21,8 @@ export interface FundPageContext {
|
||||
fundHeaderBackground: string
|
||||
fundEmptyImage: string
|
||||
fundEmptyText: string
|
||||
fundLabel: string
|
||||
fundBalanceLabel: string
|
||||
formatMetalTotal: (metal: WalletMetalTotal) => string
|
||||
openFundInfo: (productId: number) => void
|
||||
goBack: () => void
|
||||
@@ -70,6 +73,8 @@ export function useFundPage(_isDesktop: Ref<boolean>) {
|
||||
}
|
||||
})
|
||||
|
||||
const branding = getProjectBranding()
|
||||
|
||||
const context: FundPageContext = {
|
||||
meta,
|
||||
inventoryCards,
|
||||
@@ -80,7 +85,9 @@ export function useFundPage(_isDesktop: Ref<boolean>) {
|
||||
countBasedInventory,
|
||||
fundHeaderBackground: img,
|
||||
fundEmptyImage: empty,
|
||||
fundEmptyText: 'یک گنج جدید بساز!',
|
||||
fundEmptyText: isGhatreProject() ? 'یک قلک جدید بساز!' : 'یک گنج جدید بساز!',
|
||||
fundLabel: branding.fundLabel,
|
||||
fundBalanceLabel: isGhatreProject() ? `موجودی ${branding.fundLabel} ها` : `موجودی ${branding.fundLabel}`,
|
||||
formatMetalTotal,
|
||||
openFundInfo,
|
||||
goBack,
|
||||
|
||||
@@ -7,16 +7,16 @@
|
||||
بازگشت
|
||||
</button>
|
||||
<div class="dfund-topbar__meta">
|
||||
<p class="dfund-topbar__eyebrow">دارایی</p>
|
||||
<h1 class="dfund-topbar__title">داراییها</h1>
|
||||
<p class="dfund-topbar__eyebrow">{{ fundLabel }}</p>
|
||||
<h1 class="dfund-topbar__title">{{ fundLabel }}</h1>
|
||||
<p class="dfund-topbar__subtitle">نمای کلی موجودی محصولات و کیف پول</p>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<section class="dfund-summary dfund-summary--ghatreh">
|
||||
<section class="dfund-summary" :class="isGhatre ? 'dfund-summary--ghatreh' : ''">
|
||||
<img :src="fundHeaderBackground" alt="" class="dfund-summary__bg" />
|
||||
<div class="dfund-summary__content">
|
||||
<h2 class="dfund-summary__title">موجودی داراییها</h2>
|
||||
<h2 class="dfund-summary__title">{{ fundBalanceLabel }}</h2>
|
||||
|
||||
<div v-if="meta?.has_count_based_products" class="dfund-summary__row">
|
||||
<span>محصولات</span>
|
||||
@@ -93,6 +93,9 @@ import { loading } from '@/utils'
|
||||
import { usePriceWithoutType } from '@/utils/usePrice'
|
||||
import Item from '../components/Item.vue'
|
||||
import { useFundPageContext } from '../composables/useFundPage'
|
||||
import { useProject } from '@/composables/useProject'
|
||||
|
||||
const { isGhatre } = useProject()
|
||||
|
||||
const {
|
||||
meta,
|
||||
@@ -105,6 +108,8 @@ const {
|
||||
fundHeaderBackground,
|
||||
fundEmptyImage,
|
||||
fundEmptyText,
|
||||
fundLabel,
|
||||
fundBalanceLabel,
|
||||
formatMetalTotal,
|
||||
openFundInfo,
|
||||
goBack,
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
overflow: hidden;
|
||||
border-radius: 16px;
|
||||
margin-bottom: 24px;
|
||||
background: @App-primary-color;
|
||||
background: @theme-primary;
|
||||
color: #fff;
|
||||
|
||||
&--bazretala {
|
||||
@@ -339,7 +339,7 @@
|
||||
.dfund-info__balance-value {
|
||||
font-size: 28px;
|
||||
font-weight: 700;
|
||||
color: @App-primary-color;
|
||||
color: @theme-primary;
|
||||
}
|
||||
|
||||
.dfund-info__balance-unit {
|
||||
@@ -495,8 +495,8 @@
|
||||
cursor: pointer;
|
||||
|
||||
&--active {
|
||||
background: @App-primary-color;
|
||||
border-color: @App-primary-color;
|
||||
background: @theme-primary;
|
||||
border-color: @theme-primary;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,17 +6,21 @@
|
||||
<div class="cursor-pointer" @click="goBack()">
|
||||
<BasicIcon icon="vuesax-linear:arrow-right-1" />
|
||||
</div>
|
||||
<div class="mr-2">دارایی ها</div>
|
||||
<div class="mr-2">{{ fundLabel }}</div>
|
||||
</div>
|
||||
|
||||
<div class="fund-mobile-root__hero text-tertiary bg-primary">
|
||||
<div
|
||||
class="fund-mobile-root__hero text-tertiary"
|
||||
:class="isGhatre ? 'fund-mobile-root__hero--ghatre' : 'bg-primary'"
|
||||
:style="isGhatre ? { backgroundColor: fundHeroBg } : undefined"
|
||||
>
|
||||
<img
|
||||
:src="fundHeaderBackground"
|
||||
alt=""
|
||||
class="fund-mobile-root__hero-bg"
|
||||
/>
|
||||
<div class="fund-mobile-root__hero-content flex flex-col">
|
||||
<div class="font-bold mr-5 z-20">موجودی دارایی ها</div>
|
||||
<div class="font-bold mr-5 z-20">{{ fundBalanceLabel }}</div>
|
||||
|
||||
<div
|
||||
v-if="meta?.has_count_based_products"
|
||||
@@ -91,10 +95,15 @@
|
||||
|
||||
<script lang="ts" setup>
|
||||
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
|
||||
import { computed } from 'vue'
|
||||
import { loading } from '@/utils'
|
||||
import { usePriceWithoutType } from '@/utils/usePrice'
|
||||
import Item from '../components/Item.vue'
|
||||
import { useFundPageContext } from '../composables/useFundPage'
|
||||
import { useProject } from '@/composables/useProject'
|
||||
|
||||
const { isGhatre, branding } = useProject()
|
||||
const fundHeroBg = computed(() => branding.value.fundHeroBg)
|
||||
|
||||
const {
|
||||
meta,
|
||||
@@ -107,6 +116,8 @@ const {
|
||||
fundHeaderBackground,
|
||||
fundEmptyImage,
|
||||
fundEmptyText,
|
||||
fundLabel,
|
||||
fundBalanceLabel,
|
||||
formatMetalTotal,
|
||||
openFundInfo,
|
||||
goBack,
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
height: 56px;
|
||||
border-radius: 14px;
|
||||
background: rgba(167, 43, 119, 0.08);
|
||||
color: @App-primary-color;
|
||||
color: @theme-primary;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@
|
||||
}
|
||||
|
||||
.basic-icon {
|
||||
color: @App-primary-color;
|
||||
color: @theme-primary;
|
||||
flex-shrink: 0;
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
+157
-104
@@ -24,14 +24,9 @@
|
||||
<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 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 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>
|
||||
ریال
|
||||
</div>
|
||||
@@ -40,11 +35,6 @@
|
||||
<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">
|
||||
@@ -66,7 +56,7 @@
|
||||
<!-- {{walletStore?.walletInfo?.gold}}-->
|
||||
<Transition mode="out-in" name="fade">
|
||||
<div v-if="!isBuy" class="font-bold text-xs">
|
||||
<div> {{ `موجودی کیف طلا: ${walletStore?.walletInfo?.gold ?? 0} گرم` }}</div>
|
||||
<div> {{ `موجودی کیف طلا: ${formatGoldAmount(walletStore?.walletInfo?.gold ?? 0)} گرم` }}</div>
|
||||
<!-- <div v-if="walletStore?.walletInfo?.gold_block !== 0">
|
||||
{{ `موجودی قابل برداشت طلا: ${walletStore?.walletInfo?.gold_block ?? 0} گرم` }}
|
||||
</div>-->
|
||||
@@ -88,13 +78,6 @@
|
||||
@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" />
|
||||
@@ -111,10 +94,11 @@
|
||||
<div v-else>{{ !isBuy ? 'فروش' : 'خرید' }}</div>
|
||||
</div>
|
||||
</BasicButton>
|
||||
<div v-if="!isBuy && form.goldValue > walletStore?.walletInfo?.gold"
|
||||
<div v-if="!isBuy && sellGoldDebit > (walletStore?.walletInfo?.gold ?? 0)"
|
||||
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"
|
||||
@@ -128,7 +112,7 @@
|
||||
<div class="flex justify-between items-center">
|
||||
<div>کارمزد:</div>
|
||||
<div class="flex gap-2 items-center">
|
||||
<div class="">{{ parseFloat(((form.goldValue ?? 0) * 0.01).toFixed(4)) }}</div>
|
||||
<div class="">{{ feeInGrams }}</div>
|
||||
<!-- <div class="font-bold text-2xl">{{ 0 }}</div>-->
|
||||
<div>
|
||||
گرم
|
||||
@@ -154,25 +138,39 @@
|
||||
<div class="flex justify-between ">
|
||||
<div>وزن:</div>
|
||||
<div class="flex items-center">
|
||||
<div class="font-bold">{{ form.goldValue }}</div>
|
||||
<div class="font-bold">{{ displayTradeGoldAmount }}</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(isBuy ? price.buy ?? 0 : price.sell ?? 0) }}</div>
|
||||
<div class="font-bold">{{ usePriceWithoutType(Math.round(goldPriceValue)) }}</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">{{ parseFloat(((form.goldValue ?? 0) * 0.01).toFixed(4)) }}</div>
|
||||
<div class="font-bold text-xl">{{ feeInGrams }}</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">
|
||||
@@ -203,10 +201,10 @@
|
||||
|
||||
import { computed, onMounted, onUnmounted, ref, watch } from 'vue'
|
||||
import img1 from '@/assets/img/home_ly2.svg'
|
||||
import { usePrice, usePriceWithoutType } from '@/utils/usePrice'
|
||||
import { usePrice, usePriceWithoutType, formatGoldAmount } from '@/utils/usePrice'
|
||||
import BasicInput from '@/components/BasicPacks/BasicInput.vue'
|
||||
import type { Gold } from '@/models/gold'
|
||||
import { isIphone, loading, loadingMore, toFixedDownThreeChar } from '@/utils'
|
||||
import { isIphone, loading, loadingMore } from '@/utils'
|
||||
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
|
||||
import router from '@/router'
|
||||
import { useWalletStore } from '@/store/walletStore'
|
||||
@@ -228,12 +226,27 @@ 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, lastPrice, setIntervalGetAllPrice, stopPriceInterval } from '@/utils/price'
|
||||
import { getLastPrices, getTradeBuyPrice, getTradeSellPrice, lastPrice, setIntervalGetAllPrice, stopPriceInterval } from '@/utils/price'
|
||||
import { isStoreClosed, getStoreClosedMessage } from '@/utils/storeHours'
|
||||
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()
|
||||
@@ -242,7 +255,6 @@ 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()
|
||||
@@ -253,6 +265,7 @@ interface Prop {
|
||||
|
||||
const props = withDefaults(defineProps<Prop>(), {})
|
||||
const isBuy = ref<boolean>(true)
|
||||
const inputLock = ref<TradeInputLock>(null)
|
||||
|
||||
const buyPagination = ref<TableEngineInput>({
|
||||
filters: [{
|
||||
@@ -273,20 +286,52 @@ const sellPagination = ref<TableEngineInput>({
|
||||
}], limit: 6, page: 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 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 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 && form.value.goldValue > walletStore?.walletInfo?.gold) ||
|
||||
price.value?.buy === undefined)
|
||||
(!isBuy.value && sellGoldDebit.value > (walletStore?.walletInfo?.gold ?? 0)) ||
|
||||
(isBuy.value && payablePrice.value > (walletStore?.walletInfo?.cash ?? 0)) ||
|
||||
priceUnavailable.value)
|
||||
|
||||
function refreshTable() {
|
||||
sellItems.value = []
|
||||
@@ -388,6 +433,7 @@ onMounted(async () => {
|
||||
break
|
||||
}
|
||||
await initPrice()
|
||||
await loadServiceFeeFromSettings()
|
||||
/* await initSellTable()
|
||||
await initBuyTable()*/
|
||||
})
|
||||
@@ -482,20 +528,18 @@ 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 {
|
||||
// console.log((unitGoldCalculator.value * val).toFixed(2))
|
||||
// form.value.goldValue = parseFloat((unitGoldCalculator.value * val).toFixed(2))
|
||||
form.value.goldValue = toFixedDownThreeChar(parseFloat(unitGoldCalculator.value * val))
|
||||
form.value.goldValue = formatTradeGramDisplay(parseFloat(String(unitGoldCalculator.value * val)))
|
||||
calculateCash(form.value.goldValue)
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
form.value.goldValue = undefined
|
||||
form.value.goldCash = undefined
|
||||
inputLock.value = null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -508,55 +552,61 @@ const unitCashCalculator = computed(() => {
|
||||
return (walletStore?.walletInfo?.cash ?? 0) / 100
|
||||
})
|
||||
|
||||
const limitedPrice = computed(() => {
|
||||
if (walletStore.limitedPrice)
|
||||
return walletStore?.limitedPrice[0]
|
||||
})
|
||||
function syncFormWithLatestPrice() {
|
||||
const unit = unitPrice.value
|
||||
if (!unit || Number.isNaN(unit) || !inputLock.value) return
|
||||
|
||||
function calculateCash(val: number) {
|
||||
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
|
||||
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()
|
||||
})
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
form.value.goldCash = calcRialFromLockedGram(val, unit, isBuy.value)
|
||||
}
|
||||
|
||||
function calculateGold(val: number) {
|
||||
// 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
|
||||
}
|
||||
}
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -578,7 +628,7 @@ function setIsBuy(val: boolean) {
|
||||
form.value.goldValue = undefined
|
||||
form.value.goldCash = undefined
|
||||
form.value.percentWallet = 0
|
||||
priceErrorVisible.value = false
|
||||
inputLock.value = null
|
||||
// console.log(bganim.value.classList)
|
||||
// bganim?.value?.classList.add(val?'right':'left')
|
||||
// bganim?.value?.style.transform = `translateX(${val ? '0' : '-100'});`
|
||||
@@ -594,10 +644,7 @@ const formatter = (value: number) => {
|
||||
|
||||
const price = computed((): Price => <Price>lastPrice.value ?? 0)
|
||||
|
||||
const displayedGoldPrice = computed(() => {
|
||||
if (!lastPrice.value) return 0
|
||||
return isBuy.value ? (lastPrice.value.buy ?? 0) : (lastPrice.value.sell ?? 0)
|
||||
})
|
||||
const goldPriceValue = computed(() => unitPrice.value)
|
||||
|
||||
async function initPrice() {
|
||||
try {
|
||||
@@ -613,17 +660,32 @@ 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: isBuy.value ? price.value?.buy : price.value?.sell,
|
||||
amount: form.value.goldValue ?? 0
|
||||
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
|
||||
),
|
||||
})
|
||||
await walletStore.getMyWallet()
|
||||
await router.push({ name: 'transactions' })
|
||||
@@ -632,6 +694,7 @@ async function ok() {
|
||||
goldCash: undefined,
|
||||
percentWallet: undefined
|
||||
}
|
||||
inputLock.value = null
|
||||
// refreshTable()
|
||||
message.success('سفارش شما با موفقیت انجام شد')
|
||||
await fundStore.getMyFund()
|
||||
@@ -680,14 +743,4 @@ async function ok() {
|
||||
right: 100%;
|
||||
transform: translate(100%, 0);
|
||||
}
|
||||
|
||||
.gold-live-price {
|
||||
:deep(.odometer) {
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
:deep(.odometer-digit) {
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
import { computed, inject, provide, type InjectionKey } from 'vue'
|
||||
import router from '@/router'
|
||||
import { useSettingsStore } from '@/store/settingsStore'
|
||||
import { getStoreClosedMessage, isStoreClosed } from '@/utils/storeHours'
|
||||
import { isKashkoolProject } from '@/utils/project'
|
||||
import { getHomeLayoutId } from '../layouts/registry'
|
||||
import { useBanners } from './useBanners'
|
||||
import { usePriceChart } from './usePriceChart'
|
||||
import { initHomePageData } from './useHomePageData'
|
||||
import type { HomeActionItem } from '../layouts/types'
|
||||
|
||||
export const HOME_PAGE_CONTEXT_KEY: InjectionKey<ReturnType<typeof createHomePageContext>> =
|
||||
Symbol('homePageContext')
|
||||
|
||||
function createHomePageContext() {
|
||||
const settingsStore = useSettingsStore()
|
||||
const { banners } = useBanners()
|
||||
const chart = usePriceChart()
|
||||
|
||||
const isBoursecuHomeLayout = computed(() => getHomeLayoutId() === 'boursecu')
|
||||
const isGaroosi = computed(() => isKashkoolProject())
|
||||
const bannerEnabled = computed(() => settingsStore.isSettingTruthy('banner_enabled'))
|
||||
const showClosedMessage = computed(() => isStoreClosed())
|
||||
const closedMessage = computed(() => getStoreClosedMessage())
|
||||
|
||||
const mainActions = computed<HomeActionItem[]>(() => [
|
||||
{
|
||||
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: () => {},
|
||||
},
|
||||
{
|
||||
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' }),
|
||||
},
|
||||
])
|
||||
|
||||
function openGoldModal() {}
|
||||
function openRialModal() {}
|
||||
function handleBannerClick() {}
|
||||
|
||||
void initHomePageData()
|
||||
|
||||
return {
|
||||
isBoursecuHomeLayout,
|
||||
isGaroosi,
|
||||
bannerEnabled,
|
||||
banners,
|
||||
showClosedMessage,
|
||||
closedMessage,
|
||||
mainActions,
|
||||
priceChartSeries: chart.priceChartSeries,
|
||||
chartSelection: chart.chartSelection,
|
||||
selectedChartMetal: chart.selectedChartMetal,
|
||||
updateChartData: chart.updateChartData,
|
||||
setChartMetal: chart.setChartMetal,
|
||||
openGoldModal,
|
||||
openRialModal,
|
||||
handleBannerClick,
|
||||
}
|
||||
}
|
||||
|
||||
export function useHomePageProvider() {
|
||||
const context = createHomePageContext()
|
||||
provide(HOME_PAGE_CONTEXT_KEY, context)
|
||||
return context
|
||||
}
|
||||
|
||||
export function useHomePageContext() {
|
||||
const existing = inject(HOME_PAGE_CONTEXT_KEY, null)
|
||||
if (existing) return existing
|
||||
return useHomePageProvider()
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
export async function loadHomeFunds(_force = false) {
|
||||
return Promise.resolve()
|
||||
}
|
||||
|
||||
export function resetHomeFunds() {
|
||||
// no-op — fund list is loaded via wallet assets on the home page
|
||||
}
|
||||
@@ -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">{{ branding.buyPriceLabel }}</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 } from '@/utils/usePrice'
|
||||
import { usePrice, usePriceWithoutType, useTowDecimal, formatGoldAmount } from '@/utils/usePrice'
|
||||
import {
|
||||
getLastPrices,
|
||||
getTradeBuyPrice,
|
||||
@@ -174,8 +174,9 @@ 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 { useProject } from '@/composables/useProject'
|
||||
|
||||
const emit = defineEmits<{ logout: []; openBalance: [] }>()
|
||||
const { branding, projectNameFa } = useProject()
|
||||
const userStore = useUserStore()
|
||||
const walletStore = useWalletStore()
|
||||
const { assetsSummary, loadWalletAssets } = useWalletAssets()
|
||||
@@ -210,10 +211,10 @@ const balanceLabel = computed(() => {
|
||||
}
|
||||
const metal = primaryMetalTotal.value
|
||||
if (metal && Number(metal.total_weight) > 0) {
|
||||
return `${Number(metal.total_weight).toFixed(3)} ${metal.unit}`
|
||||
return `${formatGoldAmount(metal.total_weight)} ${metal.unit}`
|
||||
}
|
||||
const fallback = walletStore.walletInfo?.gold_sum ?? userStore.userInfo?.wallet?.count_gold ?? 0
|
||||
return `${Number(fallback).toFixed(3)} گرم`
|
||||
return `${formatGoldAmount(fallback)} گرم`
|
||||
})
|
||||
|
||||
const totalRialDisplay = computed(() =>
|
||||
@@ -263,7 +264,7 @@ function shareReferral() {
|
||||
const text = `⭐️الان طلا بخر؛ آخر ماه سودشو ببر!
|
||||
این دعوت نامه از طرف "${userStore.userInfo?.name}" برای شما ارسال شده.
|
||||
kh.kashkolgold.ir/login?id=${userStore.userInfo?.referral_id}`
|
||||
navigator.share({ title: 'کشکول گلد', text })
|
||||
navigator.share({ title: projectNameFa.value, text })
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
|
||||
@@ -8,10 +8,12 @@ import { computed } from 'vue'
|
||||
import { getHomeLayoutId } from '../layouts/registry'
|
||||
import BoursecuDesktopHome from './layouts/BoursecuDesktopHome.vue'
|
||||
import DefaultDesktopHome from './layouts/DefaultDesktopHome.vue'
|
||||
import { useHomePageProvider } from '../composables/useHomePage'
|
||||
|
||||
defineEmits<{
|
||||
logout: []
|
||||
}>()
|
||||
|
||||
useHomePageProvider()
|
||||
const layoutId = computed(() => getHomeLayoutId())
|
||||
</script>
|
||||
|
||||
@@ -1,36 +1,15 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, inject } from 'vue'
|
||||
import { useUserStore } from '@/store/userStore'
|
||||
import { usePriceWithoutType } from '@/utils/usePrice'
|
||||
import { inject } from 'vue'
|
||||
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="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-alerts">
|
||||
<div
|
||||
v-if="!isBoursecu && ctx.showClosedMessage.value"
|
||||
class="dhome-alert dhome-alert--info"
|
||||
v-html="ctx.closedMessage.value"
|
||||
/>
|
||||
|
||||
@@ -420,7 +420,7 @@
|
||||
height: 36px;
|
||||
border-radius: 10px;
|
||||
background: #f3f4f6;
|
||||
color: @App-primary-color;
|
||||
color: @theme-primary;
|
||||
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: @theme-primary;
|
||||
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: @theme-primary;
|
||||
color: #fff;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
@@ -1,28 +1,19 @@
|
||||
<template>
|
||||
<div class="home-page-root">
|
||||
<GhatrehHomeDesktopView
|
||||
v-show="isDesktop"
|
||||
v-if="isDesktop && !isGhatre"
|
||||
@logout="showLogoutConfirm = true"
|
||||
@open-balance="openWholeBalanceVisible()"
|
||||
/>
|
||||
<div v-show="!isDesktop" class="home-mobile-root pb-[calc(var(--app-bottom-chrome-height)+1rem)]">
|
||||
<div v-show="!isDesktop || isGhatre" class="home-mobile-root pb-[calc(var(--app-bottom-chrome-height)+1rem)]">
|
||||
<div class="app-header-scroll-sentinel" aria-hidden="true" />
|
||||
<div
|
||||
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: heroGradient }"
|
||||
>
|
||||
<div
|
||||
class="absolute inset-0 opacity-20"
|
||||
@@ -33,13 +24,13 @@
|
||||
<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>
|
||||
<div class="tracking-wide">{{ projectNameFa }}</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;">{{ branding.idCardLabel }}</div>
|
||||
<div class="flex">
|
||||
<div v-if="userStore?.userInfo?.virtual_card_number" class="ml-2 " @click.stop="copyCode()">
|
||||
<BasicIcon
|
||||
@@ -84,7 +75,7 @@
|
||||
>
|
||||
<div
|
||||
class="rounded-full w-[42px] h-[42px] bg-primary flex items-center justify-center"
|
||||
style="border: solid 1px #a72b77"
|
||||
:style="actionBorderStyle"
|
||||
|
||||
>
|
||||
<Icon class="text-tertiary" icon="vuesax-linear:money-send" />
|
||||
@@ -98,7 +89,7 @@
|
||||
>
|
||||
<div
|
||||
class="rounded-full w-[50px] h-[50px] bg-primary flex items-center justify-center"
|
||||
style="border: solid 1px #a72b77"
|
||||
:style="actionBorderStyle"
|
||||
|
||||
>
|
||||
<Icon class="text-white" icon="vuesax-linear:money-receive" />
|
||||
@@ -112,7 +103,7 @@
|
||||
>
|
||||
<div
|
||||
class="rounded-full w-[50px] h-[50px] bg-primary flex items-center justify-center"
|
||||
style="border: solid 1px #a72b77"
|
||||
:style="actionBorderStyle"
|
||||
|
||||
>
|
||||
<Icon class="text-white" icon="vuesax-linear:card-add" />
|
||||
@@ -126,7 +117,7 @@
|
||||
>
|
||||
<div
|
||||
class="rounded-full w-[50px] h-[50px] bg-primary flex items-center justify-center "
|
||||
style="border: solid 1px #a72b77"
|
||||
:style="actionBorderStyle"
|
||||
>
|
||||
<Icon class="text-white" icon="vuesax-linear:receipt-item" />
|
||||
</div>
|
||||
@@ -139,7 +130,7 @@
|
||||
>
|
||||
<div
|
||||
class="rounded-full w-[50px] h-[50px] bg-primary flex items-center justify-center"
|
||||
style=" border: solid 1px #a72b77"
|
||||
:style="actionBorderStyle"
|
||||
>
|
||||
<Icon class="text-white font-bold" icon="vuesax-linear:archive-1" />
|
||||
</div>
|
||||
@@ -152,7 +143,7 @@
|
||||
>
|
||||
<div
|
||||
class="rounded-full w-[50px] h-[50px] bg-primary flex items-center justify-center"
|
||||
style=" border: solid 1px #a72b77"
|
||||
:style="actionBorderStyle"
|
||||
|
||||
>
|
||||
<Icon class="text-white font-bold" icon="vuesax-linear:dollar-circle" />
|
||||
@@ -254,7 +245,7 @@
|
||||
>
|
||||
|
||||
<div class="w-full items-center flex flex-col">
|
||||
<div class="text-gray-600">قیمت خرید از کشکول گلد</div>
|
||||
<div class="text-gray-600">{{ branding.buyPriceLabel }}</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">
|
||||
<!– {{ usePriceWithoutType(useCounterAnim(price.price_last) ?? 0) }}–>
|
||||
@@ -446,7 +437,7 @@
|
||||
<div class="text-center">
|
||||
<div class="mt-2">
|
||||
<div>🔥یه فرصت طلایی واقعی جلوتِ !🔥</div>
|
||||
<div>دوستاتو همین الان به کشکول گلد دعوت کن!</div>
|
||||
<div>دوستاتو همین الان به {{ projectNameFa }} دعوت کن!</div>
|
||||
<div>اونا اولین خریدشونو کاملاً بدون کارمزد انجام میدن،۱۰٪ از کارمزد ۱۰ معاملهی اولشون هم، مستقیم میاد تو حساب تو!</div>
|
||||
<div>زود باش، این فرصت همیشه باز نیست! ⏳✨</div>
|
||||
</div>
|
||||
@@ -466,7 +457,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 } from '../../../utils/usePrice'
|
||||
import { usePrice, usePriceWithoutType, useTowDecimal, formatGoldAmount } from '../../../utils/usePrice'
|
||||
import {computed, createVNode, onActivated, onMounted, onUnmounted, ref, watch} from 'vue'
|
||||
import router from '@/router'
|
||||
import * as echarts from 'echarts'
|
||||
@@ -480,6 +471,7 @@ import Vue3Odometer from 'vue3-odometer'
|
||||
import 'odometer/themes/odometer-theme-default.css'
|
||||
import HomeSkeleton from '@/views/base/home/components/HomeSkeleton.vue'
|
||||
import GhatrehHomeDesktopView from '@/views/base/home/desktop/GhatrehHomeDesktopView.vue'
|
||||
import { useProject } from '@/composables/useProject'
|
||||
import {
|
||||
getLastPrices,
|
||||
getTradeBuyPrice,
|
||||
@@ -507,6 +499,10 @@ import AppHeader from '@/views/base/home/components/AppHeader.vue'
|
||||
const userStore = useUserStore()
|
||||
const walletStore = useWalletStore()
|
||||
const isDesktop = useDesktopBreakpoint()
|
||||
const { branding, projectNameFa, heroGradient, isGhatre, accentColor } = useProject()
|
||||
const actionBorderStyle = computed(() => ({
|
||||
border: `solid 1px ${accentColor.value}`,
|
||||
}))
|
||||
const chartLoading = ref<boolean>(false)
|
||||
const openModal = ref<boolean>(false)
|
||||
const wholeBalanceVisible = ref<boolean>(false)
|
||||
@@ -535,14 +531,14 @@ const balanceLabel = computed(() => {
|
||||
|
||||
const metal = primaryMetalTotal.value
|
||||
if (metal && Number(metal.total_weight) > 0) {
|
||||
return `${Number(metal.total_weight).toFixed(3)} ${metal.unit}`
|
||||
return `${formatGoldAmount(metal.total_weight)} ${metal.unit}`
|
||||
}
|
||||
|
||||
const fallback =
|
||||
walletStore.walletInfo?.gold_sum ??
|
||||
userStore.userInfo?.wallet?.count_gold ??
|
||||
0
|
||||
return `${Number(fallback).toFixed(3)} گرم`
|
||||
return `${formatGoldAmount(fallback)} گرم`
|
||||
})
|
||||
|
||||
const totalRialDisplay = computed(() =>
|
||||
@@ -717,7 +713,7 @@ const priceChartOptions = ref({
|
||||
show: false
|
||||
}
|
||||
},
|
||||
colors: ['#a72b77'],
|
||||
colors: [accentColor.value],
|
||||
fill: {
|
||||
type: 'gradient',
|
||||
gradient: {
|
||||
@@ -729,6 +725,11 @@ const priceChartOptions = ref({
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
watch(accentColor, (color) => {
|
||||
priceChartOptions.value.colors = [color]
|
||||
}, { immediate: true })
|
||||
|
||||
const toPersianNumber = (num) => {
|
||||
return num.toString().replace(/\d/g, (d) => '۰۱۲۳۴۵۶۷۸۹'[d])
|
||||
}
|
||||
@@ -752,10 +753,6 @@ const updateData = (timeline) => {
|
||||
fetchPrices()
|
||||
}
|
||||
|
||||
const limitedPrice = computed(() => {
|
||||
if (walletStore.limitedPrice) return walletStore?.limitedPrice[0]
|
||||
})
|
||||
|
||||
const test_series = [
|
||||
{
|
||||
name: 'candle',
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<template>
|
||||
<HomeDesktopView @logout="$emit('logout')" />
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import HomeDesktopView from '../desktop/HomeDesktopView.vue'
|
||||
|
||||
defineEmits<{
|
||||
logout: []
|
||||
}>()
|
||||
</script>
|
||||
@@ -0,0 +1,12 @@
|
||||
import type { HomeLayoutConfig } from '../types'
|
||||
|
||||
export const boursecuHomeLayoutConfig: HomeLayoutConfig = {
|
||||
id: 'boursecu',
|
||||
wrapperClass: 'dhome--boursecu',
|
||||
sections: [
|
||||
{ id: 'assets', visible: true },
|
||||
{ id: 'currentPrice', visible: true },
|
||||
{ id: 'priceChart', visible: true },
|
||||
{ id: 'boursecuQuickActions', visible: true },
|
||||
],
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
import type { HomeQuickActionItem } from '../types'
|
||||
|
||||
export const boursecuQuickActions: HomeQuickActionItem[] = [
|
||||
{
|
||||
id: 'buy',
|
||||
label: 'خرید',
|
||||
icon: 'vuesax-linear:money-receive',
|
||||
route: { name: 'gold', query: { state: 'buy' } },
|
||||
},
|
||||
{
|
||||
id: 'sell',
|
||||
label: 'فروش',
|
||||
icon: 'vuesax-linear:money-send',
|
||||
route: { name: 'gold', query: { state: 'sell' } },
|
||||
},
|
||||
{
|
||||
id: 'wallet',
|
||||
label: 'کیف پول',
|
||||
icon: 'vuesax-linear:wallet-1',
|
||||
route: { name: 'wallet' },
|
||||
},
|
||||
{
|
||||
id: 'transactions',
|
||||
label: 'گزارش',
|
||||
icon: 'vuesax-linear:receipt-item',
|
||||
route: { name: 'transactions' },
|
||||
},
|
||||
{
|
||||
id: 'fund',
|
||||
label: 'دارایی ها',
|
||||
icon: 'vuesax-linear:archive-1',
|
||||
route: { name: 'fund' },
|
||||
},
|
||||
{
|
||||
id: 'shop',
|
||||
label: 'فروشگاه',
|
||||
icon: 'vuesax-linear:coin',
|
||||
route: { name: 'buyProduct' },
|
||||
},
|
||||
]
|
||||
@@ -0,0 +1,12 @@
|
||||
import type { HomeLayoutConfig } from '../types'
|
||||
|
||||
export const defaultHomeLayoutConfig: HomeLayoutConfig = {
|
||||
id: 'default',
|
||||
sections: [
|
||||
{ id: 'currentPrice', visible: true },
|
||||
{ id: 'assets', visible: true },
|
||||
{ id: 'mainActions', visible: true },
|
||||
{ id: 'priceChart', visible: true },
|
||||
{ id: 'banners', visible: true },
|
||||
],
|
||||
}
|
||||
@@ -2,7 +2,6 @@
|
||||
export type HomeLayoutId = 'default' | 'boursecu'
|
||||
|
||||
export type HomeSectionId =
|
||||
| 'limitedPriceAlert'
|
||||
| 'garoosiAssets'
|
||||
| 'mainActions'
|
||||
| 'boursecuQuickActions'
|
||||
|
||||
@@ -42,11 +42,6 @@
|
||||
<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">
|
||||
@@ -505,11 +500,6 @@ 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
|
||||
|
||||
|
||||
@@ -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 ">
|
||||
<img width="30" class="p-1" :src="item.product.group_type=='گوی'?goyImg:mokaabImg">
|
||||
<ProductImage :product="item.product" img-class="p-1 max-h-full max-w-full object-contain" />
|
||||
</div>
|
||||
<div class="text-xs">{{ item?.title }}</div>
|
||||
</div>
|
||||
@@ -38,8 +38,7 @@
|
||||
<script setup lang="ts">
|
||||
import type {Physicalreceive} from "@/models/physicalreceive";
|
||||
import {toJalali} from "../../../../utils/useDateTime";
|
||||
import goyImg from "@/assets/img/goyImg.svg"
|
||||
import mokaabImg from "@/assets/img/mokaabImg.svg"
|
||||
import ProductImage from "@/components/ProductImage.vue";
|
||||
|
||||
interface Prop {
|
||||
item: Physicalreceive
|
||||
|
||||
@@ -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: @theme-primary;
|
||||
color: @theme-primary;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -251,7 +251,7 @@
|
||||
margin-top: 4px;
|
||||
border: none;
|
||||
border-radius: 10px;
|
||||
background: @App-primary-color;
|
||||
background: @theme-primary;
|
||||
color: #fff;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
|
||||
@@ -38,11 +38,6 @@
|
||||
<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">
|
||||
@@ -552,11 +547,6 @@ 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)
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
height: 56px;
|
||||
border-radius: 14px;
|
||||
background: rgba(167, 43, 119, 0.08);
|
||||
color: @App-primary-color;
|
||||
color: @theme-primary;
|
||||
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: @theme-primary;
|
||||
|
||||
&__title {
|
||||
font-size: 16px;
|
||||
|
||||
@@ -44,8 +44,8 @@
|
||||
}
|
||||
|
||||
&--active {
|
||||
background: @App-primary-color;
|
||||
border-color: @App-primary-color;
|
||||
background: @theme-primary;
|
||||
border-color: @theme-primary;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@
|
||||
height: 64px;
|
||||
border-radius: 16px;
|
||||
background: linear-gradient(135deg, #f0f4ff 0%, #e8eeff 100%);
|
||||
color: @App-primary-color;
|
||||
color: @theme-primary;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
@@ -174,8 +174,8 @@
|
||||
|
||||
&--primary {
|
||||
width: 100%;
|
||||
background: @App-primary-color;
|
||||
border-color: @App-primary-color;
|
||||
background: @theme-primary;
|
||||
border-color: @theme-primary;
|
||||
color: #fff;
|
||||
|
||||
&:hover {
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
|
||||
&--active {
|
||||
background: #fff;
|
||||
color: @App-primary-color;
|
||||
color: @theme-primary;
|
||||
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: @theme-primary;
|
||||
color: @theme-primary;
|
||||
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: @theme-primary;
|
||||
color: @theme-primary;
|
||||
}
|
||||
|
||||
&--primary {
|
||||
background: @App-primary-color;
|
||||
border-color: @App-primary-color;
|
||||
background: @theme-primary;
|
||||
border-color: @theme-primary;
|
||||
color: #fff;
|
||||
padding: 10px 16px;
|
||||
|
||||
|
||||
@@ -190,13 +190,6 @@ 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() {
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ export default defineConfig({
|
||||
],
|
||||
theme: {
|
||||
colors: {
|
||||
"primary": "#a72b77",
|
||||
"primary": "var(--app-primary-color, #a72b77)",
|
||||
"secondary": "#ffffff",
|
||||
"tertiary": "#e0be7f"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user