| | |
| | | // components/authCard/authCard.js |
| | | import { |
| | | getShopPage |
| | | } from '../../api/index' |
| | | Component({ |
| | | /** |
| | | * 组件的属性列表 |
| | |
| | | properties: { |
| | | type: { // 属性名 |
| | | type: String, |
| | | value: '0' |
| | | value: '0', |
| | | observer(val) { |
| | | if (val === '1') { |
| | | let that = this |
| | | wx.getLocation({ |
| | | type: 'wgs84', |
| | | success(res) { |
| | | const latitude = res.latitude |
| | | const longitude = res.longitude |
| | | that.getShops(latitude, longitude) |
| | | } |
| | | }) |
| | | |
| | | } |
| | | } |
| | | }, |
| | | }, |
| | | |
| | | /** |
| | | * 组件的初始数据 |
| | | */ |
| | | data: { |
| | | |
| | | shopList: [] |
| | | }, |
| | | |
| | | /** |
| | | * 组件的方法列表 |
| | | */ |
| | | methods: { |
| | | |
| | | getShops(latitude, longitude) { |
| | | getShopPage({ |
| | | model: { |
| | | longitude, |
| | | latitude |
| | | },capacity: 3,page:1 |
| | | }).then(res => { |
| | | this.setData({ |
| | | shopList: res.data.records |
| | | }) |
| | | }) |
| | | }, |
| | | shopDetail(e) { |
| | | const id = e.currentTarget.dataset.id |
| | | wx.navigateTo({ |
| | | url: `/pages/store/info?id=${id}`, |
| | | }) |
| | | }, |
| | | jumpStaff() { |
| | | wx.navigateTo({ |
| | | url: '/pages/store/staffList', |
| | | }) |
| | | }, |
| | | jumpAuth() { |
| | | wx.navigateTo({ |
| | | url: '/pages/auth/auth', |
| | | }) |
| | | }, |
| | | jumpStore() { |
| | | wx.navigateTo({ |
| | | url: '/pages/store/store', |
| | | }) |
| | | } |
| | | } |
| | | }) |
| | | }) |