| | |
| | | <view class="top-hero"> |
| | | <view :style="{ height: statusbarHeight + 'px' }"></view> |
| | | <view class="hero-bar" :style="{ height: navHeight + 'px' }"> |
| | | <view class="location-chip" @tap="handleLocation"> |
| | | <view class="location-chip" @click="chooseLocation"> |
| | | <image src="/static/icon/home1_ic_location@2x.png" mode="aspectFit"></image> |
| | | <text>{{ currentAddress }}</text> |
| | | <u-icon name="arrow-right" size="14" color="#ffffff"></u-icon> |
| | | </view> |
| | | </view> |
| | | |
| | | <view class="search-box" @tap="goStoragePage"> |
| | | <view class="search-box" @click="goStoragePage"> |
| | | <image src="/static/icon/home_ic_search@2x.png" mode="aspectFit"></image> |
| | | <text class="search-text">搜索寄存点名称或地址</text> |
| | | </view> |
| | |
| | | async onLoad() { |
| | | await this.$onLaunched |
| | | await this.getBannerList() |
| | | await this.getNearbyShopList() |
| | | if (this.cityId && this.latitude && this.longitude) { |
| | | await this.getNearbyShopList() |
| | | } |
| | | }, |
| | | onReachBottom() { |
| | | this.getNearbyShopList() |
| | | if (this.cityId && this.latitude && this.longitude) { |
| | | this.getNearbyShopList() |
| | | } |
| | | }, |
| | | methods: { |
| | | jumpxiadan() { |
| | | if (!this.cityId) return uni.showToast({ |
| | | title: '当前城市暂未开通', |
| | | icon: 'none' |
| | | }) |
| | | uni.navigateTo({ |
| | | url: '/pages/luggage-storage/luggage-storage' |
| | | }) |
| | |
| | | } |
| | | }, |
| | | jumpJC() { |
| | | if (!this.cityId) return uni.showToast({ |
| | | title: '当前城市暂未开通', |
| | | icon: 'none' |
| | | }) |
| | | uni.navigateTo({ |
| | | url: '/pages/storage-point/storage-point' |
| | | }) |
| | |
| | | if (res.authSetting['scope.userLocation']) { |
| | | that.positioning() |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | chooseLocation() { |
| | | var that = this; |
| | | uni.chooseLocation({ |
| | | type: 'gcj02', |
| | | success: async function(addr) { |
| | | if (addr.errMsg === 'chooseLocation:ok' && addr.latitude) { |
| | | const locParam = { latitude: addr.latitude, longitude: addr.longitude }; |
| | | // uni.setStorageSync('address', locParam); |
| | | |
| | | var myAmapFun = new amapFile.AMapWX({ key: 'e4d46c87adf151dca20060317592b1b6' }); |
| | | myAmapFun.getRegeo({ |
| | | location: addr.longitude + ',' + addr.latitude, |
| | | success: async function(data) { |
| | | console.log(data, '==================选择地址逆解析'); |
| | | let info = data[0]; |
| | | locParam.province = info.province; |
| | | locParam.city = (info.regeocodeData.addressComponent.city && typeof info.regeocodeData.addressComponent.city === 'string') |
| | | ? info.regeocodeData.addressComponent.city |
| | | : info.regeocodeData.addressComponent.province; |
| | | var ta = info.name || '地址获取失败'; |
| | | locParam.address = ta |
| | | const resCity = await that.$u.api.getCityByName({ cityName: locParam.city }) |
| | | if (resCity.code === 200 && resCity.data) { |
| | | locParam.cityId = resCity.data.id |
| | | that.$store.commit('setPosition', locParam) |
| | | that.page = 1 |
| | | that.pointList = [] |
| | | that.isRequest = true |
| | | that.getNearbyShopList() |
| | | } else { |
| | | that.$store.commit('setPosition', locParam) |
| | | that.$store.commit('clearCityId') |
| | | that.page = 1 |
| | | that.pointList = [] |
| | | that.isRequest = true |
| | | } |
| | | }, |
| | | fail: function(err) { |
| | | console.error('获取位置失败===========', err); |
| | | that.$store.commit('setPosition', locParam) |
| | | that.page = 1 |
| | | that.pointList = [] |
| | | that.isRequest = true |
| | | // that.getNearbyShopList() |
| | | } |
| | | }); |
| | | } |
| | | }, |
| | | fail: function(err) { |
| | | console.error('选择位置失败===========', err); |
| | | } |
| | | }); |
| | | }, |
| | |
| | | }); |
| | | }, |
| | | goStoragePage() { |
| | | if (!this.cityId) return uni.showToast({ |
| | | title: '当前城市暂未开通', |
| | | icon: 'none' |
| | | }) |
| | | uni.navigateTo({ |
| | | url: '/pages/storage-point/storage-point' |
| | | }) |