moreshop.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. // pages/index/moreshop/moreshop.js
  2. const app = getApp()
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. trafficList: []
  9. },
  10. /**
  11. * 生命周期函数--监听页面加载
  12. */
  13. onLoad: function(options) {
  14. const that = this
  15. let branche_code = wx.getStorageSync('branche_code');
  16. wx.request({
  17. url: app.globalData.url + '/getMktInfos',
  18. method: 'get',
  19. data: {
  20. mi_branche_code: branche_code
  21. },
  22. success: function(res) {
  23. // console.log(res.data)
  24. that.setData({
  25. trafficList: res.data,
  26. // map: res.data[0].mi_mapurl,
  27. // mktnum: res.data[0].id,
  28. // latitude: res.data[0].mi_latitude,
  29. // longitude: res.data[0].mi_longitude,
  30. // name: res.data[0].mi_mktname,
  31. // address: res.data[0].mi_mktaddress
  32. })
  33. },
  34. fail() {
  35. app.timeOut()
  36. }
  37. })
  38. let _this = this;
  39. _this.setData({
  40. navH: app.globalData.navHeight
  41. })
  42. },
  43. markertap: function(e) {
  44. wx.getLocation({
  45. type: 'gcj02', //返回可以用于wx.openLocation的经纬度
  46. success: function(res) {
  47. var latitude = e.currentTarget.dataset.latitude
  48. var longitude = e.currentTarget.dataset.longitude
  49. wx.openLocation({ //出发wx.openLocation API
  50. latitude: Number(latitude), //坐标纬度(从地图获取坐标)
  51. longitude: Number(longitude), //坐标经度(从地图获取坐标)
  52. name: e.currentTarget.dataset.name, //打开后显示的地址名称
  53. address: e.currentTarget.dataset.address, //打开后显示的地址汉字
  54. scale: 17
  55. })
  56. },
  57. fail() {
  58. app.timeOut()
  59. }
  60. })
  61. },
  62. goback() {
  63. wx.navigateBack({
  64. delta: 1
  65. })
  66. },
  67. /**
  68. * 用户点击右上角分享
  69. */
  70. onShareAppMessage: function() {
  71. }
  72. })