details.js 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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. },
  8. onShow() {
  9. this.getEnterpriseDetails()
  10. },
  11. data: {
  12. host: app.globalData.host,
  13. busEnterpriseId: null,
  14. enterpriseDetails: null,
  15. //店铺经纬度
  16. latitude: 43.8691319,
  17. longitude: 125.3504459,
  18. //标记点
  19. markers: [{
  20. id: 0,
  21. name: "编程小石头",
  22. address: "长春首佳科技有限公司",
  23. latitude: 43.8691319,
  24. longitude: 125.3504459,
  25. width: 35,
  26. height: 50
  27. }],
  28. isShowEdit: true,
  29. },
  30. getEnterpriseDetails() {
  31. let obj = new Object();
  32. obj.busEnterpriseId = this.data.busEnterpriseId
  33. http.post("/system/AppEnterpriseController/getEnterpriseDetails", obj, this.getEnterpriseDetailsSuccess)
  34. },
  35. getEnterpriseDetailsSuccess(res) {
  36. // var currentUserId=res.enterpriseDetails.userId;
  37. // var loginUserid=app.loginUserId;
  38. this.isShowEdit = (res.enterpriseDetails.userId === app.loginUserId)
  39. this.setData({
  40. enterpriseDetails: res.enterpriseDetails,
  41. latitude: res.enterpriseDetails.latitude,
  42. longitude: res.enterpriseDetails.longitude,
  43. isShowEdit: this.isShowEdit,
  44. markers: [{
  45. id: res.enterpriseDetails.busEnterpriseId,
  46. name: res.enterpriseDetails.businessName,
  47. address: res.enterpriseDetails.businessAddress,
  48. latitude: res.enterpriseDetails.latitude,
  49. longitude: res.enterpriseDetails.longitude,
  50. width: 35,
  51. height: 50,
  52. }]
  53. })
  54. },
  55. //拨打电话
  56. Call() {
  57. wx.makePhoneCall({
  58. phoneNumber: '17649876533'
  59. })
  60. },
  61. //巡更点跳转
  62. xungengList() {
  63. wx.navigateTo({
  64. url: '../patrol_list/patrol_list?enterpriseId=' + this.data.busEnterpriseId,
  65. })
  66. },
  67. //导航
  68. navRoad(event) {
  69. wx.getLocation({ //获取当前经纬度
  70. type: 'wgs84', //返回可以用于wx.openLocation的经纬度,
  71. success: function (res) {
  72. wx.openLocation({ //​使用微信内置地图查看位置。
  73. latitude: Number(event.currentTarget.dataset.marker.latitude), //要去的纬度-地址
  74. longitude: Number(event.currentTarget.dataset.marker.longitude), //要去的经度-地址
  75. name: event.currentTarget.dataset.marker.name,
  76. address: event.currentTarget.dataset.marker.address
  77. })
  78. }
  79. })
  80. },
  81. //-------跳转
  82. //巡检跳转
  83. bindViewXunJian() {
  84. wx.navigateTo({
  85. url: '../xunjian/xunjian?busEnterpriseId=' + this.data.busEnterpriseId
  86. + "&isBeforeBack=true",
  87. })
  88. },
  89. //巡检跳转
  90. bindViewXunChaJiLu() {
  91. wx.navigateTo({
  92. url: '../xunchajilu/xunchajilu?busEnterpriseId='
  93. + this.data.enterpriseDetails.busEnterpriseId
  94. + "&businessName=" + this.data.enterpriseDetails.businessName,
  95. })
  96. },
  97. //企业详情
  98. bindViewQiYeXiangQingTable() {
  99. wx.navigateTo({
  100. url: '../qiyexqtable/qiyexqtable?busEnterpriseId=' + this.data.busEnterpriseId,
  101. })
  102. },
  103. bindViewQiYeDelete() {
  104. wx.showModal({
  105. title: '提示',
  106. content: '确认废弃该企业?',
  107. complete: (res) => {
  108. if (res.cancel) {
  109. } else {
  110. this.deleteEnterprise()
  111. }
  112. }
  113. })
  114. },
  115. deleteEnterprise() {
  116. let obj = new Object();
  117. obj.busEnterpriseId = this.data.busEnterpriseId
  118. http.post("/system/AppEnterpriseController/deleteEnterprise", obj, this.deleteEnterpriseSuccess)
  119. },
  120. deleteEnterpriseSuccess(res) {
  121. wx.showToast({
  122. title: res.msg,
  123. })
  124. if (res.code == 200) {
  125. wx.navigateBack()
  126. }
  127. },
  128. })