完善功能
This commit is contained in:
@ -132,7 +132,7 @@ const teaPackageTitle = ref<string>('')
|
||||
// 防止重复提交
|
||||
const isSubmitting = ref(false)
|
||||
|
||||
onLoad(async (args) => {
|
||||
onLoad(async (args: any) => {
|
||||
// 订单
|
||||
orderId.value = Number(args.orderId)
|
||||
comboId.value = Number(args.cmoboId) || 0
|
||||
|
||||
@ -57,7 +57,7 @@
|
||||
// 已开通城市列表
|
||||
const openCityList = ref<Array<any>>([])
|
||||
|
||||
onLoad((args) => {
|
||||
onLoad((args: any) => {
|
||||
if (args.lat && args.lng) {
|
||||
latitude.value = Number(args.lat)
|
||||
longitude.value = Number(args.lng)
|
||||
@ -95,9 +95,10 @@
|
||||
}
|
||||
uni.$emit('locationUpdate', params)
|
||||
|
||||
// 取消全局城市缓存修改以实现功能页面之间的城市隔离
|
||||
// uni.setStorageSync(LOCATION_LAT_KEY, item.latitude)
|
||||
// uni.setStorageSync(LOCATION_LNG_KEY, item.longitude)
|
||||
uni.setStorageSync(LOCATION_CITY_KEY, item.name)
|
||||
// uni.setStorageSync(LOCATION_CITY_KEY, item.name)
|
||||
router.navigateBack()
|
||||
},
|
||||
|
||||
|
||||
@ -202,10 +202,10 @@
|
||||
import { router, previewImage } from '@/utils/tools'
|
||||
import { onPageScroll, onReachBottom } from '@dcloudio/uni-app'
|
||||
import useMescroll from "@/uni_modules/mescroll-uni/hooks/useMescroll.js"
|
||||
import { LOCATION_DENY_TIME_KEY, handleEnsureLocationAuthHooks, LOCATION_DEFAULT_CITY, handleGetLocationCity, LOCATION_CITY_KEY, handleForceGetLocation } from '@/hooks/useLocation'
|
||||
import { LOCATION_DENY_TIME_KEY, handleEnsureLocationAuthHooks, LOCATION_DEFAULT_CITY, handleGetLocationCity } from '@/hooks/useLocation'
|
||||
import { getHomeBannerList, getHomeCouponPopup, claimIndexCoupon, getTeaArtistEntrance } from '@/api/home'
|
||||
import { getTeaPackageList } from '@/api/tea-package'
|
||||
import { getHomeTeaStoreList } from '@/api/tea-room'
|
||||
import { getHomeTeaStoreList, getOpenCityList } from '@/api/tea-room'
|
||||
import { useUserStore } from '@/store'
|
||||
import { useToast } from 'wot-design-uni'
|
||||
import { getSetting } from '@/api/tea-specialist'
|
||||
@ -260,6 +260,9 @@
|
||||
// 茶艺师入口图
|
||||
const teaArtistEntrance = ref<string>('')
|
||||
|
||||
// 已开通的城市列表
|
||||
const openCityList = ref<Array<any>>([])
|
||||
|
||||
onShow(async () => {
|
||||
// if (canLocation) {
|
||||
// const location = await handleGetLocationCity(latitude.value, longitude.value)
|
||||
@ -273,7 +276,9 @@
|
||||
// 只有经纬度变化时才刷新
|
||||
if (location.lat !== lastLocation.lat || location.lng !== lastLocation.lng) {
|
||||
const loc = await handleGetLocationCity(location.lat, location.lng)
|
||||
city.value = loc.city
|
||||
if (!uni.getStorageSync('indexCityName')) {
|
||||
city.value = loc.city
|
||||
}
|
||||
|
||||
latitude.value = location.lat
|
||||
longitude.value = location.lng
|
||||
@ -306,7 +311,7 @@
|
||||
}
|
||||
})
|
||||
|
||||
onLoad(async(args) => {
|
||||
onLoad(async() => {
|
||||
// 获取小程序码注册来源
|
||||
// getWxacode().then( res => {})
|
||||
|
||||
@ -318,14 +323,20 @@
|
||||
latitude.value = lat
|
||||
longitude.value = lng
|
||||
|
||||
// 根据经纬度获取城市信息再重新赋值经纬度和城市
|
||||
const location = await handleGetLocationCity(lat, lng)
|
||||
city.value = location.city
|
||||
latitude.value = location.latitude
|
||||
longitude.value = location.longitude
|
||||
|
||||
// 删除city_id的缓存
|
||||
uni.removeStorageSync('cityId')
|
||||
// 如果有首页独立的城市缓存,优先使用;否则使用定位城市
|
||||
const indexSavedCity = uni.getStorageSync('indexCityName')
|
||||
const indexSavedCityId = uni.getStorageSync('indexCityId')
|
||||
|
||||
if (indexSavedCity && indexSavedCityId !== '') {
|
||||
city.value = indexSavedCity
|
||||
city_id.value = indexSavedCityId
|
||||
} else {
|
||||
// 根据经纬度获取城市信息再重新赋值经纬度和城市
|
||||
const location = await handleGetLocationCity(lat, lng)
|
||||
city.value = location.city
|
||||
latitude.value = location.latitude
|
||||
longitude.value = location.longitude
|
||||
}
|
||||
|
||||
Index.handleResetSearch()
|
||||
})
|
||||
@ -355,6 +366,16 @@
|
||||
}
|
||||
canLocation.value = true
|
||||
|
||||
// 如果没有城市id,就是初始化进入了系统,这个时候需要获取到对应的城市id
|
||||
if (city_id.value == 0) {
|
||||
openCityList.value.forEach((item: any) => {
|
||||
if (item.name === city.value) {
|
||||
city_id.value = item.id
|
||||
return
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const filter = {
|
||||
page: mescroll.num,
|
||||
size: mescroll.size,
|
||||
@ -411,6 +432,10 @@
|
||||
teaPackageList.value = res
|
||||
})
|
||||
|
||||
// 获取已开通城市列表
|
||||
getOpenCityList().then(res => {
|
||||
openCityList.value = res.list
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
@ -424,7 +449,8 @@
|
||||
city_id.value = params.id
|
||||
// latitude.value = params.latitude
|
||||
// longitude.value = params.longitude
|
||||
uni.setStorageSync('cityId', params.id)
|
||||
uni.setStorageSync('indexCityId', params.id)
|
||||
uni.setStorageSync('indexCityName', params.city)
|
||||
Index.handleResetSearch()
|
||||
})
|
||||
router.navigateTo(`/pages/city/city?lat=${latitude.value}&lng=${longitude.value}`)
|
||||
@ -447,7 +473,7 @@
|
||||
* 跳转到预约茶室页面
|
||||
*/
|
||||
handleToReserveRoom: (id: number = 0, type: number = 1) => {
|
||||
router.navigateTo( `/bundle/tea-room/room?id=${id}&type=${type}`)
|
||||
router.navigateTo( `/bundle/tea-room/room?id=${id}&type=${type}` )
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user