import { getShopPage } from '../../api/index' Component({ /** * 组件的属性列表 */ properties: { type: { // 属性名 type: String, 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 => { if (res.data && res.data.records) { 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', }) } } })