2026-06-14 10:08:46 +03:30
|
|
|
<template>
|
|
|
|
|
<div>
|
|
|
|
|
<div class="flex">
|
2026-06-23 18:03:59 +03:30
|
|
|
<div class="bg-gray-100 m-2 rounded-lg w-18 h-18 flex justify-center p-1 shrink-0">
|
|
|
|
|
<img :src="displayImage" class="object-contain w-full h-full" alt="" />
|
2026-06-14 10:08:46 +03:30
|
|
|
</div>
|
|
|
|
|
<div class="w-full min-w-0">
|
2026-06-23 18:03:59 +03:30
|
|
|
<div class="pr-cart-row__head">
|
|
|
|
|
<div class="truncate text-base font-bold">{{ item.product.title }}</div>
|
2026-06-14 10:08:46 +03:30
|
|
|
<BasicButton
|
|
|
|
|
icon="vuesax-linear:trash"
|
|
|
|
|
icon-class="text-red"
|
2026-06-23 18:03:59 +03:30
|
|
|
class="pr-cart-row__trash shrink-0"
|
2026-06-14 10:08:46 +03:30
|
|
|
@click="emit('remove', item.product.id)"
|
|
|
|
|
/>
|
2026-06-23 18:03:59 +03:30
|
|
|
<div class="pr-cart-row__stock text-xs">
|
|
|
|
|
<span>مقدار موجودی</span>
|
|
|
|
|
<span class="font-bold">{{ item.product.wallet.gold }}</span>
|
|
|
|
|
<span>{{ getProductQuantityUnit(item.product) }}</span>
|
|
|
|
|
<div
|
|
|
|
|
v-if="getProductUnitWeightLabel(item.product)"
|
|
|
|
|
class="mt-0.5 text-xs text-gray-500"
|
|
|
|
|
>
|
2026-06-14 10:08:46 +03:30
|
|
|
هر عدد {{ getProductUnitWeightLabel(item.product) }}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2026-06-23 18:03:59 +03:30
|
|
|
<div class="mt-2 flex justify-between items-center gap-2">
|
|
|
|
|
<div class="shrink-0">تعداد درخواستی:</div>
|
2026-06-14 10:08:46 +03:30
|
|
|
<div
|
2026-06-23 18:03:59 +03:30
|
|
|
class="flex items-center gap-1 "
|
|
|
|
|
:class="variant === 'desktop' ? 'dpr-cart-row__input' : 'pr-cart-row__input'"
|
2026-06-14 10:08:46 +03:30
|
|
|
>
|
|
|
|
|
<BasicInput
|
|
|
|
|
v-model:value="item.count"
|
|
|
|
|
:addon-before="getProductQuantityUnit(item.product)"
|
|
|
|
|
:addon-bg-color="config.config?.color"
|
|
|
|
|
addon-text-color="white"
|
2026-06-23 18:03:59 +03:30
|
|
|
type="text"
|
|
|
|
|
inputmode="numeric"
|
2026-06-14 10:08:46 +03:30
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
2026-06-23 18:03:59 +03:30
|
|
|
import { computed } from 'vue'
|
2026-06-14 10:08:46 +03:30
|
|
|
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
|
|
|
|
|
import BasicInput from '@/components/BasicPacks/BasicInput.vue'
|
|
|
|
|
import { useConfigStore } from '@/store/configStore'
|
|
|
|
|
import type { CountPInventory } from '@/models/products'
|
2026-06-23 18:03:59 +03:30
|
|
|
import { getProductDisplayImage } from '@/utils/productAssets'
|
2026-06-14 10:08:46 +03:30
|
|
|
import { getProductQuantityUnit, getProductUnitWeightLabel } from '@/utils/productDealMethod'
|
|
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
|
item: CountPInventory
|
|
|
|
|
variant?: 'mobile' | 'desktop'
|
|
|
|
|
}
|
|
|
|
|
|
2026-06-23 18:03:59 +03:30
|
|
|
const props = withDefaults(defineProps<Props>(), {
|
2026-06-14 10:08:46 +03:30
|
|
|
variant: 'mobile',
|
|
|
|
|
})
|
|
|
|
|
|
2026-06-23 18:03:59 +03:30
|
|
|
const displayImage = computed(() =>
|
|
|
|
|
getProductDisplayImage({
|
|
|
|
|
group_type: props.item.product.group_type,
|
|
|
|
|
title: props.item.product.title,
|
|
|
|
|
file: props.item.product.file,
|
|
|
|
|
})
|
|
|
|
|
)
|
|
|
|
|
|
2026-06-14 10:08:46 +03:30
|
|
|
const config = useConfigStore()
|
|
|
|
|
|
|
|
|
|
const emit = defineEmits<{
|
|
|
|
|
remove: [id: number]
|
|
|
|
|
}>()
|
|
|
|
|
</script>
|
2026-06-23 18:03:59 +03:30
|
|
|
|
|
|
|
|
<style scoped lang="less">
|
|
|
|
|
.pr-cart-row__head {
|
|
|
|
|
display: grid;
|
|
|
|
|
grid-template-columns: 1fr auto;
|
|
|
|
|
grid-template-rows: auto auto;
|
|
|
|
|
column-gap: 0.5rem;
|
|
|
|
|
row-gap: 0.125rem;
|
|
|
|
|
align-items: start;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.pr-cart-row__trash {
|
|
|
|
|
grid-column: 2;
|
|
|
|
|
grid-row: 1 / span 2;
|
|
|
|
|
justify-self: end;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.pr-cart-row__stock {
|
|
|
|
|
grid-column: 1;
|
|
|
|
|
grid-row: 2;
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-wrap: wrap;
|
|
|
|
|
align-items: center;
|
|
|
|
|
gap: 0.25rem;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.pr-cart-row__input {
|
|
|
|
|
width: auto;
|
|
|
|
|
max-width: 10rem;
|
|
|
|
|
|
|
|
|
|
:deep(.noname-input),
|
|
|
|
|
:deep(.ant-input-group-wrapper) {
|
|
|
|
|
width: 100%;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
:deep(.ant-input-group-addon) {
|
|
|
|
|
min-width: 3.75rem;
|
|
|
|
|
padding-inline: 6px;
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|