1405/04/10-fix bugs
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
<template>
|
||||
<div class="mpage-header wrap-fix">
|
||||
<button
|
||||
v-if="showBack"
|
||||
type="button"
|
||||
class="mpage-header__back"
|
||||
@click="handleBack"
|
||||
>
|
||||
<BasicIcon icon="vuesax-linear:arrow-right-1" />
|
||||
</button>
|
||||
<div class="mpage-header__title">{{ title }}</div>
|
||||
<div v-if="$slots.trailing" class="mpage-header__trailing">
|
||||
<slot name="trailing" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
|
||||
import router from '@/router'
|
||||
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
title: string
|
||||
showBack?: boolean
|
||||
}>(),
|
||||
{
|
||||
showBack: false,
|
||||
},
|
||||
)
|
||||
|
||||
function handleBack() {
|
||||
router.back()
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,125 @@
|
||||
import { nextTick } from 'vue'
|
||||
import router from '@/router'
|
||||
|
||||
let recoveryTimers: ReturnType<typeof setTimeout>[] = []
|
||||
|
||||
function clearRecoveryTimers() {
|
||||
recoveryTimers.forEach(clearTimeout)
|
||||
recoveryTimers = []
|
||||
}
|
||||
|
||||
function blurFocusedField() {
|
||||
const active = document.activeElement
|
||||
if (active instanceof HTMLElement && active !== document.body) {
|
||||
active.blur()
|
||||
}
|
||||
}
|
||||
|
||||
function clearBodyScrollLock() {
|
||||
document.body.classList.remove('van-overflow-hidden')
|
||||
document.body.style.removeProperty('position')
|
||||
document.body.style.removeProperty('top')
|
||||
document.body.style.removeProperty('left')
|
||||
document.body.style.removeProperty('right')
|
||||
document.body.style.removeProperty('width')
|
||||
document.body.style.removeProperty('height')
|
||||
document.body.style.removeProperty('min-height')
|
||||
document.body.style.removeProperty('overflow')
|
||||
document.body.style.removeProperty('transform')
|
||||
document.documentElement.style.removeProperty('overflow')
|
||||
document.documentElement.style.removeProperty('height')
|
||||
document.documentElement.style.removeProperty('transform')
|
||||
|
||||
const appRoot = document.getElementById('app')
|
||||
if (appRoot) {
|
||||
appRoot.style.removeProperty('position')
|
||||
appRoot.style.removeProperty('top')
|
||||
appRoot.style.removeProperty('height')
|
||||
appRoot.style.removeProperty('min-height')
|
||||
appRoot.style.removeProperty('overflow')
|
||||
appRoot.style.removeProperty('transform')
|
||||
}
|
||||
}
|
||||
|
||||
function resetAllScrollPositions() {
|
||||
window.scrollTo(0, 0)
|
||||
document.documentElement.scrollTop = 0
|
||||
document.body.scrollTop = 0
|
||||
|
||||
document
|
||||
.querySelectorAll('.main-with-bottom-chrome-inner, .login-page, .login-page-root')
|
||||
.forEach((node) => {
|
||||
if (node instanceof HTMLElement) {
|
||||
node.scrollTop = 0
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function kickViewportReflow() {
|
||||
window.dispatchEvent(new Event('resize'))
|
||||
|
||||
if (window.visualViewport) {
|
||||
window.scrollTo(0, 0)
|
||||
}
|
||||
}
|
||||
|
||||
function runViewportRecovery() {
|
||||
clearBodyScrollLock()
|
||||
resetAllScrollPositions()
|
||||
kickViewportReflow()
|
||||
}
|
||||
|
||||
function scheduleViewportRecovery() {
|
||||
clearRecoveryTimers()
|
||||
runViewportRecovery()
|
||||
|
||||
nextTick(() => {
|
||||
requestAnimationFrame(() => {
|
||||
runViewportRecovery()
|
||||
|
||||
for (const delay of [50, 150, 300, 500]) {
|
||||
recoveryTimers.push(window.setTimeout(runViewportRecovery, delay))
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/** Reset scroll offsets after navigation — fixes iOS safe-area drift. */
|
||||
export function resetMobileAppScroll() {
|
||||
runViewportRecovery()
|
||||
|
||||
nextTick(() => {
|
||||
requestAnimationFrame(runViewportRecovery)
|
||||
})
|
||||
}
|
||||
|
||||
export async function dismissMobileKeyboard() {
|
||||
blurFocusedField()
|
||||
await new Promise((resolve) => window.setTimeout(resolve, 120))
|
||||
}
|
||||
|
||||
export async function prepareMobileViewportForAppShell() {
|
||||
blurFocusedField()
|
||||
resetAllScrollPositions()
|
||||
await dismissMobileKeyboard()
|
||||
}
|
||||
|
||||
/** Full recovery after auth — runs after home shell is mounted. */
|
||||
export function recoverMobileViewportAfterAuth() {
|
||||
scheduleViewportRecovery()
|
||||
}
|
||||
|
||||
export const resetMobileAppScrollAfterLogin = recoverMobileViewportAfterAuth
|
||||
|
||||
export async function completeLoginNavigation() {
|
||||
await prepareMobileViewportForAppShell()
|
||||
await router.push({ name: 'buyProduct' })
|
||||
await router.isReady()
|
||||
recoverMobileViewportAfterAuth()
|
||||
}
|
||||
|
||||
export function initMobileScrollRestoration() {
|
||||
if (typeof history !== 'undefined' && 'scrollRestoration' in history) {
|
||||
history.scrollRestoration = 'manual'
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,208 @@
|
||||
/* Shared mobile page chrome (inner pages — not home .app-header) */
|
||||
|
||||
:root {
|
||||
--mpage-header-bar: 2.75rem;
|
||||
--mpage-header-offset: calc(4rem + var(--app-safe-top, env(safe-area-inset-top, 0px)));
|
||||
--mpage-subheader-offset: calc(var(--mpage-header-bar) + var(--app-safe-top, env(safe-area-inset-top, 0px)));
|
||||
--mpage-content-with-subheader: calc(6.5rem + var(--app-safe-top, env(safe-area-inset-top, 0px)));
|
||||
--mpage-scroll-max-height: calc(100dvh - 50px - var(--app-safe-top, env(safe-area-inset-top, 0px)));
|
||||
--mobile-info-support-block: calc(5rem + var(--app-safe-bottom, env(safe-area-inset-bottom, 0px)));
|
||||
}
|
||||
|
||||
/* Fixed top bar: background fills under status bar; content sits below safe area */
|
||||
.mobile-top-chrome {
|
||||
top: 0;
|
||||
box-sizing: border-box;
|
||||
padding-top: calc(0.75rem + var(--app-safe-top, env(safe-area-inset-top, 0px)));
|
||||
}
|
||||
|
||||
.mobile-top-chrome.h-12,
|
||||
.mobile-top-chrome.min-h-12 {
|
||||
height: auto;
|
||||
min-height: calc(3rem + var(--app-safe-top, env(safe-area-inset-top, 0px)));
|
||||
}
|
||||
|
||||
.mpage-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
top: 0;
|
||||
box-sizing: border-box;
|
||||
padding: 0.75rem;
|
||||
padding-top: calc(0.75rem + var(--app-safe-top, env(safe-area-inset-top, 0px)));
|
||||
background: #fff;
|
||||
color: @primary-color;
|
||||
font-size: 1rem;
|
||||
font-weight: 700;
|
||||
line-height: 1.5;
|
||||
box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
|
||||
z-index: 1999;
|
||||
|
||||
&__back {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border: none;
|
||||
background: transparent;
|
||||
padding: 0;
|
||||
color: inherit;
|
||||
cursor: pointer;
|
||||
font-family: inherit;
|
||||
}
|
||||
|
||||
&__title {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
&__trailing {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.mpage-subheader {
|
||||
top: var(--mpage-subheader-offset);
|
||||
z-index: 1999;
|
||||
padding: 0.75rem;
|
||||
background: #fff;
|
||||
color: @primary-color;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.mpage-content {
|
||||
padding-top: var(--mpage-header-offset);
|
||||
}
|
||||
|
||||
.mpage-content--with-subheader {
|
||||
padding-top: var(--mpage-content-with-subheader);
|
||||
}
|
||||
|
||||
.mpage-scroll {
|
||||
overflow-y: auto;
|
||||
max-height: var(--mpage-scroll-max-height);
|
||||
}
|
||||
|
||||
.mobile-page-body--pt10 {
|
||||
padding-top: calc(2.5rem + var(--app-safe-top, env(safe-area-inset-top, 0px)));
|
||||
}
|
||||
|
||||
.mobile-page-body--pt15 {
|
||||
padding-top: calc(3.75rem + var(--app-safe-top, env(safe-area-inset-top, 0px)));
|
||||
}
|
||||
|
||||
.mobile-page-body--pt20 {
|
||||
padding-top: calc(5rem + var(--app-safe-top, env(safe-area-inset-top, 0px)));
|
||||
}
|
||||
|
||||
/* Info pages (about, educate): fixed shell, scroll inside content box only */
|
||||
.mobile-info-page {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
min-height: 0;
|
||||
max-height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.mobile-info-page__header {
|
||||
z-index: 1999;
|
||||
}
|
||||
|
||||
/* Decorative page background — fixed to viewport, never scrolls on iOS */
|
||||
.mobile-page-bg,
|
||||
.mobile-info-page__bg {
|
||||
pointer-events: none;
|
||||
position: fixed;
|
||||
z-index: 0;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: var(--app-bottom-chrome-height, 80px);
|
||||
overflow: hidden;
|
||||
max-width: 100vw;
|
||||
box-sizing: border-box;
|
||||
|
||||
img {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
}
|
||||
|
||||
.mobile-page-bg--no-nav,
|
||||
.mobile-info-page__bg {
|
||||
bottom: var(--app-credit-footer-offset, 0px);
|
||||
}
|
||||
|
||||
.mobile-page-bg--cover {
|
||||
background-size: cover;
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
html:not(.app-layout--desktop) {
|
||||
@media screen and (min-width: 426px) and (max-width: 767.98px) {
|
||||
.mobile-page-bg,
|
||||
.mobile-info-page__bg {
|
||||
width: 426px;
|
||||
max-width: 426px;
|
||||
left: 50%;
|
||||
right: auto;
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.mobile-info-page__main {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
flex: 1 1 0;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
padding-top: calc(var(--mpage-header-offset) + 1rem);
|
||||
padding-right: 2.5rem;
|
||||
padding-left: 2.5rem;
|
||||
padding-bottom: calc(
|
||||
var(--mobile-info-support-block, 5rem) + var(--app-credit-footer-offset, 0px) + 1.25rem
|
||||
);
|
||||
pointer-events: none;
|
||||
|
||||
> * {
|
||||
pointer-events: auto;
|
||||
}
|
||||
}
|
||||
|
||||
.mobile-info-page__support {
|
||||
bottom: var(--app-credit-footer-offset, 0px);
|
||||
box-sizing: border-box;
|
||||
padding: 1rem 2.5rem;
|
||||
padding-bottom: calc(1rem + var(--app-safe-bottom, env(safe-area-inset-bottom, 0px)));
|
||||
background: #fff;
|
||||
box-shadow: 0 -2px 8px rgba(15, 23, 42, 0.06);
|
||||
z-index: 1998;
|
||||
}
|
||||
|
||||
.mobile-content-box {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1 1 0;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
margin-bottom: 0.75rem;
|
||||
}
|
||||
|
||||
.mobile-content-box__scroll {
|
||||
flex: 1 1 0;
|
||||
min-height: 0;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
overscroll-behavior-y: contain;
|
||||
}
|
||||
@@ -0,0 +1,208 @@
|
||||
<template>
|
||||
<div
|
||||
ref="headerRef"
|
||||
class="app-header px-4 pb-2 top-0 wrap-fix background-color-transition"
|
||||
:class="{ 'app-header--scrolled': isHeaderScrolled }"
|
||||
>
|
||||
<div class="flex justify-between my-2 items-center">
|
||||
<div class="flex items-center gap-2" @click.stop="router.push({ name: 'user' })">
|
||||
<div class="z-100000 rounded-full border-1 text-primary border-primary">
|
||||
<Icon icon="vuesax-linear:user" size="20" />
|
||||
</div>
|
||||
<div class="text-primary color-transition font-bold">
|
||||
{{ userStore.userInfo?.name }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
class="mhome-header-btn mhome-header-btn--logout"
|
||||
@click="$emit('logout')"
|
||||
>
|
||||
<Icon icon="vuesax-linear:logout" size="18" />
|
||||
<span>خروج</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { nextTick, onActivated, onMounted, onUnmounted, ref, watch } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { useUserStore } from '@/store/userStore'
|
||||
import router from '@/router'
|
||||
import Icon from '@/components/BasicPacks/BasicIcon.vue'
|
||||
|
||||
const headerRef = ref<HTMLElement | null>(null)
|
||||
const isHeaderScrolled = ref(false)
|
||||
const route = useRoute()
|
||||
|
||||
const userStore = useUserStore()
|
||||
|
||||
let intersectionObserver: IntersectionObserver | null = null
|
||||
let scrollTarget: HTMLElement | Window | null = null
|
||||
|
||||
function isScrollableOverflow(value: string) {
|
||||
return value === 'auto' || value === 'scroll' || value === 'overlay'
|
||||
}
|
||||
|
||||
function findScrollParent(el: HTMLElement | null): HTMLElement | null {
|
||||
let node = el?.parentElement ?? null
|
||||
|
||||
while (node) {
|
||||
const style = getComputedStyle(node)
|
||||
const overflowY = style.overflowY
|
||||
const overflow = style.overflow
|
||||
|
||||
if (isScrollableOverflow(overflowY) || isScrollableOverflow(overflow)) {
|
||||
return node
|
||||
}
|
||||
|
||||
node = node.parentElement
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
function resolveScrollRoot(): HTMLElement | null {
|
||||
const header = headerRef.value
|
||||
if (!header) return null
|
||||
|
||||
const chromeInner = header.closest('.main-with-bottom-chrome-inner')
|
||||
if (chromeInner instanceof HTMLElement) {
|
||||
return chromeInner
|
||||
}
|
||||
|
||||
const fromParent = findScrollParent(header)
|
||||
if (fromParent) {
|
||||
return fromParent
|
||||
}
|
||||
|
||||
const global = document.querySelector('.main-with-bottom-chrome-inner')
|
||||
return global instanceof HTMLElement ? global : null
|
||||
}
|
||||
|
||||
function resolveScrollSentinel(scrollRoot: HTMLElement | null): HTMLElement | null {
|
||||
if (!scrollRoot) return null
|
||||
|
||||
const local = scrollRoot.querySelector('.app-header-scroll-sentinel')
|
||||
if (local instanceof HTMLElement) {
|
||||
return local
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
function updateScrollStateFromPosition() {
|
||||
if (!scrollTarget) return
|
||||
|
||||
const next =
|
||||
scrollTarget instanceof Window
|
||||
? scrollTarget.scrollY > 50
|
||||
: scrollTarget.scrollTop > 50
|
||||
|
||||
isHeaderScrolled.value = next
|
||||
}
|
||||
|
||||
function teardownScrollTracking() {
|
||||
intersectionObserver?.disconnect()
|
||||
intersectionObserver = null
|
||||
|
||||
scrollTarget?.removeEventListener('scroll', updateScrollStateFromPosition)
|
||||
scrollTarget = null
|
||||
}
|
||||
|
||||
function setupScrollTracking() {
|
||||
teardownScrollTracking()
|
||||
|
||||
const scrollRoot = resolveScrollRoot()
|
||||
const sentinel = resolveScrollSentinel(scrollRoot)
|
||||
|
||||
if (scrollRoot && sentinel && typeof IntersectionObserver !== 'undefined') {
|
||||
intersectionObserver = new IntersectionObserver(
|
||||
([entry]) => {
|
||||
isHeaderScrolled.value = !entry?.isIntersecting
|
||||
},
|
||||
{
|
||||
root: scrollRoot,
|
||||
threshold: 0,
|
||||
rootMargin: '-1px 0px 0px 0px',
|
||||
},
|
||||
)
|
||||
intersectionObserver.observe(sentinel)
|
||||
return
|
||||
}
|
||||
|
||||
scrollTarget = scrollRoot ?? window
|
||||
scrollTarget.addEventListener('scroll', updateScrollStateFromPosition, { passive: true })
|
||||
updateScrollStateFromPosition()
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
setupScrollTracking()
|
||||
await nextTick()
|
||||
setupScrollTracking()
|
||||
requestAnimationFrame(() => setupScrollTracking())
|
||||
})
|
||||
|
||||
onActivated(() => {
|
||||
isHeaderScrolled.value = false
|
||||
setupScrollTracking()
|
||||
})
|
||||
|
||||
watch(
|
||||
() => route.fullPath,
|
||||
() => {
|
||||
if (route.name === 'home') {
|
||||
isHeaderScrolled.value = false
|
||||
nextTick(() => setupScrollTracking())
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
onUnmounted(() => {
|
||||
teardownScrollTracking()
|
||||
})
|
||||
|
||||
defineEmits<{
|
||||
logout: []
|
||||
}>()
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.app-header {
|
||||
z-index: 1999;
|
||||
box-sizing: border-box;
|
||||
padding-top: calc(0.5rem + var(--app-safe-top, env(safe-area-inset-top, 0px)));
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.app-header--scrolled {
|
||||
background-color: rgba(255, 255, 255, 0.92);
|
||||
box-shadow:
|
||||
0 1px 3px 0 rgb(0 0 0 / 0.1),
|
||||
0 1px 2px -1px rgb(0 0 0 / 0.1);
|
||||
}
|
||||
|
||||
.mhome-header-btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 4px;
|
||||
padding: 6px 10px;
|
||||
border: 1px solid #e5e7eb;
|
||||
border-radius: 8px;
|
||||
background: #fff;
|
||||
color: #0a1b37;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
font-family: inherit;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.mhome-header-btn--logout {
|
||||
color: #dc2626;
|
||||
border-color: #fecaca;
|
||||
background: #fef2f2;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,50 @@
|
||||
<template>
|
||||
<div class="h-120 flex flex-col">
|
||||
<div class="text-center">انتخاب آدرس</div>
|
||||
<div class="overflow-y-scroll h-85">
|
||||
<ARadioGroup v-model:value="selectedAddressID">
|
||||
<div class="flex flex-col">
|
||||
<div
|
||||
v-for="addr in addresses"
|
||||
:key="addr.id"
|
||||
class="text-base rounded-lg p-4 m-2 shadow-md font-medium"
|
||||
>
|
||||
<ARadio :value="addr.id">
|
||||
{{ addr.province }} / {{ addr.city }} / {{ addr.address }}
|
||||
</ARadio>
|
||||
</div>
|
||||
</div>
|
||||
</ARadioGroup>
|
||||
</div>
|
||||
<div class="flex gap-2 pt-2">
|
||||
<BasicButton @click="emit('addAddress')">افزودن آدرس +</BasicButton>
|
||||
<BasicButton class="w-2/3" type="primary" @click="emit('submit')">
|
||||
ثبت نهایی
|
||||
</BasicButton>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
|
||||
import type { Address } from '@/models/address'
|
||||
|
||||
interface Props {
|
||||
addresses?: Address[]
|
||||
selectedAddressId?: number
|
||||
}
|
||||
|
||||
const props = defineProps<Props>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
addAddress: []
|
||||
submit: []
|
||||
'update:selectedAddressId': [value: number | undefined]
|
||||
}>()
|
||||
|
||||
const selectedAddressID = computed({
|
||||
get: () => props.selectedAddressId,
|
||||
set: (value: number | undefined) => emit('update:selectedAddressId', value),
|
||||
})
|
||||
</script>
|
||||
@@ -0,0 +1,108 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="flex">
|
||||
<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="" />
|
||||
</div>
|
||||
<div class="w-full min-w-0">
|
||||
<div class="pr-cart-row__head">
|
||||
<div class="truncate text-base font-bold">{{ item.product.title }}</div>
|
||||
<BasicButton
|
||||
icon="vuesax-linear:trash"
|
||||
icon-class="text-red"
|
||||
class="pr-cart-row__trash shrink-0"
|
||||
@click="emit('remove', item.product.id)"
|
||||
/>
|
||||
<div class="pr-cart-row__stock text-xs">
|
||||
<span>مقدار موجودی</span>
|
||||
<span class="font-bold">{{ item.product.wallet.gold }}</span>
|
||||
<span>{{ item.product.unit }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-2 flex justify-between items-center gap-2">
|
||||
<div class="shrink-0">تعداد درخواستی:</div>
|
||||
<div class="flex items-center gap-1 pr-cart-row__input">
|
||||
<BasicInput
|
||||
v-model:value="item.count"
|
||||
:addon-before="item.product.unit"
|
||||
addon-bg-color="#a72b77"
|
||||
addon-text-color="white"
|
||||
type="text"
|
||||
inputmode="numeric"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
|
||||
import BasicInput from '@/components/BasicPacks/BasicInput.vue'
|
||||
import type { CountPInventory } from '@/models/products'
|
||||
import { getProductDisplayImage } from '@/utils/productAssets'
|
||||
|
||||
interface Props {
|
||||
item: CountPInventory
|
||||
}
|
||||
|
||||
const props = defineProps<Props>()
|
||||
|
||||
const displayImage = computed(() =>
|
||||
getProductDisplayImage({
|
||||
group_type: props.item.product.group_type,
|
||||
title: props.item.product.title,
|
||||
file: props.item.product.file,
|
||||
}),
|
||||
)
|
||||
|
||||
const emit = defineEmits<{
|
||||
remove: [id: number]
|
||||
}>()
|
||||
</script>
|
||||
|
||||
<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>
|
||||
@@ -0,0 +1,170 @@
|
||||
import { inject, nextTick, onMounted, provide, ref, type InjectionKey, type Ref } from 'vue'
|
||||
import { cloneDeep } from 'lodash'
|
||||
import { message } from 'ant-design-vue'
|
||||
import router from '@/router'
|
||||
import { getProductInventory } from '@/api/products'
|
||||
import { physicalReceiveApi } from '@/api/physicalreceive'
|
||||
import { tableAddress } from '@/api/address'
|
||||
import type { CountPInventory, PInventory } from '@/models/products'
|
||||
import type { Address } from '@/models/address'
|
||||
import { loading } from '@/utils'
|
||||
import { usePhysicalReceiveShellContext } from './usePhysicalReceiveShell'
|
||||
|
||||
export interface NewPhysicalRequestContext {
|
||||
isDesktop: Ref<boolean>
|
||||
items: Ref<PInventory[] | undefined>
|
||||
selectedProduct: Ref<number | undefined>
|
||||
selectedProducts: Ref<CountPInventory[]>
|
||||
address: Ref<Address[] | undefined>
|
||||
selectedAddressID: Ref<number | undefined>
|
||||
showAddress: Ref<boolean>
|
||||
addAddressVisible: Ref<boolean>
|
||||
handleAdd: () => void
|
||||
handleRemove: (id: number) => void
|
||||
handelFirstSubmit: () => Promise<void>
|
||||
handelsubmit: () => Promise<void>
|
||||
handleAddress: () => void
|
||||
}
|
||||
|
||||
export const NEW_PHYSICAL_REQUEST_KEY: InjectionKey<NewPhysicalRequestContext> =
|
||||
Symbol('newPhysicalRequest')
|
||||
|
||||
export function useNewPhysicalRequestPage() {
|
||||
const { isDesktop } = usePhysicalReceiveShellContext()
|
||||
|
||||
const items = ref<PInventory[]>()
|
||||
const baseItems = ref<PInventory[]>()
|
||||
const selectedAddressID = ref<number>()
|
||||
const selectedProduct = ref<number>()
|
||||
const productsByWalletId = ref<Array<{ wallet_id: number; value: number }>>([])
|
||||
const address = ref<Address[]>()
|
||||
const selectedProducts = ref<CountPInventory[]>([])
|
||||
const showAddress = ref(false)
|
||||
const addAddressVisible = ref(false)
|
||||
|
||||
function handleAdd() {
|
||||
const product = items.value?.find((x) => x.id === selectedProduct.value)
|
||||
if (!product) return
|
||||
|
||||
selectedProducts.value.push({
|
||||
count: 0,
|
||||
product,
|
||||
})
|
||||
items.value?.splice(items.value.findIndex((x) => x.id === selectedProduct.value), 1)
|
||||
selectedProduct.value = undefined
|
||||
}
|
||||
|
||||
function handleAddress() {
|
||||
getAddress()
|
||||
addAddressVisible.value = false
|
||||
showAddress.value = true
|
||||
}
|
||||
|
||||
function handleRemove(id: number) {
|
||||
const findItem = baseItems.value?.find((x) => x.id === id)
|
||||
if (findItem) {
|
||||
items.value?.push(findItem)
|
||||
}
|
||||
selectedProducts.value.splice(
|
||||
selectedProducts.value.findIndex((x) => x.product.id === id),
|
||||
1,
|
||||
)
|
||||
}
|
||||
|
||||
async function initProductWallet() {
|
||||
try {
|
||||
loading.value = true
|
||||
const inventory = (await getProductInventory()).rows.filter(
|
||||
(x) => x.title !== 'آبشده نقدی' && x.wallet?.gold && x.wallet.gold > 0,
|
||||
)
|
||||
items.value = inventory
|
||||
baseItems.value = cloneDeep(inventory)
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function handelFirstSubmit() {
|
||||
try {
|
||||
const zeroAmount = selectedProducts.value.map((item) => item.count <= 0)
|
||||
if (zeroAmount.includes(true)) {
|
||||
message.error('لطفاً تعداد درخواستی محصول را وارد کنید.')
|
||||
} else {
|
||||
showAddress.value = true
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
}
|
||||
|
||||
async function handelsubmit() {
|
||||
if (!selectedAddressID.value) {
|
||||
message.error('لطفاً آدرس را انتخاب کنید.')
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
loading.value = true
|
||||
productsByWalletId.value = selectedProducts.value.map((val) => ({
|
||||
wallet_id: val.product.wallet.id,
|
||||
value: val.count,
|
||||
}))
|
||||
await physicalReceiveApi({
|
||||
address_id: selectedAddressID.value,
|
||||
wallets: productsByWalletId.value,
|
||||
})
|
||||
|
||||
showAddress.value = false
|
||||
selectedAddressID.value = undefined
|
||||
selectedProducts.value = []
|
||||
await nextTick()
|
||||
|
||||
message.success('درخواست شما با موفقیت ارسال شد')
|
||||
await initProductWallet()
|
||||
await router.push({ name: 'list' })
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function getAddress() {
|
||||
const { rows } = await tableAddress({ page: 0, limit: 150 })
|
||||
address.value = rows
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await initProductWallet()
|
||||
await getAddress()
|
||||
})
|
||||
|
||||
const context: NewPhysicalRequestContext = {
|
||||
isDesktop,
|
||||
items,
|
||||
selectedProduct,
|
||||
selectedProducts,
|
||||
address,
|
||||
selectedAddressID,
|
||||
showAddress,
|
||||
addAddressVisible,
|
||||
handleAdd,
|
||||
handleRemove,
|
||||
handelFirstSubmit,
|
||||
handelsubmit,
|
||||
handleAddress,
|
||||
}
|
||||
|
||||
provide(NEW_PHYSICAL_REQUEST_KEY, context)
|
||||
return context
|
||||
}
|
||||
|
||||
export function useNewPhysicalRequestContext() {
|
||||
const context = inject(NEW_PHYSICAL_REQUEST_KEY)
|
||||
if (!context) {
|
||||
throw new Error('useNewPhysicalRequestContext must be used within useNewPhysicalRequestPage')
|
||||
}
|
||||
return context
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
import { inject, onMounted, provide, ref, type InjectionKey, type Ref } from 'vue'
|
||||
import { getPhysicalReceiveList } from '@/api/physicalreceive'
|
||||
import type { Physicalreceive } from '@/models/physicalreceive'
|
||||
import router from '@/router'
|
||||
|
||||
export interface PhysicalReceiveListContext {
|
||||
requestItems: Ref<Physicalreceive[]>
|
||||
openAdd: () => void
|
||||
}
|
||||
|
||||
export const PHYSICAL_RECEIVE_LIST_KEY: InjectionKey<PhysicalReceiveListContext> =
|
||||
Symbol('physicalReceiveList')
|
||||
|
||||
export function usePhysicalReceiveList() {
|
||||
const requestItems = ref<Physicalreceive[]>([])
|
||||
|
||||
function openAdd() {
|
||||
router.push({ name: 'new' })
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
const { rows } = await getPhysicalReceiveList()
|
||||
requestItems.value = rows
|
||||
})
|
||||
|
||||
const context: PhysicalReceiveListContext = { requestItems, openAdd }
|
||||
provide(PHYSICAL_RECEIVE_LIST_KEY, context)
|
||||
return context
|
||||
}
|
||||
|
||||
export function usePhysicalReceiveListContext() {
|
||||
const context = inject(PHYSICAL_RECEIVE_LIST_KEY)
|
||||
if (!context) {
|
||||
throw new Error('usePhysicalReceiveListContext must be used within usePhysicalReceiveList')
|
||||
}
|
||||
return context
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
import { inject, provide, type InjectionKey } from 'vue'
|
||||
import { useDesktopBreakpoint } from '@/layouts/composables/useAppLayout'
|
||||
|
||||
export interface PhysicalReceiveShellContext {
|
||||
isDesktop: ReturnType<typeof useDesktopBreakpoint>
|
||||
}
|
||||
|
||||
export const PHYSICAL_RECEIVE_SHELL_KEY: InjectionKey<PhysicalReceiveShellContext> =
|
||||
Symbol('physicalReceiveShell')
|
||||
|
||||
export function usePhysicalReceiveShell() {
|
||||
const isDesktop = useDesktopBreakpoint()
|
||||
provide(PHYSICAL_RECEIVE_SHELL_KEY, { isDesktop })
|
||||
return { isDesktop }
|
||||
}
|
||||
|
||||
export function usePhysicalReceiveShellContext() {
|
||||
const context = inject(PHYSICAL_RECEIVE_SHELL_KEY)
|
||||
if (!context) {
|
||||
throw new Error('usePhysicalReceiveShellContext must be used within physical receive shell')
|
||||
}
|
||||
return context
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
<template>
|
||||
<div class="dinner physical-receive-page">
|
||||
<div class="dinner__container">
|
||||
<DesktopPageTopbar title="درخواست جدید" show-back />
|
||||
|
||||
<div class="dinner-surface p-5 space-y-4">
|
||||
<div class="physical-new-request__picker-row">
|
||||
<div class="physical-new-request__select">
|
||||
<BasicSelect
|
||||
v-model:value="selectedProduct"
|
||||
:items="items"
|
||||
key-name="id"
|
||||
:show-search="false"
|
||||
value-name="title"
|
||||
size="large"
|
||||
placeholder="لطفا محصول را انتخاب کنید"
|
||||
:has-tooltip="false"
|
||||
/>
|
||||
</div>
|
||||
<BasicButton
|
||||
class="physical-new-request__add-btn"
|
||||
:disabled-b="selectedProduct == null"
|
||||
type="primary"
|
||||
@click="handleAdd"
|
||||
>
|
||||
افزودن
|
||||
</BasicButton>
|
||||
</div>
|
||||
|
||||
<div class="space-y-2">
|
||||
<div
|
||||
v-for="val in selectedProducts"
|
||||
:key="val.product.id"
|
||||
class="rounded-lg p-2 bg-gray-100"
|
||||
>
|
||||
<PhysicalReceiveCartRow :item="val" @remove="handleRemove" />
|
||||
</div>
|
||||
<div v-if="selectedProducts.length === 0" class="text-center text-gray-500 py-8">
|
||||
محصولی به سبد اضافه نشده است.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<BasicButton
|
||||
:disabled-b="selectedProducts.length == 0"
|
||||
class="w-full"
|
||||
type="primary"
|
||||
@click="handelFirstSubmit()"
|
||||
>
|
||||
ادامه و انتخاب آدرس
|
||||
</BasicButton>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<BasicActionSheet v-model:show="showAddress">
|
||||
<PhysicalReceiveAddressPicker
|
||||
v-model:selected-address-id="selectedAddressID"
|
||||
:addresses="address"
|
||||
@add-address="addAddressVisible = true; showAddress = false"
|
||||
@submit="handelsubmit"
|
||||
/>
|
||||
</BasicActionSheet>
|
||||
|
||||
<BasicActionSheet v-model:show="addAddressVisible">
|
||||
<New_EditAddress v-if="addAddressVisible" :visible="addAddressVisible" @onOk="handleAddress" />
|
||||
</BasicActionSheet>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
|
||||
import BasicSelect from '@/components/BasicPacks/BasicSelect.vue'
|
||||
import BasicActionSheet from '@/components/BasicPacks/BasicActionSheet.vue'
|
||||
import DesktopPageTopbar from '@/layouts/components/DesktopPageTopbar.vue'
|
||||
import New_EditAddress from '@/views/base/address/components/New_EditAddress.vue'
|
||||
import PhysicalReceiveCartRow from '../components/PhysicalReceiveCartRow.vue'
|
||||
import PhysicalReceiveAddressPicker from '../components/PhysicalReceiveAddressPicker.vue'
|
||||
import { useNewPhysicalRequestContext } from '../composables/useNewPhysicalRequestPage'
|
||||
|
||||
const {
|
||||
items,
|
||||
selectedProduct,
|
||||
selectedProducts,
|
||||
address,
|
||||
selectedAddressID,
|
||||
showAddress,
|
||||
addAddressVisible,
|
||||
handleAdd,
|
||||
handleRemove,
|
||||
handelFirstSubmit,
|
||||
handelsubmit,
|
||||
handleAddress,
|
||||
} = useNewPhysicalRequestContext()
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.physical-new-request__picker-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.physical-new-request__select {
|
||||
flex: 1 1 0;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.physical-new-request__select :deep(.ant-select) {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.physical-new-request__select :deep(.ant-select-selector) {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.physical-new-request__select :deep(.ant-select-selection-item),
|
||||
.physical-new-request__select :deep(.ant-select-selection-placeholder) {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.physical-new-request__add-btn {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,165 @@
|
||||
<template>
|
||||
<div class="physical-new-request">
|
||||
<div class="physical-new-request__toolbar mpage-content">
|
||||
<div class="physical-new-request__picker-row px-3">
|
||||
<div class="physical-new-request__select">
|
||||
<BasicSelect
|
||||
v-model:value="selectedProduct"
|
||||
:items="items"
|
||||
key-name="id"
|
||||
:show-search="false"
|
||||
value-name="title"
|
||||
size="large"
|
||||
placeholder="لطفا محصول را انتخاب کنید"
|
||||
:has-tooltip="false"
|
||||
/>
|
||||
</div>
|
||||
<BasicButton
|
||||
class="physical-new-request__add-btn"
|
||||
:disabled-b="selectedProduct == null"
|
||||
type="primary"
|
||||
@click="handleAdd"
|
||||
>
|
||||
افزودن
|
||||
</BasicButton>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="physical-new-request__items px-3">
|
||||
<div class="physical-new-request__items-scroll">
|
||||
<div
|
||||
v-for="val in selectedProducts"
|
||||
:key="val.product.id"
|
||||
class="rounded-lg p-2 bg-gray-100 mb-2 last:mb-0"
|
||||
>
|
||||
<PhysicalReceiveCartRow :item="val" @remove="handleRemove" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="physical-new-request__footer px-3">
|
||||
<BasicButton
|
||||
:disabled-b="selectedProducts.length == 0"
|
||||
class="w-full"
|
||||
@click="handelFirstSubmit()"
|
||||
>
|
||||
ثبت
|
||||
</BasicButton>
|
||||
</div>
|
||||
|
||||
<BasicActionSheet v-model:show="showAddress">
|
||||
<PhysicalReceiveAddressPicker
|
||||
v-model:selected-address-id="selectedAddressID"
|
||||
:addresses="address"
|
||||
@add-address="addAddressVisible = true; showAddress = false"
|
||||
@submit="handelsubmit"
|
||||
/>
|
||||
</BasicActionSheet>
|
||||
|
||||
<BasicActionSheet v-model:show="addAddressVisible">
|
||||
<New_EditAddress v-if="addAddressVisible" :visible="addAddressVisible" @onOk="handleAddress" />
|
||||
</BasicActionSheet>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
|
||||
import BasicSelect from '@/components/BasicPacks/BasicSelect.vue'
|
||||
import BasicActionSheet from '@/components/BasicPacks/BasicActionSheet.vue'
|
||||
import New_EditAddress from '@/views/base/address/components/New_EditAddress.vue'
|
||||
import PhysicalReceiveCartRow from '../components/PhysicalReceiveCartRow.vue'
|
||||
import PhysicalReceiveAddressPicker from '../components/PhysicalReceiveAddressPicker.vue'
|
||||
import { useNewPhysicalRequestContext } from '../composables/useNewPhysicalRequestPage'
|
||||
|
||||
const {
|
||||
items,
|
||||
selectedProduct,
|
||||
selectedProducts,
|
||||
address,
|
||||
selectedAddressID,
|
||||
showAddress,
|
||||
addAddressVisible,
|
||||
handleAdd,
|
||||
handleRemove,
|
||||
handelFirstSubmit,
|
||||
handelsubmit,
|
||||
handleAddress,
|
||||
} = useNewPhysicalRequestContext()
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.physical-new-request {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1 1 0;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
box-sizing: border-box;
|
||||
padding-bottom: var(--app-bottom-chrome-height, 80px);
|
||||
}
|
||||
|
||||
.physical-new-request__toolbar {
|
||||
flex-shrink: 0;
|
||||
padding-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.physical-new-request__picker-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.physical-new-request__select {
|
||||
flex: 1 1 0;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.physical-new-request__select :deep(.ant-select) {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.physical-new-request__select :deep(.ant-select-selector) {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.physical-new-request__select :deep(.ant-select-selection-item),
|
||||
.physical-new-request__select :deep(.ant-select-selection-placeholder) {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.physical-new-request__add-btn {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.physical-new-request__items {
|
||||
flex: 1 1 0;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.physical-new-request__items-scroll {
|
||||
flex: 1 1 0;
|
||||
min-height: 0;
|
||||
overflow-y: auto;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
overscroll-behavior-y: contain;
|
||||
border: 1px solid #e5e7eb;
|
||||
border-radius: 0.5rem;
|
||||
background: #fff;
|
||||
padding: 0.5rem;
|
||||
}
|
||||
|
||||
.physical-new-request__footer {
|
||||
flex-shrink: 0;
|
||||
padding-top: 0.75rem;
|
||||
padding-bottom: 0.75rem;
|
||||
background: #fff;
|
||||
border-top: 1px solid #f3f4f6;
|
||||
box-shadow: 0 -2px 8px rgba(15, 23, 42, 0.06);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,15 @@
|
||||
<template>
|
||||
<MobilePageHeader :title="pageTitle" show-back />
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import MobilePageHeader from '@/layouts/components/MobilePageHeader.vue'
|
||||
|
||||
const route = useRoute()
|
||||
|
||||
const pageTitle = computed(() =>
|
||||
route.name === 'list' ? 'دریافت فیزیکی' : 'دریافت فیزیکی-درخواست جدید',
|
||||
)
|
||||
</script>
|
||||
@@ -0,0 +1,29 @@
|
||||
<template>
|
||||
<div>
|
||||
<div
|
||||
class="flex flex-col gap-4 mpage-content px-2 pb-[calc(var(--app-bottom-chrome-height)+var(--app-add-card-height)+1rem)]"
|
||||
>
|
||||
<RequestItem v-for="item in requestItems" :key="item.id" :item="item" />
|
||||
<div
|
||||
v-if="requestItems.length === 0"
|
||||
class="flex flex-col items-center justify-center min-h-[40vh] text-gray-500"
|
||||
>
|
||||
هنوز درخواستی ثبت نشده است.
|
||||
</div>
|
||||
</div>
|
||||
<Teleport to="body">
|
||||
<div class="app-dock-add-bar" @click="openAdd()">
|
||||
<BasicIcon icon="vuesax-linear:add" />
|
||||
<div>افزودن درخواست جدید</div>
|
||||
</div>
|
||||
</Teleport>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
|
||||
import RequestItem from '../components/RequestItem.vue'
|
||||
import { usePhysicalReceiveListContext } from '../composables/usePhysicalReceiveList'
|
||||
|
||||
const { requestItems, openAdd } = usePhysicalReceiveListContext()
|
||||
</script>
|
||||
@@ -0,0 +1,63 @@
|
||||
<template>
|
||||
<a-form
|
||||
ref="formRef"
|
||||
:model="form"
|
||||
class="!mt-0"
|
||||
name="price-trigger-form"
|
||||
@finish="ok()"
|
||||
>
|
||||
<div class="flex flex-col gap-4 w-full">
|
||||
<a-form-item :rules="[required()]" label="جهت قیمت" name="price_condition">
|
||||
<BasicSelect
|
||||
v-model:value="form.price_condition"
|
||||
:items="typeItems"
|
||||
:show-search="false"
|
||||
key-name="key"
|
||||
placeholder="انتخاب نوع جهت قیمت"
|
||||
size="large"
|
||||
value-name="value"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item :rules="[required()]" label="قیمت" name="target_price">
|
||||
<BasicInput
|
||||
v-model:value="form.target_price"
|
||||
addon-before="ریال"
|
||||
place-holder="وارد کردن قیمت"
|
||||
size="large"
|
||||
type="price"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item :rules="[required()]" label="نوع هشدار را انتخاب کنید" name="action">
|
||||
<a-radio-group v-model:value="form.action">
|
||||
<a-radio :style="radioStyle" value="sms">ارسال پیامک</a-radio>
|
||||
<a-radio :style="radioStyle" value="email">ارسال ایمیل</a-radio>
|
||||
</a-radio-group>
|
||||
</a-form-item>
|
||||
<a-form-item>
|
||||
<a-spin :spinning="loading">
|
||||
<BasicButton class="w-full" html-type="submit" type="primary">
|
||||
{{ editId ? 'ویرایش هشدار' : 'ثبت هشدار' }}
|
||||
</BasicButton>
|
||||
</a-spin>
|
||||
</a-form-item>
|
||||
</div>
|
||||
</a-form>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
|
||||
import BasicInput from '@/components/BasicPacks/BasicInput.vue'
|
||||
import BasicSelect from '@/components/BasicPacks/BasicSelect.vue'
|
||||
import { required } from '@/utils/inputRules'
|
||||
import { usePriceTriggerPageContext } from '../composables/usePriceTriggerPage'
|
||||
|
||||
const {
|
||||
form,
|
||||
formRef,
|
||||
editId,
|
||||
loading,
|
||||
radioStyle,
|
||||
typeItems,
|
||||
ok,
|
||||
} = usePriceTriggerPageContext()
|
||||
</script>
|
||||
@@ -0,0 +1,135 @@
|
||||
import { inject, onMounted, provide, reactive, ref, type InjectionKey, type Ref } from 'vue'
|
||||
import { cloneDeep } from 'lodash'
|
||||
import { type FormInstance, message } from 'ant-design-vue'
|
||||
import { createPriceTrigger, getPriceTriggers, updatePriceTrigger } from '@/api/triggerPrice'
|
||||
import type { SelectItem } from '@/models/SelectItem'
|
||||
import type { PriceTrigger } from '@/models/PriceTrigger'
|
||||
import { loading } from '@/utils'
|
||||
|
||||
export interface PriceTriggerPageContext {
|
||||
items: Ref<PriceTrigger[]>
|
||||
addTriggerVisible: Ref<boolean>
|
||||
editId: Ref<number | undefined>
|
||||
form: Ref<PriceTrigger>
|
||||
formRef: Ref<FormInstance | undefined>
|
||||
loading: typeof loading
|
||||
radioStyle: ReturnType<typeof reactive<{ display: string; height: string; lineHeight: string }>>
|
||||
typeItems: SelectItem[]
|
||||
resetFields: () => void
|
||||
openAdd: () => void
|
||||
openEdit: (val: PriceTrigger) => void
|
||||
initItems: () => Promise<void>
|
||||
ok: () => Promise<void>
|
||||
}
|
||||
|
||||
export const PRICE_TRIGGER_PAGE_CONTEXT_KEY: InjectionKey<PriceTriggerPageContext> =
|
||||
Symbol('priceTriggerPageContext')
|
||||
|
||||
export function usePriceTriggerPage() {
|
||||
const items = ref<PriceTrigger[]>([])
|
||||
const addTriggerVisible = ref(false)
|
||||
const editId = ref<number | undefined>(undefined)
|
||||
const formRef = ref<FormInstance>()
|
||||
|
||||
const radioStyle = reactive({
|
||||
display: '',
|
||||
height: '30px',
|
||||
lineHeight: '30px',
|
||||
})
|
||||
|
||||
const form = ref<PriceTrigger>({
|
||||
price_condition: '',
|
||||
is_active: true,
|
||||
action: '',
|
||||
target_price: '',
|
||||
})
|
||||
|
||||
const typeItems: SelectItem[] = [
|
||||
{ value: 'بزرگتر', key: '>' },
|
||||
{ value: 'کوچکتر', key: '<' },
|
||||
{ value: 'مساوی', key: '==' },
|
||||
]
|
||||
|
||||
function resetFields() {
|
||||
form.value = {
|
||||
price_condition: '',
|
||||
is_active: true,
|
||||
action: '',
|
||||
target_price: '',
|
||||
}
|
||||
}
|
||||
|
||||
function openAdd() {
|
||||
resetFields()
|
||||
editId.value = undefined
|
||||
addTriggerVisible.value = true
|
||||
}
|
||||
|
||||
function openEdit(val: PriceTrigger) {
|
||||
form.value = cloneDeep(val)
|
||||
editId.value = form.value.id
|
||||
addTriggerVisible.value = true
|
||||
}
|
||||
|
||||
async function initItems() {
|
||||
try {
|
||||
items.value = []
|
||||
items.value = await getPriceTriggers()
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function ok() {
|
||||
await formRef.value?.validateFields().then(async () => {
|
||||
try {
|
||||
loading.value = true
|
||||
if (editId.value) {
|
||||
await updatePriceTrigger(editId.value, form.value)
|
||||
} else {
|
||||
await createPriceTrigger(form.value)
|
||||
}
|
||||
message.success('هشدار با موفقیت ایجاد شد')
|
||||
await initItems()
|
||||
addTriggerVisible.value = false
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
initItems()
|
||||
})
|
||||
|
||||
const context: PriceTriggerPageContext = {
|
||||
items,
|
||||
addTriggerVisible,
|
||||
editId,
|
||||
form,
|
||||
formRef,
|
||||
loading,
|
||||
radioStyle,
|
||||
typeItems,
|
||||
resetFields,
|
||||
openAdd,
|
||||
openEdit,
|
||||
initItems,
|
||||
ok,
|
||||
}
|
||||
|
||||
provide(PRICE_TRIGGER_PAGE_CONTEXT_KEY, context)
|
||||
return context
|
||||
}
|
||||
|
||||
export function usePriceTriggerPageContext() {
|
||||
const context = inject(PRICE_TRIGGER_PAGE_CONTEXT_KEY)
|
||||
if (!context) {
|
||||
throw new Error('usePriceTriggerPageContext must be used within a page that calls usePriceTriggerPage()')
|
||||
}
|
||||
return context
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
<template>
|
||||
<div class="dptr">
|
||||
<div class="dptr__container">
|
||||
<header class="dptr-topbar">
|
||||
<p class="dptr-topbar__eyebrow">اعلانها</p>
|
||||
<h1 class="dptr-topbar__title">هشدار قیمت</h1>
|
||||
<p class="dptr-topbar__subtitle">هنگام رسیدن قیمت به مقدار تعیینشده، از طریق پیامک یا ایمیل مطلع شوید</p>
|
||||
</header>
|
||||
|
||||
<div class="dptr-grid">
|
||||
<section class="dptr-surface dptr-form">
|
||||
<div class="dptr-form__header">
|
||||
<h2 class="dptr-form__title">{{ editId ? 'ویرایش هشدار' : 'ثبت هشدار جدید' }}</h2>
|
||||
<button
|
||||
v-if="editId"
|
||||
type="button"
|
||||
class="dptr-form__reset"
|
||||
@click="openAdd()"
|
||||
>
|
||||
هشدار جدید
|
||||
</button>
|
||||
</div>
|
||||
<PriceTriggerForm />
|
||||
</section>
|
||||
|
||||
<section class="dptr-surface dptr-list">
|
||||
<div class="dptr-list__header">
|
||||
<h3 class="dptr-list__title">هشدارهای فعلی</h3>
|
||||
<span class="dptr-list__count">{{ items.length }} مورد</span>
|
||||
</div>
|
||||
|
||||
<div v-if="loading" class="dptr-list__skeletons">
|
||||
<TransactionSkeleton v-for="i in 6" :key="i" class="mt-1" />
|
||||
</div>
|
||||
|
||||
<div v-else-if="items.length" class="dptr-list__items">
|
||||
<list-anim>
|
||||
<Item
|
||||
v-for="item in items"
|
||||
:key="item.id"
|
||||
:item="item"
|
||||
variant="desktop"
|
||||
@edit="openEdit"
|
||||
@refresh="initItems"
|
||||
/>
|
||||
</list-anim>
|
||||
</div>
|
||||
|
||||
<div v-else class="dptr-empty">
|
||||
<BasicIcon icon="vuesax-linear:notification-bing" size="36" />
|
||||
<p>هنوز هشداری ثبت نشده است.</p>
|
||||
<button type="button" class="dptr-empty__btn" @click="openAdd()">
|
||||
افزودن اولین هشدار
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
|
||||
import ListAnim from '@/components/ListAnim.vue'
|
||||
import TransactionSkeleton from '@/components/TransactionSkeleton.vue'
|
||||
import Item from '../components/Item.vue'
|
||||
import PriceTriggerForm from '../components/PriceTriggerForm.vue'
|
||||
import { usePriceTriggerPageContext } from '../composables/usePriceTriggerPage'
|
||||
|
||||
const {
|
||||
items,
|
||||
loading,
|
||||
editId,
|
||||
openAdd,
|
||||
openEdit,
|
||||
initItems,
|
||||
} = usePriceTriggerPageContext()
|
||||
</script>
|
||||
@@ -0,0 +1,273 @@
|
||||
/* Premium desktop price trigger page */
|
||||
|
||||
.dptr {
|
||||
min-height: 100%;
|
||||
background: #f6f7f9;
|
||||
color: #111827;
|
||||
}
|
||||
|
||||
.dptr__container {
|
||||
max-width: 1180px;
|
||||
margin: 0 auto;
|
||||
padding: 28px 36px 40px;
|
||||
}
|
||||
|
||||
.dptr-topbar {
|
||||
margin-bottom: 24px;
|
||||
padding-bottom: 24px;
|
||||
border-bottom: 1px solid rgba(15, 23, 42, 0.06);
|
||||
|
||||
&__eyebrow {
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
color: #9ca3af;
|
||||
margin: 0 0 4px;
|
||||
}
|
||||
|
||||
&__title {
|
||||
font-size: 26px;
|
||||
font-weight: 600;
|
||||
letter-spacing: -0.03em;
|
||||
color: #111827;
|
||||
margin: 0 0 6px;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
&__subtitle {
|
||||
font-size: 14px;
|
||||
color: #6b7280;
|
||||
margin: 0;
|
||||
max-width: 520px;
|
||||
line-height: 1.6;
|
||||
}
|
||||
}
|
||||
|
||||
.dptr-grid {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 380px) minmax(0, 1fr);
|
||||
gap: 20px;
|
||||
align-items: start;
|
||||
}
|
||||
|
||||
.dptr-surface {
|
||||
background: #fff;
|
||||
border: 1px solid rgba(15, 23, 42, 0.06);
|
||||
border-radius: 16px;
|
||||
box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
|
||||
}
|
||||
|
||||
.dptr-form {
|
||||
padding: 24px;
|
||||
|
||||
&__header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
&__title {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: #111827;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
&__reset {
|
||||
border: 1px solid #e5e7eb;
|
||||
border-radius: 8px;
|
||||
background: #fff;
|
||||
color: #6b7280;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
font-family: inherit;
|
||||
padding: 6px 10px;
|
||||
cursor: pointer;
|
||||
transition: border-color 0.15s ease, color 0.15s ease;
|
||||
|
||||
&:hover {
|
||||
border-color: @App-primary-color;
|
||||
color: @App-primary-color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.dptr-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 420px;
|
||||
|
||||
&__header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
padding: 20px 24px 0;
|
||||
}
|
||||
|
||||
&__title {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: #111827;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
&__count {
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
color: #6b7280;
|
||||
background: #f3f4f6;
|
||||
border-radius: 999px;
|
||||
padding: 4px 10px;
|
||||
}
|
||||
|
||||
&__items {
|
||||
padding: 16px 24px 24px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
&__skeletons {
|
||||
padding: 16px 24px 24px;
|
||||
}
|
||||
}
|
||||
|
||||
.dptr-card {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) auto;
|
||||
gap: 12px 16px;
|
||||
padding: 16px 18px;
|
||||
border: 1px solid #eef0f3;
|
||||
border-radius: 12px;
|
||||
background: #fafbfc;
|
||||
transition: border-color 0.15s ease, box-shadow 0.15s ease;
|
||||
|
||||
&:hover {
|
||||
border-color: #dbe0e6;
|
||||
box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
|
||||
}
|
||||
|
||||
&__price {
|
||||
grid-column: 1 / -1;
|
||||
font-size: 18px;
|
||||
font-weight: 700;
|
||||
color: #111827;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
&__meta {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
&__row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
font-size: 13px;
|
||||
color: #6b7280;
|
||||
}
|
||||
|
||||
&__label {
|
||||
color: #9ca3af;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
&__value {
|
||||
color: #374151;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
&__actions {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
&__icon-btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 34px;
|
||||
height: 34px;
|
||||
border: 1px solid #e5e7eb;
|
||||
border-radius: 10px;
|
||||
background: #fff;
|
||||
cursor: pointer;
|
||||
transition: border-color 0.15s ease, background 0.15s ease;
|
||||
|
||||
&:hover {
|
||||
background: #f9fafb;
|
||||
}
|
||||
|
||||
&--danger:hover {
|
||||
border-color: #fecaca;
|
||||
background: #fef2f2;
|
||||
}
|
||||
|
||||
&--edit:hover {
|
||||
border-color: #bbf7d0;
|
||||
background: #f0fdf4;
|
||||
}
|
||||
}
|
||||
|
||||
&__footer {
|
||||
grid-column: 1 / -1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
padding-top: 10px;
|
||||
border-top: 1px solid #eef0f3;
|
||||
}
|
||||
|
||||
&__date {
|
||||
font-size: 12px;
|
||||
color: #9ca3af;
|
||||
}
|
||||
}
|
||||
|
||||
.dptr-empty {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 12px;
|
||||
padding: 48px 24px;
|
||||
color: #6b7280;
|
||||
text-align: center;
|
||||
|
||||
p {
|
||||
margin: 0;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
&__btn {
|
||||
margin-top: 4px;
|
||||
border: none;
|
||||
border-radius: 10px;
|
||||
background: @App-primary-color;
|
||||
color: #fff;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
font-family: inherit;
|
||||
padding: 10px 16px;
|
||||
cursor: pointer;
|
||||
transition: opacity 0.15s ease;
|
||||
|
||||
&:hover {
|
||||
opacity: 0.92;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 1023.98px) {
|
||||
.dptr-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<template>
|
||||
<div>
|
||||
<MobilePageHeader title="هشدارهای فعلی" show-back />
|
||||
|
||||
<div
|
||||
:class="loading ? 'h-screen' : ''"
|
||||
class="px-3 mpage-content pb-2 overflow-y-scroll mpage-scroll"
|
||||
>
|
||||
<list-anim v-if="!loading" class="pb-[calc(var(--app-bottom-chrome-height)+var(--app-add-card-height)+1rem)]">
|
||||
<Item
|
||||
v-for="item in items"
|
||||
:key="item.id"
|
||||
:item="item"
|
||||
@edit="openEdit"
|
||||
@refresh="initItems"
|
||||
/>
|
||||
</list-anim>
|
||||
<div v-if="loading">
|
||||
<TransactionSkeleton v-for="i in 13" :key="i" class="mt-1" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Teleport to="body">
|
||||
<div
|
||||
v-if="!addTriggerVisible"
|
||||
class="app-dock-add-bar"
|
||||
@click="openAdd()"
|
||||
>
|
||||
<BasicIcon icon="vuesax-linear:add" />
|
||||
<div>افزودن هشدار جدید</div>
|
||||
</div>
|
||||
</Teleport>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
|
||||
import MobilePageHeader from '@/layouts/components/MobilePageHeader.vue'
|
||||
import ListAnim from '@/components/ListAnim.vue'
|
||||
import TransactionSkeleton from '@/components/TransactionSkeleton.vue'
|
||||
import Item from '../components/Item.vue'
|
||||
import { usePriceTriggerPageContext } from '../composables/usePriceTriggerPage'
|
||||
|
||||
const {
|
||||
items,
|
||||
loading,
|
||||
addTriggerVisible,
|
||||
openAdd,
|
||||
openEdit,
|
||||
initItems,
|
||||
} = usePriceTriggerPageContext()
|
||||
</script>
|
||||
@@ -0,0 +1,153 @@
|
||||
<template>
|
||||
<div class="products-mobile-root">
|
||||
<div class="mobile-page-bg" aria-hidden="true">
|
||||
<img :src="img" alt="" />
|
||||
</div>
|
||||
|
||||
<div class="products-mobile-root__chrome">
|
||||
<div class="products-mobile-root__tabs">
|
||||
<ARadioGroup
|
||||
v-model:value="productsActiveKey"
|
||||
button-style="solid"
|
||||
@change="changeProductsTab"
|
||||
>
|
||||
<ARadioButton class="cats" value="همه">همه</ARadioButton>
|
||||
<ARadioButton
|
||||
v-for="item in productsTypeItems"
|
||||
:key="item"
|
||||
class="cats"
|
||||
:value="item"
|
||||
>
|
||||
{{ item }}
|
||||
</ARadioButton>
|
||||
</ARadioGroup>
|
||||
</div>
|
||||
|
||||
<div class="products-mobile-root__toolbar mx-5">
|
||||
<button type="button" class="products-mobile-root__view-toggle" @click="viewVertical = !viewVertical">
|
||||
<BasicIcon v-if="viewVertical" icon="vuesax-linear:row-vertical" />
|
||||
<BasicIcon v-else icon="vuesax-linear:element-3" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="products-mobile-root__scroll">
|
||||
<a-spin :spinning="productsPageLoading">
|
||||
<div
|
||||
class="products-mobile-root__list mx-5 pt-2 pb-[calc(var(--app-bottom-chrome-height)+1rem)] grid gap-3 items-stretch"
|
||||
:class="viewVertical ? 'grid-cols-2' : 'grid-cols-1'"
|
||||
>
|
||||
<template v-if="viewVertical">
|
||||
<ProductItemVertical
|
||||
v-for="item in productsItems"
|
||||
:key="item.id"
|
||||
class="h-full"
|
||||
:ProductItem="item"
|
||||
@click="$emit('select', item)"
|
||||
/>
|
||||
</template>
|
||||
<template v-else>
|
||||
<ProductItem
|
||||
v-for="item in productsItems"
|
||||
:key="item.id"
|
||||
class="h-full"
|
||||
:ProductItem="item"
|
||||
@click="$emit('select', item)"
|
||||
/>
|
||||
</template>
|
||||
</div>
|
||||
</a-spin>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import type { Product } from '@/models/products'
|
||||
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
|
||||
import ProductItem from '@/views/base/products/components/ProductItem.vue'
|
||||
import ProductItemVertical from '@/views/base/products/components/ProductItemVertical.vue'
|
||||
import img from '@/assets/img/user_ly1.svg'
|
||||
import {
|
||||
productsActiveKey,
|
||||
productsTypeItems,
|
||||
productsItems,
|
||||
productsPageLoading,
|
||||
changeProductsTab,
|
||||
} from '@/views/base/products/composables/useProductsPageData'
|
||||
|
||||
defineEmits<{
|
||||
select: [item: Product]
|
||||
}>()
|
||||
|
||||
const viewVertical = ref(true)
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.products-mobile-root {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1 1 0;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.products-mobile-root__chrome {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
.products-mobile-root__tabs {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
padding: 1.25rem 0.75rem 0.5rem;
|
||||
overflow-x: auto;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
|
||||
.products-mobile-root__toolbar {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
padding-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.products-mobile-root__view-toggle {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border: none;
|
||||
background: transparent;
|
||||
padding: 0.25rem;
|
||||
color: inherit;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.products-mobile-root__scroll {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
flex: 1 1 0;
|
||||
min-height: 0;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
overscroll-behavior-y: contain;
|
||||
}
|
||||
|
||||
.products-mobile-root__list {
|
||||
min-height: min-content;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="less">
|
||||
.cats {
|
||||
font-size: x-small;
|
||||
}
|
||||
|
||||
.cats:hover span {
|
||||
--un-text-opacity: 1;
|
||||
color: rgba(206, 163, 76, var(--un-text-opacity)) !important;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user