You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

168 lines
4.0 KiB

<template>
<ScrollView ref="scroll" :class="['brand-scroll', $route.path === '/guide' ? 'guide' : 'brand']" scrollbar>
<div class="brand-content">
<div class="groups" v-for="item of list" v-show="item.shopList.length" :key="item.name">
<h1 class="info">
{{ item.name }}<span class="meta">/ {{ item.shopList.length }}个</span> <span v-if="item.name === currentFloor.floor" class="current">您在本层</span>
</h1>
<TransitionGroup name="zoom" mode="out-in" tag="div" :class="{ group: true, isRow }">
<ShopItem
:config="config"
:isRow="isRow"
:isFood="isFood"
:shop="el"
@click="handleShop(el)"
v-for="el of item.shopList"
:isActive="shop && shop.shopId === el.shopId"
:key="el.shopId"
/>
</TransitionGroup>
</div>
</div>
</ScrollView>
</template>
<script setup>
import { ref, nextTick, watch } from 'vue'
import ShopItem from '@/base/ShopItem/ShopItem.vue'
import ScrollView from '@/base/ScrollView/ScrollView.vue'
import { storeToRefs } from 'pinia'
import { useStore } from '@/store/root'
const store = useStore()
const { currentFloor } = storeToRefs(store)
const scroll = ref(null)
const props = defineProps({
list: Array,
config: Object,
isRow: Boolean,
isFood: Boolean,
shop: Object,
needFocus: Boolean
})
const emits = defineEmits(['click'])
function handleShop(item) {
emits('click', item)
}
watch(
() => props.isRow,
() =>
nextTick(() => {
scroll.value.refresh()
})
)
watch(
() => props.list,
() =>
nextTick(() => {
scroll.value.refresh()
scroll.value.scrollTo(0, 0)
if (props.shop) {
const el = document.getElementById(props.shop.houseNumber)
if (!el) return
nextTick(() => {
scroll.value.scrollToElement(el, 500, 0, -100)
})
}
})
)
watch([scroll, () => props.shop], () => {
if (!props.needFocus || !scroll.value || !props.shop || !props.list) return
const el = document.getElementById(props.shop.houseNumber)
if (!el) return
nextTick(() => {
scroll.value.scrollToElement(el, 500, 0, -100)
})
})
</script>
<style lang="scss" scoped>
.brand-scroll {
overflow: hidden;
height: 1255px;
margin-left: 68px;
&.guide {
height: 770px;
}
&.brand {
height: 1512px;
}
:deep(.bscroll-vertical-scrollbar) {
top: 102px !important;
width: 48px !important;
background: center / 6px 250px no-repeat url(@/assets/images/scrollBar.png);
border-radius: 6px;
opacity: 1 !important;
height: 250px !important;
&::after {
position: absolute;
content: '';
left: 0;
top: 120px;
margin: auto;
width: 48px;
height: 61px;
background: center / cover no-repeat url(@/assets/images/scrollHand.png);
}
.bscroll-indicator {
height: 95px !important;
width: 6px !important;
left: 0;
right: 0;
margin: auto;
background: #ffffff !important;
border-radius: 6px !important;
border: none !important;
}
}
}
.brand-content {
padding-top: 40px;
padding-bottom: 180px;
}
.info {
font-weight: 900;
font-size: 32px;
line-height: 38px;
color: var(--brand-floorNameColor);
padding-bottom: 24px;
display: flex;
align-items: baseline;
.meta {
margin-left: 12px;
font-weight: 500;
font-size: 20px;
line-height: 23px;
color: var(--brand-floorMetaColor);
}
.current {
display: flex;
width: 96px;
height: 27px;
background: linear-gradient(113.71deg, #435acd 0%, #749cf3 100%);
font-size: 16px;
color: #ffffff;
justify-content: center;
align-items: center;
border-radius: var(--global-radius, 6px);
margin-left: 12px;
}
}
.group {
display: grid;
grid-template-columns: 1fr 1fr 1fr 1fr;
gap: 24px 8px;
margin-bottom: 40px;
padding-right: 68px;
}
.isRow {
&.group {
grid-template-columns: 1fr 1fr;
gap: 8px 24px;
}
}
</style>