123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173 |
- <template>
- <!-- <text>开关锁记录</text> -->
- <view class="lockRecord">
- <map id="map" :longitude="longitude" :latitude="latitude" scale="14" :markers="markers" bindregionchange="regionchange" show-location v-if="!not"></map>
- <view class="lock" v-if="!not">
- <view class="lockDate" v-for="(item,index) in lockRecord" :key="index" >
- <view>姓名:{{item.username}} {{item.mobile}}</view>
- <view>时间:{{item.operate_time}}</view>
- <view>操作类型:{{item.name}}</view>
- </view>
- </view>
- <view class="noData" v-if="not">
- <image src="http://resource.weilaibike.com/none.png"></image>
- <view>暂无相关数据~</view>
- </view>
- </view>
- </template>
- <script>
- var app=getApp()
- export default{
- data(){
- return{
- lockRecord: [],
- longitude:'',
- latitude:'',
- not:false,
- markers:'',
-
-
-
- }
- },
- onLoad(options) {
- uni.showLoading({
- title: '加载中...',
- })
- // let that = this;
- let data = {
- bike_id: options.id
- }
- app.request('bike/locksInfo', data, 'POST').then(res => {
- wx.hideLoading();
- console.log(res, '开关锁记录')
- if (
- res.data.close_bike.length == 0 &&
- res.data.close_pause_bike.length == 0 &&
- res.data.open_bike.length == 0 &&
- res.data.open_pause_bike.length == 0
- ) {
- // this.setData({
- this.not=true
- // })
- } else {
- let close_bike = res.data.close_bike;
- let open_bike = res.data.open_bike;
- let open_pause_bike = res.data.open_pause_bike;
- let close_pause_bike = res.data.close_pause_bike;
- // 开锁记录
- if(close_bike.length>=1){
- for (var i = 0; i < close_bike.length; i++) {
- close_bike[i].iconPath = 'http://resource.weilaibike.com/common/open.app.png';
- close_bike[i].width = 24;
- close_bike[i].height =24;
- close_bike[i].zIndex = 1111;
- close_bike[i].latitude = close_bike[i].location[1];
- close_bike[i].longitude = close_bike[i].location[0];
- }
- // that.setData({
- this.markers=close_bike
- // })
- }
- //关锁记录
- if(open_bike.length>=1){
- for (var i = 0; i < open_bike.length; i++) {
- open_bike[i].iconPath = 'http://resource.weilaibike.com/common/close.app.png';
- open_bike[i].width = 24;
- open_bike[i].height = 24;
- open_bike[i].zIndex = 1111;
- open_bike[i].latitude = open_bike[i].location[1];
- open_bike[i].longitude = open_bike[i].location[0];
- }
- // that.setData({
- this.markers=this.markers.concat(open_bike)
- // })
- }
- //临时开锁
- if(open_pause_bike.length>=1){
- for (var i = 0; i < open_pause_bike.length; i++) {
- open_pause_bike[i].iconPath = 'http://resource.weilaibike.com/common/temOpen.app.png';
- open_pause_bike[i].width = 22;
- open_pause_bike[i].height = 30;
- open_pause_bike[i].zIndex = 1111;
- open_pause_bike[i].latitude = open_pause_bike[i].location[1];
- open_pause_bike[i].longitude = open_pause_bike[i].location[0];
- }
- // that.setData({
- this.markers=this.markers.concat(open_pause_bike)
- // })
- }
- //临时关锁
- if(close_pause_bike.length>=1){
- for (var i = 0; i < close_pause_bike.length; i++) {
- close_pause_bike[i].iconPath = 'http://resource.weilaibike.com/common/temClose.app.png';
- close_pause_bike[i].width = 22;
- close_pause_bike[i].height = 30;
- close_pause_bike[i].zIndex = 1111;
- close_pause_bike[i].id = close_pause_bike[i].bike_no;
- close_pause_bike[i].latitude = close_pause_bike[i].location[1];
- close_pause_bike[i].longitude = close_pause_bike[i].location[0];
- }
- // that.setData({
- this.markers=this.markers.concat(close_pause_bike),
- this.longitude=res.data.open_bike[0].location[0],
- this.latitude=res.data.open_bike[0].location[1]
- // })
- }
- //列表数据
- let arr = [];
- arr = arr.concat(
- res.close_bike,
- res.close_pause_bike,
- res.open_bike,
- res.open_pause_bike
- );
- console.log(this.markers);
- // that.setData({
- this.lockRecord=arr
- // })
- }
- }).catch(err => {
- console.log(err)
- })
- }
- }
- </script>
- <style>
- /* pages/lockRecord/lockRecord.wxss */
- @import url("/static/css/base.css");
- page {
- background: #eee;
- }
-
- map {
- width: 100%;
- height: 45%;
- position: absolute;
- }
-
- .lock {
- /* margin-top: 570rpx; */
- padding-top: 600upx;
- }
- .lock .lockDate {
- background: #fff;
- width:92%;
- margin:20rpx auto;
- height:178rpx;
- border-radius: 10rpx;
- padding:10rpx 0;
- line-height:2;
- }
- /* .lock .lockDate:first-child{
- margin:50rpx auto;
- } */
- .lock .lockDate view{
- margin-left:25rpx;
- font-size:28rpx;
- color:#4d4d4d;
- }
- </style>
|