warehouse_details.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. // pages/material/material_details.js
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. latitude: "",
  8. longitude: "",
  9. deptName: "",
  10. warehouseName: "",
  11. warehouseId:"",
  12. remark: "",
  13. //标记点
  14. markers: [{
  15. id: 0,
  16. name: "编程小石头",
  17. latitude: 43.8691319,
  18. longitude: 125.3504459,
  19. width: 35,
  20. height: 50
  21. }]
  22. },
  23. /**
  24. * 生命周期函数--监听页面加载
  25. */
  26. onLoad(options) {
  27. let details = JSON.parse(options.details)
  28. this.setData({
  29. warehouseName:details.warehouseName,
  30. warehouseId:details.warehouseId,
  31. latitude: details.latitude,
  32. longitude: details.longitude,
  33. deptName: details.deptName,
  34. remark: details.remark,
  35. markers: [{
  36. id: details.warehouseId,
  37. name: details.warehouseName,
  38. latitude: Number(details.latitude),
  39. longitude: Number(details.longitude),
  40. width: 35,
  41. height: 50
  42. }]
  43. })
  44. },
  45. //导航
  46. navRoad() {
  47. // console.log("%%%",event)
  48. let that=this
  49. wx.getLocation({ //获取当前经纬度
  50. type: 'wgs84', //返回可以用于wx.openLocation的经纬度,
  51. success: function (res) {
  52. wx.openLocation({ //​使用微信内置地图查看位置。
  53. latitude: Number(that.data.latitude), //要去的纬度-地址
  54. longitude: Number(that.data.longitude), //要去的经度-地址
  55. name: that.data.warehouseName,
  56. address: that.data.warehouseName
  57. })
  58. }
  59. })
  60. },
  61. /**
  62. * 生命周期函数--监听页面初次渲染完成
  63. */
  64. onReady() {
  65. },
  66. /**
  67. * 生命周期函数--监听页面显示
  68. */
  69. onShow() {
  70. },
  71. /**
  72. * 生命周期函数--监听页面隐藏
  73. */
  74. onHide() {
  75. },
  76. /**
  77. * 生命周期函数--监听页面卸载
  78. */
  79. onUnload() {
  80. },
  81. /**
  82. * 页面相关事件处理函数--监听用户下拉动作
  83. */
  84. onPullDownRefresh() {
  85. },
  86. /**
  87. * 页面上拉触底事件的处理函数
  88. */
  89. onReachBottom() {
  90. },
  91. /**
  92. * 用户点击右上角分享
  93. */
  94. onShareAppMessage() {
  95. }
  96. })