lockRecord.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. <template>
  2. <!-- <text>开关锁记录</text> -->
  3. <view class="lockRecord">
  4. <map id="map" :longitude="longitude" :latitude="latitude" scale="14" :markers="markers" bindregionchange="regionchange" show-location v-if="!not"></map>
  5. <view class="lock" v-if="!not">
  6. <view class="lockDate" v-for="(item,index) in lockRecord" :key="index" >
  7. <view>姓名:{{item.username}} {{item.mobile}}</view>
  8. <view>时间:{{item.operate_time}}</view>
  9. <view>操作类型:{{item.name}}</view>
  10. </view>
  11. </view>
  12. <view class="noData" v-if="not">
  13. <image src="http://resource.weilaibike.com/none.png"></image>
  14. <view>暂无相关数据~</view>
  15. </view>
  16. </view>
  17. </template>
  18. <script>
  19. var app=getApp()
  20. export default{
  21. data(){
  22. return{
  23. lockRecord: [],
  24. longitude:'',
  25. latitude:'',
  26. not:false,
  27. markers:'',
  28. }
  29. },
  30. onLoad(options) {
  31. uni.showLoading({
  32. title: '加载中...',
  33. })
  34. // let that = this;
  35. let data = {
  36. bike_id: options.id
  37. }
  38. app.request('bike/locksInfo', data, 'POST').then(res => {
  39. wx.hideLoading();
  40. console.log(res, '开关锁记录')
  41. if (
  42. res.data.close_bike.length == 0 &&
  43. res.data.close_pause_bike.length == 0 &&
  44. res.data.open_bike.length == 0 &&
  45. res.data.open_pause_bike.length == 0
  46. ) {
  47. // this.setData({
  48. this.not=true
  49. // })
  50. } else {
  51. let close_bike = res.data.close_bike;
  52. let open_bike = res.data.open_bike;
  53. let open_pause_bike = res.data.open_pause_bike;
  54. let close_pause_bike = res.data.close_pause_bike;
  55. // 开锁记录
  56. if(close_bike.length>=1){
  57. for (var i = 0; i < close_bike.length; i++) {
  58. close_bike[i].iconPath = 'http://resource.weilaibike.com/common/open.app.png';
  59. close_bike[i].width = 24;
  60. close_bike[i].height =24;
  61. close_bike[i].zIndex = 1111;
  62. close_bike[i].latitude = close_bike[i].location[1];
  63. close_bike[i].longitude = close_bike[i].location[0];
  64. }
  65. // that.setData({
  66. this.markers=close_bike
  67. // })
  68. }
  69. //关锁记录
  70. if(open_bike.length>=1){
  71. for (var i = 0; i < open_bike.length; i++) {
  72. open_bike[i].iconPath = 'http://resource.weilaibike.com/common/close.app.png';
  73. open_bike[i].width = 24;
  74. open_bike[i].height = 24;
  75. open_bike[i].zIndex = 1111;
  76. open_bike[i].latitude = open_bike[i].location[1];
  77. open_bike[i].longitude = open_bike[i].location[0];
  78. }
  79. // that.setData({
  80. this.markers=this.markers.concat(open_bike)
  81. // })
  82. }
  83. //临时开锁
  84. if(open_pause_bike.length>=1){
  85. for (var i = 0; i < open_pause_bike.length; i++) {
  86. open_pause_bike[i].iconPath = 'http://resource.weilaibike.com/common/temOpen.app.png';
  87. open_pause_bike[i].width = 22;
  88. open_pause_bike[i].height = 30;
  89. open_pause_bike[i].zIndex = 1111;
  90. open_pause_bike[i].latitude = open_pause_bike[i].location[1];
  91. open_pause_bike[i].longitude = open_pause_bike[i].location[0];
  92. }
  93. // that.setData({
  94. this.markers=this.markers.concat(open_pause_bike)
  95. // })
  96. }
  97. //临时关锁
  98. if(close_pause_bike.length>=1){
  99. for (var i = 0; i < close_pause_bike.length; i++) {
  100. close_pause_bike[i].iconPath = 'http://resource.weilaibike.com/common/temClose.app.png';
  101. close_pause_bike[i].width = 22;
  102. close_pause_bike[i].height = 30;
  103. close_pause_bike[i].zIndex = 1111;
  104. close_pause_bike[i].id = close_pause_bike[i].bike_no;
  105. close_pause_bike[i].latitude = close_pause_bike[i].location[1];
  106. close_pause_bike[i].longitude = close_pause_bike[i].location[0];
  107. }
  108. // that.setData({
  109. this.markers=this.markers.concat(close_pause_bike),
  110. this.longitude=res.data.open_bike[0].location[0],
  111. this.latitude=res.data.open_bike[0].location[1]
  112. // })
  113. }
  114. //列表数据
  115. let arr = [];
  116. arr = arr.concat(
  117. res.close_bike,
  118. res.close_pause_bike,
  119. res.open_bike,
  120. res.open_pause_bike
  121. );
  122. console.log(this.markers);
  123. // that.setData({
  124. this.lockRecord=arr
  125. // })
  126. }
  127. }).catch(err => {
  128. console.log(err)
  129. })
  130. }
  131. }
  132. </script>
  133. <style>
  134. /* pages/lockRecord/lockRecord.wxss */
  135. @import url("/static/css/base.css");
  136. page {
  137. background: #eee;
  138. }
  139. map {
  140. width: 100%;
  141. height: 45%;
  142. position: absolute;
  143. }
  144. .lock {
  145. /* margin-top: 570rpx; */
  146. padding-top: 600upx;
  147. }
  148. .lock .lockDate {
  149. background: #fff;
  150. width:92%;
  151. margin:20rpx auto;
  152. height:178rpx;
  153. border-radius: 10rpx;
  154. padding:10rpx 0;
  155. line-height:2;
  156. }
  157. /* .lock .lockDate:first-child{
  158. margin:50rpx auto;
  159. } */
  160. .lock .lockDate view{
  161. margin-left:25rpx;
  162. font-size:28rpx;
  163. color:#4d4d4d;
  164. }
  165. </style>