[更新]
This commit is contained in:
62
pages/storeDetails/storeDetails.js
Normal file
62
pages/storeDetails/storeDetails.js
Normal 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
|
||||
})
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user