1405/02/19-change style for garoosi

This commit is contained in:
2026-05-09 16:52:43 +03:30
parent 35542bdf9a
commit d8110f024f
3 changed files with 441 additions and 214 deletions
+1 -1
View File
@@ -8,7 +8,6 @@ export {}
declare module 'vue' {
export interface GlobalComponents {
AButton: typeof import('ant-design-vue/es')['Button']
AConfigProvider: typeof import('ant-design-vue/es')['ConfigProvider']
ADivider: typeof import('ant-design-vue/es')['Divider']
AForm: typeof import('ant-design-vue/es')['Form']
AFormItem: typeof import('ant-design-vue/es')['FormItem']
@@ -24,6 +23,7 @@ declare module 'vue' {
ASpin: typeof import('ant-design-vue/es')['Spin']
ASwitch: typeof import('ant-design-vue/es')['Switch']
ATag: typeof import('ant-design-vue/es')['Tag']
ATextarea: typeof import('ant-design-vue/es')['Textarea']
ATooltip: typeof import('ant-design-vue/es')['Tooltip']
BaseDatePicker: typeof import('./src/components/BasicPacks/BaseDatePicker/src/BaseDatePicker.vue')['default']
Basic: typeof import('./src/components/BasicPacks/BaseDatePicker/src/datePick/demo/basic.vue')['default']
+32 -55
View File
@@ -4,11 +4,11 @@
<!-- <div @click="isBuy = false" class="w-full text-center" :class="!isBuy?'text-primary':'text-gray-400'">خرید طلا</div>
<div @click="isBuy = true" class="w-full text-center" :class="isBuy?'text-primary':'text-gray-400'">فروش طلا</div>-->
<div class="flex justify-evenly w-full px-2 h-11 items-center bg-gray-50 relative rounded ">
<div :class="isBuy?'text-secondary':'text-gray-400'" class="w-full text-center z-2"
<div :class="isBuy?'text-tertiary':'text-gray-400'" class="w-full text-center z-2"
@click.stop="setIsBuy(true) ">
خرید طلا {{ props?.ProductItem?.title }}
</div>
<div :class="!isBuy?'text-secondary':'text-gray-400'" class="w-full text-center z-2"
<div :class="!isBuy?'text-tertiary':'text-gray-400'" class="w-full text-center z-2"
@click.stop="setIsBuy(false) ">
فروش طلا {{ props?.ProductItem?.title }}
</div>
@@ -46,17 +46,17 @@
<bg_main />
<div class="z-100 relative">
<a-form-item>
<BasicInput v-model:value="form.goldCash" addon-before="ریال" addon-bg-color="#000000FF"
<BasicInput v-model:value="form.goldCash" addon-before="ریال" :addon-bg-color="useConfigStore().config.color"
addon-text-color="white"
place-holder="ارزش کل"
size="large"
type="price" @onchange="handleGoldCashChange" />
type="price" @onchange="calculateGold" />
</a-form-item>
<a-form-item>
<BasicInput v-model:value="form.goldValue" addon-before="گرم" addon-bg-color="#000000FF"
<a-form-item :rules="[justNumber()]">
<BasicInput v-model:value="form.goldValue" addon-before="گرم" :addon-bg-color="useConfigStore().config.color"
addon-text-color="white"
place-holder="مقدار طلا"
size="large" type="text" input="decimal" @onchange="handleGoldValueChange" />
size="large" type="text" inputmode="decimal" @onchange="calculateCash" />
</a-form-item>
<!-- {{walletStore?.walletInfo?.gold}}-->
<Transition mode="out-in" name="fade">
@@ -182,7 +182,6 @@
<div class="text-xs mr-1">ریال</div>
</div>
</div>
</div>
<BasicButton class="mb-20 mt-5 w-full" type="primary" @click="ok(); confirmAction= false">ثبت نهایی</BasicButton>
</BasicActionSheet>
@@ -208,27 +207,35 @@ import img1 from '@/assets/img/home_ly2.svg'
import { usePrice, usePriceWithoutType } from '@/utils/usePrice'
import BasicInput from '@/components/BasicPacks/BasicInput.vue'
import type { Gold } from '@/models/gold'
import { loading, loadingMore, toFixedDownThreeChar } from '@/utils'
import { isIphone, loading, loadingMore, toFixedDownThreeChar } from '@/utils'
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
import router from '@/router'
import { useWalletStore } from '@/store/walletStore'
import { createOrder } from '@/api/order'
import { message } from 'ant-design-vue'
import type { Price } from '@/models/home'
import { getLastPrice } from '@/api/home'
import Icon from '@/components/BasicPacks/BasicIcon.vue'
import { useUserStore } from '@/store/userStore'
import BasicActionSheet from '@/components/BasicPacks/BasicActionSheet.vue'
import { justNumber } from '@/utils/inputRules'
import GoldSkeleton from '@/views/base/gold/components/GoldSkeleton.vue'
import GoldLoading from '@/components/GoldLoading.vue'
import { update } from 'lodash'
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
import TransactionSkeleton from '@/components/TransactionSkeleton.vue'
import ListAnim from '@/components/ListAnim.vue'
import Item from '@/views/base/wallet/components/Item.vue'
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, getUpPrice, lastPrice, setIntervalGetAllPrice, stopPriceInterval } from '@/utils/price'
import type { Product } from '@/models/products'
import { useFundUserStore } from '@/store/fundStore'
import {debounce} from "lodash";
import {useConfigStore} from "@/store/configStore";
// import Bg_main from "@/components/bg_main.vue";
const infoVisible = ref(false)
const walletStore = useWalletStore()
const userStore = useUserStore()
@@ -247,7 +254,6 @@ interface Prop {
}
const props = withDefaults(defineProps<Prop>(), {})
const isBuy = ref<boolean>(true)
const buyPagination = ref<TableEngineInput>({
@@ -397,53 +403,24 @@ const form = ref<Gold>({
goldValue: undefined,
percentWallet: undefined
})
const persianToEnglish = (str: string | number | undefined): string => {
if (!str) return '';
return str.toString()
.replace(/[۰-۹]/g, (d) => '۰۱۲۳۴۵۶۷۸۹'.indexOf(d).toString())
.replace(/٫/g, '.');
};
function handleGoldCashChange(val: string | number | undefined) {
if (val === undefined || val === null || val === '') {
form.value.goldCash = undefined
return
}
const valStr = val.toString()
const convertedValue = persianToEnglish(valStr)
const numericValue = parseFloat(convertedValue.replace(/,/g, ''))
form.value.goldCash = isNaN(numericValue) ? undefined : numericValue
if (form.value.goldCash !== undefined) {
calculateGold(form.value.goldCash)
}
}
const handleGoldValueChange = debounce( (val: string | number | undefined) => {
if (val === undefined || val === null || val === '') {
form.value.goldValue = undefined
return
}
const valStr = val.toString()
const convertedValue = persianToEnglish(valStr)
const numericValue = parseFloat(convertedValue)
form.value.goldValue = isNaN(numericValue) ? undefined : numericValue
if (form.value.goldValue !== undefined) {
calculateCash(form.value.goldValue)
}
},1500)
const allowedAsciiCodeFloat = [46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57]
const allowedAsciiCodeInt = [48, 49, 50, 51, 52, 53, 54, 55, 56, 57]
watch(() => form.value.goldValue, (newVal) => {
if (newVal !== undefined && newVal !== null && newVal !== '') {
calculateCash(newVal)
watch(form.value, () => {
if (form.value.goldValue) {
const lastCharGoldStr: string = form.value.goldValue.toString()
if (!allowedAsciiCodeFloat.includes(lastCharGoldStr.slice(-1).charCodeAt(0))) {
form.value.goldValue = isNaN(parseFloat(lastCharGoldStr.slice(0, -1))) ? null : parseFloat(lastCharGoldStr.slice(0, -1))
calculateCash(form.value.goldValue)
}
}
})
watch(() => form.value.goldCash, (newVal) => {
if (newVal !== undefined && newVal !== null && newVal !== '') {
calculateGold(newVal)
if (form.value.goldCash) {
const lastCharCashStr: string = form.value.goldCash.toString()
if (!allowedAsciiCodeInt.includes(lastCharCashStr.slice(-1).charCodeAt(0))) {
form.value.goldCash = isNaN(parseFloat(lastCharCashStr.slice(0, -1))) ? null : parseFloat(lastCharCashStr.slice(0, -1))
calculateGold(form.value.goldCash)
}
}
})
onMounted(() => {
@@ -638,7 +615,7 @@ async function ok() {
background: blue;
}*/
.completeButtonStyle .van-dialog__confirm .van-button__content {
background: #000000FF;
background: @App-primary-color;
color: white;
}
+408 -158
View File
@@ -1,19 +1,19 @@
<template>
<div class=" mt-20">
<div class=" mt-20 ">
<!-- <div class="flex gap-7 overflow-x-scroll px-5">
<ProductInventory v-for="item in productInventorys" :ProductItem="item" class="shadow-lg my-5" :key="item.id"></ProductInventory>
</div>-->
<div>
<div
v-if="userStore.userInfo && !loading"
class="bg-white w-screen md:w-auto h-fit px-5 m-[-1px]"
v-if="userStore.userInfo && !loading"
class="bg-white w-screen 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"
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" />
<Icon icon="vuesax-linear:info-circle" size="16"/>
حداقل مبلغ اولیه برای ثبت سفارش
{{ usePriceWithoutType(limitedPrice.value as number ?? 0) }} ریال می باشد.
</div>
@@ -23,8 +23,20 @@
style="touch-action: none" />
</div>-->
<!-- <div class="bg-gradient-to-l mt-3 p-1 shadow-lg from-primary rounded-lg p-px to-transparent ">-->
<div class="mt-3 p-1 shadow-lg from-primary rounded-lg p-px to-transparent">
<div class=" p-2 py-6 rounded-lg bg-tertiary">
<div class=" p-1 shadow-lg from-primary rounded-lg p-px to-transparent" :class="getConfigApp('name')=='garoosi'?'mt-0':'mt-5'">
<div v-if="getConfigApp('name')=='garoosi'" class="flex justify-between px-2 mb-2 ">
<div class="flex gap-1">
<div >دارایی طلایی:</div>
<div class="font-bold">{{ (userStore?.userInfo?.wallet?.count_gold ?? 0).toFixed(3) }}گرم</div>
</div>
<div class="flex gap-1">
<div>دارایی ریالی:</div>
<div class="font-bold">{{
usePriceWithoutType(userStore?.userInfo?.wallet?.count_cash ?? 0)
}}ریال</div>
</div>
</div>
<div class="p-2 py-3 rounded-lg bg-tertiary">
<div class="flex justify-between ">
<!-- <div
class="text-center w-full flex-flex-col items-center home_appear_fade_in_up"
@@ -33,7 +45,7 @@
>
<div
class="rounded-full w-[42px] h-[42px] bg-primary flex items-center justify-center"
style="border: solid 1px #000000FF"
style="border: solid 1px #0A1B37"
>
<Icon class="text-tertiary" icon="vuesax-linear:money-send" />
@@ -41,79 +53,140 @@
<div class="text-primary">فروش</div>
</div>-->
<div
class="text-center w-full flex-flex-col items-center home_appear_fade_in_up"
style="text-align: -webkit-center"
@click="router.push({ name: 'buyProduct' })"
class="text-center w-full flex-flex-col items-center home_appear_fade_in_up"
style="text-align: -webkit-center"
@click="router.push({ name: 'buyProduct' })"
>
<div
class="rounded-full w-[50px] h-[50px] bg-primary flex items-center justify-center"
style="border: solid 1px #000000FF"
class="rounded-full w-[50px] h-[50px] bg-primary flex items-center justify-center"
style="border: solid 1px #0A1B37"
>
<Icon class="text-tertiary" icon="vuesax-linear:money-receive" />
<Icon class="text-tertiary" icon="vuesax-linear:money-receive"/>
</div>
<div class="text-primary">خرید و فروش</div>
</div>
<div
class="text-center w-full flex-flex-col items-center home_appear_fade_in_down"
style="text-align: -webkit-center"
@click="router.push({ name: 'wallet', query: { state: 'deposit' } })"
class="text-center w-full flex-flex-col items-center home_appear_fade_in_down"
style="text-align: -webkit-center"
@click="router.push({ name: 'wallet', query: { state: 'deposit' } })"
>
<div
class="rounded-full w-[50px] h-[50px] bg-primary flex items-center justify-center"
style="border: solid 1px #000000FF"
class="rounded-full w-[50px] h-[50px] bg-primary flex items-center justify-center"
style="border: solid 1px #0A1B37"
>
<Icon class="text-tertiary" icon="vuesax-linear:card-add" />
<Icon class="text-tertiary" icon="vuesax-linear:card-add"/>
</div>
<div class="text-primary">واریز نقدی</div>
<div v-if="getConfigApp('name')=='garoosi'" class="text-primary">واریز و برداشت</div>
<div v-else class="text-primary">واریز نقدی</div>
</div>
<div
class="text-center w-full flex-flex-col items-center home_appear_fade_in_up"
style="text-align: -webkit-center"
@click="openWholeBalanceVisible()"
class="text-center w-full flex-flex-col items-center home_appear_fade_in_up"
style="text-align: -webkit-center"
@click="openWholeBalanceVisible()"
>
<div
class="rounded-full w-[50px] h-[50px] bg-primary flex items-center justify-center "
style="border: solid 1px #000000FF"
class="rounded-full w-[50px] h-[50px] bg-primary flex items-center justify-center "
style="border: solid 1px #0A1B37"
>
<Icon class="text-tertiary" icon="vuesax-linear:receipt-item" />
<Icon class="text-tertiary" icon="vuesax-linear:receipt-item"/>
</div>
<div class="text-primary">موجودی</div>
</div>
<div
class="text-center w-full flex-flex-col items-center home_appear_fade_in_down"
style="text-align: -webkit-center"
@click="router.push({ name: 'fund' })"
<div v-if="getConfigApp('name')=='garoosi'"
class="text-center w-full flex-flex-col items-center home_appear_fade_in_down"
style="text-align: -webkit-center"
@click="shareCode()"
>
<div
class="rounded-full w-[50px] h-[50px] bg-primary flex items-center justify-center"
style=" border: solid 1px #000000FF"
class="rounded-full w-[50px] h-[50px] bg-primary flex items-center justify-center"
style=" border: solid 1px #0A1B37"
>
<Icon class="text-tertiary font-bold" icon="vuesax-linear:cup" />
<Icon class="text-tertiary font-bold" icon="vuesax-linear:share"/>
</div>
<div class="text-primary">دعوت از دوستان</div>
</div>
<div v-else
class="text-center w-full flex-flex-col items-center home_appear_fade_in_down"
style="text-align: -webkit-center"
@click="router.push({ name: 'fund' })"
>
<div
class="rounded-full w-[50px] h-[50px] bg-primary flex items-center justify-center"
style=" border: solid 1px #0A1B37"
>
<Icon class="text-tertiary font-bold" icon="vuesax-linear:cup"/>
</div>
<div class="text-primary">دارایی ها</div>
</div>
</div>
</div>
<!-- <ADivider></ADivider>-->
<div>
<!-- <div @click="router.push({ name: 'fund' })">-->
<div class="bg-primary rounded-lg p-2 py-6 mt-2">
<div v-if="getConfigApp('name')=='garoosi'" class="bg-primary rounded-lg p-2 py-1 mt-2">
<div class="p-2">
<div
v-if="userStore.userInfo?.referral_id"
class="text-tertiary font-bold w-full text-center flex justify-between gap-2 items-center"
>
کد معرف:
<div class="flex gap-2">
<div class="mr-2">{{ userStore.userInfo?.referral_id }}</div>
<!-- <BasicIcon icon="vuesax-linear:copy" color="#2563EB" class="cursor-pointer" size="18"
@click.stop="copyCode()" />
&lt;!&ndash; vuesax-linear:hierarchy-3&ndash;&gt;
<BasicIcon icon="vuesax-linear:share" color="#2563EB" class="cursor-pointer" size="18"
@click.stop="shareCode()" />-->
</div>
</div>
<div class="w-full flex gap-2 mt-1">
<BasicButton
icon="vuesax-linear:share"
size="small"
class="flex-1 !bg-primary !border-tertiary !text-tertiary "
icon-size="18"
@click.stop="shareCode()"
>
{{ getConfigApp('name') == 'garoosi' ? 'دعوت از دوستان' : ' اشتراک گذاری' }}
</BasicButton>
<BasicButton
icon="vuesax-linear:copy"
size="small"
class="flex-1 !bg-primary !border-tertiary !text-tertiary"
icon-size="18"
@click.stop="copyCode()"
>
رونوشت
</BasicButton>
</div>
</div>
</div>
<div v-else class="bg-primary rounded-lg p-2 py-3 mt-2">
<div class="flex justify-center text-tertiary w-full z-20">
محصولات:
<div class="text-l mr-2 font-bold">{{ userStore?.userInfo?.wallet?.count_product ?? 0}}عدد</div>
<div class="text-l mr-2 font-bold">{{ userStore?.userInfo?.wallet?.count_product ?? 0 }}عدد</div>
</div>
<div class="flex mt-2 justify-center text-tertiary w-full z-20">
دارایی طلایی:
<div class="text-l mr-2 font-bold">{{ (userStore?.userInfo?.wallet?.count_gold ?? 0).toFixed(3)}}گرم</div>
<BasicIcon @click="openGoldModal" icon="vuesax-linear:info-circle" size="18" color="orange" />
<div class="text-l mr-2 font-bold">{{ (userStore?.userInfo?.wallet?.count_gold ?? 0).toFixed(3) }}گرم
</div>
<BasicIcon @click="openGoldModal" icon="vuesax-linear:info-circle" size="18" color="tertiary"/>
</div>
<div class="flex mt-2 justify-center text-tertiary w-full z-20">
دارایی ریالی:
<div class="text-l mr-2 font-bold">{{ usePriceWithoutType(userStore?.userInfo?.wallet?.count_cash ?? 0) }}ریال</div>
<BasicIcon @click="openRialModal" icon="vuesax-linear:info-circle" size="18" color="orange" />
<div class="text-l mr-2 font-bold">{{
usePriceWithoutType(userStore?.userInfo?.wallet?.count_cash ?? 0)
}}ریال
</div>
<BasicIcon @click="openRialModal" icon="vuesax-linear:info-circle" size="18" color="tertiary"/>
</div>
</div>
<!-- <div class="flex justify-center mt-2 w-full z-20">
@@ -184,13 +257,16 @@
</div>
</div>-->
</div>
<div v-if="userStore.getValueByKey('closed_message') && lastPrice?.goldir==0 "
class="bg-red-50 text-red-600 text-center font-500 py-4 px-2 mt-2 rounded-lg "
v-html="userStore.getValueByKey('closed_message')"
></div>
<div
class="w-full relative mt-5 border-gray-200 border-1 rounded-lg h-[88px] flex flex-col justify-center home_appear_fade_in"
class="w-full relative mt-2 border-gray-200 border-1 rounded-lg py-3 flex flex-col justify-center home_appear_fade_in"
>
<div class="w-full items-center flex flex-col">
<div class="text-gray-600">قیمت خرید از بذر طلا</div>
<div v-if="price" class="flex gap-1 mt-3 text-xs items-center">
<div class="w-full items-center flex justify-center">
<div class="text-gray-600 text-[12px] ml-2">قیمت خرید از {{ useConfigStore().config.name_fa }}</div>
<div v-if="price" class="flex gap-1 text-xs items-center">
<!-- <div id="odometer" class="font-bold text-2xl odometer animated fadeIn">
&lt;!&ndash; {{ usePriceWithoutType(useCounterAnim(price.price_last) ?? 0) }}&ndash;&gt;
</div>-->
@@ -205,18 +281,44 @@
</div>
</div>
<Vue3Odometer
:value="goldVal"
class="o-text !text-2xl font-bold"
style="font-family: iran-sans; direction: ltr"
v-if="key % 2 === 0"
:value="goldVal"
class="o-text !text-xl font-bold"
style="font-family: iran-sans; direction: ltr"
v-if="key % 2 === 0"
/>
ریال
</div>
</div>
</div>
<div class="flex mt-5 gap-1 bg-primary text-[#CEA34C] font-bold justify-center rounded-lg py-5"
@click="router.push({ name: 'buyProduct', query: { cat: 'coin'} })">
<div>خرید و فروش</div>
<!-- <div class="flex mt-5 gap-1 bg-primary text-tertiary cursor-pointer font-bold justify-center rounded-lg py-5"
@click="router.push({ name: 'buyProduct' })">
<div>خرید و فروش</div>
</div>-->
<div
v-if="config.config.name === 'garoosi' && banners?.length > 0"
class="w-full relative mt-2 flex flex-col justify-center home_appear_fade_in overflow-hidden rounded-lg"
>
<div class="w-full aspect-[2.8/1] min-h-[10rem] max-h-[14rem]">
<swiper
:modules="bannerSwiperModules"
:slides-per-view="1"
:space-between="6"
:autoplay="{ delay: 4000, disableOnInteraction: false }"
:pagination="{ clickable: true }"
class="banner-swiper h-full w-full rounded-lg"
>
<swiper-slide v-for="(banner, index) in banners" :key="index" class="!h-full">
<img
v-if="banner.show"
class="banner-img w-full h-full object-cover rounded-lg block"
:src="banner.icon"
:alt="banner.caption || ''"
@click="handleBannerClick(banner)"
:style="(banner.link || banner.typeClick=='share') ? 'cursor: pointer;' : ''"
/>
</swiper-slide>
</swiper>
</div>
</div>
@@ -245,16 +347,16 @@
</a-radio-group>
<div id="chart-timeline">
<apexchart
type="area"
height="200"
ref="chart"
:options="priceChartOptions"
:series="priceChartSeries"
type="area"
height="200"
ref="chart"
:options="priceChartOptions"
:series="priceChartSeries"
></apexchart>
</div>
</div>
</div>
<div class=" w-full flex justify-evenly rounded-lg py-2 home_appear_fade_in mt-6 pb-25">
<div class=" w-full flex justify-evenly rounded-lg py-2 home_appear_fade_in mt-6 pb-45">
<div class="text-center w-full">
<div>بالاترین قیمت امروز</div>
<div v-if="lastPrice" class="flex flex-col items-center mt-3">
@@ -264,7 +366,7 @@
</div>
</div>
</div>
<a-divider class="bg-gray-200 !h-auto !my-2" type="vertical" />
<a-divider class="bg-gray-200 !h-auto !my-2" type="vertical"/>
<div class="text-center w-full">
<div>پایین ترین قیمت امروز</div>
<div class="flex w-full mt-3 justify-evenly">
@@ -280,16 +382,16 @@
</div>
<div v-else class="bg-white w-screen md:w-auto h-[80vh] px-5 m-[-1px] flex justify-center ">
<HomeSkeleton class="w-full" />
<HomeSkeleton class="w-full"/>
</div>
<!-- <div class="relative pt-15 overflow-hidden ">-->
<!-- <div class="absolute left&#45;&#45;12 top-0">-->
<!-- <img :src="image">-->
<!-- </div>-->
<!-- <div class="bg-primary pb-30"-->
<!-- style="background: linear-gradient(to bottom, #fff,#fff, #000000FF, #000000FF);"-->
<!-- style="background: linear-gradient(to bottom, #fff,#fff, #0A1B37, #0A1B37);"-->
<!-- >-->
<!-- <div class=" text-tertiary text-2xl pt-6 pr-5 pl-50" style="font-size: 26px;font-weight: 600; color: #000000FF" >ارسال کالا بعد از ثبت سفارش</div>-->
<!-- <div class=" text-tertiary text-2xl pt-6 pr-5 pl-50" style="font-size: 26px;font-weight: 600; color: #0A1B37" >ارسال کالا بعد از ثبت سفارش</div>-->
<!-- <div class="pr-5 pl-8 pt-10 text-tertiary ">میتوانید با خرید محصولات بعد از ثبت سفارش درخواست ارسال را-->
<!-- ثبت کرده و زیر 24 ساعت خرید خود را دریافت کنید-->
<!-- </div>-->
@@ -297,27 +399,27 @@
<!-- </div>-->
</div>
<div
:class="y > 50 ? 'bg-white shadow opacity-95' : ''"
class="px-4 py-2 top-0 z-5 wrap-fix background-color-transition"
:class="y > 50 ? 'bg-white shadow opacity-95' : ''"
class="px-4 py-2 top-0 z-5 wrap-fix background-color-transition"
>
<div class="flex justify-between my-2">
<div class="flex items-center gap-2" @click.stop="router.push({ name: 'user' })">
<!-- <img :src="testimg" alt="" class="w-[24px] h-[24px]">-->
<div
class="z-100000 rounded-full border-1"
:class="y > 50 ? 'text-primary border-primary' : 'text-primary border-primary'"
class="z-100000 rounded-full border-1"
:class="y > 50 ? 'text-primary border-primary' : 'text-primary border-primary'"
>
<Icon icon="vuesax-linear:user" size="20" />
<Icon icon="vuesax-linear:user" size="20"/>
</div>
<div :class="y > 50 ? 'text-primary' : 'text-primary'" class="color-transition font-bold">
{{ userStore.userInfo?.name }}
</div>
</div>
<Icon
:color="y > 50 ? '#000000FF' : '#000000FF'"
class="color-transition"
icon="vuesax-linear:logout"
@click="showLogoutConfirm = true"
:color="y > 50 ? '#0A1B37' : '#0A1B37'"
class="color-transition"
icon="vuesax-linear:logout"
@click="showLogoutConfirm = true"
/>
</div>
</div>
@@ -329,9 +431,9 @@
<template v-slot:title>
<div class="flex flex-col items-center">
<DotLottieVue
class="w-11rem h-11rem"
autoplay
src="https://lottie.host/129cf3a1-df84-4758-a856-58c133ae6013/R5RqclXA8G.json"
class="w-11rem h-11rem"
autoplay
src="https://lottie.host/129cf3a1-df84-4758-a856-58c133ae6013/R5RqclXA8G.json"
/>
<div class="p-5 text-sm">آیا از خروج خود اطمینان دارید؟</div>
</div>
@@ -352,12 +454,12 @@
<div class="h-30vh overflow-y-auto">
<div class="mt-5">
<BasicInfoItem
class="flex justify-between"
title="مجموعه کل دارایی طلایی"
is-line
:info="`در این قسمت مجموع کل وزن طلای آبشده (${(walletStore.walletInfo?.gold ?? 0)?.toFixed(3)}) + ارزش دارایی ها (${(walletStore.walletInfo?.treasure_sum ?? 0)?.toFixed(3)} ) را مشاهده میفرمایید.`"
infoHead="مجموع کل دارایی طلایی"
:value="parseFloat((walletStore.walletInfo?.gold_sum ?? 0).toFixed(2)) + ' گرم'"
class="flex justify-between"
title="مجموعه کل دارایی طلایی"
is-line
:info="`در این قسمت مجموع کل وزن طلای آبشده (${(walletStore.walletInfo?.gold ?? 0)?.toFixed(3)}) + ارزش دارایی ها (${(walletStore.walletInfo?.treasure_sum ?? 0)?.toFixed(3)} ) را مشاهده میفرمایید.`"
infoHead="مجموع کل دارایی طلایی"
:value="parseFloat((walletStore.walletInfo?.gold_sum ?? 0).toFixed(2)) + ' گرم'"
/>
<!-- <a-divider class="!my-1" />
<BasicInfoItem
@@ -373,28 +475,45 @@
is-line
:value="parseFloat((walletStore.walletInfo?.treasure_sum ?? 0)?.toFixed(3)) + ' گرم'"
/>-->
<a-divider class="!my-1" />
<a-divider class="!my-1"/>
<BasicInfoItem
class="flex justify-between"
title="دارایی کیف پول ریالی"
is-line
:value="usePrice(walletStore.walletInfo?.count_cash ?? 0)"
class="flex justify-between"
title="دارایی کیف پول ریالی"
is-line
:value="usePrice(walletStore.walletInfo?.cash ?? 0)"
/>
<a-divider class="!my-1" />
<a-divider class="!my-1"/>
<BasicInfoItem
class="flex justify-between"
title="دارایی کیف پول طلایی"
is-line
:value="(walletStore.walletInfo?.count_gold ?? 0) + ' گرم'"
class="flex justify-between"
title="دارایی کیف پول طلایی"
is-line
:value="(walletStore.walletInfo?.count_gold_wallet ?? 0) + ' گرم'"
/>
<a-divider class="!my-1" />
<a-divider class="!my-1"/>
<BasicInfoItem
class="flex justify-between"
title="دارایی کیف پول نقره"
is-line
:value="(walletStore.walletInfo?.count_silver ?? 0) + ' گرم'"
v-if="nameProject === 'goldsun'"
class="flex justify-between"
title="دارایی کیف پول نقره"
is-line
:value="(walletStore.walletInfo?.count_silver ?? 0) + ' گرم'"
/>
<a-divider class="!my-1" />
<a-divider v-if="nameProject === 'goldsun'" class="!my-1"/>
<BasicInfoItem
v-if="nameProject === 'goldsun'"
class="flex justify-between"
title="دارایی کیف پول مس"
is-line
:value="(walletStore.walletInfo?.count_copper ?? 0) + ' گرم'"
/>
<a-divider v-if="nameProject === 'goldsun'" class="!my-1"/>
<BasicInfoItem
class="flex justify-between"
title="معادل ریالی مجموع دارایی ها"
is-line
:value="usePrice(walletStore.walletInfo?.count_cash_total ?? 0)"
/>
<a-divider class="!my-1"/>
<!-- <BasicInfoItem class="flex justify-between" title="دارایی کیف پول(به گرم)" is-line
:value="((walletStore.walletInfo?.cash?? 0) / (goldVal?? 0)).toFixed(2)+ ' گرم'" />
<a-divider class="!my-1" />-->
@@ -410,47 +529,76 @@
).toFixed(0)
)
"
/>
<a-divider class="!my-1" />-->
<BasicInfoItem
class="flex justify-between"
title="ارزش کل دارایی ریالی شما"
is-line
:value="
usePrice(
(walletStore.walletInfo?.count_cash_total ?? 0).toFixed(0)
)
"
/>
/>-->
</div>
</div>
</div>
</div>
</BasicActionSheet>
<BasicModal v-model:visible="showTextBanner" :custom-footer="true" destroyOnClose="true">
<div class="max-h-[54vh]">
<div class="w-full ql-editor " v-html="TextBanner">
</div>
</div>
</BasicModal>
<BasicModal v-model:visible="showShare" :custom-footer="true">
<div class="p-2">
<div
v-if="userStore.userInfo?.referral_id"
class="text-primary font-bold w-full text-center flex justify-between gap-2 items-center"
>
کد معرف:
<div class="flex gap-2">
<div class="mr-2">{{ userStore.userInfo?.referral_id }}</div>
<!-- <BasicIcon icon="vuesax-linear:copy" color="#2563EB" class="cursor-pointer" size="18"
@click.stop="copyCode()" />
&lt;!&ndash; vuesax-linear:hierarchy-3&ndash;&gt;
<BasicIcon icon="vuesax-linear:share" color="#2563EB" class="cursor-pointer" size="18"
@click.stop="shareCode()" />-->
</div>
</div>
<div class="w-full flex gap-2 mt-1">
<BasicButton
icon="vuesax-linear:share"
size="small"
class="flex-1"
icon-size="18"
@click.stop="shareCode()"
>
{{ getConfigApp('name') == 'garoosi' ? 'دعوت از دوستان' : ' اشتراک گذاری' }}
</BasicButton>
<BasicButton
icon="vuesax-linear:copy"
size="small"
class="flex-1"
icon-size="18"
@click.stop="copyCode()"
>
رونوشت
</BasicButton>
</div>
</div>
</BasicModal>
</template>
<script lang="tsx" setup>
import img from '@/assets/img/home_ly1.svg'
import img1 from '@/assets/img/home_ly2.svg'
import Icon from '@/components/BasicPacks/BasicIcon.vue'
import { usePrice, usePriceWithoutType, useTowDecimal } from '../../../utils/usePrice'
import {computed, createVNode, onMounted, onUnmounted, ref, watch, watchEffect} from 'vue'
import {usePrice, usePriceWithoutType, useTowDecimal} from '../../../utils/usePrice'
import {computed, onMounted, onUnmounted, ref, watch} from 'vue'
import router from '@/router'
import * as echarts from 'echarts'
import { useIntersectionObserver, useWindowScroll } from '@vueuse/core'
import { loading, removeToken } from '@/utils'
import { useUserStore } from '@/store/userStore'
import { useWalletStore } from '@/store/walletStore'
import {useIntersectionObserver, useWindowScroll} from '@vueuse/core'
import {loading, removeToken} from '@/utils'
import {useUserStore} from '@/store/userStore'
import {useWalletStore} from '@/store/walletStore'
import DialogVant from '@/components/DialogVant.vue'
import type { Price } from '@/models/home'
import { getAllPrices, getChart, getLastPrice, getPrice } from '@/api/home'
// import odometer from 'odometer/odometer'
import {getAllPrices, getChart} from '@/api/home'
import Vue3Odometer from 'vue3-odometer'
import 'odometer/themes/odometer-theme-default.css'
import 'quill/dist/quill.core.css';
import HomeSkeleton from '@/views/base/home/components/HomeSkeleton.vue'
import { toJalaliNotime } from '@/utils/useDateTime'
import {
getLastPrices,
getUpPrice,
@@ -460,36 +608,34 @@ import {
setIntervalGetAllPrice,
stopPriceInterval
} from '@/utils/price'
import { DotLottieVue } from '@lottiefiles/dotlottie-vue'
import {DotLottieVue} from '@lottiefiles/dotlottie-vue'
import BasicActionSheet from '@/components/BasicPacks/BasicActionSheet.vue'
import BasicInfoItem from '@/components/BasicPacks/BasicInfoItem.vue'
import MySlider from '@/views/base/wallet/components/mySlider/MySlider.vue'
import type { Card, PWallet, Wallet } from '@/models/wallet'
import { getActivatedCards } from '@/api/wallet'
import banner1 from '@/assets/img/banner/banner1.png'
import banner2 from '@/assets/img/banner/banner2.png'
import image from '@/assets/img/image.svg'
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
import ProductInventory from '@/views/base/home/components/ProductInventory.vue'
import type { PInventory, Product } from '@/models/products'
import { getProductInventory } from '@/api/products'
import type { Fund } from '@/models/fund'
import type { TableOutput } from '@/models/table'
import { useFundUserStore } from '@/store/fundStore'
import {Modal} from "ant-design-vue";
import {ExclamationCircleOutlined} from "@ant-design/icons-vue";
import {message} from "ant-design-vue/es";
import type {PInventory} from '@/models/products'
import type {Fund} from '@/models/fund'
import type {TableOutput} from '@/models/table'
import {useFundUserStore} from '@/store/fundStore'
import {message, Modal} from "ant-design-vue";
import {useConfigStore} from "@/store/configStore";
import {Swiper, SwiperSlide} from 'swiper/vue'
import {Autoplay, Pagination} from 'swiper/modules'
import 'swiper/swiper-bundle.css'
import 'swiper/css/pagination'
import {getConstByKey} from '@/api/const'
import type {IBenefits} from "@/models/banner";
import BasicModal from "@/components/BasicPacks/BasicModal.vue";
import {getConfigApp} from "@/utils/config";
import BasicButton from "@/components/BasicPacks/BasicButton.vue";
const bannerSwiperModules = [Autoplay, Pagination]
const nameProject = useConfigStore().config.name
const userStore = useUserStore()
const walletStore = useWalletStore()
const chartLoading = ref<boolean>(false)
const wholeBalanceVisible = ref<boolean>(false)
const { x, y } = useWindowScroll()
const series = ref<Chart[]>([{ data: [] }])
const {x, y} = useWindowScroll()
const series = ref<Chart[]>([{data: []}])
const key = ref<number>(0)
const cardItems = [banner1, banner2]
const main = ref(null)
const logoutLoading = ref(false)
const productInventorys = ref<PInventory[] | undefined>()
@@ -499,6 +645,36 @@ const tableOutput = ref<TableOutput<Fund> | null>(null)
const inventory = ref<number>(0)
const sumGold = ref<number>(0)
const fundStore = useFundUserStore()
const config = useConfigStore()
const showTextBanner = ref<boolean>(false)
const showShare = ref<boolean>(false)
const TextBanner = ref<string>('')
function shareCode() {
// nextTick(() => {
const val = `⭐️الان طلا بخر؛ آخر ماه سودشو ببر!
با خرید طلای آبشده در مقدارهای کم ولی مستمر، سود بیشتری ببر!
این دعوت نامه از طرف "${userStore.userInfo?.name}" عزیز برای شما ارسال شده تا شما هم از بازار طلای ${nameProject} جا نمونید.
روی لینک زیر کلیک کنید و ثبت نام خود را تکمیل کنید.
${window.location.hostname}/login?id=${userStore.userInfo?.referral_id}`
navigator.share({
title: nameProject,
text: val
})
// message.info('کد رونوشت شد')
// })
}
function copyCode() {
// nextTick(() => {
const val = userStore.userInfo?.referral_id
console.log(val)
navigator.clipboard.writeText(val)
message.info('کد رونوشت شد')
// })
}
async function initTable() {
try {
@@ -512,16 +688,67 @@ async function initTable() {
}
}
const banners = ref<Array<IBenefits>>([])
async function initBanners() {
try {
const response = await getConstByKey('header_banner')
if (response == null) return
let list: Array<{ icon: string; show: boolean; caption: string | null; link: string | null }> = []
// پاسخ مستقیم به‌صورت رشتهٔ JSON
if (typeof response === 'string') {
list = JSON.parse(response)
}
// پاسخ شیء با فیلد value (یک Const تکی)
else if (typeof response === 'object' && !Array.isArray(response) && 'value' in response) {
const val = (response as { value: string | unknown }).value
list = typeof val === 'string' ? JSON.parse(val) : (val as typeof list)
}
// پاسخ آرایهٔ Const با فیلد value
else if (Array.isArray(response) && response.length > 0) {
const first = response[0] as { value?: string | unknown; icon?: string }
if (first.value !== undefined && first.value !== null) {
list = typeof first.value === 'string' ? JSON.parse(first.value) : (first.value as typeof list)
} else if (first.icon !== undefined) {
list = response as typeof list
}
}
banners.value = Array.isArray(list) ? list.filter((banner: any) => banner.show === true) : []
} catch (e) {
console.log('Error loading banners:', e)
}
}
function handleBannerClick(banner: IBenefits) {
if (banner.typeClick == 'share') {
showShare.value = true
return;
}
if (banner.typeClick == 'modal') {
if (!banner.modalText) return
TextBanner.value = banner.modalText
showTextBanner.value = true
return;
}
if (banner.typeClick == 'link') {
if (!banner.link) return
if (banner.link.startsWith('http://') || banner.link.startsWith('https://')) {
window.open(banner.link, '_blank')
} else {
router.push(banner.link)
}
}
}
onUnmounted(() => {
stopPriceInterval()
})
/*
onMounted(() => {
animateNum(2)
})
*/
const goldVal = ref<number | undefined>()
function openWholeBalanceVisible() {
@@ -550,7 +777,7 @@ const targetIsVisible = ref(false)
const isHidden = ref<boolean>(false)
const { stop } = useIntersectionObserver(target, ([{ isIntersecting }], observerElement) => {
const {stop} = useIntersectionObserver(target, ([{isIntersecting}], observerElement) => {
targetIsVisible.value = isIntersecting
console.log('saaaaa', targetIsVisible.value)
})
@@ -688,7 +915,7 @@ const priceChartOptions = ref({
show: false
}
},
colors: ['#000000FF'],
colors: [config.config.color],
fill: {
type: 'gradient',
gradient: {
@@ -778,7 +1005,7 @@ async function initPrice() {
goldVal.value = 0
// console.log(price?.value.price_last)
if (userStore.isFirst) {
const timer = setInterval(function() {
const timer = setInterval(function () {
update()
// if (current == end) {
userStore.isFirst = false
@@ -826,6 +1053,7 @@ onMounted(async () => {
// await initChart()
await initPrice()
await fetchPrices()
await initBanners()
update()
} catch (e) {
console.log(e)
@@ -836,7 +1064,6 @@ onMounted(async () => {
onUnmounted(() => {
stopPriceInterval()
// console.log('okhome')
})
@@ -850,7 +1077,7 @@ async function logout() {
/* userStore.$reset()
walletStore.$reset()*/
removeToken()
await router.push({ name: 'login' })
await router.push({name: 'login'})
logoutLoading.value = true
window.location.reload()
// console.log('salam')
@@ -862,16 +1089,16 @@ async function openGoldModal() {
title: `در این قسمت مجموع کل وزن طلای آبشده (${(walletStore.walletInfo?.gold ?? 0)?.toFixed(3)}) + ارزش دارایی ها (${(walletStore.walletInfo?.count_gold_wallets ?? 0)?.toFixed(3)} ) را مشاهده میفرمایید.`,
okText: 'متوجه شدم',
centered: true,
cancelButtonProps: { style: { display: 'none' } },
cancelButtonProps: {style: {display: 'none'}},
})
}
async function openRialModal() {
Modal.confirm({
title: `در این قسمت مجموع کیف پول ریالی (${usePrice(walletStore?.walletInfo?.count_cash_wallet ?? 0) }) + معادل ریالی محصولات (${ usePrice(walletStore?.walletInfo?.count_cash_wallets ?? 0)} ) را مشاهده میفرمایید.`,
title: `در این قسمت مجموع کیف پول ریالی (${usePrice(walletStore?.walletInfo?.count_cash_wallet ?? 0)}) + معادل ریالی محصولات (${usePrice(walletStore?.walletInfo?.count_cash_wallets ?? 0)} ) را مشاهده میفرمایید.`,
okText: 'متوجه شدم',
centered: true,
cancelButtonProps: { style: { display: 'none' } },
cancelButtonProps: {style: {display: 'none'}},
})
}
</script>
@@ -904,6 +1131,29 @@ apexchart {
padding: 0 !important;
margin: 0 !important;
}
/* بنر اسلایدر — ظاهر و نقطه‌های pagination مشابه نمونه */
.banner-swiper {
--swiper-pagination-bottom: 0.75rem;
.swiper-slide {
display: flex;
align-items: center;
justify-content: center;
}
.swiper-pagination-bullet {
width: 0.5rem;
height: 0.5rem;
background: rgba(0, 0, 0, 0.35);
opacity: 1;
transition: background 0.2s;
}
.swiper-pagination-bullet-active {
background: #fff;
}
}
</style>
<script setup lang="ts">