1404/11/19-add inventory for product
This commit is contained in:
+1
-1
@@ -42,7 +42,7 @@
|
|||||||
<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://rubika.ir/nore8tom" target="_blank" id="whatsapp-button">
|
<a href="https://web.rubika.ir/#c=u0I8F1U0a939b0df5ba9f73618d33d7c" target="_blank" id="whatsapp-button">
|
||||||
<img class="p-2" src="/src/assets/img/rubika.webp" alt="" />
|
<img class="p-2" src="/src/assets/img/rubika.webp" alt="" />
|
||||||
</a>
|
</a>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|||||||
@@ -67,10 +67,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="wrap-fix bottom-0 px-10 py-6 flex gap-2 bg-white items-center">
|
<div class="wrap-fix bottom-0 px-10 py-6 flex gap-2 bg-white items-center">
|
||||||
<a class="w-full" href="https://rubika.ir/nore8tom">
|
<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://rubika.ir/nore8tom">
|
<a href="https://web.rubika.ir/#c=u0I8F1U0a939b0df5ba9f73618d33d7c">
|
||||||
<img src="@/assets/img/rubika.webp" alt="" class=" w-12"/>
|
<img src="@/assets/img/rubika.webp" alt="" class=" w-12"/>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
@@ -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"
|
||||||
>
|
>
|
||||||
ناموجود
|
ناموجود
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|
||||||
|
|
||||||
@@ -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>
|
||||||
@@ -147,6 +156,7 @@ watch(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
async function loadProduct() {
|
async function loadProduct() {
|
||||||
try {
|
try {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
@@ -172,6 +182,7 @@ async function loadProduct() {
|
|||||||
loading.value = false
|
loading.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(lastPrice, async () => {
|
watch(lastPrice, async () => {
|
||||||
// console.log(items);
|
// console.log(items);
|
||||||
if (lastPrice.value && product.value.similar) {
|
if (lastPrice.value && product.value.similar) {
|
||||||
@@ -234,6 +245,7 @@ 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}})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -155,13 +155,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="wrap-fix bottom-0 px-10 py-6 flex gap-2 bg-white items-center">
|
<div class="wrap-fix bottom-0 px-10 py-6 flex gap-2 bg-white items-center">
|
||||||
<a class="w-full" href="https://rubika.ir/nore8tom">
|
<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://rubika.ir/nore8tom">
|
<a href="https://web.rubika.ir/#c=u0I8F1U0a939b0df5ba9f73618d33d7c">
|
||||||
<img src="@/assets/img/rubika.webp" alt="" class="w-12"/>
|
<img src="@/assets/img/rubika.webp" alt="" class="w-12"/>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -302,7 +302,7 @@
|
|||||||
<span>جهت شارژ حساب کاربری خود، کلمه "شماره حساب" را برای پشتیبانی ارسال نمایید.</span>
|
<span>جهت شارژ حساب کاربری خود، کلمه "شماره حساب" را برای پشتیبانی ارسال نمایید.</span>
|
||||||
</div>
|
</div>
|
||||||
<BasicButton class="mt-4">
|
<BasicButton class="mt-4">
|
||||||
<a class="w-full" href="https://rubika.ir/nore8tom">
|
<a class="w-full" href="https://web.rubika.ir/#c=u0I8F1U0a939b0df5ba9f73618d33d7c">
|
||||||
پیام به پشتیبانی
|
پیام به پشتیبانی
|
||||||
</a>
|
</a>
|
||||||
</BasicButton>
|
</BasicButton>
|
||||||
|
|||||||
Reference in New Issue
Block a user