| | |
| | | // pages/store/info.js |
| | | import { |
| | | getShopDetail |
| | | } from '../../api/index' |
| | | Page({ |
| | | |
| | | /** |
| | | * 页面的初始数据 |
| | | */ |
| | | data: { |
| | | bottomLift: 0 |
| | | bottomLift: 0, |
| | | clientHeight: 0, |
| | | clientTop: 0, |
| | | }, |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面加载 |
| | | */ |
| | | onLoad(options) { |
| | | this.getDetail(options.id) |
| | | var app = getApp().globalData |
| | | this.setData({ |
| | | bottomLift: app.bottomLift |
| | | }) |
| | | const res = wx.getMenuButtonBoundingClientRect() |
| | | this.setData({clientHeight: res.height}) |
| | | this.setData({clientTop: res.top}) |
| | | |
| | | }, |
| | | navback() { |
| | | wx.navigateBack() |
| | | }, |
| | | makePhone(e) { |
| | | const { linkPhone } = this.data.info |
| | | wx.makePhoneCall({ phoneNumber: linkPhone }) |
| | | }, |
| | | handleDetail(e) { |
| | | const id = e.currentTarget.dataset.id |
| | | wx.navigateTo({ |
| | | url: '/pages/store/staff?id=' + id, |
| | | }) |
| | | }, |
| | | handleNavigation() { |
| | | wx.getLocation({ |
| | | type: 'gcj02', //返回可以用于wx.openLocation的经纬度 |
| | | success (res) { |
| | | const latitude = res.latitude |
| | | const longitude = res.longitude |
| | | wx.openLocation({ |
| | | latitude, |
| | | longitude, |
| | | scale: 18 |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | getDetail(id) { |
| | | getShopDetail({shopId: id}).then(res => { |
| | | this.setData({ info: res.data }) |
| | | }) |
| | | }, |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面初次渲染完成 |
| | | */ |
| | | onReady() { |
| | | |
| | | }, |