MrShi
10 小时以前 3f9032e92fdd383bfefc87a0bec9b242e1223851
small-program/shop/pages/storage-point/storage-point.vue
@@ -32,7 +32,7 @@
               :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>
@@ -170,8 +170,8 @@
               locationTagId: ''
            },
            mapCenter: {
               latitude: 31.86119,
               longitude: 117.28565
               latitude: '',
               longitude: ''
            },
            filters: [
               { key: 'sortType', label: '综合排序' },
@@ -201,7 +201,8 @@
            },
            pointList: [],
            isRequest: true,
            showLogin: false
            showLogin: false,
            firstLoad: true
         }
      },
      computed: {
@@ -244,7 +245,12 @@
      },
      watch: {
         filterLabels: {
            deep: true,
            handler(newVal, oldVal) {
               if (this.firstLoad) {
                  this.firstLoad = false
                  return
               }
               this.handleSearch()
            }
         }
@@ -252,7 +258,14 @@
      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
@@ -265,6 +278,25 @@
         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
         },
@@ -360,6 +392,7 @@
                  }
                  arr.push(obj)
               })
               this.pointList = []
               this.pointList = [...this.pointList, ...arr]
               this.page++
               if (res.data.total <= this.pointList.length) {