// 获取当前位置的经纬度
getUserLocation: function () {
const that = this;
wx.getLocation({
type: 'gcj02',
success: function (res) {
console.log(res)
//纬度,范围为 -90~90,负数表示南纬
const latitude = res.latitude
//经度,范围为 -180~180,负数表示西经
const longitude = res.longitude
that.setData({
lng: longitude,
lat: latitude
})
// 获取平台下所有门店列表
that.getAllStoreListForWap();
},
})
},

openLocation: function (e) {
const that = this;
let latitude = parseFloat(e.currentTarget.dataset.lat);
let longitude = parseFloat(e.currentTarget.dataset.lng);
// 使用微信内置地图查看位置
wx.openLocation({
latitude,
longitude,
scale: 18
})
},

// 获取平台下所有门店列表
getAllStoreListForWap: function () {
const that = this;
let postData = {
'page_index': that.data.page_index,
'page_size': that.data.page_size,
'lng': that.data.lng,
'lat': that.data.lat,
}
let datainfo = requestSign.requestSign(postData);
header.sign = datainfo;
re.request(api.get_getAllStoreListForWap, postData, header).then((res) => {
if (res.data.code == 1) {
that.setData({
store_list: res.data.data.store_list
})
} else {
wx.showModal({
title: '提示',
content: res.data.message,
})
}
})
},