This commit is contained in:
张慢慢
2021-05-24 13:56:00 +08:00
commit a7995d90bc
208 changed files with 13143 additions and 0 deletions

View File

@@ -0,0 +1,62 @@
// pages/storeDetails/storeDetails.js
Page({
/**
* 页面的初始数据
*/
data: {
storeinfo : '', //门店详情
distance : 0,
longitude : 0,
latitude : 0
},
/**
* 生命周期函数--监听页面加载
*/
onLoad (options) {
wx.$api.user.storesShow(options.store_id, options.user_lng, options.user_lat).then(res=>{
let distance = res.data.distance
if(distance > 1000){
distance = (distance / 1000) + "km"
}else{
distance = distance + "m"
}
this.setData({
storeinfo : res.data,
distance : distance
})
})
},
/**
* 拨打电话
*/
tel(e) {
let tel = this.data.storeinfo.mobile
wx.showActionSheet({
itemList : ['呼叫商家'],
success : res =>{
if(res.tapIndex==0){
wx.makePhoneCall({
phoneNumber: tel
})
}
}
})
},
/**
* 导航
*/
siteMap(){
wx.openLocation({
latitude : parseFloat(this.data.storeinfo.latitude),
longitude : parseFloat(this.data.storeinfo.longitude),
address : this.data.storeinfo.address
})
}
})