1734 lines
49 KiB
Vue
1734 lines
49 KiB
Vue
<template>
|
||
<view class="page">
|
||
<u-navbar title="车辆详情" :border-bottom="false" :background="bgc" title-color='#2E4975' title-size='36'
|
||
height='45'></u-navbar>
|
||
<map class="map" id="map" ref="map" :scale="zoomSize" :latitude="latitude" :longitude="longitude"
|
||
:show-location="true" :markers="markers" :polygons="polyline">
|
||
<cover-view class="park" @click="toggleIconAndCallout">
|
||
<cover-image class="img" src="https://lxnapi.ccttiot.com/bike/img/static/uRiYQZQEb3l2LsltEsyW"
|
||
mode=""></cover-image>
|
||
</cover-view>
|
||
<!-- <cover-view class="track" @click="toTrack">
|
||
<cover-image class="img" src="https://lxnapi.ccttiot.com/bike/img/static/ufaAAtlirJYs1QwJF25P"
|
||
mode=""></cover-image>
|
||
</cover-view> -->
|
||
</map>
|
||
|
||
<view class="new_infocard">
|
||
<view class="topsn">
|
||
<view class="lt">
|
||
车牌号:{{deviceInfos.vehicleNum == null ? '--' : deviceInfos.vehicleNum}}
|
||
</view>
|
||
|
||
<view class="rt">
|
||
<view class="stutas">
|
||
<span style="background-color: #979797;" v-if="deviceInfos.status == 0">仓库中</span>
|
||
<span style="background-color: #4c97e7;" v-if="deviceInfos.status == 1">待租</span>
|
||
<span style="background-color: #28c445;" v-if="deviceInfos.status == 2">预约中</span>
|
||
<span style="background-color: #ffc757;" v-if="deviceInfos.status == 3">骑行中</span>
|
||
<span style="background-color: #ff7429;" v-if="deviceInfos.status == 4">临时锁车中</span>
|
||
<span style="background-color: #986cf0;" v-if="deviceInfos.status == 6">调度中</span>
|
||
<span style="background-color: #343a40;" v-if="deviceInfos.status == 8">下线</span>
|
||
<span style="background-color: #ff7429;" v-if="deviceInfos.status == 9">强制锁车</span>
|
||
</view>
|
||
<view class="issuo" v-if="deviceInfos.lockStatus == 0">
|
||
锁已关
|
||
</view>
|
||
<view class="issuo" style="background-color: #4C97E7;color: #fff;" v-if="deviceInfos.lockStatus == 1">
|
||
锁已开
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="" style="display: flex;justify-content: space-between;">
|
||
<view class="cent">
|
||
<view class="lypic" v-if="ver_dataflag == 3 && deviceInfos.onlineStatus == 0">
|
||
<image src="https://api.ccttiot.com/smartmeter/img/static/uLw46jus4X9fposAvVD7" mode=""></image> 已连接
|
||
</view>
|
||
<view class="lypic" v-if="ver_dataflag == 1 && deviceInfos.onlineStatus == 0">
|
||
<image src="https://api.ccttiot.com/smartmeter/img/static/uCdHjNaNfD9aikVg9Cuk" mode=""></image> 未连接
|
||
</view>
|
||
|
||
<view class="lypic" v-if="deviceInfos.music == 0">
|
||
<image src="https://api.ccttiot.com/smartmeter/img/static/uDORYeTuc2EQ1lSI2dbe" mode=""></image> 静音
|
||
</view>
|
||
<view class="lypic" v-if="deviceInfos.music == 1">
|
||
<image src="https://api.ccttiot.com/smartmeter/img/static/u8ii1aiUgREfYyMVIjpO" mode=""></image> 语音
|
||
</view>
|
||
<view class="lypic" v-if="deviceInfos.music == 2">
|
||
<image src="https://api.ccttiot.com/smartmeter/img/static/uP7BOVsjvWaGItgHtoKV" mode=""></image> 彩铃
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="bikesn">
|
||
<view class="">
|
||
SN:{{deviceInfos.sn == null ? '--' : deviceInfos.sn}}
|
||
</view>
|
||
<view class="">
|
||
MAC:{{deviceInfos.mac == null ? '--' : deviceInfos.mac}}
|
||
</view>
|
||
<view class="">
|
||
车型:{{deviceInfos.modelName == null ? '--' : deviceInfos.modelName}}
|
||
</view>
|
||
</view>
|
||
<view class="bikexx">
|
||
<view class="dianliang">
|
||
<image v-if="deviceInfos.remainingPower >= 0 && deviceInfos.remainingPower < 20 " src="https://api.ccttiot.com/smartmeter/img/static/u8M9KmIfHXpmeifTwCzj" mode=""></image>
|
||
<image v-if="deviceInfos.remainingPower >= 20 && deviceInfos.remainingPower < 50 " src="https://api.ccttiot.com/smartmeter/img/static/u2gp2pE9kPGwaJ4MKUxE" mode=""></image>
|
||
<image v-if="deviceInfos.remainingPower >= 50 && deviceInfos.remainingPower < 80 " src="https://api.ccttiot.com/smartmeter/img/static/umm5Ruc5vhNSjeacslwX" mode=""></image>
|
||
<image v-if="deviceInfos.remainingPower >= 80 && deviceInfos.remainingPower <= 100 " src="https://api.ccttiot.com/smartmeter/img/static/uo75cOfYZiQoxZQAI3FH" mode=""></image>
|
||
<view class="dl">
|
||
电量:<span>{{deviceInfos.remainingPower == null ? '--' : deviceInfos.remainingPower.toFixed(2)}}%</span>
|
||
</view>
|
||
<view class="dy">
|
||
电压:<span>{{deviceInfos.voltage == null ? '--' : deviceInfos.voltage.toFixed(2)}}V</span>
|
||
</view>
|
||
</view>
|
||
<view class="xuhang">
|
||
<view class="">
|
||
<image src="https://api.ccttiot.com/smartmeter/img/static/uBueutMzheLZWktEFWVR" mode=""></image> 续航 {{deviceInfos.remainEndurance == null ? '--' : deviceInfos.remainEndurance}}km
|
||
</view>
|
||
<!-- <view class="" style="margin-top: 20rpx;">
|
||
<image src="https://api.ccttiot.com/smartmeter/img/static/ur7Q7YC9AOkkTpvaLEUU" mode=""></image> 车型 {{deviceInfos.modelName}}
|
||
</view> -->
|
||
</view>
|
||
<view class="ewm">
|
||
<!-- <view class="" @click="generateQrcode()">
|
||
<image src="https://api.ccttiot.com/smartmeter/img/static/uiCssXpb4SpuFAQYOp2A" mode=""></image> 二维码
|
||
</view> -->
|
||
<view class="" @click="toTrack">
|
||
<image src="https://api.ccttiot.com/smartmeter/img/static/uJtMZ16iR2q8agQ4iLm3" mode=""></image> 轨迹
|
||
</view>
|
||
<view class="" style="margin-top: 14rpx;" @click="btndaohang">
|
||
<image src="https://api.ccttiot.com/smartmeter/img/static/u3De0EsfW6ZctTFCH9p7" mode=""></image> 导航
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="caozuoanniu">
|
||
<view class="dangeanniu" @click="checkbtn(0)">
|
||
<view class="pic">
|
||
<image src="https://api.ccttiot.com/smartmeter/img/static/uuHHQU2Yg2sReTadF51Y" mode=""></image>
|
||
</view>
|
||
开锁
|
||
</view>
|
||
<view class="dangeanniu" @click="checkbtn(1)">
|
||
<view class="pic">
|
||
<image src="https://api.ccttiot.com/smartmeter/img/static/uKear247uKM7Axwgh3Jc" mode=""></image>
|
||
</view>
|
||
关锁
|
||
</view>
|
||
<view class="dangeanniu" @click="btn(4)">
|
||
<view class="pic">
|
||
<image src="https://api.ccttiot.com/smartmeter/img/static/uE7zUe5bXdtGGyWA9WGG" mode=""></image>
|
||
</view>
|
||
响铃寻车
|
||
</view>
|
||
<view class="dangeanniu" v-if="this.deviceInfos.hardwareVersion && this.deviceInfos.hardwareVersion.toLowerCase().includes('x')" @click="btn(9)">
|
||
<view class="pic">
|
||
<image src="https://api.ccttiot.com/smartmeter/img/static/ujhsaJeL6KVrYgFSEKkj" mode=""></image>
|
||
</view>
|
||
坐垫锁
|
||
</view>
|
||
<view class="dangeanniu" @click="btn(8)">
|
||
<view class="pic">
|
||
<image src="https://api.ccttiot.com/smartmeter/img/static/uWnOOwRQYpZxB14stYl8" mode=""></image>
|
||
</view>
|
||
重启
|
||
</view>
|
||
<view class="dangeanniu" @click="btn(2)" v-if="deviceInfos.status!=8">
|
||
<view class="pic">
|
||
<image src="https://api.ccttiot.com/smartmeter/img/static/u1PlutiYn3alAcF2VuTH" mode=""></image>
|
||
</view>
|
||
禁用
|
||
</view>
|
||
<view class="dangeanniu" @click="btn(3)" v-if="deviceInfos.status==8">
|
||
<view class="pic">
|
||
<image src="https://api.ccttiot.com/smartmeter/img/static/u1PlutiYn3alAcF2VuTH" mode=""></image>
|
||
</view>
|
||
解禁
|
||
</view>
|
||
<view class="dangeanniu" @click="btn(5)" v-if="deviceInfos.status!=0">
|
||
<view class="pic">
|
||
<image src="https://api.ccttiot.com/smartmeter/img/static/uJvI9lLyEkA2QdSr74LX" mode=""></image>
|
||
</view>
|
||
回仓
|
||
</view>
|
||
<view class="dangeanniu" @click="btn(6)" v-if="deviceInfos.status==0">
|
||
<view class="pic">
|
||
<image src="https://api.ccttiot.com/smartmeter/img/static/uJvI9lLyEkA2QdSr74LX" mode=""></image>
|
||
</view>
|
||
出仓
|
||
</view>
|
||
<view class="dangeanniu" @click="btn(7)">
|
||
<view class="pic">
|
||
<image src="https://api.ccttiot.com/smartmeter/img/static/u277Tj0k5M7I8EO4V3ki" mode=""></image>
|
||
</view>
|
||
车牌修改
|
||
</view>
|
||
<view class="dangeanniu" @click="changeShwoList">
|
||
<view class="pic">
|
||
<image src="https://api.ccttiot.com/smartmeter/img/static/ua7Xl6Eew8AvjeKJFKXI" mode=""></image>
|
||
</view>
|
||
修改车型
|
||
</view>
|
||
<view class="dangeanniu" @click="yunyingflag = true">
|
||
<view class="pic">
|
||
<image src="https://api.ccttiot.com/smartmeter/img/static/uZuY3hgJBtCwnSnWTIC3" mode=""></image>
|
||
</view>
|
||
划拨
|
||
</view>
|
||
<view class="dangeanniu" v-if="Number(deviceInfos.softwareVersion) > 6000" @click="btnjingyin">
|
||
<view class="pic">
|
||
<image src="https://api.ccttiot.com/smartmeter/img/static/uUJGVRpPIRC34vF7240K" mode=""></image>
|
||
</view>
|
||
声音
|
||
</view>
|
||
<view class="dangeanniu" @click="btn(10)">
|
||
<view class="pic">
|
||
<image src="https://api.ccttiot.com/smartmeter/img/static/uuuFxDo4XNzXJDTOQIeZ" mode=""></image>
|
||
</view>
|
||
定位更新
|
||
</view>
|
||
<view class="dangeanniu" @click="generateQrcode()">
|
||
<view class="pic">
|
||
<image src="https://api.ccttiot.com/smartmeter/img/static/uQdKTkDuXlwaZT5WFL2l" mode=""></image>
|
||
</view>
|
||
二维码
|
||
</view>
|
||
<!-- 蓝牙控制 -->
|
||
<view class="dangeanniu" @click="lanya(1)" v-if="ver_dataflag == 3 && deviceInfos.onlineStatus == 0">
|
||
<view class="pic">
|
||
<image src="https://api.ccttiot.com/smartmeter/img/static/uqUiYiMtGTjkPNgmCjvP" mode=""></image>
|
||
</view>
|
||
蓝牙开锁
|
||
</view>
|
||
<view class="dangeanniu" @click="lanya(2)" v-if="ver_dataflag == 3 && deviceInfos.onlineStatus == 0">
|
||
<view class="pic">
|
||
<image src="https://api.ccttiot.com/smartmeter/img/static/uqUiYiMtGTjkPNgmCjvP" mode=""></image>
|
||
</view>
|
||
蓝牙关锁
|
||
</view>
|
||
<view class="dangeanniu" @click="lanya(3)" v-if="ver_dataflag == 3 && deviceInfos.onlineStatus == 0">
|
||
<view class="pic">
|
||
<image src="https://api.ccttiot.com/smartmeter/img/static/uqUiYiMtGTjkPNgmCjvP" mode=""></image>
|
||
</view>
|
||
蓝牙重启
|
||
</view>
|
||
<view class="dangeanniu" @click="lanya(4)" v-if="ver_dataflag == 3 && deviceInfos.onlineStatus == 0">
|
||
<view class="pic">
|
||
<image src="https://api.ccttiot.com/smartmeter/img/static/uqUiYiMtGTjkPNgmCjvP" mode=""></image>
|
||
</view>
|
||
蓝牙响铃
|
||
</view>
|
||
</view>
|
||
<view class="zuche">
|
||
<view class="">
|
||
运营区域:<span>{{deviceInfos.areaName == null ? '--' : deviceInfos.areaName}}</span>
|
||
</view>
|
||
<view class="one">
|
||
最后租车客户: <span @click="btntel" style="color: #4C97E7;"><image src="https://api.ccttiot.com/smartmeter/img/static/uCa86z0tr5WHiymtRJYt" mode=""></image>{{deviceInfos.lastUserPhone == null ? '--' : deviceInfos.lastUserPhone}}</span>
|
||
</view>
|
||
<view class="one" style="display: flex;justify-content: space-between;align-items: center;">
|
||
最后定位时间:
|
||
<view class="one" style="margin-bottom: 0;">
|
||
<image src="https://api.ccttiot.com/smartmeter/img/static/uesvOKQAO4eIFWSTIuQD" mode=""></image> {{deviceInfos.satellites == null ? '--' : deviceInfos.satellites}}
|
||
</view>
|
||
<span>{{deviceInfos.lastLocationTime == null ? '--' : deviceInfos.lastLocationTime}}</span>
|
||
</view>
|
||
<view class="one" style="display: flex;justify-content: space-between;align-items: center;">
|
||
最后在线时间:
|
||
<view class="one" style="margin-bottom: 0;">
|
||
<image src="https://api.ccttiot.com/smartmeter/img/static/u5ouYhbxDvAVM6pImusK" mode=""></image> {{deviceInfos.signalStrength == null ? '--' : deviceInfos.signalStrength}}
|
||
</view>
|
||
<span>{{deviceInfos.lastOnlineTime == null ? '--' : deviceInfos.lastOnlineTime}}</span>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<u-mask :show="false" @click="show = false" :z-index='100' />
|
||
<u-mask :show="maskloading" :z-index='100' duration='0' />
|
||
<u-mask :show="showvehicle" @click="closevehicle()" :z-index='100' />
|
||
<view class="tip_box" v-if="showvehicle">
|
||
<view class="top" v-if="showvehicle">
|
||
<view class="tip">
|
||
设备信息修改
|
||
</view>
|
||
<view class="ipt_box">
|
||
<view class="text">
|
||
车牌号
|
||
</view>
|
||
<view class="ipt">
|
||
<input type="text" v-model="vehicleNum" placeholder=" " class="input"
|
||
placeholder-style="color:#C7CDD3">
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="bots">
|
||
<view class="bot_left" @click="closevehicle()">
|
||
取消
|
||
</view>
|
||
<view class="bot_right" @click="putvehicle()">
|
||
确定
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<u-mask :show="showqr" @click="closeQr()" :z-index='100' />
|
||
<view class="tip_box" v-if="showqr">
|
||
<view class="ewm" style="padding-top: 50rpx;">
|
||
<canvas id="qrcode" canvas-id="qrcode" style="width: 350rpx;height:350rpx;margin-left: 164rpx;" />
|
||
</view>
|
||
<view class="saveQr" @click="saveQrcode()">
|
||
保存二维码
|
||
</view>
|
||
</view>
|
||
<u-mask :show="showbtntip" @click="closevehicle()" :z-index='100' />
|
||
<view class="tip_box" v-if="showbtntip">
|
||
<view class="top" v-if="showbtntip">
|
||
<view class="tip">
|
||
操作提示
|
||
</view>
|
||
<view class="ipt_box" style="justify-content: center;">
|
||
<view class="text" style="width: 80%;text-align: center;">
|
||
车辆有正在进行中的订单,是否进行该操作
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="bots">
|
||
<view class="bot_left" @click="closeshowtip() ">
|
||
取消
|
||
</view>
|
||
<view class="bot_right" @click="btn(btnnum)">
|
||
确定
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<u-select v-model="showModelList" :list="ModelList" title='修改车型' @confirm="confirm"></u-select>
|
||
<u-select v-model="yunyingflag" :list="yunyingList" title='修改运营区' @confirm="yunyingconfirm"></u-select>
|
||
<u-select v-model="shengyin" :list="shengyinlist" title='修改声音' @confirm="shengyinaniu"></u-select>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
const app = getApp()
|
||
var xBlufi = require("@/components/blufi/xBlufi.js")
|
||
let _this = null
|
||
export default {
|
||
data() {
|
||
return {
|
||
shengyin:false,
|
||
shengyinlist:[{label:'静音',value:0},{label:'语音',value:1},{label:'彩铃',value:2}],
|
||
|
||
devicesList: [],
|
||
searching: false,
|
||
texts: '正在扫描蓝牙设备...',
|
||
btnflag: true,
|
||
tishiflag: false,
|
||
option: '',
|
||
bluthlist: [], //蓝牙数组
|
||
statusflag: false,
|
||
Bluetoothmac: '',
|
||
mac: '',
|
||
ishave: false,
|
||
ver_data: null,
|
||
deviceInfoss: {},
|
||
gps: {},
|
||
isband: false,
|
||
deviceIds: '',
|
||
name: '',
|
||
orderinfo: {},
|
||
dl: 0,
|
||
czmoney: true,
|
||
iscz: true,
|
||
bgc: {
|
||
backgroundColor: "#F7FAFE",
|
||
},
|
||
show: true,
|
||
showgj: true,
|
||
searchKeyword: '11',
|
||
latitude: '',
|
||
longitude: '',
|
||
isMap: false,
|
||
zoomSize: 15,
|
||
markers: [],
|
||
polyline: [],
|
||
polygons: [],
|
||
cardId: '001区域',
|
||
sn: '',
|
||
deviceInfos: {},
|
||
carstause: false,
|
||
|
||
maskloading: false,
|
||
toploadtxt: "开锁中0%",
|
||
loadimg: 'https://lxnapi.ccttiot.com/bike/img/static/urJQJnOI1DEjWatFqHYh',
|
||
tiptxt: '请定点停放,规范用车',
|
||
maskepage: 0,
|
||
backgps: {},
|
||
buletxt: '',
|
||
|
||
buleclose: false,
|
||
buleopen: false,
|
||
bulering: false,
|
||
bulerebort: false,
|
||
getnum: 0,
|
||
showvehicle: false,
|
||
vehicleNum: '',
|
||
showbtntip: false,
|
||
btnnum: null,
|
||
showqr: false,
|
||
canvasWidth: 300,
|
||
deptId: null,
|
||
showModelList: false,
|
||
ModelList: [],
|
||
yunyingflag: false,
|
||
yunyingList: [],
|
||
jytxt: '',
|
||
|
||
ver_dataflag: 1,
|
||
mac: '',
|
||
deviceid: '',
|
||
devicename: '',
|
||
devicesarr: [],
|
||
findDeviceTimer: null
|
||
}
|
||
},
|
||
onLoad(e) {
|
||
this.sn = e.id
|
||
this.deviceInfo()
|
||
this.deptId = uni.getStorageSync('deptId');
|
||
},
|
||
onShow() {
|
||
this.getyunying()
|
||
xBlufi.notifyStartDiscoverBle({
|
||
'isStart': true
|
||
})
|
||
xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent)
|
||
},
|
||
onUnload: function() {
|
||
xBlufi.notifyConnectBle({
|
||
isStart: false,
|
||
deviceId: this.deviceId,
|
||
name: this.name
|
||
})
|
||
if (this.findDeviceTimer) {
|
||
clearTimeout(this.findDeviceTimer)
|
||
this.findDeviceTimer = null
|
||
}
|
||
},
|
||
methods: {
|
||
// 请求自己所有运营区
|
||
getyunying(){
|
||
this.$u.get(`/bst/area/list?pageNum=1&pageSize=999`).then(res =>{
|
||
if(res.code == 200){
|
||
this.yunyingList = res.rows.map(item => ({
|
||
value: item.id,
|
||
label: item.name
|
||
}))
|
||
}
|
||
})
|
||
},
|
||
// 点击拨打最近租车人电话
|
||
btntel(){
|
||
uni.makePhoneCall({
|
||
phoneNumber: this.deviceInfos.lastUserPhone,
|
||
success: function(res) {
|
||
console.log('拨打电话成功', res)
|
||
},
|
||
fail: function(err) {
|
||
console.error('拨打电话失败', err)
|
||
}
|
||
})
|
||
},
|
||
// 选择彩铃
|
||
shengyinaniu(e){
|
||
this.$u.put(`/bst/device/iot/music?id=${this.sn}&music=${e[0].value}`).then(res => {
|
||
if (res.code == 200) {
|
||
this.jytxt = e[0].label
|
||
this.deviceInfos.music = e[0].value
|
||
uni.showToast({
|
||
title: '操作成功',
|
||
icon: 'success',
|
||
duration: 2000
|
||
})
|
||
}else{
|
||
uni.showToast({
|
||
title: res.msg,
|
||
icon: 'none',
|
||
duration: 2000
|
||
})
|
||
}
|
||
})
|
||
},
|
||
// 点击进行导航
|
||
btndaohang(){
|
||
uni.openLocation({
|
||
latitude: this.deviceInfos.latitude, //纬度-目的地/坐标点
|
||
longitude: this.deviceInfos.longitude, //经度-目的地/坐标点
|
||
name: '', //地点名称
|
||
address:'' //详细地点名称
|
||
})
|
||
},
|
||
// 连接蓝牙
|
||
lanya(num) {
|
||
if (num == 1) {
|
||
xBlufi.notifySendCustomData({
|
||
customData: "11open@"
|
||
})
|
||
} else if (num == 2) {
|
||
xBlufi.notifySendCustomData({
|
||
customData: "11close@"
|
||
})
|
||
}else if (num == 3) {
|
||
xBlufi.notifySendCustomData({
|
||
customData: "11reboot@"
|
||
})
|
||
} else {
|
||
xBlufi.notifySendCustomData({
|
||
customData: "11play1@"
|
||
})
|
||
}
|
||
},
|
||
getlanya() {
|
||
console.log("进入111蓝牙连接")
|
||
if (this.ver_dataflag != 3) {
|
||
this.ver_dataflag = 1
|
||
this.findDevice()
|
||
}
|
||
},
|
||
findDevice() {
|
||
// 使用 find 方法查找匹配的设备
|
||
const matchedDevice = this.devicesarr.find(device => {
|
||
console.log(device.name, this.mac, '111')
|
||
return device.name.slice(-12) == this.mac.slice(-12)
|
||
})
|
||
if (matchedDevice) {
|
||
// 找到匹配的设备
|
||
xBlufi.notifyStartDiscoverBle({
|
||
'isStart': false
|
||
})
|
||
xBlufi.notifyConnectBle({
|
||
isStart: true,
|
||
deviceId: matchedDevice.deviceId,
|
||
name: matchedDevice.name
|
||
})
|
||
this.deviceid = matchedDevice.deviceId
|
||
this.devicename = matchedDevice.name
|
||
console.log(this.deviceid, '11221')
|
||
} else {
|
||
console.log("未找到匹配的设备,继续查找...")
|
||
this.findDeviceTimer = setTimeout(this.findDevice.bind(this), 1000) // 使用 bind 保持 this 上下文
|
||
}
|
||
},
|
||
// 获取附近蓝牙设备列表
|
||
funListenDeviceMsgEvent: function(options) {
|
||
switch (options.type) {
|
||
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS:
|
||
if (options.result) {
|
||
this.devicesarr = options.data
|
||
}
|
||
break;
|
||
case xBlufi.XBLUFI_TYPE.TYPE_CONNECTED:
|
||
console.log("连接回调:" + JSON.stringify(options))
|
||
if (options.result == true) {
|
||
setTimeout(() => {
|
||
this.ver_dataflag = 3
|
||
}, 2000)
|
||
xBlufi.notifyInitBleEsp32({
|
||
deviceId: this.deviceid
|
||
})
|
||
this.deviceid = options.data.deviceId
|
||
this.name = this.name
|
||
}
|
||
break;
|
||
case xBlufi.XBLUFI_TYPE.TYPE_RECIEVE_CUSTON_DATA:
|
||
this.ver_dataflag = 3
|
||
console.log("1收到设备发来的自定义数据结果:", options.data)
|
||
break;
|
||
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_START:
|
||
if (!options.result) {
|
||
console.log('蓝牙未开启')
|
||
return
|
||
} else {
|
||
this.lanyaflag = false
|
||
}
|
||
break;
|
||
}
|
||
},
|
||
|
||
|
||
|
||
// 静音
|
||
btnjingyin() {
|
||
this.shengyin = true
|
||
},
|
||
|
||
toTrack() {
|
||
uni.navigateTo({
|
||
url: '/page_shanghu/guanli/bike_track?sn=' + this.deviceInfos.sn + '&type=1'
|
||
})
|
||
},
|
||
changeShwoList() {
|
||
console.log('diaoyongle')
|
||
this.showModelList = true
|
||
},
|
||
// 修改运营区
|
||
yunyingconfirm(e){
|
||
let areaId = e[0].value
|
||
let data = {
|
||
ids: [this.sn],
|
||
areaId: areaId
|
||
}
|
||
this.$u.put('/bst/device/transfer', data).then((res) => {
|
||
if (res.code == 200) {
|
||
this.showModelList = false
|
||
this.deviceInfo()
|
||
uni.showToast({
|
||
title: '修改成功',
|
||
icon: 'none',
|
||
duration: 2000
|
||
})
|
||
} else {
|
||
uni.showToast({
|
||
title: res.msg,
|
||
icon: 'none',
|
||
duration: 2000
|
||
})
|
||
}
|
||
})
|
||
},
|
||
// 修改车型
|
||
confirm(e) {
|
||
let modelId = e[0].value
|
||
let data = {
|
||
id: this.sn,
|
||
modelId: modelId
|
||
}
|
||
this.$u.put('/bst/device', data).then((res) => {
|
||
if (res.code == 200) {
|
||
this.showModelList = false
|
||
this.deviceInfo()
|
||
uni.showToast({
|
||
title: '修改成功',
|
||
icon: 'none',
|
||
duration: 2000
|
||
})
|
||
} else {
|
||
uni.showToast({
|
||
title: res.msg,
|
||
icon: 'none',
|
||
duration: 2000
|
||
})
|
||
}
|
||
})
|
||
},
|
||
getModelList() {
|
||
this.$u.get(`/bst/model/list?pageNum=1&pageSize=999`).then((res) => {
|
||
if (res.code == 200) {
|
||
this.ModelList = res.rows.map(item => ({
|
||
value: item.id,
|
||
label: item.name
|
||
}))
|
||
} else {
|
||
uni.showToast({
|
||
title: res.msg,
|
||
icon: 'none',
|
||
duration: 2000
|
||
})
|
||
}
|
||
})
|
||
},
|
||
closeQr() {
|
||
this.showqr = false
|
||
},
|
||
generateQrcode() {
|
||
uni.navigateTo({
|
||
url: '/page_shanghu/guanli/Qrcode?sn=' + this.deviceInfos.sn
|
||
})
|
||
},
|
||
saveQrcode() {
|
||
uni.canvasToTempFilePath({
|
||
canvasId: 'qrcode',
|
||
x: -10, // 裁剪区域的 x
|
||
y: 0, // 裁剪区域的 y
|
||
width: 155, // 裁剪区域的宽度,包含边距
|
||
height: 157 + 15, // 裁剪区域的高度,包含边距
|
||
success: (res) => {
|
||
uni.saveImageToPhotosAlbum({
|
||
filePath: res.tempFilePath,
|
||
success: () => {
|
||
uni.showToast({
|
||
title: '保存成功',
|
||
icon: 'success'
|
||
})
|
||
this.showqr = false
|
||
},
|
||
fail: (err) => {
|
||
uni.showToast({
|
||
title: '保存失败',
|
||
icon: 'none'
|
||
})
|
||
}
|
||
})
|
||
},
|
||
fail: (err) => {
|
||
uni.showToast({
|
||
title: '生成二维码失败',
|
||
icon: 'none'
|
||
})
|
||
}
|
||
})
|
||
},
|
||
closeshowtip() {
|
||
this.showbtntip = false
|
||
},
|
||
checkbtn(num) {
|
||
if (this.deviceInfos.status == 3 || this.deviceInfos.status == 2 || this.deviceInfos.status == 4) {
|
||
this.showbtntip = true
|
||
this.btnnum = num
|
||
} else {
|
||
this.btn(num)
|
||
}
|
||
},
|
||
putvehicle() {
|
||
let data = {
|
||
id: this.sn,
|
||
vehicleNum: this.vehicleNum
|
||
}
|
||
this.$u.put('/bst/device', data).then((res) => {
|
||
if (res.code == 200) {
|
||
this.deviceInfo()
|
||
this.showvehicle = false
|
||
uni.showToast({
|
||
title: '修改成功',
|
||
icon: 'none',
|
||
duration: 2000
|
||
})
|
||
} else {
|
||
uni.showToast({
|
||
title: res.msg,
|
||
icon: 'none',
|
||
duration: 2000
|
||
})
|
||
}
|
||
})
|
||
},
|
||
closemask() {
|
||
this.maskloading = false
|
||
},
|
||
statuss() {
|
||
if (this.deviceInfos.sn) {
|
||
if (this.deviceInfos.etOrders[0]) {
|
||
if (this.deviceInfos.etOrders[0].status == 0) {
|
||
return '预约中'
|
||
} else if (this.deviceInfos.etOrders[0].status == 1) {
|
||
return '取消预约'
|
||
} else if (this.deviceInfos.etOrders[0].status == 2) {
|
||
return '骑行中'
|
||
} else if (this.deviceInfos.etOrders[0].status == 3) {
|
||
return '骑行结束'
|
||
} else if (this.deviceInfos.etOrders[0].status == 4) {
|
||
return '订单完成'
|
||
}
|
||
}
|
||
}
|
||
},
|
||
closevehicle() {
|
||
this.showvehicle = false
|
||
},
|
||
btn(num) {
|
||
this.showbtntip = false
|
||
let data = [this.sn]
|
||
if (num == 0) {
|
||
uni.showLoading({
|
||
title: '加载中...'
|
||
})
|
||
console.log('点击了....1');
|
||
this.$u.put('/bst/device/iot/unlock?id=' + this.sn).then((res) => {
|
||
if (res.code == 200) {
|
||
// 处理接口返回的数据,将边界数据转换为地图组件需要的折线结构
|
||
this.deviceInfo()
|
||
uni.showToast({
|
||
title: '操作成功',
|
||
icon: 'success',
|
||
duration: 2000
|
||
})
|
||
} else {
|
||
uni.hideLoading()
|
||
uni.showToast({
|
||
title: res.msg,
|
||
icon: 'none',
|
||
duration: 2000
|
||
})
|
||
}
|
||
})
|
||
} else if (num == 1) {
|
||
uni.showLoading({
|
||
title: '加载中...'
|
||
})
|
||
console.log('点击了....2');
|
||
this.$u.put('/bst/device/iot/lock?id=' + this.sn).then((res) => {
|
||
if (res.code == 200) {
|
||
// 处理接口返回的数据,将边界数据转换为地图组件需要的折线结构
|
||
this.deviceInfo()
|
||
uni.showToast({
|
||
title: '操作成功',
|
||
icon: 'success',
|
||
duration: 2000
|
||
});
|
||
} else {
|
||
uni.hideLoading()
|
||
uni.showToast({
|
||
title: res.msg,
|
||
icon: 'none',
|
||
duration: 2000
|
||
})
|
||
}
|
||
})
|
||
} else if (num == 2) {
|
||
uni.showLoading({
|
||
title: '加载中...'
|
||
})
|
||
this.$u.put('/bst/device/disable', data).then((res) => {
|
||
if (res.code == 200) {
|
||
uni.showToast({
|
||
title: '解禁成功',
|
||
icon: 'success',
|
||
duration: 2000
|
||
});
|
||
// 处理接口返回的数据,将边界数据转换为地图组件需要的折线结构
|
||
this.deviceInfo()
|
||
} else {
|
||
uni.showToast({
|
||
title: res.msg,
|
||
icon: 'none',
|
||
duration: 2000
|
||
})
|
||
}
|
||
})
|
||
} else if (num == 3) {
|
||
uni.showLoading({
|
||
title: '加载中...'
|
||
})
|
||
this.$u.put('/bst/device/enable', data).then((res) => {
|
||
if (res.code == 200) {
|
||
// 处理接口返回的数据,将边界数据转换为地图组件需要的折线结构
|
||
uni.showToast({
|
||
title: '解禁成功',
|
||
icon: 'success',
|
||
duration: 2000
|
||
});
|
||
this.deviceInfo()
|
||
} else {
|
||
uni.showToast({
|
||
title: res.msg,
|
||
icon: 'none',
|
||
duration: 2000
|
||
});
|
||
}
|
||
})
|
||
} else if (num == 4) {
|
||
uni.showLoading({
|
||
title: '加载中...'
|
||
})
|
||
this.$u.put('/bst/device/iot/ring?id=' + this.sn).then((res) => {
|
||
if (res.code == 200) {
|
||
uni.hideLoading()
|
||
uni.showToast({
|
||
title: '操作成功',
|
||
icon: 'success',
|
||
duration: 2000
|
||
});
|
||
} else {
|
||
uni.hideLoading()
|
||
uni.showToast({
|
||
title: res.msg,
|
||
icon: 'none',
|
||
duration: 2000
|
||
});
|
||
}
|
||
})
|
||
} else if (num == 5) {
|
||
uni.showLoading({
|
||
title: '加载中...'
|
||
})
|
||
this.$u.put('/bst/device/in', data).then((res) => {
|
||
if (res.code == 200) {
|
||
uni.showToast({
|
||
title: '回仓成功',
|
||
icon: 'success',
|
||
duration: 2000
|
||
});
|
||
this.deviceInfo()
|
||
} else {
|
||
uni.showToast({
|
||
title: res.msg,
|
||
icon: 'none',
|
||
duration: 2000
|
||
})
|
||
}
|
||
})
|
||
} else if (num == 6) {
|
||
uni.showLoading({
|
||
title: '加载中...'
|
||
})
|
||
this.$u.put('/bst/device/out', data).then((res) => {
|
||
if (res.code == 200) {
|
||
this.deviceInfo()
|
||
uni.showToast({
|
||
title: '出仓成功',
|
||
icon: 'success',
|
||
duration: 2000
|
||
})
|
||
} else {
|
||
uni.showToast({
|
||
title: res.msg,
|
||
icon: 'none',
|
||
duration: 2000
|
||
})
|
||
}
|
||
})
|
||
} else if (num == 7) {
|
||
this.showvehicle = true
|
||
} else if (num == 8) {
|
||
uni.showLoading({
|
||
title: '加载中...'
|
||
})
|
||
this.$u.put('/bst/device/iot/reboot?id=' + this.sn).then((res) => {
|
||
if (res.code == 200) {
|
||
this.deviceInfo()
|
||
uni.showToast({
|
||
title: '操作成功',
|
||
icon: 'success',
|
||
duration: 2000
|
||
})
|
||
} else {
|
||
uni.showToast({
|
||
title: res.msg,
|
||
icon: 'none',
|
||
duration: 2000
|
||
})
|
||
}
|
||
})
|
||
} else if (num == 9) {
|
||
uni.showLoading({
|
||
title: '加载中...'
|
||
})
|
||
this.$u.put('/bst/device/iot/unlockSeat?id=' + this.sn).then((res) => {
|
||
if (res.code == 200) {
|
||
this.deviceInfo()
|
||
uni.showToast({
|
||
title: '操作成功',
|
||
icon: 'success',
|
||
duration: 2000
|
||
})
|
||
} else {
|
||
uni.showToast({
|
||
title: res.msg,
|
||
icon: 'none',
|
||
duration: 2000
|
||
})
|
||
}
|
||
})
|
||
} else if (num == 10) {
|
||
uni.showLoading({
|
||
title: '加载中...'
|
||
})
|
||
this.$u.put('/bst/device/iot/refresh?id=' + this.sn).then((res) => {
|
||
if (res.code == 200) {
|
||
this.deviceInfo()
|
||
uni.showToast({
|
||
title: '操作成功',
|
||
icon: 'success',
|
||
duration: 2000
|
||
})
|
||
} else {
|
||
uni.showToast({
|
||
title: res.msg,
|
||
icon: 'none',
|
||
duration: 2000
|
||
})
|
||
}
|
||
})
|
||
}
|
||
},
|
||
btnyc() {
|
||
this.titleflag = false
|
||
},
|
||
// 点击隐藏没有设备提示
|
||
btnhd() {
|
||
this.tishiflag = false
|
||
},
|
||
deviceInfo() {
|
||
this.markers = []
|
||
this.$u.get(`/bst/device?id=${this.sn}`).then((res) => {
|
||
console.log(res, 'rererer')
|
||
if (res.code === 200) {
|
||
if(res.data.music == 0){
|
||
this.jytxt = '静音'
|
||
}else if(res.data.music == 1){
|
||
this.jytxt = '语音'
|
||
}else if(res.data.music == 2){
|
||
this.jytxt = '彩铃'
|
||
}
|
||
this.deviceInfos = res.data
|
||
this.mac = res.data.mac
|
||
if (res.data.onlineStatus == 0) {
|
||
this.getlanya()
|
||
}
|
||
// if (res.data.isSound == 0) {
|
||
// this.jytxt = '关'
|
||
// } else {
|
||
// this.jytxt = '开'
|
||
// }
|
||
if (this.getnum == 0) {
|
||
this.getArea()
|
||
}
|
||
this.getnum = 1
|
||
this.vehicleNum = res.data.vehicleNum
|
||
this.getModelList()
|
||
this.latitude = this.deviceInfos.latitude
|
||
this.longitude = this.deviceInfos.longitude
|
||
if (this.deviceInfos.status == 0) {
|
||
this.markers.push({
|
||
id: parseFloat(this.deviceInfos.sn),
|
||
latitude: this.deviceInfos.latitude,
|
||
longitude: this.deviceInfos.longitude,
|
||
// title: item.deviceName,
|
||
width: 40,
|
||
height: 47,
|
||
// iconPath: 'https://lxnapi.ccttiot.com/bike/img/static/u6jBvj7S50FPgsHaHXai',
|
||
iconPath: this.deviceInfos.onlineStatus == 0 ?
|
||
'https://lxnapi.ccttiot.com/bike/img/static/uQRng4QNKA38Amk8Wgt5' :
|
||
'https://lxnapi.ccttiot.com/bike/img/static/uocjFo8Ar2BJVpzC2G2f',
|
||
callout: {
|
||
content: this.deviceInfos.remainingPower + '%', // 修改为你想要显示的文字内容
|
||
color: '#ffffff', // 修改为文字颜色
|
||
fontSize: 10, // 修改为文字大小
|
||
borderRadius: 10, // 修改为气泡圆角大小
|
||
bgColor: '#000000', // 修改为气泡背景颜色
|
||
padding: 2, // 修改为气泡内边距
|
||
display: 'ALWAYS', // 修改为气泡的显示策略
|
||
}
|
||
})
|
||
} else if (this.deviceInfos.status == 1) {
|
||
this.markers.push({
|
||
id: parseFloat(this.deviceInfos.sn),
|
||
latitude: this.deviceInfos.latitude,
|
||
longitude: this.deviceInfos.longitude,
|
||
// title: item.deviceName,
|
||
width: 40,
|
||
height: 47,
|
||
iconPath: this.deviceInfos.onlineStatus == 0 ?
|
||
'https://lxnapi.ccttiot.com/bike/img/static/uzhMeExOQJbMcZtrfGUV' :
|
||
'https://lxnapi.ccttiot.com/bike/img/static/uheL17wVZn24BwCwEztT',
|
||
callout: {
|
||
content: this.deviceInfos.remainingPower + '%', // 修改为你想要显示的文字内容
|
||
color: '#2679D1', // 修改为文字颜色
|
||
fontSize: 10, // 修改为文字大小
|
||
borderRadius: 10, // 修改为气泡圆角大小
|
||
bgColor: '#D4ECFF', // 修改为气泡背景颜色
|
||
padding: 2, // 修改为气泡内边距
|
||
display: 'ALWAYS', // 修改为气泡的显示策略
|
||
}
|
||
})
|
||
} else if (this.deviceInfos.status == 2) {
|
||
this.markers.push({
|
||
id: parseFloat(this.deviceInfos.sn),
|
||
latitude: this.deviceInfos.latitude,
|
||
longitude: this.deviceInfos.longitude,
|
||
// title: item.deviceName,
|
||
width: 40,
|
||
height: 47,
|
||
iconPath: this.deviceInfos.onlineStatus == 0 ?
|
||
'https://lxnapi.ccttiot.com/bike/img/static/uR3DQEssiK62ovhh88y8' :
|
||
'https://lxnapi.ccttiot.com/bike/img/static/u460R1NKWHEpHbt0U4H7',
|
||
callout: {
|
||
content: this.deviceInfos.remainingPower + '%', // 修改为你想要显示的文字内容
|
||
color: '#2679D1', // 修改为文字颜色
|
||
fontSize: 10, // 修改为文字大小
|
||
borderRadius: 10, // 修改为气泡圆角大小
|
||
bgColor: '#D4ECFF', // 修改为气泡背景颜色
|
||
padding: 2, // 修改为气泡内边距
|
||
display: 'ALWAYS', // 修改为气泡的显示策略
|
||
}
|
||
})
|
||
} else if (this.deviceInfos.status == 3) {
|
||
this.markers.push({
|
||
id: parseFloat(this.deviceInfos.sn),
|
||
latitude: this.deviceInfos.latitude,
|
||
longitude: this.deviceInfos.longitude,
|
||
// title: item.deviceName,
|
||
width: 40,
|
||
height: 47,
|
||
iconPath: this.deviceInfos.onlineStatus == 0 ?
|
||
'https://lxnapi.ccttiot.com/bike/img/static/uG13E7BpUFF44wVYC9no' :
|
||
'https://lxnapi.ccttiot.com/bike/img/static/uHQIdWCTmtUztl49wBKU',
|
||
callout: {
|
||
content: this.deviceInfos.remainingPower + '%', // 修改为你想要显示的文字内容
|
||
color: '#2679D1', // 修改为文字颜色
|
||
fontSize: 10, // 修改为文字大小
|
||
borderRadius: 10, // 修改为气泡圆角大小
|
||
bgColor: '#D4ECFF', // 修改为气泡背景颜色
|
||
padding: 2, // 修改为气泡内边距
|
||
display: 'ALWAYS', // 修改为气泡的显示策略
|
||
}
|
||
})
|
||
} else if (this.deviceInfos.status == 4 || this.deviceInfos.status == 9) {
|
||
this.markers.push({
|
||
id: parseFloat(this.deviceInfos.sn),
|
||
latitude: this.deviceInfos.latitude,
|
||
longitude: this.deviceInfos.longitude,
|
||
// title: item.deviceName,
|
||
width: 40,
|
||
height: 47,
|
||
// joinCluster: true,
|
||
iconPath: this.deviceInfos.onlineStatus == 0 ?
|
||
'https://lxnapi.ccttiot.com/bike/img/static/uRod2zf3t9dAOYafWoWt' :
|
||
'https://lxnapi.ccttiot.com/bike/img/static/uZpXq3TBtM5gVgJJeImY',
|
||
callout: {
|
||
content: this.deviceInfos.remainingPower + '%', // 修改为你想要显示的文字内容
|
||
color: '#2679D1', // 修改为文字颜色
|
||
fontSize: 10, // 修改为文字大小
|
||
borderRadius: 10, // 修改为气泡圆角大小
|
||
bgColor: '#D4ECFF', // 修改为气泡背景颜色
|
||
padding: 2, // 修改为气泡内边距
|
||
display: 'ALWAYS', // 修改为气泡的显示策略
|
||
}
|
||
})
|
||
} else if (this.deviceInfos.status == 6) {
|
||
this.markers.push({
|
||
id: parseFloat(this.deviceInfos.sn),
|
||
latitude: this.deviceInfos.latitude,
|
||
longitude: this.deviceInfos.longitude,
|
||
// title: item.deviceName,
|
||
width: 40,
|
||
height: 47,
|
||
iconPath: this.deviceInfos.onlineStatus == 0 ?
|
||
'https://lxnapi.ccttiot.com/bike/img/static/uhZudZM3nEKj0tYKlho2' :
|
||
'https://lxnapi.ccttiot.com/bike/img/static/ujur6TezvPf4buFAqPHo',
|
||
callout: {
|
||
content: '' + this.deviceInfos.remainingPower + '%',
|
||
color: '#2679D1', // 修改为文字颜色
|
||
fontSize: 10, // 修改为文字大小
|
||
borderRadius: 10, // 修改为气泡圆角大小
|
||
bgColor: '#D4ECFF', // 修改为气泡背景颜色
|
||
padding: 2, // 修改为气泡内边距
|
||
display: 'ALWAYS', // 修改为气泡的显示策略
|
||
}
|
||
})
|
||
} else if (this.deviceInfos.status == 8) {
|
||
this.markers.push({
|
||
id: parseFloat(this.deviceInfos.sn),
|
||
latitude: this.deviceInfos.latitude,
|
||
longitude: this.deviceInfos.longitude,
|
||
// title: item.deviceName,
|
||
width: 40,
|
||
height: 47,
|
||
iconPath: this.deviceInfos.onlineStatus == 0 ?
|
||
'https://lxnapi.ccttiot.com/bike/img/static/ucBKG3ebYRAToVweJihu' :
|
||
'https://lxnapi.ccttiot.com/bike/img/static/uyK7Vg4Lu8xb3oNVuG2l',
|
||
callout: {
|
||
content: this.deviceInfos.remainingPower + '%', // 修改为你想要显示的文字内容
|
||
color: '#ffffff', // 修改为文字颜色
|
||
fontSize: 10, // 修改为文字大小
|
||
borderRadius: 10, // 修改为气泡圆角大小
|
||
bgColor: '#000000', // 修改为气泡背景颜色
|
||
padding: 2, // 修改为气泡内边距
|
||
display: 'ALWAYS', // 修改为气泡的显示策略
|
||
}
|
||
})
|
||
}
|
||
this.$forceUpdate()
|
||
} else {
|
||
uni.showToast({
|
||
title: res.msg,
|
||
icon: 'none',
|
||
duration: 2000
|
||
})
|
||
}
|
||
})
|
||
},
|
||
convertBoundaryToPolyline(boundary) {
|
||
if (!boundary) return null
|
||
const points = JSON.parse(boundary).map(coord => ({
|
||
latitude: coord[1],
|
||
longitude: coord[0]
|
||
}))
|
||
const polyline = {
|
||
points: points,
|
||
fillColor: "#55888840", //填充颜色
|
||
strokeColor: "#22FF00", //描边颜色
|
||
strokeWidth: 2, //描边宽度
|
||
zIndex: 1, //层级
|
||
}
|
||
return polyline
|
||
},
|
||
convertBoundaryToPolylines(boundaries, num) {
|
||
if (num == 1) {
|
||
console.log('判断')
|
||
return boundaries.map(boundary => {
|
||
if (!boundary) return null
|
||
let coords
|
||
try {
|
||
coords = JSON.parse(boundary)
|
||
} catch (error) {
|
||
console.error("Error parsing boundary JSON:", error)
|
||
return null
|
||
}
|
||
if (!Array.isArray(coords)) {
|
||
console.error("Parsed boundary is not an array:", coords)
|
||
return null
|
||
}
|
||
console.log(coords, '1111111');
|
||
const points = coords.map(coord => ({
|
||
latitude: coord[1],
|
||
longitude: coord[0]
|
||
}))
|
||
return {
|
||
points: points,
|
||
fillColor: "#3A7EDB40", //填充颜色
|
||
strokeColor: "#3A7EDB", //描边颜色
|
||
strokeWidth: 2, //描边宽度
|
||
zIndex: 1, //层级
|
||
|
||
};
|
||
}).filter(polyline => polyline !== null) // 过滤掉无效的折线数据
|
||
} else if (num == 2) {
|
||
return boundaries.map(boundary => {
|
||
if (!boundary) return null
|
||
let coords
|
||
try {
|
||
coords = JSON.parse(boundary)
|
||
} catch (error) {
|
||
console.error("Error parsing boundary JSON:", error)
|
||
return null;
|
||
}
|
||
if (!Array.isArray(coords)) {
|
||
console.error("Parsed boundary is not an array:", coords)
|
||
return null;
|
||
}
|
||
console.log(coords, '2222222222222');
|
||
const points = coords.map(coord => ({
|
||
latitude: coord[1],
|
||
longitude: coord[0]
|
||
}))
|
||
return {
|
||
points: points,
|
||
fillColor: "#FFF5D640", //填充颜色
|
||
strokeColor: "#FF473E", //描边颜色
|
||
strokeWidth: 2, //描边宽度
|
||
zIndex: 1, //层级
|
||
}
|
||
}).filter(polyline => polyline !== null) // 过滤掉无效的折线数据
|
||
} else if (num == 3) {
|
||
return boundaries.map(boundary => {
|
||
if (!boundary) return null
|
||
let coords
|
||
try {
|
||
coords = JSON.parse(boundary)
|
||
} catch (error) {
|
||
console.error("Error parsing boundary JSON:", error)
|
||
return null
|
||
}
|
||
if (!Array.isArray(coords)) {
|
||
console.error("Parsed boundary is not an array:", coords)
|
||
return null
|
||
}
|
||
console.log(coords, '333333333333');
|
||
const points = coords.map(coord => ({
|
||
latitude: coord[1],
|
||
longitude: coord[0]
|
||
}));
|
||
return {
|
||
points: points,
|
||
fillColor: "#FFD1CF40", //填充颜色
|
||
strokeColor: "#FFC107", //描边颜色
|
||
strokeWidth: 2, //描边宽度
|
||
zIndex: 1, //层级
|
||
|
||
};
|
||
}).filter(polyline => polyline !== null) // 过滤掉无效的折线数据
|
||
}
|
||
},
|
||
toggleIconAndCallout() {
|
||
this.showIconAndCallout = !this.showIconAndCallout
|
||
if (this.showIconAndCallout) {
|
||
const newMarkers = []
|
||
this.parkingList.forEach(item => {
|
||
newMarkers.push({
|
||
id: parseFloat(item.id),
|
||
latitude: parseFloat(item.latitude),
|
||
longitude: parseFloat(item.longitude),
|
||
width: 20,
|
||
height: 28.95,
|
||
iconPath: item.type == 1 ?
|
||
'https://lxnapi.ccttiot.com/bike/img/static/up2xXqAgwCX5iER600k3' : item
|
||
.type == 2 ?
|
||
'https://lxnapi.ccttiot.com/bike/img/static/uDNY5Q4zOiZTCBTA2Jdq' :
|
||
'https://lxnapi.ccttiot.com/bike/img/static/u53BAQcFIX3vxsCzEZ7t',
|
||
callout: {
|
||
content: item.name,
|
||
color: '#ffffff',
|
||
fontSize: 14,
|
||
borderRadius: 10,
|
||
bgColor: item.type == 1 ? '#3A7EDB' : item.type == 2 ? '#FF473E' :
|
||
'#FFC107',
|
||
padding: 6,
|
||
display: 'ALWAYS'
|
||
},
|
||
isCalloutVisible: true // 添加标记
|
||
})
|
||
})
|
||
this.$set(this, 'markers', [...this.markers, ...newMarkers])
|
||
} else {
|
||
// 过滤掉所有气泡显示的标记
|
||
this.$set(this, 'markers', this.markers.filter(marker => !marker.isCalloutVisible))
|
||
}
|
||
},
|
||
getParking() {
|
||
// 发送请求获取数据
|
||
let data = {
|
||
areaId: this.deviceInfos.areaId,
|
||
type: ''
|
||
}
|
||
this.$u.get(`/bst/areaSub/listByAreaId`, data).then((res) => {
|
||
if (res.code === 200) {
|
||
// 处理接口返回的数据
|
||
const type1Data = []
|
||
const type2Data = []
|
||
const type3Data = []
|
||
res.data.forEach(row => {
|
||
if (row.type == 1) {
|
||
type1Data.push(row)
|
||
} else if (row.type == 2) {
|
||
type2Data.push(row)
|
||
} else if (row.type == 3) {
|
||
type3Data.push(row)
|
||
}
|
||
})
|
||
const validBoundaries = type1Data.map(row => row.boundaryStr).filter(boundary =>
|
||
typeof boundary === 'string' && boundary.trim() !== '')
|
||
const polylines = this.convertBoundaryToPolylines(validBoundaries, 1)
|
||
const validBoundaries1 = type2Data.map(row => row.boundaryStr).filter(boundary =>
|
||
typeof boundary === 'string' && boundary.trim() !== '')
|
||
const polylines1 = this.convertBoundaryToPolylines(validBoundaries1, 2)
|
||
const validBoundaries2 = type3Data.map(row => row.boundaryStr).filter(boundary =>
|
||
typeof boundary === 'string' && boundary.trim() !== '')
|
||
const polylines2 = this.convertBoundaryToPolylines(validBoundaries2, 3)
|
||
// 将处理后的数据添加到 this.polyline 中
|
||
this.polyline = this.polyline.concat(polylines2)
|
||
this.polyline = this.polyline.concat(polylines1)
|
||
this.polyline = this.polyline.concat(polylines)
|
||
this.parkingList = res.data
|
||
// console.log(this.polyline);
|
||
|
||
}
|
||
}).catch(error => {
|
||
console.error("Error fetching parking data:", error)
|
||
})
|
||
},
|
||
getArea() {
|
||
// 发送请求获取数据
|
||
let id = this.deviceInfos.areaId
|
||
this.$u.get(`/bst/area/${id}`).then((res) => {
|
||
if (res.code === 200) {
|
||
// 处理接口返回的数据,将边界数据转换为地图组件需要的折线结构
|
||
const polylines = this.convertBoundaryToPolyline(res.data.boundaryStr)
|
||
// 更新折线数据
|
||
this.polyline.push(polylines)
|
||
console.log(this.polyline);
|
||
this.getParking()
|
||
}
|
||
}).catch(error => {
|
||
console.error("Error fetching area data:", error)
|
||
})
|
||
},
|
||
}
|
||
}
|
||
</script>
|
||
<style lang="scss">
|
||
page {
|
||
overflow-x: hidden;
|
||
background-color: #F6F8FA; // 更改背景色为更柔和的色调
|
||
}
|
||
|
||
.page {
|
||
padding-bottom: 400rpx;
|
||
width: 750rpx;
|
||
|
||
.new_infocard{
|
||
width: 750rpx;
|
||
max-height: 1384rpx;
|
||
overflow: scroll;
|
||
background: #FFFFFF;
|
||
border-radius: 30rpx;
|
||
padding: 30rpx;
|
||
box-sizing: border-box;
|
||
position: absolute;
|
||
z-index: 99;
|
||
top: 900rpx;
|
||
.zuche{
|
||
margin-top: 26rpx;
|
||
.one{
|
||
display: flex;
|
||
align-items: center;
|
||
image{
|
||
width: 32rpx;
|
||
height: 32rpx;
|
||
margin-right: 4rpx;
|
||
}
|
||
span{
|
||
font-size: 28rpx;
|
||
color: #3D3D3D;
|
||
}
|
||
}
|
||
view{
|
||
font-size: 28rpx;
|
||
color: #808080;
|
||
margin-bottom: 26rpx;
|
||
display: flex;
|
||
justify-content: space-between;
|
||
span{
|
||
color: #3D3D3D;
|
||
}
|
||
}
|
||
}
|
||
.bikejcxx{
|
||
margin-top: 26rpx;
|
||
border-bottom: 1rpx solid #D8D8D8;
|
||
.wai{
|
||
display: flex;
|
||
justify-content: space-between;
|
||
margin-bottom: 26rpx;
|
||
.lt{
|
||
width: 46%;
|
||
text-align: left;
|
||
font-size: 24rpx;
|
||
color: #808080;
|
||
span{
|
||
color: #3D3D3D;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
.caozuoanniu{
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
margin-top: 26rpx;
|
||
border-bottom: 1rpx solid #D8D8D8;
|
||
.dangeanniu{
|
||
width: 20%;
|
||
text-align: center;
|
||
margin-bottom: 28rpx;
|
||
.pic{
|
||
width: 88rpx;
|
||
height: 88rpx;
|
||
background: #F1F1F1;
|
||
border-radius: 6rpx 6rpx 6rpx 6rpx;
|
||
margin: auto;
|
||
margin-bottom: 14rpx;
|
||
image{
|
||
width: 42rpx;
|
||
height: 42rpx;
|
||
margin-top: 24rpx;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
.ewm{
|
||
view{
|
||
width: 140rpx;
|
||
height: 44rpx;
|
||
background: #4C97E7;
|
||
border-radius: 6rpx 6rpx 6rpx 6rpx;
|
||
font-size: 24rpx;
|
||
color: #FFFFFF;
|
||
display: flex;
|
||
align-items: center;
|
||
padding: 0 8rpx;
|
||
padding-left: 18rpx !important;
|
||
text-align: center;
|
||
box-sizing: border-box;
|
||
image{
|
||
width: 26rpx;
|
||
height: 26rpx;
|
||
margin-right: 10rpx;
|
||
}
|
||
}
|
||
}
|
||
.xuhang{
|
||
view{
|
||
width: 284rpx;
|
||
height: 102rpx;
|
||
background: #F1F1F1;
|
||
border-radius: 8rpx 8rpx 8rpx 8rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
font-size: 30rpx;
|
||
color: #3D3D3D;
|
||
padding-left: 18rpx;
|
||
box-sizing: border-box;
|
||
image{
|
||
width: 56rpx;
|
||
height: 56rpx;
|
||
margin-right: 14rpx;
|
||
}
|
||
}
|
||
}
|
||
.bikesn{
|
||
font-size: 24rpx;
|
||
color: #7C7C7C;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
border-bottom: 1rpx solid #D8D8D8;
|
||
padding-bottom: 26rpx;
|
||
margin-top: 20rpx;
|
||
}
|
||
.cent{
|
||
display: flex;
|
||
|
||
.lypic{
|
||
display: flex;
|
||
align-items: center;
|
||
font-size: 24rpx;
|
||
color: #3D3D3D;
|
||
margin-right: 22rpx;
|
||
image{
|
||
width: 36rpx;
|
||
height: 36rpx;
|
||
margin-right: 8rpx;
|
||
}
|
||
}
|
||
}
|
||
.bikexx{
|
||
margin-top: 26rpx;
|
||
display: flex;
|
||
justify-content: space-between;
|
||
border-bottom: 1rpx solid #D8D8D8;
|
||
padding-bottom: 26rpx;
|
||
box-sizing: border-box;
|
||
.dianliang{
|
||
position: relative;
|
||
background: linear-gradient(to right, #c0dfff, #fff);
|
||
border-radius: 10rpx;
|
||
.dl{
|
||
margin-top: 10rpx;
|
||
padding-left: 52rpx;
|
||
box-sizing: border-box;
|
||
}
|
||
.dy{
|
||
margin-top: 2rpx;
|
||
padding-left: 52rpx;
|
||
box-sizing: border-box;
|
||
}
|
||
view{
|
||
padding-left: 14rpx;
|
||
box-sizing: border-box;
|
||
font-size: 24rpx;
|
||
color: #3D3D3D;
|
||
span{
|
||
font-size: 32rpx;
|
||
}
|
||
}
|
||
image{
|
||
position: absolute;
|
||
width: 22rpx;
|
||
height: 48rpx;
|
||
left: 20rpx;
|
||
top: 30rpx;
|
||
}
|
||
}
|
||
}
|
||
|
||
.topsn{
|
||
display: flex;
|
||
justify-content: space-between;
|
||
padding-bottom: 26rpx;
|
||
box-sizing: border-box;
|
||
|
||
.lt{
|
||
font-weight: 600;
|
||
font-size: 30rpx;
|
||
color: #3D3D3D;
|
||
display: flex;
|
||
align-items: center;
|
||
}
|
||
.rt{
|
||
display: flex;
|
||
.issuo{
|
||
width: 104rpx;
|
||
height: 42rpx;
|
||
background: #F1F1F1;
|
||
border-radius: 6rpx 6rpx 6rpx 6rpx;
|
||
text-align: center;
|
||
line-height: 42rpx;
|
||
margin-left: 28rpx;
|
||
font-size: 24rpx;
|
||
color: #3D3D3D;
|
||
}
|
||
.stutas{
|
||
span{
|
||
display: inline-block;
|
||
width: 104rpx;
|
||
height: 42rpx;
|
||
// background: #DBFDD6;
|
||
border-radius: 6rpx 6rpx 6rpx 6rpx;
|
||
text-align: center;
|
||
line-height: 42rpx;
|
||
margin-left: 28rpx;
|
||
font-size: 24rpx;
|
||
color: #fff;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
.tip_box {
|
||
position: fixed;
|
||
left: 72rpx;
|
||
top: 628rpx;
|
||
width: 610rpx;
|
||
// height: 282rpx;
|
||
background: #FFFFFF;
|
||
border-radius: 30rpx 30rpx 30rpx 30rpx;
|
||
z-index: 110;
|
||
padding-bottom: 100rpx;
|
||
|
||
.saveQr {
|
||
margin: 0 auto;
|
||
margin-top: 30rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
width: 502rpx;
|
||
height: 68rpx;
|
||
background: #4C97E7;
|
||
border-radius: 10rpx 10rpx 10rpx 10rpx;
|
||
font-weight: 500;
|
||
font-size: 36rpx;
|
||
color: #FFFFFF;
|
||
}
|
||
|
||
.top {
|
||
padding: 52rpx 38rpx 42rpx 36rpx;
|
||
|
||
.ipt_box {
|
||
margin-top: 22rpx;
|
||
display: flex;
|
||
flex-wrap: nowrap;
|
||
align-items: center;
|
||
|
||
.text {
|
||
width: 350rpx;
|
||
font-weight: 400;
|
||
font-size: 32rpx;
|
||
color: #3D3D3D;
|
||
}
|
||
|
||
.ipt {
|
||
padding: 10rpx 18rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
margin-left: 26rpx;
|
||
width: 420rpx;
|
||
height: 64rpx;
|
||
border-radius: 0rpx 0rpx 0rpx 0rpx;
|
||
border: 2rpx solid #979797;
|
||
|
||
.input {
|
||
width: 80%;
|
||
}
|
||
}
|
||
}
|
||
|
||
.tip {
|
||
width: 100%;
|
||
text-align: center;
|
||
font-weight: 700;
|
||
font-size: 32rpx;
|
||
color: #3D3D3D;
|
||
}
|
||
|
||
.txt {
|
||
margin-top: 32rpx;
|
||
width: 100%;
|
||
text-align: center;
|
||
font-weight: 500;
|
||
font-size: 32rpx;
|
||
color: #3D3D3D;
|
||
}
|
||
}
|
||
|
||
.bots {
|
||
position: absolute;
|
||
width: 610rpx;
|
||
display: flex;
|
||
flex-wrap: nowrap;
|
||
bottom: -20rpx;
|
||
|
||
.bot_left {
|
||
border-radius: 0rpx 0rpx 0rpx 30rpx;
|
||
width: 50%;
|
||
height: 86rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
font-weight: 500;
|
||
font-size: 32rpx;
|
||
color: #3D3D3D;
|
||
background: #EEEEEE;
|
||
}
|
||
|
||
.bot_right {
|
||
border-radius: 0rpx 0rpx 30rpx 0rpx;
|
||
width: 50%;
|
||
height: 86rpx;
|
||
background: #4C97E7;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
color: #FFFFFF;
|
||
font-weight: 500;
|
||
font-size: 32rpx;
|
||
}
|
||
}
|
||
}
|
||
|
||
.map {
|
||
position: relative;
|
||
width: 750rpx;
|
||
height: 752rpx;
|
||
|
||
.track,
|
||
.park {
|
||
position: absolute;
|
||
width: 88rpx;
|
||
height: 88rpx;
|
||
bottom: 40rpx;
|
||
border-radius: 50%;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
transition: all 0.3s ease;
|
||
|
||
&:active {
|
||
transform: scale(0.95);
|
||
}
|
||
|
||
.img {
|
||
width: 80rpx;
|
||
height: 80rpx;
|
||
}
|
||
}
|
||
|
||
.track {
|
||
left: 30rpx;
|
||
}
|
||
|
||
.park {
|
||
right: 30rpx;
|
||
}
|
||
}
|
||
}
|
||
</style> |