details.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. // pages/details/details.js
  2. import http from '../../base/httputil'
  3. const app = getApp()
  4. Page({
  5. onLoad(e) {
  6. this.data.busEnterpriseId = e.busEnterpriseId
  7. this.getEnterpriseDetails()
  8. },
  9. data: {
  10. host: app.globalData.host,
  11. busEnterpriseId: null,
  12. enterpriseDetails: null,
  13. //店铺经纬度
  14. latitude: 43.8691319,
  15. longitude: 125.3504459,
  16. //标记点
  17. markers: [{
  18. id: 0,
  19. name: "编程小石头",
  20. address: "长春首佳科技有限公司",
  21. latitude: 43.8691319,
  22. longitude: 125.3504459,
  23. width: 35,
  24. height: 50
  25. }]
  26. },
  27. getEnterpriseDetails() {
  28. let obj = new Object();
  29. obj.busEnterpriseId = this.data.busEnterpriseId
  30. http.post("/system/AppEnterpriseController/getEnterpriseDetails", obj, this.getEnterpriseDetailsSuccess)
  31. },
  32. getEnterpriseDetailsSuccess(res) {
  33. console.log(res)
  34. this.setData({
  35. enterpriseDetails: res.enterpriseDetails,
  36. latitude: res.enterpriseDetails.latitude,
  37. longitude: res.enterpriseDetails.longitude,
  38. markers: [{
  39. id: res.enterpriseDetails.busEnterpriseId,
  40. name: res.enterpriseDetails.businessName,
  41. address: res.enterpriseDetails.businessAddress,
  42. latitude: res.enterpriseDetails.latitude,
  43. longitude: res.enterpriseDetails.longitude,
  44. width: 35,
  45. height: 50
  46. }]
  47. })
  48. },
  49. //拨打电话
  50. Call() {
  51. wx.makePhoneCall({
  52. phoneNumber: '17649876533'
  53. })
  54. },
  55. //导航
  56. navRoad(event) {
  57. console.log(event)
  58. wx.getLocation({ //获取当前经纬度
  59. type: 'wgs84', //返回可以用于wx.openLocation的经纬度,
  60. success: function (res) {
  61. wx.openLocation({ //​使用微信内置地图查看位置。
  62. latitude: event.currentTarget.dataset.marker.latitude, //要去的纬度-地址
  63. longitude: event.currentTarget.dataset.marker.longitude, //要去的经度-地址
  64. name: event.currentTarget.dataset.marker.name,
  65. address: event.currentTarget.dataset.marker.address
  66. })
  67. }
  68. })
  69. },
  70. //-------跳转
  71. //巡检跳转
  72. bindViewXunJian() {
  73. wx.navigateTo({
  74. url: '../xunjian/xunjian?busEnterpriseId='+this.data.busEnterpriseId,
  75. })
  76. },
  77. //巡检跳转
  78. bindViewXunChaJiLu() {
  79. wx.navigateTo({
  80. url: '../xunchajilu/xunchajilu?busEnterpriseId='
  81. +this.data.enterpriseDetails.busEnterpriseId
  82. +"&businessName="+this.data.enterpriseDetails.businessName,
  83. })
  84. },
  85. //企业详情
  86. bindViewQiYeXiangQingTable() {
  87. wx.navigateTo({
  88. url: '../qiyexqtable/qiyexqtable?busEnterpriseId='+this.data.busEnterpriseId,
  89. })
  90. },
  91. })