k94314517
2024-07-25 a75b18a4157ab486e0b51c438ac165ab3a08e3e0
wechat_jiaxuan/components/authCard/authCard.js
@@ -1,4 +1,6 @@
import { getShopPage } from '../../api/index'
import {
  getShopPage
} from '../../api/index'
Component({
  /**
   * 组件的属性列表
@@ -8,18 +10,52 @@
      type: String,
      value: '0',
      observer(val) {
        if(val === '1'){
          this.getShops()
        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() {
      getShopPage()
    getShops(latitude, longitude) {
      getShopPage({
        model: {
          longitude,
          latitude
        }
      }).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({
@@ -27,4 +63,4 @@
      })
    }
  }
})
})