<template>
|
<view class="storage-page">
|
<view class="top-fixed">
|
<view class="search-row">
|
<view class="search-box">
|
<image src="/static/icon/ic_search2@2x.png" mode="widthFix"></image>
|
<input
|
v-model="keyword"
|
class="search-input"
|
type="text"
|
@confirm="handleSearch"
|
placeholder="搜索寄存点名称或地址"
|
placeholder-style="color: #999999;"
|
/>
|
</view>
|
<view class="map-entry" @tap="toggleViewMode">
|
<view class="map-icon">
|
<image src="/static/icon/ic_list@2x.png" mode="widthFix" v-if="isMapMode"></image>
|
<image src="/static/icon/ic_map@2x.png" mode="widthFix" v-else></image>
|
</view>
|
<text class="map-text">{{ isMapMode ? '列表' : '地图' }}</text>
|
</view>
|
</view>
|
|
<view class="filter-row" style="height: 88rpx; padding: 0 30rpx; box-sizing: border-box; border-bottom: 1rpx solid #E5E5E5; justify-content: space-around;">
|
<view
|
v-for="item in filters"
|
:key="item.label"
|
class="filter-item"
|
:class="{ active: currentDropdown === item.key }"
|
@click="toggleDropdown(item.key)"
|
>
|
<text :class="{ 'filter-text-bold': isFilterBold(item.key) }">{{ filterLabels[item.key] }}</text>
|
<image :src="currentDropdown === item.key ? '/static/icon/ar_open_sel@2x.png' : '/static/icon/ar_open1@2x.png'" mode="widthFix"></image>
|
</view>
|
</view>
|
|
<view v-if="currentDropdown" class="dropdown-panel">
|
<view
|
v-for="option in currentOptions"
|
:key="option.value"
|
class="dropdown-option"
|
:class="{ active: selectedFilters[currentDropdown] === option.value }"
|
@click="selectDropdownOption(option)"
|
>
|
<text>{{ option.label||'' }}</text>
|
<u-icon v-if="selectedFilters[currentDropdown] === option.value" name="checkmark" size="24" color="#2F86F6"></u-icon>
|
</view>
|
</view>
|
</view>
|
|
<view v-if="currentDropdown" class="dropdown-mask" @click="closeDropdown"></view>
|
|
<view class="content-wrap">
|
<view v-if="!isMapMode" class="card-list">
|
<view v-for="(item, index) in pointList" :key="index" class="point-card" @click="goShopDetails(item)">
|
<view class="thumb" :class="item.thumbClass">
|
<image :src="item.cover" mode="widthFix"></image>
|
</view>
|
<view class="point-main">
|
<view class="point-head">
|
<text class="point-name">{{ item.name }}</text>
|
<text class="point-distance">{{ item.distance }}</text>
|
</view>
|
<view class="point-address">
|
<image src="/static/icon/home_ic_location3@2x.png" mode="widthFix"></image>
|
<text>{{ item.address ||''}}</text>
|
</view>
|
<text class="point-time">{{ item.time|| '' }}</text>
|
</view>
|
</view>
|
</view>
|
|
<view v-else class="map-panel">
|
<map
|
id="storageMap"
|
class="store-map"
|
:latitude="mapCenter.latitude"
|
:longitude="mapCenter.longitude"
|
:scale="14"
|
:markers="mapMarkers"
|
:show-location="true"
|
:enable-rotate="false"
|
:enable-overlooking="false"
|
:enable-poi="true"
|
@markertap="handleMarkerTap"
|
@callouttap="handleMarkerTap"
|
@tap="closeStorePopup"
|
></map>
|
<view class="location-btn" @tap="resetMapCenter">
|
<u-icon name="map-fill" size="28" color="#333333"></u-icon>
|
</view>
|
<view v-if="activeStore" class="store-popup-mask" @tap="closeStorePopup"></view>
|
<view v-if="activeStore" class="store-popup">
|
<scroll-view scroll-y class="popup-scroll">
|
<view class="popup-close" @tap="closeStorePopup">
|
<u-icon name="close" size="26" color="#8C939F"></u-icon>
|
</view>
|
<swiper class="popup-banner-swiper" :indicator-dots="true" :autoplay="true" :interval="3000" :duration="500" :circular="true">
|
<swiper-item v-for="(item, index) in activeStore.images" :key="index">
|
<image class="popup-banner-image" :src="item" mode="aspectFill"></image>
|
</swiper-item>
|
</swiper>
|
<view class="popup-body">
|
<text class="popup-title">{{ activeStore.name }}</text>
|
<text class="popup-hours">{{ activeStore.time }}</text>
|
<text class="popup-desc" v-if="activeStore.content">{{ activeStore.content }}</text>
|
<view class="popup-address-row" @click="openNavigation">
|
<view class="popup-address">
|
<image src="/static/icon/home_ic_location3@2x.png" mode="aspectFit"></image>
|
<text>{{ activeStore.address }}</text>
|
</view>
|
<view class="popup-distance-wrap">
|
<image src="/static/icon/ic_address@2x.png" mode="aspectFit"></image>
|
<text>{{ activeStore.distanceText }}</text>
|
</view>
|
</view>
|
<view class="popup-gap"></view>
|
<view class="popup-section">
|
<text class="popup-section-title">寄存类型</text>
|
<text class="popup-section-text">{{ activeStore.depositTypes }}</text>
|
</view>
|
<view class="popup-gap"></view>
|
<view class="popup-section no-border">
|
<text class="popup-section-title">收费标准</text>
|
<text class="popup-section-text">{{ activeStore.feeStandard }}</text>
|
</view>
|
</view>
|
</scroll-view>
|
<view class="popup-footer">
|
<view class="popup-btn ghost" @click="contactStore">联系门店</view>
|
<view class="popup-btn primary" @click="storeLuggage">行李寄存</view>
|
</view>
|
</view>
|
</view>
|
</view>
|
<auth-login :show="showLogin" @close="showLogin = false"></auth-login>
|
</view>
|
</template>
|
|
<script>
|
import { mapState } from 'vuex'
|
export default {
|
data() {
|
return {
|
keyword: '',
|
page: 1,
|
isMapMode: false,
|
activeStore: null,
|
currentDropdown: '',
|
selectedFilters: {
|
sortType: '',
|
distance: '',
|
businessType: ''
|
},
|
mapCenter: {
|
latitude: 31.86119,
|
longitude: 117.28565
|
},
|
filters: [
|
{ key: 'sortType', label: '综合排序' },
|
{ key: 'distance', label: '位置范围' },
|
{ key: 'businessType', label: '营业时间' }
|
],
|
dropdownOptions: {
|
sortType: [
|
{ label: '综合排序', value: '' },
|
{ label: '评分优先', value: '2' }
|
],
|
distance: [
|
{ label: '位置范围', value: '' },
|
{ label: '500m', value: '500' },
|
{ label: '1km', value: '1000' },
|
{ label: '2km', value: '2000' },
|
{ label: '3km', value: '3000' },
|
{ label: '5km', value: '5000' },
|
],
|
businessType: [
|
{ label: '营业时间', value: '' },
|
{ label: '全天营业', value: '1' },
|
{ label: '限时营业', value: '0' }
|
]
|
},
|
pointList: [],
|
isRequest: true,
|
showLogin: false
|
}
|
},
|
computed: {
|
...mapState(['latitude', 'longitude', 'cityId', 'token']),
|
filterLabels() {
|
return {
|
sortType: this.getFilterLabel('sortType'),
|
distance: this.getFilterLabel('distance'),
|
businessType: this.getFilterLabel('businessType')
|
}
|
},
|
currentOptions() {
|
return this.currentDropdown ? this.dropdownOptions[this.currentDropdown] || [] : []
|
},
|
mapMarkers() {
|
return this.pointList.map((item, index) => ({
|
id: index,
|
latitude: item.latitude,
|
longitude: item.longitude,
|
width: 0,
|
height: 0,
|
iconPath: '/static/icon/home1_ic_location@2x.png',
|
anchor: {
|
x: 0.5,
|
y: 1
|
},
|
callout: {
|
content: `${item.name} ${item.distance}`,
|
display: 'ALWAYS',
|
padding: 8,
|
borderRadius: 18,
|
bgColor: '#FFFFFF',
|
color: '#4AA8FF',
|
fontSize: 12,
|
textAlign: 'center'
|
}
|
}))
|
}
|
},
|
watch: {
|
filterLabels: {
|
handler(newVal, oldVal) {
|
this.handleSearch()
|
}
|
}
|
},
|
async onLoad() {
|
await this.$onLaunched
|
this.getNearbyShopList()
|
},
|
onReachBottom() {
|
this.getNearbyShopList()
|
},
|
methods: {
|
isFilterBold(key) {
|
if (key === 'sortType') {
|
return true
|
}
|
const label = this.filterLabels[key]
|
if (key === 'distance') {
|
return label !== '位置范围'
|
} else if (key === 'businessType') {
|
return label !== '营业时间'
|
}
|
return false
|
},
|
handleSearch() {
|
this.page = 1
|
this.pointList = []
|
this.isRequest = true
|
this.getNearbyShopList()
|
},
|
handleFilterChange(key, value) {
|
this.selectedFilters[key] = value
|
this.page = 1
|
this.pointList = []
|
this.getNearbyShopList()
|
},
|
async getNearbyShopList() {
|
if (!this.isRequest) return;
|
const res = await this.$u.api.getNearbyShopList({
|
capacity: 10,
|
page: this.page,
|
model: {
|
latitude: this.latitude,
|
longitude: this.longitude,
|
distance: this.selectedFilters.distance || '',
|
name: this.keyword,
|
cityId: this.cityId,
|
sortType: this.selectedFilters.sortType || 1,
|
businessType: this.selectedFilters.businessType || ''
|
}
|
})
|
if (res.code === 200) {
|
let arr = []
|
res.data.records.forEach(item => {
|
let obj = {
|
id: item.id,
|
shopId: item.id,
|
name: item.name,
|
address: item.address,
|
time: item.shopHours,
|
distance: item.distanceText,
|
cover: item.coverImg,
|
latitude: item.latitude,
|
longitude: item.longitude,
|
depositTypes: item.depositTypes,
|
feeStandard: item.feeStandard
|
}
|
arr.push(obj)
|
})
|
this.pointList = [...this.pointList, ...arr]
|
this.page++
|
if (res.data.total <= this.pointList.length) {
|
this.isRequest = false
|
}
|
}
|
},
|
getFilterLabel(key) {
|
const options = this.dropdownOptions[key] || []
|
const current = options.find(item => item.value === this.selectedFilters[key])
|
return current ? current.label : (this.filters.find(item => item.key === key) || {}).label || ''
|
},
|
toggleDropdown(key) {
|
this.currentDropdown = this.currentDropdown === key ? '' : key
|
},
|
closeDropdown() {
|
this.currentDropdown = ''
|
},
|
closeStorePopup() {
|
this.activeStore = null
|
},
|
selectDropdownOption(option) {
|
if (!this.currentDropdown) {
|
return
|
}
|
this.$set(this.selectedFilters, this.currentDropdown, option.value)
|
this.closeDropdown()
|
},
|
toggleViewMode() {
|
this.isMapMode = !this.isMapMode
|
this.closeDropdown()
|
this.closeStorePopup()
|
if (this.isMapMode) {
|
this.resetMapCenter()
|
}
|
},
|
handleMarkerTap(event) {
|
const markerId = typeof event.detail.markerId !== 'undefined' ? event.detail.markerId : event.detail.id
|
const current = this.pointList[markerId]
|
if (!current) {
|
return
|
}
|
this.mapCenter = {
|
latitude: current.latitude,
|
longitude: current.longitude
|
}
|
console.log('current', current)
|
this.$u.api.getShopDetail({
|
id: current.shopId,
|
latitude: this.latitude,
|
longitude: this.longitude,
|
}).then(res => {
|
if (res.code === 200) {
|
this.activeStore = res.data
|
}
|
})
|
},
|
resetMapCenter() {
|
var that = this
|
uni.getLocation({
|
type: 'wgs84',
|
success: (res) => {
|
that.mapCenter = {
|
latitude: res.latitude,
|
longitude: res.longitude
|
}
|
}
|
})
|
},
|
openNavigation() {
|
uni.openLocation({
|
latitude: this.activeStore.latitude,
|
longitude: this.activeStore.longitude,
|
name: this.activeStore.name,
|
address: this.activeStore.address,
|
scale: 18,
|
infoUrl: ''
|
})
|
},
|
contactStore() {
|
uni.showToast({
|
title: '联系门店待接入',
|
icon: 'none'
|
})
|
},
|
storeLuggage() {
|
if (!this.token) {
|
this.showLogin = true
|
return
|
}
|
uni.navigateTo({
|
url: '/pages/luggage-storage/luggage-storage'
|
})
|
},
|
goShopDetails(item){
|
console.log(item)
|
uni.navigateTo({
|
url: '/pages/storage-point-detail/storage-point-detail?id='+item.id
|
})
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.storage-page {
|
position: relative;
|
min-height: 100vh;
|
background: #ffffff;
|
}
|
|
.top-fixed {
|
position: fixed;
|
left: 0;
|
top: 0;
|
width: 100%;
|
background: #ffffff;
|
z-index: 20;
|
}
|
|
.dropdown-mask {
|
position: fixed;
|
left: 0;
|
right: 0;
|
top: 184rpx;
|
bottom: 0;
|
background: rgba(0, 0, 0, 0.18);
|
z-index: 14;
|
}
|
|
.content-wrap {
|
padding-top: 184rpx;
|
min-height: 100vh;
|
box-sizing: border-box;
|
}
|
|
.search-row,
|
.filter-row,
|
.content-wrap {
|
position: relative;
|
z-index: 1;
|
}
|
|
.search-row {
|
display: flex;
|
align-items: center;
|
padding: 24rpx 24rpx 0;
|
gap: 18rpx;
|
}
|
|
.search-box {
|
flex: 1;
|
height: 72rpx;
|
background: #F9F9FB;
|
border-radius: 16rpx;
|
border: 1rpx solid #EEEEEE;
|
padding: 0 22rpx;
|
display: flex;
|
align-items: center;
|
gap: 14rpx;
|
image {
|
width: 32rpx;
|
height: 32rpx;
|
}
|
}
|
|
.search-input {
|
flex: 1;
|
height: 72rpx;
|
font-weight: 400;
|
font-size: 26rpx;
|
color: #111111;
|
background: transparent;
|
}
|
|
.map-entry {
|
width: 70rpx;
|
display: flex;
|
flex-direction: column;
|
align-items: center;
|
justify-content: center;
|
gap: 4rpx;
|
}
|
|
.map-icon {
|
width: 40rpx;
|
height: 40rpx;
|
border-radius: 12rpx;
|
background: rgba(255, 255, 255, 0.92);
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
image {
|
width: 100%;
|
height: 100%;
|
}
|
}
|
|
.map-text {
|
font-size: 22rpx;
|
line-height: 1;
|
color: #6a7485;
|
}
|
|
.filter-row {
|
display: flex;
|
align-items: center;
|
justify-content: space-between;
|
padding: 22rpx 30rpx 20rpx;
|
background: #ffffff;
|
}
|
|
.dropdown-panel {
|
position: absolute;
|
left: 0;
|
right: 0;
|
top: 184rpx;
|
padding: 10rpx 0 18rpx;
|
background: #ffffff;
|
box-shadow: 0 12rpx 32rpx rgba(0, 0, 0, 0.08);
|
z-index: 21;
|
}
|
|
.dropdown-option {
|
height: 76rpx;
|
padding: 0 30rpx;
|
display: flex;
|
align-items: center;
|
justify-content: space-between;
|
font-size: 28rpx;
|
color: #555555;
|
box-sizing: border-box;
|
}
|
|
.dropdown-option.active {
|
color: #2f86f6;
|
font-weight: 500;
|
}
|
|
.filter-item {
|
display: flex;
|
align-items: center;
|
gap: 8rpx;
|
font-weight: 400;
|
font-size: 28rpx;
|
color: #777777;
|
}
|
|
.filter-item image {
|
width: 20rpx;
|
height: 20rpx;
|
}
|
|
.filter-item.active {
|
color: #222222;
|
}
|
|
.filter-text-bold {
|
font-weight: 700;
|
color: #000000;
|
}
|
|
.card-list {
|
padding: 30rpx;
|
box-sizing: border-box;
|
}
|
|
.map-panel {
|
position: relative;
|
height: calc(100vh - 184rpx);
|
}
|
|
.store-map {
|
width: 100%;
|
height: 100%;
|
}
|
|
.location-btn {
|
position: absolute;
|
right: 24rpx;
|
bottom: 32rpx;
|
width: 72rpx;
|
height: 72rpx;
|
border-radius: 16rpx;
|
background: #ffffff;
|
box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.12);
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
z-index: 2;
|
}
|
|
.store-popup-mask {
|
position: fixed;
|
left: 0;
|
right: 0;
|
top: 0;
|
bottom: 0;
|
background: rgba(0, 0, 0, 0.36);
|
z-index: 998;
|
}
|
|
.store-popup {
|
position: fixed;
|
left: 0;
|
right: 0;
|
bottom: 0;
|
height: 80vh;
|
background: #ffffff;
|
border-radius: 28rpx 28rpx 0 0;
|
z-index: 999;
|
overflow: hidden;
|
animation: popup-slide-up 0.25s ease-out;
|
}
|
|
.popup-scroll {
|
position: relative;
|
height: calc(80vh - 132rpx);
|
}
|
|
.popup-close {
|
position: absolute;
|
right: 24rpx;
|
top: 24rpx;
|
width: 56rpx;
|
height: 56rpx;
|
border-radius: 28rpx;
|
background: rgba(255, 255, 255, 0.92);
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
z-index: 2;
|
}
|
|
.popup-banner-swiper {
|
width: 100%;
|
height: 422rpx;
|
}
|
|
.popup-banner-image {
|
width: 100%;
|
height: 100%;
|
object-fit: cover;
|
}
|
|
.popup-body {
|
padding: 24rpx 30rpx 0;
|
box-sizing: border-box;
|
padding-bottom: 32rpx;
|
}
|
|
.popup-gap {
|
width: 100%;
|
height: 20rpx;
|
background: #f7f7f7;
|
}
|
|
.popup-title {
|
display: block;
|
font-size: 40rpx;
|
font-weight: 600;
|
line-height: 1.35;
|
color: #222222;
|
}
|
|
.popup-hours {
|
display: inline-block;
|
margin-top: 18rpx;
|
padding: 10rpx 16rpx;
|
border-radius: 8rpx;
|
background: #f5f7fb;
|
font-size: 24rpx;
|
color: #8c939f;
|
}
|
|
.popup-desc {
|
display: block;
|
margin-top: 24rpx;
|
font-size: 28rpx;
|
line-height: 1.7;
|
color: #444444;
|
}
|
|
.popup-address-row {
|
padding: 24rpx 0;
|
border-top: 1rpx solid #ededed;
|
display: flex;
|
align-items: center;
|
justify-content: space-between;
|
gap: 20rpx;
|
margin-top: 20rpx;
|
}
|
|
.popup-address {
|
flex: 1;
|
min-width: 0;
|
display: flex;
|
align-items: center;
|
font-size: 26rpx;
|
color: #8c939f;
|
image {
|
width: 26rpx;
|
height: 26rpx;
|
margin-right: 8rpx;
|
}
|
text {
|
overflow: hidden;
|
text-overflow: ellipsis;
|
white-space: nowrap;
|
}
|
}
|
|
.popup-distance-wrap {
|
flex-shrink: 0;
|
height: 52rpx;
|
display: flex;
|
align-items: center;
|
font-size: 28rpx;
|
color: #555555;
|
image {
|
width: 48rpx;
|
height: 48rpx;
|
margin-right: 12rpx;
|
}
|
}
|
|
.popup-section {
|
padding: 28rpx 0;
|
border-bottom: 1rpx solid #ededed;
|
}
|
|
.popup-section.no-border {
|
border-bottom: none;
|
padding-bottom: 10rpx;
|
}
|
|
.popup-section-title {
|
display: block;
|
margin-bottom: 20rpx;
|
font-size: 34rpx;
|
font-weight: 600;
|
color: #222222;
|
}
|
|
.popup-section-text {
|
display: block;
|
font-size: 28rpx;
|
line-height: 1.8;
|
color: #4a4a4a;
|
}
|
|
.popup-footer {
|
padding: 24rpx 30rpx calc(24rpx + env(safe-area-inset-bottom));
|
display: flex;
|
gap: 18rpx;
|
}
|
|
.popup-btn {
|
flex: 1;
|
height: 84rpx;
|
border-radius: 42rpx;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
font-size: 32rpx;
|
font-weight: 600;
|
}
|
|
.popup-btn.ghost {
|
border: 2rpx solid #23a7f6;
|
color: #23a7f6;
|
background: #eff9ff;
|
}
|
|
.popup-btn.primary {
|
background: linear-gradient(90deg, #24b2ff 0%, #1d9ff3 100%);
|
color: #ffffff;
|
}
|
|
@keyframes popup-slide-up {
|
from {
|
transform: translateY(100%);
|
opacity: 0;
|
}
|
to {
|
transform: translateY(0);
|
opacity: 1;
|
}
|
}
|
|
.point-card {
|
display: flex;
|
gap: 22rpx;
|
padding: 30rpx;
|
box-sizing: border-box;
|
margin-bottom: 18rpx;
|
border-radius: 24rpx;
|
background: #F6F9FF;
|
box-shadow: 0 10rpx 30rpx rgba(38, 44, 56, 0.05);
|
}
|
|
.thumb {
|
position: relative;
|
flex-shrink: 0;
|
width: 140rpx;
|
height: 140rpx;
|
border-radius: 8rpx;
|
overflow: hidden;
|
}
|
|
.thumb image {
|
width: 100%;
|
}
|
|
.point-main {
|
flex: 1;
|
min-width: 0;
|
}
|
|
.point-head {
|
display: flex;
|
align-items: flex-start;
|
justify-content: space-between;
|
gap: 12rpx;
|
}
|
|
.point-name {
|
flex: 1;
|
line-height: 1.35;
|
font-weight: 600;
|
font-size: 30rpx;
|
color: #222222;
|
}
|
|
.point-distance {
|
flex-shrink: 0;
|
font-size: 24rpx;
|
line-height: 1.4;
|
color: #8C939F;
|
}
|
|
.point-address {
|
margin-top: 10rpx;
|
display: flex;
|
align-items: center;
|
gap: 6rpx;
|
font-weight: 400;
|
font-size: 24rpx;
|
color: #6C717A;
|
}
|
|
.point-address image {
|
width: 24rpx;
|
height: 24rpx;
|
margin-right: 4rpx;
|
}
|
|
.point-time {
|
display: block;
|
margin-top: 20rpx;
|
line-height: 1.5;
|
font-weight: 400;
|
font-size: 24rpx;
|
color: #8C939F;
|
}
|
</style>
|