uni.request({
url: 'https://apis.map.qq.com/ws/geocoder/v1',
data: {
address: this.cityCode + this.areaCode,
key: 'FIPBZ-MUICU-BFTVW-4HXQS-XWCOQ-TXBZI',
output: 'json',
},
success: (res) => {
uni.getLocation({
type: 'gcj02',
success: function(resq) {
const latitude = res.data.result.location.lat
const longitude = res.data.result.location.lng
uni.chooseLocation({
latitude: latitude,
longitude: longitude,
success: function(dt) {
that.addressData.addressLat = dt.latitude
that.addressData.addressLon = dt.longitude
that.addressData.address = dt.address
that.addressData.addressName = dt.address
},
})
},
})
},
})
uni.getLocation({
type: 'wgs84',
success: function(res) {
uni.request({
url: 'https://apis.map.qq.com/ws/geocoder/v1',
data: {
location: res.latitude + ',' + res.longitude,
key: 'FIPBZ-MUICU-BFTVW-4HXQS-XWCOQ-TXBZI',
output: 'json',
},
success: (req) => {
that.locationAddress = req.data.result.address,
uni.setStorage({
key: 'location',
data: {
latitude: res.latitude,
longitude: res.longitude
}
});
that.shopList(res.latitude, res.longitude, that.pageNum, that.pageSize);
uni.hideLoading();
}
})
}
})