Merge remote-tracking branch 'origin/main'

# Conflicts:
#	src/views/login/components/Register.vue
This commit is contained in:
2026-02-09 13:47:56 +03:30
18 changed files with 250 additions and 110 deletions
+3 -3
View File
@@ -17,7 +17,7 @@
right: 20px; right: 20px;
width: 60px; width: 60px;
height: 60px; height: 60px;
background-color: #25D366; background-color: #ffffff;
border-radius: 50%; border-radius: 50%;
display: flex; display: flex;
justify-content: center; justify-content: center;
@@ -42,8 +42,8 @@
<body> <body>
<div id="app"></div> <div id="app"></div>
<script type="module" src="/src/main.ts"></script> <script type="module" src="/src/main.ts"></script>
<a href="https://wa.me/989390624220" target="_blank" id="whatsapp-button"> <a href="https://web.rubika.ir/#c=u0I8F1U0a939b0df5ba9f73618d33d7c" target="_blank" id="whatsapp-button">
<img class="p-2" src="/whatsapp.png" alt="" /> <img class="p-2" src="/src/assets/img/rubika.webp" alt="" />
</a> </a>
</body> </body>
</html> </html>
Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

+3 -3
View File
@@ -73,8 +73,8 @@ function goToLogin(to: RouteLocationNormalized, next: NavigationGuardNext) {
} }
function goToHome(to: RouteLocationNormalized, next: NavigationGuardNext) { function goToHome(to: RouteLocationNormalized, next: NavigationGuardNext) {
if (to.name !== 'home') { if (to.name !== 'buyProduct') {
return next({ name: 'home' }) // Redirect to login return next({ name: 'buyProduct' }) // Redirect to login
} else { } else {
return next() // If already on the login page, don't redirect return next() // If already on the login page, don't redirect
} }
@@ -151,7 +151,7 @@ router.beforeEach(async (to, from, next) => {
if (fingerPosition) { if (fingerPosition) {
if (getToken()) { if (getToken()) {
if (to.name === 'login') { if (to.name === 'login') {
return next({ name: from.name || 'home' }) // Redirect to home if trying to access login after authentication return next({ name: from.name || 'buyProduct' }) // Redirect to home if trying to access login after authentication
} }
return next() // Proceed to the intended route return next() // Proceed to the intended route
} else { } else {
+1
View File
@@ -26,6 +26,7 @@ export interface Product {
description: string description: string
wallet: Wallet wallet: Wallet
similar?:Product[] similar?:Product[]
inventory:number
} }
export interface PInventory { export interface PInventory {
+44
View File
@@ -169,6 +169,39 @@ const checkNumber = async (_rule: Rule, value: number) => {
return Promise.resolve() return Promise.resolve()
} }
}
const checkNumber2 = async (_rule: Rule, value: number) => {
if (!value) {
return Promise.reject('تعداد محصول را مشخص کنید')
}
if (value % 1 !== 0) {
return Promise.reject('استفاده از اعداد اعشاری مجاز نمی باشد')
}
if (isBuyP) {
// Skip wallet balance check if gateway is enabled
if (!gatewayP && isToken()) {
// if (!walletCash?.walletInfo?.cash && methodP == 'cash') {
// return Promise.reject('موجودی کیف پول ناکافی است')
// }
// if (!walletCash?.walletInfo?.gold && methodP == 'gold') {
// return Promise.reject('موجودی کیف طلا ناکافی است')
// }
// if (priceP * value > walletCash?.walletInfo?.cash && methodP == 'cash')
// return Promise.reject('موجودی کیف پول ناکافی است')
// if (amountP * value > walletCash?.walletInfo?.gold && methodP == 'gold')
// return Promise.reject('موجودی کیف طلا ناکافی است')
}
return Promise.resolve()
} else {
if (value > NumP)
return Promise.reject('موجودی محصول ناکافی است')
else
return Promise.resolve()
}
} }
export const justNumber2 = (price: number, method?: string, amount?: number, isBuy?: boolean, gateway?: boolean) => { export const justNumber2 = (price: number, method?: string, amount?: number, isBuy?: boolean, gateway?: boolean) => {
priceP = price priceP = price
@@ -193,6 +226,17 @@ export const justNumber3 = (price: number, Num?: number, isBuy?: boolean) => {
trigger: 'change' trigger: 'change'
} }
}
export const justNumber4 = (price: number, Num?: number, isBuy?: boolean) => {
priceP = price
NumP = Num
isBuyP = isBuy
return {
required: true,
validator: checkNumber2,
trigger: 'change'
}
} }
export const ruleNumber = () => { export const ruleNumber = () => {
+4 -4
View File
@@ -66,12 +66,12 @@
</div> </div>
</div> </div>
</div> </div>
<div class="wrap-fix bottom-0 px-10 py-6 flex gap-2 bg-white"> <div class="wrap-fix bottom-0 px-10 py-6 flex gap-2 bg-white items-center">
<a class="w-full" href="tel:09128081392"> <a class="w-full" href="https://web.rubika.ir/#c=u0I8F1U0a939b0df5ba9f73618d33d7c">
<BasicButton class="w-full" type="primary">تماس با پشتیبانی</BasicButton> <BasicButton class="w-full" type="primary">تماس با پشتیبانی</BasicButton>
</a> </a>
<a href="https://t.me/ghatreh"> <a href="https://web.rubika.ir/#c=u0I8F1U0a939b0df5ba9f73618d33d7c">
<img src="@/assets/img/telegram.png" alt="" class="h-10 w-10"/> <img src="@/assets/img/rubika.webp" alt="" class=" w-12"/>
</a> </a>
</div> </div>
</div> </div>
+6 -6
View File
@@ -34,7 +34,7 @@
> >
<div class="flex gap-4"> <div class="flex gap-4">
<!-- Product Image --> <!-- Product Image -->
<div class="bg-gray-100 rounded-lg flex justify-center items-center p-3 min-w-[80px] h-[80px]"> <div class="bg-gray-100 rounded-lg flex justify-center items-center p-1 min-w-[80px] h-[80px]">
<img <img
:src="getProductImage(item.product)" :src="getProductImage(item.product)"
class="max-w-full max-h-full object-contain" class="max-w-full max-h-full object-contain"
@@ -152,7 +152,7 @@ watch(lastPrice, () => {
// Update item price and total price // Update item price and total price
item.price = newPrice + (product.cash_fee_buy ?? 0) item.price = newPrice + (product.cash_fee_buy ?? 0)
item.totalPrice = item.price * item.quantity item.totalPrice = parseInt(item.price * item.quantity)
}) })
// Save updated prices to storage // Save updated prices to storage
@@ -162,7 +162,7 @@ watch(lastPrice, () => {
// Computed total price that updates with price changes // Computed total price that updates with price changes
const totalPrice = computed(() => { const totalPrice = computed(() => {
return cartStore.cartItems.reduce((sum, item) => sum + item.totalPrice, 0) return parseInt(cartStore.cartItems.reduce((sum, item) => sum + item.totalPrice, 0))
}) })
function getProductImage(product: any) { function getProductImage(product: any) {
@@ -255,7 +255,7 @@ async function handleCheckout() {
// Check wallet balance for cash method items (without gateway) // Check wallet balance for cash method items (without gateway)
const cashItemsTotal = cartStore.cartItems const cashItemsTotal = cartStore.cartItems
.filter(item => item.method === 'cash' && !item.gateway) .filter(item => item.method === 'cash' && !item.gateway)
.reduce((sum, item) => sum + item.totalPrice, 0) .reduce((sum, item) => parseInt(sum + item.totalPrice), 0)
if (cashItemsTotal > 0) { if (cashItemsTotal > 0) {
// Ensure wallet info is loaded // Ensure wallet info is loaded
@@ -308,7 +308,7 @@ async function handleCheckout() {
return { return {
direction: 1, // 1 for buy (cart items are always buy orders) direction: 1, // 1 for buy (cart items are always buy orders)
price: productPrice, price: productPrice,
amount: item.quantity, amount: product.amount,
gateway: item.gateway, gateway: item.gateway,
product_id: product.id, product_id: product.id,
method: item.method, method: item.method,
@@ -374,7 +374,7 @@ async function initPrice() {
// Update item price and total price // Update item price and total price
item.price = newPrice + (product.cash_fee_buy ?? 0) item.price = newPrice + (product.cash_fee_buy ?? 0)
item.totalPrice = item.price * item.quantity item.totalPrice =parseInt(item.price * item.quantity)
}) })
// Save updated prices to storage // Save updated prices to storage
+28 -24
View File
@@ -22,27 +22,27 @@
<div>حساب کاربری</div> <div>حساب کاربری</div>
</div> </div>
</BasicButton> </BasicButton>
<BasicButton v-if="isToken()" icon-size="16" class="!font-bold w-15rem" <!-- <BasicButton v-if="isToken()" icon-size="16" class="!font-bold w-15rem"-->
@click="$router.push({name: 'notifyTrigger'}); popVisible = false"> <!-- @click="$router.push({name: 'notifyTrigger'}); popVisible = false">-->
<div class="flex gap-2 items-center"> <!-- <div class="flex gap-2 items-center">-->
<BasicIcon icon="vuesax-linear:bill" size="16" class="absolute right-2" /> <!-- <BasicIcon icon="vuesax-linear:bill" size="16" class="absolute right-2" />-->
<div>هشدار قیمت</div> <!-- <div>هشدار قیمت</div>-->
</div> <!-- </div>-->
</BasicButton> <!-- </BasicButton>-->
<BasicButton v-if="isToken()" icon-size="16" class="!font-bold w-15rem" <!-- <BasicButton v-if="isToken()" icon-size="16" class="!font-bold w-15rem"-->
@click="$router.push({name: 'transfer'}); popVisible = false"> <!-- @click="$router.push({name: 'transfer'}); popVisible = false">-->
<div class="flex gap-2 items-center"> <!-- <div class="flex gap-2 items-center">-->
<BasicIcon icon="vuesax-linear:card-send" size="16" class="absolute right-2" /> <!-- <BasicIcon icon="vuesax-linear:card-send" size="16" class="absolute right-2" />-->
<div>انتقال قطره</div> <!-- <div>انتقال قطره</div>-->
</div> <!-- </div>-->
</BasicButton> <!-- </BasicButton>-->
<BasicButton v-if="isToken()" icon-size="16" class="!font-bold w-15rem" <!-- <BasicButton v-if="isToken()" icon-size="16" class="!font-bold w-15rem"-->
@click="$router.push({name: 'physicalReceive'}); popVisible = false"> <!-- @click="$router.push({name: 'physicalReceive'}); popVisible = false">-->
<div class="flex gap-2 items-center"> <!-- <div class="flex gap-2 items-center">-->
<BasicIcon icon="vuesax-linear:direct-inbox" size="16" class="absolute right-2" /> <!-- <BasicIcon icon="vuesax-linear:direct-inbox" size="16" class="absolute right-2" />-->
<div>دریافت طلای فیزیکی</div> <!-- <div>دریافت طلای فیزیکی</div>-->
</div> <!-- </div>-->
</BasicButton> <!-- </BasicButton>-->
<BasicButton v-if="isToken()" icon-size="16" class="!font-bold w-15rem" <BasicButton v-if="isToken()" icon-size="16" class="!font-bold w-15rem"
@click="$router.push({name: 'buyProduct'}); popVisible = false"> @click="$router.push({name: 'buyProduct'}); popVisible = false">
<div class="flex gap-2 items-center"> <div class="flex gap-2 items-center">
@@ -100,9 +100,13 @@
<!-- <canvas ref="canvas" id="canvas1" width="400" height="80" class="w-full"></canvas>--> <!-- <canvas ref="canvas" id="canvas1" width="400" height="80" class="w-full"></canvas>-->
<div v-if="isToken()" class="bottom-appbar w-auto mx-auto"> <div v-if="isToken()" class="bottom-appbar w-auto mx-auto">
<div class="tabs"> <div class="tabs">
<div :class="setNavColor('home')" class="tab" @click="setRoute('home')"> <!-- <div :class="setNavColor('home')" class="tab" @click="setRoute('home')">-->
<Icon icon="vuesax-linear:home" /> <!-- <Icon icon="vuesax-linear:home" />-->
<div class="text-xs mt-1 font-bold">صفحه اصلی</div> <!-- <div class="text-xs mt-1 font-bold">صفحه اصلی</div>-->
<!-- </div>-->
<div :class="setNavColor('buyProduct')" class="tab" @click="setRoute('buyProduct')">
<Icon icon="vuesax-linear:coin" />
<div class="text-xs mt-1 font-bold">فروشگاه</div>
</div> </div>
<div :class="setNavColor('transactions')" class="tab" @click="setRoute('transactions')"> <div :class="setNavColor('transactions')" class="tab" @click="setRoute('transactions')">
<Icon icon="vuesax-linear:receipt-item" /> <Icon icon="vuesax-linear:receipt-item" />
@@ -60,7 +60,7 @@
</a-form-item> </a-form-item>
<a-form-item v-if="isBuy" name="goldValue" <a-form-item v-if="isBuy" name="goldValue"
:rules="[justNumber2(props?.ProductItem?.price , form.method , props?.ProductItem?.amount, true, form.gateway)]"> :rules="[justNumber4(props?.ProductItem?.price , form.method , props?.ProductItem?.amount, true, form.gateway)]">
<BasicInput v-model:value="form.goldValue" addon-before="تعداد" addon-bg-color="#521620" <BasicInput v-model:value="form.goldValue" addon-before="تعداد" addon-bg-color="#521620"
addon-text-color="white" addon-text-color="white"
place-holder="تعداد" place-holder="تعداد"
@@ -253,7 +253,7 @@ import type { Price } from '@/models/home'
import Icon from '@/components/BasicPacks/BasicIcon.vue' import Icon from '@/components/BasicPacks/BasicIcon.vue'
import { useUserStore } from '@/store/userStore' import { useUserStore } from '@/store/userStore'
import BasicActionSheet from '@/components/BasicPacks/BasicActionSheet.vue' import BasicActionSheet from '@/components/BasicPacks/BasicActionSheet.vue'
import { justNumber, justNumber2, justNumber3, required, ruleNumber } from '@/utils/inputRules' import {justNumber, justNumber2, justNumber3, justNumber4, required, ruleNumber} from '@/utils/inputRules'
import GoldSkeleton from '@/views/base/gold/components/GoldSkeleton.vue' import GoldSkeleton from '@/views/base/gold/components/GoldSkeleton.vue'
import GoldLoading from '@/components/GoldLoading.vue' import GoldLoading from '@/components/GoldLoading.vue'
// import {update} from 'lodash' // import {update} from 'lodash'
@@ -274,10 +274,10 @@ const typeDeal: SelectItem[] = [
value: 'نقدی', value: 'نقدی',
key: 'cash' key: 'cash'
}, },
{ // {
value: ' طلایی', // value: ' طلایی',
key: 'gold' // key: 'gold'
} // }
] ]
const infoVisible = ref(false) const infoVisible = ref(false)
@@ -558,9 +558,9 @@ const limitedPrice = computed(() => {
function calculateCash(val: number) { function calculateCash(val: number) {
priceErrorVisible.value = false priceErrorVisible.value = false
// console.log(val) console.log("val",val,props?.ProductItem)
if (price.value) { if (price.value) {
form.value.goldVazn = parseFloat((val * (( props?.ProductItem?.price) + (props?.ProductItem?.cash_fee_buy)))/lastPrice.value?.buy).toFixed(1) form.value.goldVazn = parseFloat((val * props?.ProductItem?.amount).toFixed(3))
console.log(val,props?.ProductItem?.price,props?.ProductItem?.cash_fee_buy,lastPrice.value?.buy) console.log(val,props?.ProductItem?.price,props?.ProductItem?.cash_fee_buy,lastPrice.value?.buy)
if (isBuy.value) { if (isBuy.value) {
if (val){ if (val){
@@ -579,7 +579,7 @@ console.log(val,props?.ProductItem?.price,props?.ProductItem?.cash_fee_buy,lastP
form.value.goldVazn = 0 form.value.goldVazn = 0
} }
} }
console.log(form.value.goldVazn) console.log('goldVazn',form.value.goldVazn)
} }
} }
@@ -95,7 +95,7 @@
</div> </div>
<span <span
v-if="!props.ProductItem.show" v-if="!props.ProductItem?.inventory || props.ProductItem?.inventory==0"
class="text-xs bg-gray-300 text-gray-600 px-2 py-0.5 rounded-md" class="text-xs bg-gray-300 text-gray-600 px-2 py-0.5 rounded-md"
> >
ناموجود ناموجود
@@ -30,7 +30,7 @@
</div> </div>
<span <span
v-if="!props.ProductItem.show" v-if="!props.ProductItem?.inventory || props.ProductItem?.inventory==0"
class="text-xs bg-gray-300 text-gray-600 px-2 py-0.5 rounded-md" class="text-xs bg-gray-300 text-gray-600 px-2 py-0.5 rounded-md"
> >
ناموجود ناموجود
+3 -4
View File
@@ -18,11 +18,10 @@
</div> </div>
<div class="mx-5 pb-30 pt-2 grid grid-cols-2 gap-2" style="color: #1b2b07"> <div class="mx-5 pb-30 pt-2 grid grid-cols-2 gap-2" style="color: #1b2b07">
<div class="mt-3 gap-2 " :class="!viewVertical?'col-span-2':''" v-for="item in items"> <div class="mt-3 gap-2 " :class="!viewVertical?'col-span-2':''" v-for="item in items?.filter(i => i.show)">
<ProductItemVertical v-if="viewVertical" :ProductItem="item" @click="clickProduct(item)"></ProductItemVertical> <ProductItemVertical v-if="viewVertical" :ProductItem="item" @click="clickProduct(item)"></ProductItemVertical>
<ProductItem v-else class="col-span-2" :ProductItem="item" @click="clickProduct(item)"></ProductItem> <ProductItem v-else class="col-span-2" :ProductItem="item" @click="clickProduct(item)"></ProductItem>
</div> </div>
</div> </div>
</div> </div>
+59 -29
View File
@@ -1,13 +1,13 @@
<template> <template>
<div class="bottom-0 fixed top-0"> <div class="bottom-0 fixed top-0">
<img :src="img" alt="" class="w-inherit" :style="{ backgroundRepeat: 'repeat' }" /> <img :src="img" alt="" class="w-inherit" :style="{ backgroundRepeat: 'repeat' }"/>
</div> </div>
<a-spin :spinning="loading"> <a-spin :spinning="loading">
<div class="!h-full overflow-y-scroll"> <div class="!h-full overflow-y-scroll">
<div class="mx-5 pb-30 pt-5" style="color: #1b2b07"> <div class="mx-5 pb-30 pt-5" style="color: #1b2b07">
<!-- Product Image --> <!-- Product Image -->
<div class="bg-gray-100 rounded-lg w-full flex justify-center p-8 mb-4"> <div class="bg-gray-100 rounded-lg w-full flex justify-center mb-4">
<img :src="getProductImage(product)" class="max-w-full h-auto" /> <img :src="getProductImage(product)" class="max-w-full h-auto"/>
</div> </div>
<!-- Product Title --> <!-- Product Title -->
@@ -20,7 +20,7 @@
<div class="flex-1"> <div class="flex-1">
<!-- Buy Button --> <!-- Buy Button -->
<BasicButton <BasicButton
v-if="product?.show && product?.open_buy" v-if="product?.show && product?.open_buy &&(product?.inventory || product?.inventory >0)"
class="w-full py-3 " class="w-full py-3 "
type="primary" type="primary"
size="large" size="large"
@@ -34,6 +34,9 @@
<div v-else-if="!product?.open_buy" class="text-center text-gray-500 py-4"> <div v-else-if="!product?.open_buy" class="text-center text-gray-500 py-4">
خرید این محصول در حال حاضر امکان پذیر نیست خرید این محصول در حال حاضر امکان پذیر نیست
</div> </div>
<div v-else-if="!product?.inventory || product?.inventory==0" class="text-center text-gray-500 py-4">
ناموجود
</div>
</div> </div>
@@ -44,30 +47,30 @@
<div v-if="product?.description" class="mb-6"> <div v-if="product?.description" class="mb-6">
<div class="text-lg font-semibold mb-2">توضیحات محصول:</div> <div class="text-lg font-semibold mb-2">توضیحات محصول:</div>
<div class="text-base text-gray-700 whitespace-pre-line">{{ product?.description }}</div> <div class="text-base text-gray-700 whitespace-pre-line">{{ product?.description }}</div>
<!-- <div class="text-base text-gray-700 whitespace-pre-line">شمش طلای نقش برجسته ونوس ۱ گرمی انتخابی ظریف و ارزشمند برای سرمایه‌گذاری و هدیه است. این شمش از طلای خالص با عیار بالا ساخته شده و نقش برجسته‌ی الهه ونوس، نمادی از زیبایی و ظرافت، جلوه‌ای هنری و خاص به آن بخشیده است. وزن دقیق ۱ گرم، ابعاد مناسب و بسته‌بندی شکیل، این محصول را به گزینه‌ای ایده‌آل برای نگهداری ارزش، هدیه‌های خاص و کلکسیون‌های طلا تبدیل می‌کند. </div>--> <!-- <div class="text-base text-gray-700 whitespace-pre-line">شمش طلای نقش برجسته ونوس ۱ گرمی انتخابی ظریف و ارزشمند برای سرمایه‌گذاری و هدیه است. این شمش از طلای خالص با عیار بالا ساخته شده و نقش برجسته‌ی الهه ونوس، نمادی از زیبایی و ظرافت، جلوه‌ای هنری و خاص به آن بخشیده است. وزن دقیق ۱ گرم، ابعاد مناسب و بسته‌بندی شکیل، این محصول را به گزینه‌ای ایده‌آل برای نگهداری ارزش، هدیه‌های خاص و کلکسیون‌های طلا تبدیل می‌کند. </div>-->
</div> </div>
<!-- Similar Products --> <!-- Similar Products -->
<div v-if="product?.similar?.length" class="mt-8"> <div v-if="product?.similar?.length" class="mt-8">
<div class="text-lg font-semibold mb-4">محصولات مشابه</div> <div class="text-lg font-semibold mb-4">محصولات مشابه</div>
<swiper <swiper
:slides-per-view="2.25" :slides-per-view="2.25"
:space-between="16" :space-between="16"
class="similar-products-swiper" class="similar-products-swiper"
> >
<swiper-slide <swiper-slide
v-for="item in product.similar" v-for="item in product.similar"
:key="item.id" :key="item.id"
> >
<div <div
class="bg-white rounded-lg shadow p-4 cursor-pointer h-full" class="bg-white rounded-lg shadow p-4 cursor-pointer h-full"
@click="goToProduct(item.id)" @click="goToProduct(item.id)"
> >
<!-- Image --> <!-- Image -->
<div class="bg-gray-100 rounded-md flex justify-center p-4 mb-2"> <div class="bg-gray-100 rounded-md flex justify-center p-4 mb-2">
<img <img
:src="getProductImage(item)" :src="getProductImage(item)"
class="h-20 object-contain" class="h-20 object-contain"
/> />
</div> </div>
@@ -75,11 +78,17 @@
<div class="text-sm font-semibold mb-1 line-clamp-2"> <div class="text-sm font-semibold mb-1 line-clamp-2">
{{ item.title }} {{ item.title }}
</div> </div>
<!-- Price --> <!-- Price -->
<div class="text-sm text-primary font-bold"> <div class="text-sm text-primary font-bold mb-3">
{{ usePrice((item.price ?? 0) + (item.cash_fee_buy ?? 0)) }} {{ usePrice((item.price ?? 0) + (item.cash_fee_buy ?? 0)) }}
</div> </div>
<span
v-if="item.inventory || item.inventory==0"
class="text-xs bg-gray-300 text-gray-600 px-1 py-0.5 rounded-md "
>
ناموجود
</span>
</div> </div>
</swiper-slide> </swiper-slide>
</swiper> </swiper>
@@ -101,24 +110,24 @@
<script setup lang="ts"> <script setup lang="ts">
import {onMounted, onUnmounted, ref, computed, watch} from 'vue' import {onMounted, onUnmounted, ref, computed, watch} from 'vue'
import { useRoute, useRouter } from 'vue-router' import {useRoute, useRouter} from 'vue-router'
import {getProductById, getProducts} from '@/api/products' import {getProductById, getProducts} from '@/api/products'
import { loading, getToken } from '@/utils' import {loading, getToken} from '@/utils'
import type { Product } from '@/models/products' import type {Product} from '@/models/products'
import BasicActionSheet from '@/components/BasicPacks/BasicActionSheet.vue' import BasicActionSheet from '@/components/BasicPacks/BasicActionSheet.vue'
import indexGold from '@/views/base/gold/index.vue' import indexGold from '@/views/base/gold/index.vue'
import DealProduct from '@/views/base/products/components/DealProduct.vue' import DealProduct from '@/views/base/products/components/DealProduct.vue'
import { cloneDeep } from 'lodash' import {cloneDeep} from 'lodash'
import img from '@/assets/img/user_ly1.svg' import img from '@/assets/img/user_ly1.svg'
import { message } from 'ant-design-vue' import {message} from 'ant-design-vue'
import BasicButton from '@/components/BasicPacks/BasicButton.vue' import BasicButton from '@/components/BasicPacks/BasicButton.vue'
import { usePrice } from '@/utils/usePrice' import {usePrice} from '@/utils/usePrice'
import { import {
getLastPrices, getLastPrices,
lastPrice, lastPrice,
stopPriceInterval stopPriceInterval
} from '@/utils/price' } from '@/utils/price'
import { Swiper, SwiperSlide } from 'swiper/vue' import {Swiper, SwiperSlide} from 'swiper/vue'
import 'swiper/swiper-bundle.css' import 'swiper/swiper-bundle.css'
// Image imports // Image imports
@@ -143,10 +152,11 @@ watch(
(newId, oldId) => { (newId, oldId) => {
if (newId && newId !== oldId) { if (newId && newId !== oldId) {
loadProduct() loadProduct()
window.scrollTo({ top: 0, behavior: 'smooth' }) window.scrollTo({top: 0, behavior: 'smooth'})
} }
} }
) )
async function loadProduct() { async function loadProduct() {
try { try {
loading.value = true loading.value = true
@@ -155,7 +165,7 @@ async function loadProduct() {
const foundProduct = products const foundProduct = products
if (!foundProduct) { if (!foundProduct) {
message.error('محصول یافت نشد') message.error('محصول یافت نشد')
router.push({ name: 'buyProduct' }) router.push({name: 'buyProduct'})
return return
} }
product.value = foundProduct product.value = foundProduct
@@ -164,7 +174,7 @@ async function loadProduct() {
console.log(e) console.log(e)
if (e?.response?.status === 401) { if (e?.response?.status === 401) {
message.warning('برای مشاهده محصولات، لطفا ابتدا وارد حساب کاربری خود شوید') message.warning('برای مشاهده محصولات، لطفا ابتدا وارد حساب کاربری خود شوید')
router.push({ name: 'login' }) router.push({name: 'login'})
} else { } else {
message.error('خطا در بارگذاری محصول') message.error('خطا در بارگذاری محصول')
} }
@@ -173,6 +183,25 @@ async function loadProduct() {
} }
} }
watch(lastPrice, async () => {
// console.log(items);
if (lastPrice.value && product.value.similar) {
product.value.similar.forEach((val) => {
// console.log(lastPrice.value)
if (val.group_type == 'آبشده') {
val.price = lastPrice.value?.price_last
val.sellPrice = lastPrice.value?.sell
} else {
val.price = parseInt(val.amount * lastPrice.value?.price_last)
val.sellPrice = parseInt(val.amount * lastPrice.value?.sell)
// console.log(lastPrice.value?.price_last + "*" + val.amount + ' ' + val.price)
}
})
}
}, {deep: true})
async function initPrice() { async function initPrice() {
try { try {
await getLastPrices() await getLastPrices()
@@ -197,7 +226,7 @@ function handleBuyClick() {
if (!product.value?.show) { if (!product.value?.show) {
return return
} }
// // Check if user is logged in // // Check if user is logged in
// if (!getToken()) { // if (!getToken()) {
// message.warning('برای خرید یا فروش محصولات، لطفا ابتدا وارد حساب کاربری خود شوید') // message.warning('برای خرید یا فروش محصولات، لطفا ابتدا وارد حساب کاربری خود شوید')
@@ -216,8 +245,9 @@ onMounted(() => {
onUnmounted(() => { onUnmounted(() => {
stopPriceInterval() stopPriceInterval()
}) })
function goToProduct(id: number) { function goToProduct(id: number) {
router.push({ name: 'productDetail', params: { id } }) router.push({name: 'productDetail', params: {id}})
} }
function getProductImage(product: any) { function getProductImage(product: any) {
@@ -225,7 +255,7 @@ function getProductImage(product: any) {
if (product?.file?.src) { if (product?.file?.src) {
return product.file.src return product.file.src
} }
// Fallback to local images based on group_type if file is empty or doesn't exist // Fallback to local images based on group_type if file is empty or doesn't exist
const type = product?.group_type const type = product?.group_type
switch (type) { switch (type) {
+4 -4
View File
@@ -154,15 +154,15 @@
</div> </div>
</div> </div>
<div class="wrap-fix bottom-0 px-10 py-6 flex gap-2 bg-white"> <div class="wrap-fix bottom-0 px-10 py-6 flex gap-2 bg-white items-center">
<a class="w-full" href="tel:09128081392"> <a class="w-full" href="https://web.rubika.ir/#c=u0I8F1U0a939b0df5ba9f73618d33d7c">
<BasicButton class="w-full" type="primary">تماس با پشتیبانی</BasicButton> <BasicButton class="w-full" type="primary">تماس با پشتیبانی</BasicButton>
</a> </a>
<!-- <BasicButton type="primary" @click="$router.push({name: 'permissions'})"> <!-- <BasicButton type="primary" @click="$router.push({name: 'permissions'})">
<div>مجوز ها</div> <div>مجوز ها</div>
</BasicButton>--> </BasicButton>-->
<a href="https://t.me/ghatreh"> <a href="https://web.rubika.ir/#c=u0I8F1U0a939b0df5ba9f73618d33d7c">
<img src="@/assets/img/telegram.png" alt="" class="h-10 w-10"/> <img src="@/assets/img/rubika.webp" alt="" class="w-12"/>
</a> </a>
</div> </div>
</div> </div>
+80 -18
View File
@@ -93,16 +93,16 @@
<div>آدرس ها</div> <div>آدرس ها</div>
</div> </div>
</BasicButton>--> </BasicButton>-->
<BasicButton <!-- <BasicButton-->
class="w-full mt-2" <!-- class="w-full mt-2"-->
size="large" <!-- size="large"-->
@click="$router.push({ name: 'notifyTrigger' })" <!-- @click="$router.push({ name: 'notifyTrigger' })"-->
> <!-- >-->
<div class="flex"> <!-- <div class="flex">-->
<BasicIcon icon="vuesax-linear:bill" class="absolute right-8" /> <!-- <BasicIcon icon="vuesax-linear:bill" class="absolute right-8" />-->
<div>هشدار قیمت</div> <!-- <div>هشدار قیمت</div>-->
</div> <!-- </div>-->
</BasicButton> <!-- </BasicButton>-->
<BasicButton <BasicButton
class="mt-2 w-full" class="mt-2 w-full"
icon="" icon=""
@@ -151,22 +151,61 @@
<div>مجوز ها</div> <div>مجوز ها</div>
</div> </div>
</BasicButton>--> </BasicButton>-->
<!-- <BasicButton-->
<!-- class="mt-2 w-full"-->
<!-- icon=""-->
<!-- iconSize="18"-->
<!-- size="large"-->
<!-- @click="$router.push({ name: 'earnMoney' })"-->
<!-- >-->
<!-- <div class="flex">-->
<!-- <BasicIcon icon="vuesax-linear:dollar-circle" class="absolute right-8" />-->
<!-- <div>کسب درآمد</div>-->
<!-- </div>-->
<!-- </BasicButton>-->
<BasicButton <BasicButton
class="mt-2 w-full" class="mt-2 w-full"
icon="" icon=""
iconSize="18" iconSize="18"
size="large" size="large"
@click="$router.push({ name: 'earnMoney' })" @click="showLogoutConfirm=!showLogoutConfirm"
> >
<div class="flex"> <div class="flex">
<BasicIcon icon="vuesax-linear:dollar-circle" class="absolute right-8" /> <Icon
<div>کسب درآمد</div> :color="y > 50 ? '' : ''"
class="color-transition absolute right-8"
icon="vuesax-linear:logout"
@click="showLogoutConfirm = true"
/>
<div>خروج از حساب کاربری</div>
</div> </div>
</BasicButton> </BasicButton>
</div> </div>
</div> </div>
</div> </div>
<DialogVant v-model:show="showLogoutConfirm" :closeOnClickOverlay="false" :timeOut="-1">
<!-- <template v-slot:img>
<img :src="registerDelayImage" alt="" class="opacity-80">
</template>-->
<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"
/>
<div class="p-5 text-sm">آیا از خروج خود اطمینان دارید؟</div>
</div>
</template>
<template v-slot:button>
<div class="text-center text-red flex items-center justify-center" @click="logout">
<a-spin :spinning="logoutLoading" size="small"> خروج</a-spin>
</div>
<div class="text-center" @click="showLogoutConfirm = false">انصراف</div>
</template>
</DialogVant>
<BasicActionSheet v-model:show="editPassVisible"> <BasicActionSheet v-model:show="editPassVisible">
<div class="flex justify-center justify-between"> <div class="flex justify-center justify-between">
<div class="font-bold text-lg">ویرایش اطلاعات</div> <div class="font-bold text-lg">ویرایش اطلاعات</div>
@@ -257,7 +296,7 @@
import { onMounted, reactive, ref, computed } from 'vue' import { onMounted, reactive, ref, computed } from 'vue'
import img from '@/assets/img/user_ly1.svg' import img from '@/assets/img/user_ly1.svg'
import gr_bottom from './assets/img/gr_bottom_white.svg' import gr_bottom from './assets/img/gr_bottom_white.svg'
import { loading } from '@/utils' import {loading, removeToken} from '@/utils'
import BasicButton from '@/components/BasicPacks/BasicButton.vue' import BasicButton from '@/components/BasicPacks/BasicButton.vue'
import BasicActionSheet from '@/components/BasicPacks/BasicActionSheet.vue' import BasicActionSheet from '@/components/BasicPacks/BasicActionSheet.vue'
import { import {
@@ -277,6 +316,11 @@ import { message } from 'ant-design-vue'
import { updateMe, updatePass } from '@/api/me' import { updateMe, updatePass } from '@/api/me'
import { useUserStore } from '@/store/userStore' import { useUserStore } from '@/store/userStore'
import BaseDatePicker from '@/components/BasicPacks/BaseDatePicker' import BaseDatePicker from '@/components/BasicPacks/BaseDatePicker'
import {DotLottieVue} from "@lottiefiles/dotlottie-vue";
import DialogVant from "@/components/DialogVant.vue";
import {useWalletStore} from "@/store/walletStore";
import Icon from "@/components/BasicPacks/BasicIcon.vue";
import {useWindowScroll} from "@vueuse/core/index";
const userFormState = ref<User>({ const userFormState = ref<User>({
fname: '', fname: '',
lname: '', lname: '',
@@ -291,11 +335,29 @@ const userPassForm = ref<Password>({
const formRef = ref<FormInstance>() const formRef = ref<FormInstance>()
const formPassRef = ref<FormInstance>() const formPassRef = ref<FormInstance>()
const userStore = useUserStore() const userStore = useUserStore()
const showLogoutConfirm = ref<boolean>()
const walletStore=useWalletStore()
const logoutLoading = ref<boolean>(false)
const { x, y } = useWindowScroll()
// const editPassVisible = ref<boolean>(false) // const editPassVisible = ref<boolean>(false)
const editPassVisible = ref<boolean>(false) const editPassVisible = ref<boolean>(false)
const editPasswordVisible = ref<boolean>(false) const editPasswordVisible = ref<boolean>(false)
async function logout() {
logoutLoading.value = true
// baseConfirm('آیا از حساب کاربری خارج می شوید؟',async () => {
userStore.userInfo = undefined
walletStore.walletInfo = undefined
/* userStore.$reset()
walletStore.$reset()*/
removeToken()
await router.push({ name: 'login' })
logoutLoading.value = true
window.location.reload()
// console.log('salam')
// })
}
function setForm() { function setForm() {
userFormState.value = userStore.userInfo userFormState.value = userStore.userInfo
} }
+1 -1
View File
@@ -302,7 +302,7 @@
<span>جهت شارژ حساب کاربری خود، کلمه "شماره حساب" را برای پشتیبانی ارسال نمایید.</span> <span>جهت شارژ حساب کاربری خود، کلمه "شماره حساب" را برای پشتیبانی ارسال نمایید.</span>
</div> </div>
<BasicButton class="mt-4"> <BasicButton class="mt-4">
<a class="w-full" href="https://wa.me/989390624220"> <a class="w-full" href="https://web.rubika.ir/#c=u0I8F1U0a939b0df5ba9f73618d33d7c">
پیام به پشتیبانی پیام به پشتیبانی
</a> </a>
</BasicButton> </BasicButton>
+2 -2
View File
@@ -203,7 +203,7 @@ async function enterFingerPrint() {
const fingerPrint = await authenticateWithFingerprint() const fingerPrint = await authenticateWithFingerprint()
if (fingerPrint) { if (fingerPrint) {
setTruth() setTruth()
await router.push({ name: 'home' }) await router.push({ name: 'buyProduct' })
} else { } else {
message.error('خطا در اعتبارسنجی') message.error('خطا در اعتبارسنجی')
} }
@@ -234,7 +234,7 @@ async function login(accessToken: string | undefined) {
/* if (userStore.userInfo?.type === (URLUserType() === 'customer' ? 1 : 2)) {*/ /* if (userStore.userInfo?.type === (URLUserType() === 'customer' ? 1 : 2)) {*/
await walletStore.getMyWallet() await walletStore.getMyWallet()
setTruth() setTruth()
await router.push({ name: 'home' }) await router.push({ name: 'buyProduct' })
/* } else { /* } else {
removeToken() removeToken()
userStore.removeInformation() userStore.removeInformation()
+1 -1
View File
@@ -43,7 +43,7 @@ const userFormState = ref<UserMobile>({
}) })
function phoneVerification() { function phoneVerification() {
router.push({name: 'home' }) router.push({name: 'buyProduct' })
} }
</script> </script>