| | |
| | | :class="{ active: currentDropdown === item.key }" |
| | | @click="toggleDropdown(item.key)" |
| | | > |
| | | <text :class="{ 'filter-text-bold': isFilterBold(item.key) }">{{ filterLabels[item.key] }}</text> |
| | | <text :class="{ 'filter-text-bold': isFilterBold(item.key) }">{{ ellipsisText(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> |
| | |
| | | locationTagId: '' |
| | | }, |
| | | mapCenter: { |
| | | latitude: 31.86119, |
| | | longitude: 117.28565 |
| | | latitude: '', |
| | | longitude: '' |
| | | }, |
| | | filters: [ |
| | | { key: 'sortType', label: '综合排序' }, |
| | |
| | | }, |
| | | pointList: [], |
| | | isRequest: true, |
| | | showLogin: false |
| | | showLogin: false, |
| | | firstLoad: true |
| | | } |
| | | }, |
| | | computed: { |
| | |
| | | }, |
| | | watch: { |
| | | filterLabels: { |
| | | deep: true, |
| | | handler(newVal, oldVal) { |
| | | if (this.firstLoad) { |
| | | this.firstLoad = false |
| | | return |
| | | } |
| | | this.handleSearch() |
| | | } |
| | | } |
| | |
| | | async onLoad() { |
| | | await this.$onLaunched |
| | | this.getLocationTagList() |
| | | this.getNearbyShopList() |
| | | // 获取当前位置作为地图中心 |
| | | this.getCurrentLocation() |
| | | .then(() => { |
| | | this.handleSearch() |
| | | }) |
| | | .catch(() => { |
| | | uni.showToast({ title: '获取位置失败,请授权位置权限', icon: 'none' }) |
| | | }) |
| | | uni.$on('city', (city) => { |
| | | this.cityNameMine = city.cityName |
| | | this.cityIdMine = city.cityId |
| | |
| | | this.getNearbyShopList() |
| | | }, |
| | | methods: { |
| | | ellipsisText(text) { |
| | | if (!text) return '' |
| | | return text.length > 4 ? text.slice(0, 4) + '...' : text |
| | | }, |
| | | getCurrentLocation() { |
| | | return new Promise((resolve, reject) => { |
| | | uni.getLocation({ |
| | | type: 'gcj02', |
| | | success: (res) => { |
| | | this.mapCenter.latitude = res.latitude |
| | | this.mapCenter.longitude = res.longitude |
| | | resolve() |
| | | }, |
| | | fail: () => { |
| | | reject() |
| | | } |
| | | }) |
| | | }) |
| | | }, |
| | | toggleExpand() { |
| | | this.isExpanded = !this.isExpanded |
| | | }, |
| | |
| | | } |
| | | arr.push(obj) |
| | | }) |
| | | this.pointList = [] |
| | | this.pointList = [...this.pointList, ...arr] |
| | | this.page++ |
| | | if (res.data.total <= this.pointList.length) { |