new_patrol_point.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. import http from '../../base/httputil'
  2. const app = getApp()
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. host: app.globalData.host,
  9. enterpriseId: null,
  10. details: {
  11. id: null,
  12. longitude: Number,
  13. latitude: Number,
  14. name: null,
  15. code: null,
  16. address: null,
  17. },
  18. },
  19. /**
  20. * 生命周期函数--监听页面加载
  21. */
  22. onLoad(options) {
  23. this.enterpriseId = options.id
  24. // this.getDetails()
  25. },
  26. // getDetails() {
  27. // let obj = new Object();
  28. // obj.id = this.id
  29. // http.post("/system/AppEnterpriseController/getEnterpriseDetails", obj, this.getEnterpriseDetailsSuccess)
  30. // },
  31. // getEnterpriseDetailsSuccess(res) {
  32. // this.setData({
  33. // enterpriseDetails: res.enterpriseDetails,
  34. // })
  35. // },
  36. //-----------------------------------------
  37. bindInputName(e) {
  38. this.data.details.name = e.detail.value
  39. },
  40. bindInputAddress(e) {
  41. this.data.details.address = e.detail.value
  42. },
  43. bindInputCode(e) {
  44. this.data.details.code = e.detail.value
  45. },
  46. //------------------------------------------
  47. updateDetails() {
  48. let obj = new Object();
  49. obj.enterpriseId = this.data.details.enterpriseId
  50. obj.name = this.data.details.name
  51. obj.address = this.data.details.address
  52. obj.code = this.data.details.code
  53. // http.post("/system/AppEnterpriseController/updateEnterprise", obj, this.updateDetailsSuccess)
  54. },
  55. updateDetailsSuccess(res) {
  56. wx.showToast({
  57. title: res.msg,
  58. })
  59. if(res.code == 200){
  60. wx.navigateBack()
  61. // wx.navigateTo({
  62. // url: '../details/details?busEnterpriseId=' + this.busEnterpriseId,
  63. // })
  64. }
  65. },
  66. deletePatrolPoint() {
  67. // let obj = new Object();
  68. // obj.busEnterpriseId = this.data.enterpriseDetails.busEnterpriseId
  69. // http.post("/system/AppEnterpriseController/deleteEnterprise", obj, this.deleteEnterpriseSuccess)
  70. },
  71. // deleteEnterpriseSuccess(res) {
  72. // wx.showToast({
  73. // title: res.msg,
  74. // })
  75. // if(res.code == 200){
  76. // wx.navigateTo({
  77. // url: '../qiye/qiye'
  78. // })
  79. // }
  80. // },
  81. /**
  82. * 生命周期函数--监听页面初次渲染完成
  83. */
  84. onReady() {
  85. },
  86. /**
  87. * 生命周期函数--监听页面显示
  88. */
  89. onShow() {
  90. },
  91. /**
  92. * 生命周期函数--监听页面隐藏
  93. */
  94. onHide() {
  95. },
  96. /**
  97. * 生命周期函数--监听页面卸载
  98. */
  99. onUnload() {
  100. },
  101. /**
  102. * 页面相关事件处理函数--监听用户下拉动作
  103. */
  104. onPullDownRefresh() {
  105. },
  106. /**
  107. * 页面上拉触底事件的处理函数
  108. */
  109. onReachBottom() {
  110. },
  111. /**
  112. * 用户点击右上角分享
  113. */
  114. onShareAppMessage() {
  115. },
  116. getLocation() {
  117. let that = this
  118. wx.getLocation({
  119. type: 'wgs84', //返回可以用于wx.openLocation的经纬度
  120. success: function (res) {
  121. that.setData({
  122. details: {
  123. longitude: res.longitude,
  124. latitude: res.latitude
  125. }
  126. })
  127. },
  128. })
  129. },
  130. })