新电动车

This commit is contained in:
吴鹏 2025-04-12 18:01:40 +08:00
parent 2a9de15785
commit 132f7808db
13 changed files with 1162 additions and 618 deletions

View File

@ -156,25 +156,35 @@
let sceneValue = res.result
let decodedValue = decodeURIComponent(sceneValue)
this.sn = getQueryParam(decodedValue, 's')
this.$u.get(`/app/device/availableDetail?sn=${this.sn}`).then((res) => {
if (res.code == 200) {
if(res.data){
this.modelId = res.data.modelId
uni.navigateTo({
url:'/page_fenbao/storedlist/trueorder?modelId=' + this.modelId + '&sn=' + this.sn
})
}else{
uni.showToast({
title: '当前车辆不可用',
icon: 'none'
})
}
}else{
uni.showToast({
title: res.msg,
icon: 'none'
})
}
this.$u.get("/app/orderDevice/mineUsing").then(res =>{
if(res.code == 200){
if(res.data){
uni.switchTab({
url:'/pages/nearbystores/index'
})
}else{
this.$u.get(`/app/device/availableDetail?sn=${this.sn}`).then((res) => {
if (res.code == 200) {
if(res.data){
this.modelId = res.data.modelId
uni.navigateTo({
url:'/page_fenbao/storedlist/trueorder?modelId=' + this.modelId + '&sn=' + this.sn
})
}else{
uni.showToast({
title: '当前车辆不可用',
icon: 'none'
})
}
}else{
uni.showToast({
title: res.msg,
icon: 'none'
})
}
})
}
}
})
},
fail: err => {

View File

@ -36,40 +36,50 @@
methods: {
//
btnkaisuo(){
this.$u.get("/app/device/availableDetail?sn=" + this.sn).then((res) => {
if (res.code == 200) {
this.$u.get("/app/orderDevice/mineUsing").then(res =>{
if(res.code == 200){
if(res.data){
uni.navigateTo({
url:'/page_fenbao/storedlist/trueorder?modelId=' + res.data.modelId + '&sn=' + this.sn
uni.switchTab({
url:'/pages/nearbystores/index'
})
}else{
uni.showToast({
title:'当前车辆不可用',
icon: 'none',
duration:2000
})
}
}else if(res.code == 401){
uni.showModal({
title: '提示',
content: '您当前未登录,是否前去登录?',
showCancel: true,
success: function (res) {
if (res.confirm) {
uni.reLaunch({
url:'/pages/login/login'
this.$u.get("/app/device/availableDetail?sn=" + this.sn).then((res) => {
if (res.code == 200) {
if(res.data){
uni.navigateTo({
url:'/page_fenbao/storedlist/trueorder?modelId=' + res.data.modelId + '&sn=' + this.sn
})
}else{
uni.showToast({
title:'当前车辆不可用',
icon: 'none',
duration:2000
})
} else if (res.cancel) {
}
}else if(res.code == 401){
uni.showModal({
title: '提示',
content: '您当前未登录,是否前去登录?',
showCancel: true,
success: function (res) {
if (res.confirm) {
uni.reLaunch({
url:'/pages/login/login'
})
} else if (res.cancel) {
}
}
})
} else{
uni.showToast({
title: res.msg,
icon: 'none',
duration:2000
})
}
})
} else{
uni.showToast({
title: res.msg,
icon: 'none',
duration:2000
})
}
}
})
}

View File

@ -1,6 +1,6 @@
<template>
<view class="page">
<u-navbar title="确认订单页" :border-bottom="false" :background="bgc" back-icon-color="#3D3D3D" title-color='#3D3D3D'
<u-navbar :title="tit" :border-bottom="false" :background="bgc" back-icon-color="#3D3D3D" title-color='#3D3D3D'
title-size='36' height='50' id="navbar" :custom-back="btnfh">
</u-navbar>
<view class="jieshao">
@ -314,7 +314,7 @@
</view>
</view>
<view style="width: 100%;height: 100vh;position: fixed;top: 0;left: 0;background-color: #fff;z-index: 99;" v-if="zhezhaoflag"></view>
<view style="width: 100%;height: 100vh;position: fixed;top: 0;left: 0;background-color: #fff;z-index: 999;" v-if="zhezhaoflag"></view>
</view>
</template>
@ -324,7 +324,7 @@
data() {
return {
bgc: {
backgroundColor: "#CCE5FF",
backgroundColor: "",
},
bqlist: ['含电池', '含头盔', '含充电器', '含瓶装水', '含竹篮'],
fanganindex: 0,
@ -347,32 +347,94 @@
deviceId: '',
name: '',
mac: '',
zhezhaoflag:true
zhezhaoflag:true,
tit:' '
}
},
onLoad(option) {
console.log(option)
if (option.modelId) {
this.zhezhaoflag = false
this.modelId = option.modelId
this.chesn = option.sn
this.gettaocan()
this.getcheliang()
} else {
this.zhezhaoflag = true
uni.showLoading({
title: '加载中...',
mask: true
})
this.$u.get("/app/orderDevice/mineUsing").then((res) => {
if (res.code == 200) {
if (res.data) {
uni.switchTab({
url:'/pages/nearbystores/index'
})
this.zhezhaoflag = false
uni.hideLoading()
} else {
setTimeout(()=>{
this.$u.get("/app/orderDevice/mineUsing").then(res =>{
if(res.code == 200){
if(res.data){
uni.switchTab({
url:'/pages/nearbystores/index'
})
this.zhezhaoflag = false
uni.hideLoading()
}else{
this.tit= '确认订单页'
this.zhezhaoflag = false
uni.hideLoading()
this.modelId = option.modelId
this.chesn = option.sn
this.gettaocan()
this.getcheliang()
}
}
})
},1000)
} else {
// this.zhezhaoflag = true
uni.showLoading({
title: '加载中...',
mask: true
})
setTimeout(()=>{
this.$u.get("/app/orderDevice/mineUsing").then((res) => {
if (res.code == 200) {
if (res.data) {
uni.switchTab({
url:'/pages/nearbystores/index'
})
this.zhezhaoflag = false
uni.hideLoading()
} else {
this.tit= '确认订单页'
this.zhezhaoflag = false
uni.hideLoading()
//
function getQueryParam(url, paramName) {
let regex = new RegExp(`[?&]${paramName}=([^&]*)`)
let results = regex.exec(url)
return results ? decodeURIComponent(results[1].replace(/\+/g, ' ')) : null
}
let sceneValue = option.q
let decodedValue = decodeURIComponent(sceneValue)
this.sn = getQueryParam(decodedValue, 's')
this.$u.get(`/app/device/availableDetail?sn=${this.sn}`).then((res) => {
if (res.code == 200) {
if (res.data) {
this.bikeobj = res.data
this.modelId = res.data.modelId
this.gettaocan()
this.getcheliang()
} else {
uni.showToast({
title: '当前车辆不可用',
icon: 'none',
duration: 2000
})
setTimeout(() => {
if (this.chesn == '') { //
uni.switchTab({
url: '/pages/nearbystores/index'
})
} else { //
uni.navigateBack()
}
}, 1500)
}
}
})
}
}else{
this.tit= '确认订单页'
this.zhezhaoflag = false
uni.hideLoading()
//
@ -410,45 +472,8 @@
}
})
}
}else{
this.zhezhaoflag = false
uni.hideLoading()
//
function getQueryParam(url, paramName) {
let regex = new RegExp(`[?&]${paramName}=([^&]*)`)
let results = regex.exec(url)
return results ? decodeURIComponent(results[1].replace(/\+/g, ' ')) : null
}
let sceneValue = option.q
let decodedValue = decodeURIComponent(sceneValue)
this.sn = getQueryParam(decodedValue, 's')
this.$u.get(`/app/device/availableDetail?sn=${this.sn}`).then((res) => {
if (res.code == 200) {
if (res.data) {
this.bikeobj = res.data
this.modelId = res.data.modelId
this.gettaocan()
this.getcheliang()
} else {
uni.showToast({
title: '当前车辆不可用',
icon: 'none',
duration: 2000
})
setTimeout(() => {
if (this.chesn == '') { //
uni.switchTab({
url: '/pages/nearbystores/index'
})
} else { //
uni.navigateBack()
}
}, 1500)
}
}
})
}
})
})
},1000)
}
},
methods: {
@ -666,42 +691,42 @@
this.$u.get(`/app/device/availableDetail?sn=${this.sn}`).then((res) => {
if (res.code == 200) {
this.bikeobj = res.data
if (res.data.onlineStatus == 0) {
wx.openBluetoothAdapter({
success: function(res) {
console.log('蓝牙适配器初始化成功')
xBlufi.initXBlufi(1)
xBlufi.notifyStartDiscoverBle({
'isStart': true
})
xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent)
},
fail: function(err) {
console.error('蓝牙适配器初始化失败,可能是因为没有权限', err)
}
})
}
// if (res.data.onlineStatus == 0) {
// wx.openBluetoothAdapter({
// success: function(res) {
// console.log('')
// xBlufi.initXBlufi(1)
// xBlufi.notifyStartDiscoverBle({
// 'isStart': true
// })
// xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent)
// },
// fail: function(err) {
// console.error('', err)
// }
// })
// }
}
})
} else {
this.$u.get(`/app/device/availableDetail?sn=${this.chesn}`).then((res) => {
if (res.code == 200) {
this.bikeobj = res.data
if (res.data.onlineStatus == 0) {
wx.openBluetoothAdapter({
success: function(res) {
console.log('蓝牙适配器初始化成功')
xBlufi.initXBlufi(1)
xBlufi.notifyStartDiscoverBle({
'isStart': true
})
xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent)
},
fail: function(err) {
console.error('蓝牙适配器初始化失败,可能是因为没有权限', err)
}
})
}
// if (res.data.onlineStatus == 0) {
// wx.openBluetoothAdapter({
// success: function(res) {
// console.log('')
// xBlufi.initXBlufi(1)
// xBlufi.notifyStartDiscoverBle({
// 'isStart': true
// })
// xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent)
// },
// fail: function(err) {
// console.error('', err)
// }
// })
// }
}
})
}

View File

@ -533,11 +533,11 @@
},
2: {
fillColor: "#FFF5D640",
strokeColor: "#FFC107"
strokeColor: "#FF473E"
},
3: {
fillColor: "#FFD1CF40",
strokeColor: "#FF473E"
strokeColor: "#FFC107"
}
};
@ -925,15 +925,15 @@
iconPath: row.type == 1 ?
'https://lxnapi.ccttiot.com/bike/img/static/up2xXqAgwCX5iER600k3' :
row.type == 2 ?
'https://lxnapi.ccttiot.com/bike/img/static/u53BAQcFIX3vxsCzEZ7t' :
'https://lxnapi.ccttiot.com/bike/img/static/uDNY5Q4zOiZTCBTA2Jdq',
'https://lxnapi.ccttiot.com/bike/img/static/uDNY5Q4zOiZTCBTA2Jdq' :
'https://lxnapi.ccttiot.com/bike/img/static/u53BAQcFIX3vxsCzEZ7t',
callout: {
content: row.name,
color: '#ffffff',
fontSize: 14,
borderRadius: 10,
bgColor: row.type == 1 ? '#3A7EDB' : row.type == 2 ?
'#FFC107' : '#FF473E',
'#FF473E' : '#FFC107',
padding: 6,
display: 'BYCLICK'
},

View File

@ -295,7 +295,9 @@
createDateRange:this.firsTime == '' ? '' : this.lasTime == '' ? '' : this.firsTime + ',' + this.lasTime,
areaId: this.areaId,
pageSize: 20,
pageNum: this.pageNum
pageNum: this.pageNum,
isAsc:'desc',
orderByColumn:'createTime'
};
} else if (this.typeidx == 2) { // this.typeidx == 2
data = {
@ -305,7 +307,9 @@
createDateRange:this.firsTime == '' ? '' : this.lasTime == '' ? '' : this.firsTime + ',' + this.lasTime,
areaId: this.areaId,
pageSize: 20,
pageNum: this.pageNum
pageNum: this.pageNum,
isAsc:'desc',
orderByColumn:'createTime'
};
}
this.$u.get('/bst/order/list?', data).then((res) => {

View File

@ -372,7 +372,7 @@ export default {
})
} else if (num == 4) { //
uni.switchTab({
url: '/pages/index/index'
url: '/pages/my'
})
} else if (num == 5) {
uni.navigateTo({

View File

@ -17,7 +17,13 @@
<view class="new_infocard">
<view class="topsn">
<view class="lt">
SN{{deviceInfos.sn}}
SN{{deviceInfos.sn}}
<view class="lypic" style="background-color: #28c445;" v-if="ver_dataflag == 3 && deviceInfos.onlineStatus == 0">
<image src="https://api.ccttiot.com/smartmeter/img/static/uqUiYiMtGTjkPNgmCjvP" mode=""></image>
</view>
<view class="lypic" v-if="ver_dataflag == 1 && deviceInfos.onlineStatus == 0">
<image src="https://api.ccttiot.com/smartmeter/img/static/uqUiYiMtGTjkPNgmCjvP" mode=""></image>
</view>
</view>
<view class="rt">
<view class="stutas">
@ -75,15 +81,6 @@
</view>
开锁
</view>
<!-- <view class="btn" @click="lanya(1)">
蓝牙开锁
</view>
<view class="btn" @click="lanya(2)">
蓝牙关锁
</view>
<view class="btn" @click="lanya(3)">
蓝牙响铃
</view> -->
<view class="dangeanniu" @click="checkbtn(1)">
<view class="pic">
<image src="https://api.ccttiot.com/smartmeter/img/static/uKear247uKM7Axwgh3Jc" mode=""></image>
@ -156,6 +153,31 @@
</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="bikejcxx">
<view class="wai">
@ -197,45 +219,6 @@
</view>
<u-mask :show="false" @click="show = false" :z-index='100' />
<u-mask :show="maskloading" :z-index='100' duration='0' />
<view class="maskloadpage" v-if="maskloading">
<view class="maskpage1" v-if="maskepage==4">
<view class="top_info">
<image :src="loadimg" mode=""></image>
<view class="masktxt">
{{buletxt}}
</view>
</view>
<view class="masktips" style="width: 100%;">
请确保与车辆的距离小于3米
</view>
<view class="tipsimg">
<image src="https://lxnapi.ccttiot.com/bike/img/static/ugvqmfB3QYujZ6SnfTia" mode=""></image>
</view>
</view>
<!-- 不允许停车点外还车 -->
<view class="maskpage1" v-if="maskepage==5">
<view class="top_info">
<image src="https://lxnapi.ccttiot.com/bike/img/static/uG3cbPgvPDzwlq6IHHxK" mode=""></image>
<view class="masktxt" v-if="orderinfo.sn">
蓝牙连接失败
</view>
</view>
<view class="masktips" style="width: 100%;">
请确保手机蓝牙已经打开
</view>
<view class="tipsimg">
<image src="https://lxnapi.ccttiot.com/bike/img/static/ugvqmfB3QYujZ6SnfTia" mode=""></image>
</view>
<view class="btn_box">
<view class="btn4" @click="closemask()">
返回
</view>
<view class="btn3" @click="Binddevice">
重新连接
</view>
</view>
</view>
</view>
<u-mask :show="showvehicle" @click="closevehicle()" :z-index='100' />
<view class="tip_box" v-if="showvehicle">
<view class="top" v-if="showvehicle">
@ -415,6 +398,10 @@
xBlufi.notifySendCustomData({
customData: "11close@"
})
}else if (num == 3) {
xBlufi.notifySendCustomData({
customData: "11reboot@"
})
} else {
xBlufi.notifySendCustomData({
customData: "11play1@"
@ -424,7 +411,7 @@
getlanya() {
console.log("进入111蓝牙连接")
if (this.ver_dataflag != 3) {
this.ver_dataflag = 2
this.ver_dataflag = 1
this.findDevice()
}
},
@ -900,9 +887,9 @@
if (res.code === 200) {
this.deviceInfos = res.data
this.mac = res.data.mac
// if (res.data.onlineStatus == 1) {
// this.getlanya()
// }
if (res.data.onlineStatus == 0) {
this.getlanya()
}
if (res.data.isSound == 0) {
this.jytxt = '关'
} else {
@ -913,7 +900,6 @@
}
this.getnum = 1
this.vehicleNum = res.vehicleNum
this.mac = res.data.mac
this.getModelList()
this.latitude = this.deviceInfos.latitude
this.longitude = this.deviceInfos.longitude
@ -1144,7 +1130,7 @@
return {
points: points,
fillColor: "#FFF5D640", //
strokeColor: "#FFC107", //
strokeColor: "#FF473E", //
strokeWidth: 2, //
zIndex: 1, //
}
@ -1171,7 +1157,7 @@
return {
points: points,
fillColor: "#FFD1CF40", //
strokeColor: "#FF473E", //
strokeColor: "#FFC107", //
strokeWidth: 2, //
zIndex: 1, //
@ -1193,15 +1179,15 @@
iconPath: item.type == 1 ?
'https://lxnapi.ccttiot.com/bike/img/static/up2xXqAgwCX5iER600k3' : item
.type == 2 ?
'https://lxnapi.ccttiot.com/bike/img/static/u53BAQcFIX3vxsCzEZ7t' :
' https://lxnapi.ccttiot.com/bike/img/static/uDNY5Q4zOiZTCBTA2Jdq',
'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 ? '#FFC107' :
'#FF473E',
bgColor: item.type == 1 ? '#3A7EDB' : item.type == 2 ? '#FF473E' :
'#FFC107',
padding: 6,
display: 'ALWAYS'
},
@ -1444,6 +1430,22 @@
font-weight: 600;
font-size: 32rpx;
color: #3D3D3D;
display: flex;
align-items: center;
.lypic{
background-color: #ccc;
width: 50rpx;
height: 50rpx;
margin-left: 10rpx;
text-align: center;
padding-top: 8rpx;
border-radius: 6rpx;
box-sizing: border-box;
image{
width: 32rpx;
height: 32rpx;
}
}
}
.rt{
display: flex;

View File

@ -1553,7 +1553,7 @@
return {
points: points,
fillColor: "#FFF5D640", //
strokeColor: "#FFC107", //
strokeColor: "#FF473E", //
strokeWidth: 2, //
zIndex: 1, //
}
@ -1580,7 +1580,7 @@
return {
points: points,
fillColor: "#FFD1CF40", //
strokeColor: "#FF473E", //
strokeColor: "#FFC107", //
strokeWidth: 2, //
zIndex: 1, //
@ -1602,14 +1602,14 @@
iconPath: item.type == 1 ?
'https://lxnapi.ccttiot.com/bike/img/static/up2xXqAgwCX5iER600k3' : item
.type == 2 ?
'https://lxnapi.ccttiot.com/bike/img/static/u53BAQcFIX3vxsCzEZ7t' :
' https://lxnapi.ccttiot.com/bike/img/static/uDNY5Q4zOiZTCBTA2Jdq',
'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 ? '#FFC107' : '#FF473E',
bgColor: item.type == 1 ? '#3A7EDB' : item.type == 2 ? '#FF473E' : '#FFC107',
padding: 6,
display: 'ALWAYS'
},

View File

@ -10,16 +10,16 @@
车牌号{{item.vehicleNum == null ? '--' : item.vehicleNum}}
</view>
<view class="zt" v-if="item.appealStatus == 0">
已驳回 <u-icon name="arrow-right" color="#808080" size="28"></u-icon>
已驳回 <!-- <u-icon name="arrow-right" color="#808080" size="28"></u-icon> -->
</view>
<view class="zt" v-if="item.appealStatus == 1">
待处理 <u-icon name="arrow-right" color="#808080" size="28"></u-icon>
待处理 <!-- <u-icon name="arrow-right" color="#808080" size="28"></u-icon> -->
</view>
<view class="zt" v-if="item.appealStatus == 2">
维修中 <u-icon name="arrow-right" color="#808080" size="28"></u-icon>
维修中 <!-- <u-icon name="arrow-right" color="#808080" size="28"></u-icon> -->
</view>
<view class="zt" v-if="item.appealStatus == 3">
已完成 <u-icon name="arrow-right" color="#808080" size="28"></u-icon>
已完成 <!-- <u-icon name="arrow-right" color="#808080" size="28"></u-icon> -->
</view>
</view>
<view class="wz">
@ -50,29 +50,33 @@
},
list:[],
pageNum:1,
total:''
total:'',
userid:''
}
},
onLoad() {
},
onShow() {
this.pageNum = 1
this.list = []
this.getuser()
},
methods: {
getuser(){
this.$u.get("/getInfo").then((res) => {
if (res.code == 200) {
this.userid = res.user.userId
let that = this
that.$u.get(`/app/fault?userId=${res.user.userId}&pageNum=${this.pageNum}&pageSize=10`).then((resp) => {
that.$u.get(`/app/fault?userId=${that.userid}&pageNum=${that.pageNum}&pageSize=10`).then((resp) => {
if (resp.code == 200) {
that.total = resp.total
if(this.pageNum == 1){
if(that.pageNum == 1){
that.list = resp.rows
}else{
that.list = that.list.concat(resp.rows)
}
this.pageNum++
that.pageNum++
}
})
}else if(res.code == 401){
@ -97,10 +101,10 @@
handleScrollToLower() {
if(this.total > this.list.length){
let that = this
that.$u.get(`/app/fault?userId=${res.user.userId}&pageNum=${this.pageNum}&pageSize=10`).then((resp) => {
that.$u.get(`/app/fault?userId=${that.userid}&pageNum=${that.pageNum}&pageSize=10`).then((resp) => {
if (resp.code == 200) {
that.total = resp.total
if(this.pageNum == 1){
if(that.pageNum == 1){
that.list = resp.rows
}else{
that.list = that.list.concat(resp.rows)

View File

@ -1,65 +1,161 @@
<template>
<view class="page">
<u-navbar title="订单详情" :border-bottom="false" :background="bgc" title-color='#fff' title-size='36' height='45' back-icon-color='#fff'></u-navbar>
<view class="tit">
<view class="left">{{info.deviceVehicleNum == null ? '--' : info.deviceVehicleNum}}</view>
</view>
<view class="data">
{{info.createTime}}
</view>
<view class="card">
<view class="card_tit">
账单信息
<u-navbar title="订单详情" :border-bottom="false" :background="bgc" title-color='#000' title-size='36' height='45' back-icon-color='#000'></u-navbar>
<view class="jiaoyi">
<view class="pic">
<image src="https://api.ccttiot.com/smartmeter/img/static/uiXte3LpSV30jyvTUR2R" mode=""></image>
<text v-if="info.status == 'PROCESSING'">进行中</text>
<text v-if="info.status == 'WAIT_PAY'">待支付</text>
<text v-if="info.status == 'CANCELED'">已取消</text>
<text v-if="info.status == 'FINISHED'">交易完成</text>
<text v-if="info.status == 'WAIT_VERIFY'">待审核</text>
</view>
<view class="cont">
<view class="cont_box" style="margin-top: 20rpx;">
<view class="cont_left">
支付金额
<view class="gx">
<text v-if="info.status == 'PROCESSING'">订单进行中</text>
<text v-if="info.status == 'WAIT_PAY'">订单待支付</text>
<text v-if="info.status == 'CANCELED'">订单已取消</text>
<text v-if="info.status == 'FINISHED'">感谢您的支持欢迎再次光临</text>
<text v-if="info.status == 'WAIT_VERIFY'">订单待审核</text>
</view>
</view>
<view class="ordermx">
<view class="top">
订单明细
</view>
<view class="xuxian">
<view class="one">
<view class="qian">
订单编号
</view>
<view class="cont_right">
{{info.payAmount}}
<view class="shen">
{{info.no == null ? '--' : info.no}} <image src="https://api.ccttiot.com/smartmeter/img/static/uimYURcxkn9ItLquwPpM" mode=""></image>
</view>
</view>
<view class="cont_box" style="margin-top: 20rpx;">
<view class="cont_left">
预存金额
<view class="one">
<view class="qian">
下单时间
</view>
<view class="cont_right">
{{info.depositFee}}
<view class="shen">
{{info.createTime == null ? '--' : info.createTime}}
</view>
</view>
<view class="cont_box" style="margin-top: 20rpx;">
<view class="cont_left">
<view class="one">
<view class="qian">
结束时间
</view>
<view class="shen">
{{info.endTime == null ? '--' : info.endTime}}
</view>
</view>
</view>
<view class="xuxian">
<view class="one">
<view class="qian">
骑行费
</view>
<view class="cont_right">
{{info.ridingFee}}
<view class="shen">
{{info.ridingFee == null ? '0.00' : info.ridingFee}}
</view>
</view>
<view class="cont_box" style="margin-top: 20rpx;">
<view class="cont_left">
<view class="one">
<view class="qian">
停车点外调度费
</view>
<view class="cont_right">
{{info.manageFee}}
<view class="shen">
{{info.manageFee == null ? '0.00' : info.manageFee}}
</view>
</view>
<view class="cont_box" style="margin-top: 20rpx;">
<view class="cont_left">
<view class="one">
<view class="qian">
运营区外调度费
</view>
<view class="cont_right">
{{info.dispatchFee}}
<view class="shen">
{{info.dispatchFee == null ? '0.00' : info.dispatchFee}}
</view>
</view>
<view class="tip">
骑行时间{{ rideDuration == '' ? '--' : rideDuration}}
</view>
<view class="xuxian">
<view class="one">
<view class="qian">
合计
</view>
<view class="shen">
{{info.totalFee == null ? '0.00' : info.totalFee}}
</view>
</view>
<view class="one">
<view class="qian">
预存金额
</view>
<view class="shen">
{{info.depositFee == null ? '0.00' : info.depositFee}}
</view>
</view>
<view class="one">
<view class="qian">
退款金额
</view>
<view class="shen">
{{info.payRefunded == null ? '0.00' : info.payRefunded}}
</view>
</view>
</view>
<view class="price">
<view class="zhanwei"></view>
<view class="prices">
共计<span style="font-size:48rpx ;">{{info.totalFee}}</span>
<view class="xuxian" style="border: 0;">
<view class="one">
<view class="qian">
实付金额
</view>
<view class="shen">
<span style="color: #E7612E;font-size: 40rpx;">{{info.payAmount == null ? '0.00' : info.payAmount}}</span>
</view>
</view>
</view>
</view>
<view class="qixing">
<view class="top">
骑行信息
</view>
<view class="xuxian">
<view class="one">
<view class="qian">
骑行时长
</view>
<view class="shen">
{{ rideDuration == '' ? '--' : rideDuration}}
</view>
</view>
<view class="one">
<view class="qian">
骑行距离
</view>
<view class="shen">
{{info.distance > 1000 ? (info.distance / 1000).toFixed(2) + 'km' : info.distance + 'm'}}
</view>
</view>
<view class="one">
<view class="qian">
运营区
</view>
<view class="shen">
{{info.areaName == null ? '--' : info.areaName}}
</view>
</view>
<view class="one">
<view class="qian">
车牌号
</view>
<view class="shen">
{{info.deviceVehicleNum == null ? '--' : info.deviceVehicleNum}}
</view>
</view>
<view class="one">
<view class="qian">
车辆编号SN
</view>
<view class="shen">
{{info.deviceSn == null ? '--' : info.deviceSn}}
</view>
</view>
</view>
</view>
@ -74,7 +170,7 @@
data() {
return {
bgc: {
backgroundColor: "",
backgroundColor: "#fff",
},
id: 0,
info: {},
@ -143,13 +239,15 @@ page{
}
.page{
width: 750rpx;
background: linear-gradient( 180deg, #C4E1FF 0%, rgba(255,255,255,0) 100%), #FFFFFF;
background: #F7F7F7;
border-radius: 0rpx 0rpx 0rpx 0rpx;
padding-bottom: 200rpx;
box-sizing: border-box;
.kefu{
width: 680rpx;
height: 100rpx;
line-height: 100rpx;
background-color: #4297F3;
background-color: #4C97E7;
color: #fff;
font-size: 36rpx;
font-weight: 600;
@ -160,125 +258,109 @@ page{
bottom: 50rpx;
border-radius: 20rpx;
}
.tit{
margin-left: 86rpx;
margin-right: 86rpx;
margin-top: 30rpx;
display: flex;
flex-wrap: nowrap;
justify-content: space-between;
align-items: center;
.left{
font-weight: 700;
font-size: 40rpx;
color: #3D3D3D;
}
.right{
font-weight: 400;
font-size: 24rpx;
color: #3D3D3D;
}
}
.data{
margin-left: 86rpx;
font-weight: 400;
font-size: 24rpx;
color: #808080;
}
.card{
padding:34rpx 44rpx ;
margin: 68rpx auto;
width: 672rpx;
.qixing{
width: 702rpx;
height: 466rpx;
background: #FFFFFF;
box-shadow: 0rpx 10rpx 64rpx 0rpx rgba(0,0,0,0.08);
border-radius: 32rpx 32rpx 32rpx 32rpx;
.card_tit{
width: 112rpx;
height: 38rpx;
font-family: AlibabaPuHuiTi, AlibabaPuHuiTi;
font-weight: 400;
font-size: 28rpx;
border-radius: 16rpx 16rpx 16rpx 16rpx;
padding: 0 42rpx;
box-sizing: border-box;
margin: auto;
margin-top: 32rpx;
.top{
font-weight: 600;
font-size: 32rpx;
color: #3D3D3D;
background: linear-gradient( 0deg, #C4E1FF 0.1%, rgba(255,255,255,0) 40%), #FFFFFF;
padding: 36rpx 0 24rpx 0;
box-sizing: border-box;
border-bottom: 1px dashed #D8D8D8;
}
.cont{
padding: 32rpx 28rpx;
margin-top: 26rpx;
width: 586rpx;
background: #F3F3F3;
border-radius: 26rpx 26rpx 26rpx 26rpx;
.cont_box{
.xuxian{
.one{
display: flex;
flex-wrap: nowrap;
justify-content: space-between;
.cont_left{
font-weight: 400;
font-size: 28rpx;
color: #3D3D3D;
}
.cont_right{
font-weight: 400;
font-size: 28rpx;
color: #3D3D3D;
}
}
.tip{
margin-top: 32rpx;
font-weight: 400;
font-size: 24rpx;
color: #808080;
}
}
.price{
margin-top: 28rpx;
display: flex;
flex-wrap: nowrap;
.prices{
margin-left: auto;
font-weight: 400;
font-size: 24rpx;
color: #3D3D3D;
span{
margin-left: 2rpx;
margin-right: 2rpx;
}
}
.showmore{
margin-left: auto;
display: flex;
flex-wrap: nowrap;
align-items: center;
font-weight: 400;
font-size: 20rpx;
color: #3D3D3D;
.icon-xiangshang1{
font-size: 20rpx;
color: #3D3D3D;
margin-top: 30rpx;
.qian{
color: #808080;
font-size: 28rpx;
}
.icon-xiangxia1{
font-size: 20rpx;
.shen{
color: #3D3D3D;
}
}
}
.info_cont{
margin-top: 12rpx;
}
.ordermx{
width: 702rpx;
max-height: 1862rpx;
background: #FFFFFF;
border-radius: 16rpx 16rpx 16rpx 16rpx;
padding: 0 42rpx;
box-sizing: border-box;
margin: auto;
margin-top: 32rpx;
.xuxian{
padding-bottom: 24rpx;
box-sizing: border-box;
border-bottom: 1px dashed #D8D8D8;
.one{
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 30rpx;
.qian{
color: #808080;
font-size: 28rpx;
}
.shen{
color: #3D3D3D;
image{
width: 23rpx;
height: 28rpx;
vertical-align: baseline;
margin-left: 10rpx;
}
}
}
}
.top{
font-weight: 600;
font-size: 32rpx;
color: #3D3D3D;
padding: 36rpx 0 24rpx 0;
box-sizing: border-box;
border-bottom: 1px dashed #D8D8D8;
}
}
.jiaoyi{
width: 702rpx;
height: 182rpx;
background: #FFFFFF;
border-radius: 16rpx 16rpx 16rpx 16rpx;
margin: auto;
text-align: center;
margin-top: 26rpx;
.pic{
padding-top: 34rpx;
display: flex;
flex-wrap: nowrap;
align-items: center;
justify-content: space-between;
.cont_left{
font-weight: 400;
font-size: 24rpx;
color: #3D3D3D;
}
.cont_right{
font-weight: 400;
font-size: 24rpx;
color: #3D3D3D;
justify-content: center;
width: 100%;
image{
width: 38rpx;
height: 38rpx;
margin-right: 10rpx;
}
font-weight: 600;
font-size: 40rpx;
color: #4C97E7;
}
.gx{
font-size: 28rpx;
color: #808080;
margin-top: 20rpx;
}
}
}

View File

@ -75,7 +75,7 @@
<view class="rt" v-if="item.status == 'WAIT_PAY'">
待支付 <u-icon name="arrow-right" color="#808080" size="28"></u-icon>
</view>
<view class="rt" v-if="item.status == 'CANCEL'">
<view class="rt" v-if="item.status == 'CANCELED'">
已取消 <u-icon name="arrow-right" color="#808080" size="28"></u-icon>
</view>
<view class="rt" v-if="item.status == 'PROCESSING'">
@ -84,6 +84,9 @@
<view class="rt" v-if="item.status == 'FINISHED'">
已完成 <u-icon name="arrow-right" color="#808080" size="28"></u-icon>
</view>
<view class="rt" v-if="item.status == 'WAIT_VERIFY'">
待审核 <u-icon name="arrow-right" color="#808080" size="28"></u-icon>
</view>
</view>
<view class="bot">
<view class="lt">
@ -94,7 +97,7 @@
<text>时长</text> {{computedList(item.duration)}}
</view>
<view class="">
<text>距离</text> {{item.distance > 1000 ? item.distance / 1000 + 'km' : item.distance + 'm'}}
<text>距离</text> {{item.distance > 1000 ? (item.distance / 1000).toFixed(2) + 'km' : item.distance + 'm'}}
</view>
<view class="" v-if="item.status == 'WAIT_VERIFY'">
<text>还车审核</text> 未审核
@ -173,7 +176,7 @@
},
//
getlist(){
this.$u.get(`/app/order/mineList?pageNum=${this.pageNum}&pageSize=10&suitType=${this.activeindex}&status=${this.status}`).then((res) => {
this.$u.get(`/app/order/mineList?pageNum=${this.pageNum}&pageSize=10&suitType=${this.activeindex}&status=${this.status}&isAsc=desc&orderByColumn=createTime`).then((res) => {
if (res.code == 200) {
if(this.pageNum == 1){
this.qixinglist = res.rows

View File

@ -18,8 +18,11 @@
车牌号{{deivceobj.deviceVehicleNum == null ? '--' : deivceobj.deviceVehicleNum}}
<text>SN{{deivceobj.deviceSn == null ? '--' : deivceobj.deviceSn}}</text>
</view>
<!-- <view class="lanya">
<image src="https://api.ccttiot.com/smartmeter/img/static/uGhbsMP0tkh3ngL6EI99" class="xz" mode=""></image> 正在连接 <image src="https://api.ccttiot.com/smartmeter/img/static/uO1TOFA1vdxQlz3NJenN" class="ljimg" mode=""></image>
<!-- <view class="lanya" v-if="ver_dataflag == 3">
<image src="https://api.ccttiot.com/smartmeter/img/static/uFfCiqhjHpbTBXcZvKl6" class="ljimg" mode=""></image>
</view>
<view class="lanya" v-else>
<image src="https://api.ccttiot.com/smartmeter/img/static/uO1TOFA1vdxQlz3NJenN" class="ljimg" mode=""></image>
</view> -->
</view>
<view class="dianliang">
@ -143,6 +146,7 @@
</template>
<script>
var xBlufi = require("@/components/blufi/xBlufi.js")
export default {
data() {
return {
@ -165,15 +169,27 @@
imglist:[],
deivceobj:{},
orderAreaReturnVerify:false,
imgs:''
imgs:'',
ver_dataflag: 1,
mac: '',
deviceid: '',
devicename: '',
devicesarr: [],
findDeviceTimer: null,
name:''
};
},
onLoad(option) {
// xBlufi.initXBlufi(1)
if(option.id){
this.cheflag = false
}
},
onShow() {
// xBlufi.notifyStartDiscoverBle({
// 'isStart': true
// })
// xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent)
setTimeout(()=>{
this.getorderdevice()
},100)
@ -183,15 +199,33 @@
this.timer = setInterval(() => {
this.executeTask();
}, 60000);
xBlufi.notifyConnectBle({
isStart: false,
deviceId: this.deviceId,
name: this.name
})
},
onHide() {
//
this.clearTimer();
xBlufi.notifyStartDiscoverBle({
'isStart': false
})
if (this.findDeviceTimer) {
clearTimeout(this.findDeviceTimer)
this.findDeviceTimer = null
}
},
onUnload() {
//
this.clearTimer();
xBlufi.notifyStartDiscoverBle({
'isStart': false
})
if (this.findDeviceTimer) {
clearTimeout(this.findDeviceTimer)
this.findDeviceTimer = null
}
},
methods: {
// 使
@ -199,6 +233,8 @@
this.$u.get("/app/orderDevice/mineUsing").then((res) => {
if (res.code == 200) {
if(res.data){
this.mac = res.data.deviceMac
this.findDevice()
this.cheflag = false
this.orderAreaReturnVerify = res.data.orderAreaReturnVerify
this.deivceobj = res.data
@ -209,6 +245,72 @@
}
})
},
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_STATUS_CONNECTED:
if (!options.result) {
this.ver_dataflag = 1
console.log('断开');
}
break;
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;
}
},
//
btnghbike(){
uni.navigateTo({
@ -343,7 +445,7 @@
//
btntcd(){
uni.navigateTo({
url:'/pages/myorder/returned/tingche'
url:'/pages/myorder/returned/tingche?areaId=' + this.deivceobj.orderAreaId
})
},
//
@ -427,6 +529,9 @@
},
//
btnfm(){
// xBlufi.notifySendCustomData({
// customData: "11play1@"
// })
this.$u.put(`/bst/device/iot/ring?id=${this.deivceobj.deviceId}`).then((res) => {
if (res.code == 200) {
uni.showToast({
@ -797,17 +902,6 @@
}
}
.lanya{
display: flex;
align-items: center;
justify-content: space-between;
padding-left: 22rpx;
box-sizing: border-box;
font-size: 32rpx;
color: #FF8282;
width: 272rpx;
height: 60rpx;
background: #FFFFFF;
border-radius: 30rpx 30rpx 30rpx 30rpx;
.xz{
width: 32rpx;
height: 32rpx;

View File

@ -139,8 +139,8 @@
</view>
</view>
<view class="mask" v-if="kefuflag"></view>
<!-- 有订单弹窗 -->
<!-- 有订单弹窗 -->
<view class="conts_box" v-if="orderAreaId != ''" @click="btntz">
<view class="orderzt">
<view class="" style="font-size: 32rpx;font-weight: 600;">
@ -150,36 +150,64 @@
<view style="color: #333;">订单进行中<u-icon name="arrow-right" color="#333" size="28"></u-icon></view>
</view>
</view>
<view class="cont_li">
<view class="cont_li">
<view class="right">
<image src="https://lxnapi.ccttiot.com/bike/img/static/uqKmFMF9YHTX8lAQARSd" mode="aspectFill"></image>
<image src="https://lxnapi.ccttiot.com/bike/img/static/uqKmFMF9YHTX8lAQARSd" mode="aspectFill">
</image>
<view class="NO">
SN{{orderobj.deviceSn == null ? '--' : orderobj.deviceSn}}
</view>
</view>
<view class="left">
<view class="km">
可继续行驶{{orderobj.deviceRemainEndurance == null ? '--' : orderobj.deviceRemainEndurance}}公里
</view>
<view class="speed">
<view class="speeds" :style="{ width: orderobj.deviceRemainingPower + '%' }"></view>
</view>
<view class="NO">
电量{{orderobj.deviceRemainingPower == null ? '--' : orderobj.deviceRemainingPower}}%
</view>
</view>
</view>
<view class="" style="display: flex;width: 100%;padding: 0 20rpx;box-sizing: border-box;justify-content: space-between;">
<view class="dh" @click.stop="danghang">
导航 <u-icon name="arrow-right" color="#333" size="28"></u-icon>
</view>
<view class="suocheanniu">
<view class="lssc" @click.stop="btnqd">
{{orderobj.deviceLockStatus == 1 ? '临时锁车' : '开锁'}}
</view>
</view>
</view>
</view>
<view class="left">
<view class="km">
可继续行驶{{orderobj.deviceRemainEndurance == null ? '--' : orderobj.deviceRemainEndurance}}公里
</view>
<view class="speed">
<view class="speeds" :style="{ width: orderobj.deviceRemainingPower + '%' }"></view>
</view>
<view class="NO">
电量{{orderobj.deviceRemainingPower == null ? '--' : orderobj.deviceRemainingPower}}%
</view>
</view>
</view>
<view class=""
style="display: flex;width: 100%;padding: 0 20rpx;box-sizing: border-box;justify-content: space-between;">
<view class="dh" @click.stop="danghang">
导航 <u-icon name="arrow-right" color="#333" size="28"></u-icon>
</view>
<view class="suocheanniu">
<view class="lssc" @click.stop="btnjsdd">
结束订单
</view>
<view class="lssc" @click.stop="btnqd">
{{orderobj.deviceLockStatus == 1 ? '临时锁车' : '开锁'}}
</view>
</view>
</view>
</view>
<!-- 扫码用车未在停车点内还车弹窗 -->
<view class="tingchetc" v-if="fjflag">
<view class="topname">
<image src="https://api.ccttiot.com/smartmeter/img/static/uDfEXjApmdS6ByM88pv3" mode=""></image>
{{fajinobj.manageFee > 0 ? '不在运营区' : fajinobj.dispatchFee > 0 ? '不在停车点' : ''}}
</view>
<view class="shuom">
需支付<text>{{fajinobj.manageFee > 0 ? fajinobj.manageFee : fajinobj.dispatchFee > 0 ? fajinobj.dispatchFee : ''}}</text>你可查看<text
@click="btntcd">最近停车点</text>
</view>
<image src="https://api.ccttiot.com/smartmeter/img/static/uzRrRFiToK3bb3IurIHU" class="tcimg" mode="">
</image>
<view class="btnan">
<view class="fj" @click="btnfajin">
缴纳罚金还车
</view>
<view class="qx" @click="fjflag = false">
继续骑行
</view>
</view>
</view>
<view class="mask" v-if="fjflag"></view>
<tab-bar :indexs='1'></tab-bar>
@ -195,10 +223,10 @@
},
latitude: '',
longitude: '',
lat:'',
lng:'',
latsc:'',
lngsc:'',
lat: '',
lng: '',
latsc: '',
lngsc: '',
rtindex: 2,
covers: [],
shoptcflag: false,
@ -214,13 +242,19 @@
kefulist: [],
orderAreaId: '',
areaId: '',
orderobj:{},
orderAreaReturnVerify:'',
orderobj: {},
orderAreaReturnVerify: '',
fajinobj: {},
fjflag: false,
sockedata:{},
socketTask: null,
reconnectTimer: null,
heartbeatTimer: null,
dataList: [],
messages: [],
reconnectAttempts: 0,
maxReconnectAttempts: 5,
reconnectInterval: 3000, // 3
isPageActive: true,
deviceMac: '' //
}
},
onLoad() {
@ -233,103 +267,262 @@
this.polyline = []
},
onUnload() {
this.socketTask?.close()
this.stopHeartbeat()
this.isPageActive = false;
this.closeWebSocket();
},
onHide() {
//
this.isPageActive = false;
this.closeWebSocket();
},
methods: {
// 使websocket
//WebSocket
initWebSocket() {
if (!this.isPageActive || !this.deviceMac) return;
let token = uni.getStorageSync('token');
//
if (this.socketTask) {
this.socketTask.close();
this.socketTask = null;
}
//
this.socketTask = uni.connectSocket({
url: 'wss://your-websocket-server.com',
})
url: `wss://ele.ccttiot.com/prod-api/ws/device?token=${token}&mac=${this.deviceMac}`,
success: () => {
console.log('WebSocket连接建立中...');
},
fail: (err) => {
console.error('WebSocket连接失败:', err);
this.scheduleReconnect();
}
});
//
this.socketTask.onOpen(() => {
console.log('WebSocket 已连接')
this.startHeartbeat()
console.log('WebSocket连接已打开');
this.reconnectAttempts = 0; //
//
this.socketTask.send({
data: JSON.stringify({
action: 'subscribe'
}),
})
})
success: () => console.log('订阅消息发送成功'),
fail: (err) => console.error('订阅消息发送失败:', err)
});
});
//
this.socketTask.onMessage((res) => {
// this.covers.push(JSON.parse(res.data))
})
this.socketTask.onClose(() => {
console.log('WebSocket 断开,尝试重连...')
this.reconnect()
})
this.socketTask.onError((err) => {
console.error('WebSocket 错误:', err)
this.reconnect()
})
},
reconnect() {
if (this.reconnectTimer) clearTimeout(this.reconnectTimer)
this.reconnectTimer = setTimeout(() => {
this.initWebSocket()
}, 3000)
},
startHeartbeat() {
this.heartbeatTimer = setInterval(() => {
if (this.socketTask?.readyState === 1) {
this.socketTask.send({
data: 'ping'
console.log('收到实时消息:', res.data);
this.messages.push(res.data); //
try {
const data = JSON.parse(res.data);
console.log('解析后的JSON数据:', data);
//
this.sockedata = data
this.getqingqiu()
this.covers.push({
latitude: data.latitude,
longitude: data.longitude,
width: 8,
height: 8,
iconPath: 'https://api.ccttiot.com/smartmeter/img/static/uow9Zq3edTUYCVHI9H60',
})
} catch (e) {
console.log('原始消息内容:', res.data);
}
}, 30000)
});
//
this.socketTask.onError((err) => {
console.error('WebSocket错误:', err);
this.scheduleReconnect();
});
//
this.socketTask.onClose((res) => {
console.log('WebSocket连接已关闭', res);
if (this.isPageActive) {
this.scheduleReconnect();
}
});
},
stopHeartbeat() {
clearInterval(this.heartbeatTimer)
// WebSocket
closeWebSocket() {
if (this.socketTask) {
this.socketTask.close({
success: () => {
console.log('WebSocket已主动关闭');
this.socketTask = null;
},
fail: (err) => {
console.error('WebSocket关闭失败:', err);
this.socketTask = null;
}
});
}
},
//
btntz(){
uni.switchTab({
url:'/pages/myorder/returned/index'
//
scheduleReconnect() {
if (!this.isPageActive || this.reconnectAttempts >= this.maxReconnectAttempts) {
console.log('已达到最大重连次数或页面已关闭,停止重连');
return;
}
this.reconnectAttempts++;
console.log(`尝试第 ${this.reconnectAttempts} 次重连,等待 ${this.reconnectInterval/1000} 秒...`);
setTimeout(() => {
this.initWebSocket();
}, this.reconnectInterval);
// 退
this.reconnectInterval = Math.min(this.reconnectInterval * 2, 30000); // 30
},
//
btnjsdd() {
if (this.orderAreaReturnVerify == true) {
uni.navigateTo({
url: '/page_user/hcshenhe?sn=' + this.orderobj.deviceSn + '&orderid=' + this.orderobj
.orderId + '&orderAreaId=' + this.orderobj.orderAreaId
})
} else {
uni.getLocation({
type: 'wgs84',
success: (res) => {
console.log(res);
this.latsc = res.latitude
this.lonsc = res.longitude
this.getfeiyong()
},
fail: (err) => {
console.error('获取位置失败:', err)
this.getfeiyong()
}
})
}
},
//
getfeiyong() {
let data = {
orderId: this.orderobj.orderId,
lon: this.latsc,
lat: this.lonsc
}
this.$u.post(`/app/order/calcFee`, data).then(res => {
if (res.code == 200) {
this.fajinobj = res.data
if (res.data.manageFee > 0 || res.data.dispatchFee > 0) {
this.fjflag = true
// this.gethuan()
} else {
// this.fjflag = true
this.gethuan()
}
}
})
},
//
danghang(){
uni.openLocation({
latitude: this.orderobj.latitude, //-/
longitude: this.orderobj.longitude, //-/
name: '', //
address:'' //
})
},
// and
btnqd(){
if(this.orderobj.deviceLockStatus == 0){
let that = this
uni.showModal({
title: '提示',
content: '您是否要解锁车辆?',
showCancel: true,
success: function (res) {
if (res.confirm) {
that.$u.put(`/app/order/openDevice?orderId=${that.orderobj.orderId}`).then((res) => {
if (res.code == 200) {
uni.showToast({
title: '解锁成功',
icon: 'success',
duration: 2000
})
that.getorderdevice()
}else{
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
})
}
})
} else if (res.cancel) {
console.log('取消'); //
}
}
})
}else if(this.orderobj.deviceLockStatus == 1){
//
btnfajin() {
this.gethuan()
},
//
gethuan() {
let that = this
uni.showModal({
title: '提示',
content: '您确定要还车吗?',
showCancel: true,
success: function(res) {
if (res.confirm) {
let data = {
orderId: that.orderobj.orderId,
picture: that.imgs,
lon: that.lonsc,
lat: that.latsc
}
that.$u.put(`/app/order/end`, data).then(res => {
if (res.code == 200) {
uni.showToast({
title: '还车成功',
icon: 'success',
duration: 2000
})
that.getorderdevice()
that.fjflag = false
} else {
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
})
}
})
} else if (res.cancel) {
}
}
})
},
//
btntcd() {
uni.navigateTo({
url: '/pages/myorder/returned/tingche?areaId=' + this.orderobj.orderAreaId
})
},
//
btntz() {
uni.switchTab({
url: '/pages/myorder/returned/index'
})
},
//
danghang() {
if (this.orderobj.deviceLatitude && this.orderobj.deviceLongitude) {
uni.openLocation({
latitude: this.orderobj.deviceLatitude, //-/
longitude: this.orderobj.deviceLongitude, //-/
name: '', //
address: '' //
})
} else {
uni.showToast({
title: '车辆暂无法导航',
icon: 'none',
duration: 2000
})
}
},
// and
btnqd() {
if (this.orderobj.deviceLockStatus == 0) {
let that = this
uni.showModal({
title: '提示',
content: '您是否要解锁车辆?',
showCancel: true,
success: function(res) {
if (res.confirm) {
that.$u.put(`/app/order/openDevice?orderId=${that.orderobj.orderId}`).then((
res) => {
if (res.code == 200) {
uni.showToast({
title: '解锁成功',
icon: 'success',
duration: 2000
})
that.getorderdevice()
} else {
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
})
}
})
} else if (res.cancel) {
console.log('取消'); //
}
}
})
} else if (this.orderobj.deviceLockStatus == 1) {
uni.getLocation({
type: 'wgs84',
type: 'wgs84',
success: (res) => {
console.log(res);
this.latsc = res.latitude
@ -339,36 +532,38 @@
console.error('获取位置失败:', err)
}
})
let that = this
uni.showModal({
title: '提示',
content: '您是否要临时解锁?',
showCancel: true,
success: function (res) {
if (res.confirm) {
that.$u.put(`/app/order/closeDevice?orderId=${that.orderobj.orderId}&lat=${that.latsc}&lon=${that.lngsc}`).then((res) => {
if (res.code == 200) {
uni.showToast({
title: '临时锁车成功',
icon: 'success',
duration: 2000
})
that.getorderdevice()
}else{
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
})
}
})
} else if (res.cancel) {
console.log('取消'); //
}
}
})
}
},
let that = this
uni.showModal({
title: '提示',
content: '您是否要临时解锁?',
showCancel: true,
success: function(res) {
if (res.confirm) {
that.$u.put(
`/app/order/closeDevice?orderId=${that.orderobj.orderId}&lat=${that.latsc}&lon=${that.lngsc}`
).then((res) => {
if (res.code == 200) {
uni.showToast({
title: '临时锁车成功',
icon: 'success',
duration: 2000
})
that.getorderdevice()
} else {
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
})
}
})
} else if (res.cancel) {
console.log('取消'); //
}
}
})
}
},
// 使
getorderdevice() {
this.$u.get("/app/orderDevice/mineUsing").then((res) => {
@ -378,6 +573,11 @@
this.orderAreaReturnVerify = res.data.orderAreaReturnVerify
this.orderAreaId = res.data.orderAreaId
this.areaId = res.data.orderAreaId
this.deviceMac = res.data.deviceMac
this.isPageActive = true
this.initWebSocket() //WebSocket
this.$u.get(`/app/area/detail?id=${this.orderAreaId}`).then((res) => {
if (res.code == 200) {
const polylines = this.convertBoundaryToPolyline(res.data.boundaryStr)
@ -407,7 +607,8 @@
if (this.orderAreaId == '') {
this.covers.filter(item => {
if (item.id == id) {
item.iconPath = 'https://api.ccttiot.com/smartmeter/img/static/uCBNaRAdk9kcgQgrom2G'
item.iconPath =
'https://api.ccttiot.com/smartmeter/img/static/uCBNaRAdk9kcgQgrom2G'
this.taocanflag = true
this.$u.get(`/app/device/availableDetail?id=${id.slice(0, -1)}`).then((res) => {
if (res.code == 200) {
@ -444,7 +645,8 @@
if (res.code == 200) {
this.taocanflag = false
uni.navigateTo({
url: '/page_fenbao/storedlist/trueorder?modelId=' + this.cheobj.modelId + '&sn=' + this.cheobj.sn
url: '/page_fenbao/storedlist/trueorder?modelId=' + this.cheobj.modelId +
'&sn=' + this.cheobj.sn
})
} else if (res.code == 401) {
uni.showModal({
@ -592,6 +794,15 @@
this.$u.get(`/app/device/listNearBy?radius=10000&center=${this.jingweidu}`).then((res) => {
if (res.code == 200) {
this.covers = []
if(this.sockedata.latitude){
this.covers.push({
latitude: this.sockedata.latitude,
longitude: this.sockedata.longitude,
width: 8,
height: 8,
iconPath: 'https://api.ccttiot.com/smartmeter/img/static/uow9Zq3edTUYCVHI9H60',
})
}
res.data.forEach(item => {
const shopCover = {
// 123
@ -705,7 +916,7 @@
return {
points: points,
fillColor: "#FFF5D640", //
strokeColor: "#FFC107", //
strokeColor: "#FF473E", //
strokeWidth: 2, //
zIndex: 1, //
}
@ -732,7 +943,7 @@
return {
points: points,
fillColor: "#FFD1CF40", //
strokeColor: "#FF473E", //
strokeColor: "#FFC107", //
strokeWidth: 2, //
zIndex: 1, //
@ -760,17 +971,16 @@
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/u53BAQcFIX3vxsCzEZ7t' :
' https://lxnapi.ccttiot.com/bike/img/static/uDNY5Q4zOiZTCBTA2Jdq',
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 ? '#FFC107' :
'#FF473E',
bgColor: item.type == 1 ? '#3A7EDB' : item.type == 2 ? '#FF473E' :
'#FFC107',
padding: 6,
display: 'ALWAYS'
},
@ -859,24 +1069,111 @@
opacity: 1;
}
}
.conts_box {
width: 680rpx;
.mask {
width: 100%;
height: 100vh;
position: fixed;
top: 0;
left: 0;
background-color: rgba(0, 0, 0, .3);
z-index: 9;
}
.tingchetc {
width: 624rpx;
height: 610rpx;
background: #FFFFFF;
border-radius: 20rpx 20rpx 20rpx 20rpx;
position: fixed;
left: 50%;
transform: translateX(-50%);
top: 572rpx;
z-index: 99;
padding: 28rpx 36rpx;
box-sizing: border-box;
.btnan {
display: flex;
justify-content: space-between;
margin-top: 40rpx;
.fj {
width: 252rpx;
height: 72rpx;
border-radius: 45rpx 45rpx 45rpx 45rpx;
border: 2rpx solid #808080;
font-weight: 600;
font-size: 32rpx;
color: #808080;
text-align: center;
line-height: 72rpx;
}
.qx {
width: 252rpx;
height: 72rpx;
background: #4C97E7;
border-radius: 45rpx 45rpx 45rpx 45rpx;
text-align: center;
line-height: 72rpx;
box-sizing: border-box;
font-weight: 600;
font-size: 32rpx;
color: #FFFFFF;
}
}
.tcimg {
width: 552rpx;
height: 300rpx;
margin-top: 28rpx;
}
.shuom {
font-size: 26rpx;
color: #3D3D3D;
margin-top: 18rpx;
text {
color: #4C97E7;
}
}
.topname {
font-weight: 600;
font-size: 36rpx;
color: #3D3D3D;
display: flex;
align-items: center;
image {
width: 48rpx;
height: 48rpx;
margin-right: 14rpx;
}
}
}
.conts_box {
width: 680rpx;
height: 360rpx;
margin: 0 auto;
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: space-between;
margin-top: 38rpx;
background: #FFFFFF;
box-shadow: 0rpx 10rpx 64rpx 0rpx rgba(0, 0, 0, 0.08);
border-radius: 20rpx 20rpx 20rpx 20rpx;
padding-bottom: 20rpx;
position: fixed;
margin: 0 auto;
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: space-between;
margin-top: 38rpx;
background: #FFFFFF;
box-shadow: 0rpx 10rpx 64rpx 0rpx rgba(0, 0, 0, 0.08);
border-radius: 20rpx 20rpx 20rpx 20rpx;
padding-bottom: 20rpx;
position: fixed;
left: 50%;
transform: translateX(-50%);
bottom: 220rpx;
.orderzt{
.orderzt {
display: flex;
justify-content: space-between;
padding: 0 20rpx;
@ -884,15 +1181,17 @@
box-sizing: border-box;
width: 100%;
}
.txtss {
margin-top: 18rpx;
padding-left: 20rpx;
width: 100%;
font-weight: 500;
font-size: 28rpx;
color: #808080;
}
.dh{
.txtss {
margin-top: 18rpx;
padding-left: 20rpx;
width: 100%;
font-weight: 500;
font-size: 28rpx;
color: #808080;
}
.dh {
width: 160rpx;
height: 60rpx;
border-radius: 30rpx;
@ -902,10 +1201,12 @@
padding-top: 10rpx;
box-sizing: border-box;
}
.suocheanniu{
.suocheanniu {
display: flex;
align-items: center;
.lssc{
.lssc {
width: 160rpx;
height: 60rpx;
border-radius: 30rpx;
@ -918,58 +1219,66 @@
margin-left: 30rpx;
}
}
.cont_li {
width: 100%;
display: flex;
flex-wrap: nowrap;
align-items: center;
justify-content: space-between;
padding: 0 20rpx;
.cont_li {
width: 100%;
display: flex;
flex-wrap: nowrap;
align-items: center;
justify-content: space-between;
padding: 0 20rpx;
box-sizing: border-box;
.left {
display: flex;
flex-wrap: wrap;
font-weight: 600;
font-size: 36rpx;
color: #3D3D3D;
.km {
font-weight: 400;
font-size: 28rpx;
color: #3D3D3D;
}
.speed {
margin-top: 18rpx;
width: 226rpx;
height: 22rpx;
background: #ccc;
border-radius: 16rpx 16rpx 16rpx 16rpx;
.speeds {
height: 100%;
background: #4297F3;
border-radius: 16rpx 16rpx 16rpx 16rpx;
}
}
.NO {
width: 100%;
font-weight: 400;
font-size: 24rpx;
color: #3D3D3D;
margin-top: 18rpx;
}
}
.right {
.left {
display: flex;
flex-wrap: wrap;
font-weight: 600;
font-size: 36rpx;
color: #3D3D3D;
.km {
font-weight: 400;
font-size: 28rpx;
color: #3D3D3D;
}
.speed {
margin-top: 18rpx;
width: 226rpx;
height: 22rpx;
background: #ccc;
border-radius: 16rpx 16rpx 16rpx 16rpx;
.speeds {
height: 100%;
background: #4297F3;
border-radius: 16rpx 16rpx 16rpx 16rpx;
}
}
.NO {
width: 100%;
font-weight: 400;
font-size: 24rpx;
color: #3D3D3D;
margin-top: 18rpx;
}
}
.right {
width: 70%;
padding-right: 20rpx;
font-size: 24rpx;
color: #333;
image {
width: 160rpx;
height: 110rpx;
}
}
}
}
padding-right: 20rpx;
font-size: 24rpx;
color: #333;
image {
width: 160rpx;
height: 110rpx;
}
}
}
}
.picimg {
width: 120rpx;
height: 120rpx;
@ -1078,12 +1387,13 @@
transform: translateX(-50%);
bottom: 220rpx;
z-index: 99;
background-color: #fff;
background-color: #fff;
border-radius: 30rpx;
width: 700rpx;
margin: auto;
padding-bottom: 30rpx;
box-sizing: border-box;
.topfor {
width: 100%;
margin: auto;
@ -1093,7 +1403,7 @@
padding: 44rpx 34rpx;
box-sizing: border-box;
position: relative;
.bikeyc {
position: absolute;
top: 20rpx;