This commit is contained in:
Sliverber 2024-07-06 18:04:41 +08:00
parent 9738ebf092
commit e07dbe517c
8 changed files with 723 additions and 666 deletions

View File

@ -19,13 +19,13 @@ const install = (Vue, vm) => {
// },
// });
uni.setStorageSync('deptId', 100);
uni.setStorageSync('deptId', 101);
Vue.prototype.$u.http.setConfig({
// baseUrl: 'http://61.174.243.28:15861',
// baseUrl: 'http://192.168.2.14:8080',
// baseUrl: 'http://124.221.246.124:2289',
// baseUrl: 'https://dianche.chuantewulian.cn/prod-api',
baseUrl: 'https://dche.ccttiot.com/prod-api',
baseUrl: 'https://dianche.chuantewulian.cn/prod-api',
// baseUrl: 'https://dche.ccttiot.com/prod-api',
loadingText: '努力加载中~',
// loadingTime: 2000,
// 设置自定义头部content-type

View File

@ -51,7 +51,7 @@
/* */
"mp-weixin" : {
"libVersion" : "latest",
"appid" : "wx3428c498d5061192",
"appid" : "wx4d178f8c80348214",
"setting" : {
"urlCheck" : false
},

View File

@ -202,9 +202,12 @@
<view class="info_li_left">
换电后电量
</view>
<view class="info_li_right">
<view class="info_li_right" v-if="info.afterElectric">
{{info.afterElectric}}%
</view>
<view class="info_li_right" v-else>
--
</view>
</view>
<view class="info_li">
<view class="info_li_left">
@ -241,7 +244,7 @@
<view class="btn" @click="btn(4)">
响铃寻车
</view>
<view class="btn" @click="bulebtn(1)">
<!-- <view class="btn" @click="bulebtn(1)">
蓝牙响铃
</view>
<view class="btn" @click="bulebtn(2)">
@ -249,7 +252,7 @@
</view>
<view class="btn" @click="bulebtn(3)">
蓝牙关锁
</view>
</view> -->
<view class="btn" @click="bulebtn(4)">
设备重启
</view>
@ -904,49 +907,68 @@
btn(num){
if(num==0){
this.$u.post('/appVerify/admin/unlocking?sn='+this.info.sn).then((res) => {
btn(num) {
if (num == 0) {
this.$u.post('/appVerify/admin/unlocking?sn=' + this.sn).then((res) => {
if (res.code === 200) {
// 线
this.deviceInfo()
// this.deviceInfo()
}else{
this.bulebtn(2)
}
}).catch(error => {
console.error("Error fetching area data:", error);
});
}else if(num==1){
this.$u.post('/appVerify/admin/lock?sn='+this.info.sn).then((res) => {
} else if (num == 1) {
this.$u.post('/appVerify/admin/lock?sn=' + this.sn).then((res) => {
if (res.code === 200) {
// 线
this.deviceInfo()
// this.deviceInfo()
}else{
this.bulebtn(3)
}
}).catch(error => {
console.error("Error fetching area data:", error);
});
}else if(num==2){
this.$u.post('/appVerify/device/offline?sn='+this.info.sn).then((res) => {
} else if (num == 2) {
this.$u.post('/appVerify/device/offline?sn=' + this.sn).then((res) => {
if (res.code === 200) {
// 线
this.deviceInfo()
// this.deviceInfo()
}
}).catch(error => {
console.error("Error fetching area data:", error);
});
}else if(num==3){
this.$u.post('/appVerify/device/online?sn='+this.info.sn).then((res) => {
} else if (num == 3) {
this.$u.post('/appVerify/device/online?sn=' + this.sn).then((res) => {
if (res.code === 200) {
// 线
this.deviceInfo()
// this.deviceInfo()
}
}).catch(error => {
console.error("Error fetching area data:", error);
});
}else if(num==4){
this.$u.post('/app/device/ring?sn=' + this.info.sn).then((res) => {
} else if (num == 4) {
uni.showLoading({})
this.$u.post('/app/device/ring?sn=' + this.sn).then((res) => {
if (res.code === 200) {
uni.hideLoading()
} else {
uni.hideLoading()
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
});
this.bulebtn(1)
}
})
}
},
historyList(){

View File

@ -2,7 +2,7 @@
<view class="page" >
<u-navbar title="我的订单" :border-bottom="false" :background="bgc" title-color='#000' title-size='36'
height='45'></u-navbar>
<view class="card" v-for="(item, index) in computedList" :key="index" @click="topage(item)">
<view class="card" v-for="(item, index) in list" :key="index" @click="topage(item)">
<view class="top_li">
<view class="left">
<image src="https://api.ccttiot.com/smartmeter/img/static/upPr9QBpmeFzYN2kXEJj" mode=""></image> 电单车
@ -10,15 +10,18 @@
<view class="right" v-if="item.status==4&&item.paid==1">
已完成 <view class="iconfont icon-xiangyou1"></view>
</view>
<view class="right" v-if="item.status==4&&item.paid==0" style="color: red;">
<view class="right" v-if="item.status==3&&item.paid==0" style="color: red;">
待支付 <view class="iconfont icon-xiangyou1"></view>
</view>
<view class="right" v-if="item.status!=3&&item.paid==0" style="color: #4C97E7;">
骑行中 <view class="iconfont icon-xiangyou1"></view>
</view>
</view>
<view class="info">
时间{{ item.createTime }}
</view>
<view class="info">
时长{{ item.duration }}
时长{{ computedList(item) }}
</view>
<view class="info" v-if="item.distance">
距离{{ (item.distance / 1000).toFixed(2) }} 公里
@ -26,7 +29,7 @@
<view class="info" v-else>
距离--公里
</view>
<view class="price">
<view class="price" v-if="item.status!=2">
{{item.totalFee}}
</view>
</view>
@ -45,24 +48,66 @@
};
},
computed: {
computedList() {
return this.list.map(item => {
const createTime = new Date(item.createTime);
const payTime = new Date(item.returnTime);
const timeDifference = Math.abs(createTime - payTime);
// computedList() {
// return this.list.map(item => {
// const createTime = new Date(item.createTime);
// const payTime = new Date(item.returnTime);
// const timeDifference = Math.abs(createTime - payTime);
// const hours = Math.floor(timeDifference / (1000 * 60 * 60));
// const minutes = Math.floor((timeDifference % (1000 * 60 * 60)) / (1000 * 60));
// const seconds = Math.floor((timeDifference % (1000 * 60)) / 1000);
// return {
// ...item,
// duration: `${minutes}${seconds}`
// };
// });
// }
},
methods: {
computedList(item) {
if (item.status == 0 || item.status == 2) {
const createTime = new Date(item.createTime);
const payTime = Date.now();
const timeDifference = Math.abs(createTime - payTime);
const hours = Math.floor(timeDifference / (1000 * 60 * 60));
const minutes = Math.floor((timeDifference % (1000 * 60 * 60)) / (1000 * 60));
const seconds = Math.floor((timeDifference % (1000 * 60)) / 1000);
return {
...item,
duration: `${minutes}分钟${seconds}`
};
});
}
},
methods: {
let result = '';
if (hours > 0) {
result += `${hours}小时`;
}
if (minutes > 0 || hours > 0) { //
result += `${minutes}分钟`;
}
// result += `${seconds}`; //
return result;
} else {
const createTime = new Date(item.createTime);
const payTime = new Date(item.returnTime);
const timeDifference = Math.abs(createTime - payTime);
const hours = Math.floor(timeDifference / (1000 * 60 * 60));
const minutes = Math.floor((timeDifference % (1000 * 60 * 60)) / (1000 * 60));
const seconds = Math.floor((timeDifference % (1000 * 60)) / 1000);
let result = '';
if (hours > 0) {
result += `${hours}小时`;
}
if (minutes > 0 || hours > 0) { //
result += `${minutes}分钟`;
}
// result += `${seconds}`; //
return result;
}
},
getuserInfo() {
this.$u.get("/getAppInfo").then((res) => {
if (res.code === 200) {
@ -78,18 +123,9 @@
});
},
topage(item){
if(item.status==4&&item.paid==1){
uni.navigateTo({
url:'/page_user/xcjs?id='+item.orderNo
})
}else {
uni.showToast({
title: '请支付订单后再查看详情',
icon: 'none',
duration: 2000
});
}
uni.navigateTo({
url:'/page_user/xcjs?id='+item.orderNo
})
},
getlist() {

View File

@ -4,9 +4,9 @@
height='45'></u-navbar>
<map class="map" id="map" ref="map" :scale="zoomSize" :latitude="latitude" :longitude="longitude"
:show-location='true' :markers="markers" :polygons="polygons" :polyline="polyline"> </map>
<view class="park" @click="toggleIconAndCallout">
<image src="https://lxnapi.ccttiot.com/bike/img/static/uRiYQZQEb3l2LsltEsyW" mode=""></image>
</view>
<view class="park" @click="toggleIconAndCallout">
<image src="https://lxnapi.ccttiot.com/bike/img/static/uRiYQZQEb3l2LsltEsyW" mode=""></image>
</view>
<!-- <map class="map" id="map" ref="map"
\> </map> -->
<view class="bot_btn" v-if="false">
@ -56,11 +56,11 @@
骑行距离
</view>
<view class="right" style="font-size:26rpx ;" v-if="orderInfo.distance">
<!-- {{orderInfo.distance}}公里 -->
{{ (orderInfo.distance / 1000).toFixed(2) }} 公里
<!-- {{orderInfo.distance}}公里 -->
{{ (orderInfo.distance / 1000).toFixed(2) }} 公里
</view>
<view class="right" style="font-size:26rpx ;" v-else>
--公里
--公里
</view>
</view>
</view>
@ -70,6 +70,9 @@
</view>
</view>
</view>
<view class="paybtn" v-if="orderInfo.status==3&&orderInfo.paid==0" @click="topay1()">
去支付
</view>
</view>
<u-mask :show="show" @click="show = false" :z-index='100' />
@ -103,10 +106,15 @@
orderId: '',
orderInfo: {},
loading: false,
showIconAndCallout:false
showIconAndCallout: false,
ispaid: false,
_mapContext: null
}
},
created() {
this._mapContext = uni.createMapContext("map", this); //mapmapid
},
onLoad(e) {
this.orderId = e.id
this.getOrderDetail()
@ -116,6 +124,73 @@
},
methods: {
//
topay1() {
if (this.ispaid == false) {
this.ispaid = true
let data = {
userId: this.orderInfo.userId,
sn: this.orderInfo.sn,
orderNo: this.orderInfo.orderNo,
// money: this.freeInfo.fee,
mark: "订单支付",
type: '1'
}
uni.showLoading({
})
console.log('点击了');
let that = this
this.$u.post('/appVerify/pre/order', data).then((res) => {
if (res.code === 200) {
uni.hideLoading()
// this.freList=res.rows
uni.requestPayment({
provider: 'wxpay',
timeStamp: res.data.timeStamp,
nonceStr: res.data.nonceStr,
package: res.data.packageVal,
signType: res.data.signType,
paySign: res.data.paySign,
success(res) {
that.ispaid = false
// console.log('');
// //
// clearInterval(that.timer)
// that.orderinfo = {}
// that.showdevice = false
// that.deviceIndex = 0
that.getOrderDetail()
},
fail(err) {
that.ispaid = false
//
uni.showToast({
title: '支付失败',
icon: 'none',
duration: 2000
});
}
});
} else {
that.ispaid = false
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
});
}
})
}
},
topage(num) {
if (num == 1) {
uni.navigateTo({
@ -127,16 +202,47 @@
})
}
},
computedList(info) {
const createTime = new Date(info.createTime);
const payTime = new Date(info.returnTime);
const timeDifference = Math.abs(createTime - payTime);
computedList(item) {
if (item.status == 0 || item.status == 2) {
const createTime = new Date(item.createTime);
const payTime = Date.now();
const timeDifference = Math.abs(createTime - payTime);
const hours = Math.floor(timeDifference / (1000 * 60 * 60));
const minutes = Math.floor((timeDifference % (1000 * 60 * 60)) / (1000 * 60));
const seconds = Math.floor((timeDifference % (1000 * 60)) / 1000);
const hours = Math.floor(timeDifference / (1000 * 60 * 60));
const minutes = Math.floor((timeDifference % (1000 * 60 * 60)) / (1000 * 60));
const seconds = Math.floor((timeDifference % (1000 * 60)) / 1000);
return `${minutes}分钟${seconds}`
let result = '';
if (hours > 0) {
result += `${hours}小时`;
}
if (minutes > 0 || hours > 0) { //
result += `${minutes}分钟`;
}
// result += `${seconds}`; //
return result;
} else {
const createTime = new Date(item.createTime);
const payTime = new Date(item.returnTime);
const timeDifference = Math.abs(createTime - payTime);
const hours = Math.floor(timeDifference / (1000 * 60 * 60));
const minutes = Math.floor((timeDifference % (1000 * 60 * 60)) / (1000 * 60));
const seconds = Math.floor((timeDifference % (1000 * 60)) / 1000);
let result = '';
if (hours > 0) {
result += `${hours}小时`;
}
if (minutes > 0 || hours > 0) { //
result += `${minutes}分钟`;
}
// result += `${seconds}`; //
return result;
}
},
convertBoundaryToPolyline(boundary) {
if (!boundary) return null;
@ -261,10 +367,10 @@
},
getParking() {
//
let data={
areaId:this.orderInfo.areaId
let data = {
areaId: this.orderInfo.areaId
}
this.$u.get('/app/parking/list?',data).then((res) => {
this.$u.get('/app/parking/list?', data).then((res) => {
if (res.code === 200) {
//
const type1Data = [];
@ -298,7 +404,7 @@
this.polygons = this.polygons.concat(polylines);
// console.log(this.polyline);
this.parkingList = res.rows
}
}).catch(error => {
@ -316,7 +422,11 @@
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/u53BAQcFIX3vxsCzEZ7t' :' https://lxnapi.ccttiot.com/bike/img/static/uDNY5Q4zOiZTCBTA2Jdq',
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',
callout: {
content: item.parkingName,
color: '#ffffff',
@ -335,11 +445,11 @@
//
this.$set(this, 'markers', this.markers.filter(marker => !marker.isCalloutVisible));
}
},
getArea() {
// this.$u.get("/app/area/" + this.orderInfo.areaId).then((res) => {
this.$u.get("/app/area/" + this.orderInfo.areaId).then((res) => {
if (res.code == 200) {
@ -378,55 +488,97 @@
},
getOrderDetail() {
uni.showLoading({});
this.$u.get('/appVerify/order/' + this.orderId).then((res) => {
if (res.code === 200) {
this.orderInfo = res.data;
this.loading = true;
this.getArea();
if(res.data.tripRouteStr){
let abb;
try {
abb = JSON.parse(res.data.tripRouteStr);
} catch (error) {
console.error("Error parsing tripRouteStr:", error);
return;
}
if (abb.length > 2) {
this.latitude = parseFloat(abb[0][1]);
this.longitude = parseFloat(abb[0][0]);
this.polyline[0].points = abb.map(coord => ({
latitude: coord[1],
longitude: coord[0]
}));
this.markers.push({
id: 0,
latitude: abb[0][1],
longitude: abb[0][0],
width: 25,
height: 38,
iconPath: 'https://lxnapi.ccttiot.com/bike/img/static/u06paUGiHLvL08Pw7BGr'
}, {
id: 1,
latitude: abb[abb.length - 1][1],
longitude: abb[abb.length - 1][0],
width: 25,
height: 38,
iconPath: 'https://lxnapi.ccttiot.com/bike/img/static/uwpAj9vYtPRmhtTOtflx'
});
}else{
this.latitude = parseFloat(abb[0][1]);
this.longitude = parseFloat(abb[0][0]);
}
uni.showLoading({});
this.$u.get('/appVerify/order/' + this.orderId).then((res) => {
if (res.code === 200) {
this.orderInfo = res.data;
this.loading = true;
this.getArea();
if (res.data.tripRouteStr) {
let abb;
try {
abb = JSON.parse(res.data.tripRouteStr);
} catch (error) {
console.error("Error parsing tripRouteStr:", error);
return;
}
uni.hideLoading();
}
}).catch(error => {
console.error("Error fetching area data:", error);
});
if (abb.length > 2) {
this.latitude = parseFloat(abb[0][1]);
this.longitude = parseFloat(abb[0][0]);
this.polyline[0].points = abb.map(coord => ({
latitude: coord[1],
longitude: coord[0]
}));
this.markers.push({
id: 0,
latitude: abb[0][1],
longitude: abb[0][0],
width: 25,
height: 38,
iconPath: 'https://lxnapi.ccttiot.com/bike/img/static/u06paUGiHLvL08Pw7BGr'
}, {
id: 1,
latitude: abb[abb.length - 1][1],
longitude: abb[abb.length - 1][0],
width: 25,
height: 38,
iconPath: 'https://lxnapi.ccttiot.com/bike/img/static/uwpAj9vYtPRmhtTOtflx'
}, {
id: 3,
latitude: abb[0][1],
longitude: abb[0][0],
width: 40,
height: 28,
iconPath: 'https://api.ccttiot.com/smartmeter/img/static/uF9qLejuAZErNTrRuHq7'
});
// Start the track playback
this.translateMarkerFun(abb);
} else {
this.latitude = parseFloat(abb[0][1]);
this.longitude = parseFloat(abb[0][0]);
}
}
uni.hideLoading();
}
}).catch(error => {
console.error("Error fetching area data:", error);
});
},
translateMarkerFun(path) {
let abb = JSON.parse(this.orderInfo.tripRouteStr);
// console.log(abb,'abb');
let formattedPath = path.map(coord => ({
latitude: parseFloat(coord[1]),
longitude: parseFloat(coord[0])
}));
// console.log(path,'path');
// let totalDistance = this.calculateTotalDistance(path);
let baseSpeed = 300; //
// let duration = totalDistance > 0 ? totalDistance * baseSpeed : 60000; //
let duration = abb.length*300;
// console.log(duration,'durationduration',totalDistance);
this._mapContext.includePoints({
points: formattedPath,
padding: [50, 50, 50, 50],
});
this._mapContext.moveAlong({
markerId: 3,
path: formattedPath,
autoRotate: true,
duration: duration,
iconPath: 'https://api.ccttiot.com/smartmeter/img/static/uF9qLejuAZErNTrRuHq7', //
});
this.$forceUpdate();
}
}
}
</script>
@ -444,26 +596,30 @@
width: 750rpx;
height: 100vh;
}
.park {
position: fixed;
display: flex;
align-items: center;
justify-content: center;
right: 30rpx;
bottom: 500rpx;
bottom: 600rpx;
// background-color: #fff;
border-radius: 50%;
width: 82rpx;
height: 82rpx;
z-index: 10;
.img {
width: 82rpx;
height: 82rpx;
}
}
.bot {
display: flex;
flex-wrap: wrap;
justify-content: center;
padding: 26rpx 34rpx 48rpx 34rpx;
position: fixed;
@ -473,6 +629,23 @@
background: #F7F7F7;
border-radius: 30rpx;
.paybtn {
display: flex;
align-items: center;
justify-content: center;
margin-top: 30rpx;
border-radius: 20rpx;
width: 100%;
height: 90rpx;
background: #4C97E7;
font-weight: 500;
font-size: 40rpx;
color: #FFFFFF;
}
.card {
width: 708rpx;
// height: 320rpx;

View File

@ -1213,27 +1213,8 @@
});
},
computed: {
appointmentServiceFee() {
return this.$store.getters.appointmentServiceFee;
},
dispatchFee() {
return this.$store.getters.dispatchFee;
},
vehicleManagementFee() {
return this.$store.getters.vehicleManagementFee;
},
startingPrice() {
return this.$store.getters.startingPrice;
},
timeFee() {
return this.$store.getters.timeFee;
},
timeMinutes() {
return this.$store.getters.timeMinutes;
},
startingHowManyMinutes() {
return this.$store.getters.startingHowManyMinutes;
},
userId() {
return this.$store.getters.userId;
},
@ -1466,97 +1447,115 @@
},
getmarks() {
let data = {
areaId: this.areaInfo.areaId
};
if (this.areaInfo.areaId) {
this.$u.get(`/app/allVehicleByArea`, data).then((res) => {
if (res.code === 200 && res.data != '') {
this.listData = res.data;
const newDeviceMarkers = this.listData.map(item => ({
id: parseFloat(item.sn),
latitude: parseFloat(item.latitude),
longitude: parseFloat(item.longitude),
width: 40,
height: 28,
iconPath: this.defaultMarkerIconPath,
isDeviceMarker: true //
}));
//
const preservedMarkers = this.markers.filter(marker => marker.isParkingMarker || marker
.id === this.specificDeviceMarkerId);
// markers
let updatedMarkers = [...newDeviceMarkers, ...preservedMarkers];
// console.log(this.lastClickedMarkerId,'this.lastClickedMarkerIdthis.lastClickedMarkerId');
//
if (this.lastClickedMarkerId != null) {
updatedMarkers = updatedMarkers.map(marker => {
if (marker.id === this.lastClickedMarkerId) {
return {
...marker,
width: 50,
height: 35,
iconPath: this.clickedMarkerIconPath
};
}
return marker;
});
}
// 使this.$setVue
this.$set(this, 'markers', updatedMarkers);
this.oldMarkers = [...this.markers];
}
}).catch(error => {
console.error("Error fetching device data:", error);
});
}
let data = {
areaId: this.areaInfo.areaId
};
if (this.areaInfo.areaId) {
this.$u.get(`/app/allVehicleByArea`, data).then((res) => {
if (res.code === 200 && res.data != '') {
this.listData = res.data;
const newDeviceMarkers = this.listData.map(item => ({
id: parseFloat(item.sn),
latitude: parseFloat(item.latitude),
longitude: parseFloat(item.longitude),
width: 40,
height: 28,
iconPath: this.defaultMarkerIconPath,
isDeviceMarker: true //
}));
//
const preservedMarkers = this.markers.filter(marker => marker.isParkingMarker || marker.id === parseFloat(this.OrderdeviceInfos.sn));
// markers
let updatedMarkers = [...newDeviceMarkers, ...preservedMarkers];
//
if (this.lastClickedMarkerId != null) {
updatedMarkers = updatedMarkers.map(marker => {
if (marker.id === this.lastClickedMarkerId) {
return {
...marker,
width: 50,
height: 35,
iconPath: this.clickedMarkerIconPath
};
}
return marker;
});
}
// 使this.$setVue
this.$set(this, 'markers', updatedMarkers);
this.oldMarkers = [...this.markers];
}
}).catch(error => {
console.error("Error fetching device data:", error);
});
}
},
timestare() {
this.timers = setInterval(() => {
this.getmarks();
if (this.orderinfo.sn) {
this.$u.get('/app/device/info?sn=' + this.orderinfo.sn).then((res) => {
if (res.code === 200) {
this.mac = this.OrderdeviceInfos.mac;
if (this.OrderdeviceInfos.onlineStatus != res.data.onlineStatus) {
this.OrderdeviceInfos = res.data;
}
if(this.OrderdeviceInfos.status != res.data.status){
this.getisInOrder()
}
// console.log(parseFloat(res.data.latitude),parseFloat(res.data.longitude),'');
// //
// this.specificDeviceMarkerId = parseFloat(this.orderinfo.sn);
// const specificDeviceMarker = {
// id: this.specificDeviceMarkerId,
// latitude: parseFloat(res.data.latitude),
// longitude: parseFloat(res.data.longitude),
// width: 40,
// height: 28,
// iconPath: 'https://lxnapi.ccttiot.com/bike/img/static/u5Im6YipwNSYiiaMTHxH',
// // isSpecificDeviceMarker: true //
// };
// //
// const preservedMarkers = this.markers.filter(marker => marker.id !== this.specificDeviceMarkerId);
// // markers
// const updatedMarkers = [...preservedMarkers, specificDeviceMarker];
// this.$set(this, 'markers', updatedMarkers);
} else {
//
}
}).catch(error => {
console.error("Error fetching specific device data:", error);
});
}
}, 3000); // 3
this.timers = setInterval(() => {
this.getmarks();
if (this.orderinfo.sn) {
this.$u.get('/app/device/info?sn=' + this.orderinfo.sn).then((res) => {
if (res.code === 200) {
this.mac = this.OrderdeviceInfos.mac;
if (this.OrderdeviceInfos.onlineStatus !== res.data.onlineStatus) {
this.OrderdeviceInfos = res.data;
}
if (this.OrderdeviceInfos.status !== res.data.status) {
this.getisInOrder();
}
const sn = parseFloat(res.data.sn);
const latitude = parseFloat(res.data.latitude);
const longitude = parseFloat(res.data.longitude);
// marker
let markerIndex = this.markers.findIndex(marker => marker.id === sn);
if (markerIndex !== -1) {
// marker
this.markers[markerIndex].latitude = latitude;
this.markers[markerIndex].longitude = longitude;
} else {
// marker
const specificDeviceMarker = {
id: sn,
latitude: latitude,
longitude: longitude,
width: 10,
height: 10,
iconPath: 'https://lxnapi.ccttiot.com/bike/img/static/u4D2g8B76trqZLhIiNWN'
};
this.markers.push(specificDeviceMarker);
}
// markers
this.$set(this, 'markers', [...this.markers]);
} else {
//
}
}).catch(error => {
console.error("Error fetching specific device data:", error);
});
} else {
// marker
const markerIndex = this.markers.findIndex(marker => marker.id === parseFloat(this.OrderdeviceInfos.sn));
if (markerIndex !== -1) {
this.markers.splice(markerIndex, 1);
// markers
this.$set(this, 'markers', [...this.markers]);
}
}
}, 3000); // 3
},
toggleIconAndCallout() {
this.showIconAndCallout = !this.showIconAndCallout;
@ -2589,82 +2588,6 @@
},
//
// Binddevice() {
// this.isnoline = false
// this.loadingmask = true
// this.loadingtxt = '...'
// // uni.showLoading({
// // title: '..'
// // })
// xBlufi.initXBlufi(1);
// console.log("xBlufi", xBlufi.XMQTT_SYSTEM);
// xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent);
// xBlufi.notifyStartDiscoverBle({
// 'isStart': true
// });
// //
// setTimeout(() => {
// xBlufi.notifyStartDiscoverBle({
// 'isStart': false
// });
// setTimeout(() => {
// // uni.hideLoading()
// if (this.devicesList.length == 0) {
// uni.showToast({
// title: ',',
// icon: 'none',
// duration: 1500
// });
// } else {
// let uniqueDevicesList = Array.from(new Set(this.devicesList));
// // this.devicesList
// this.devicesList = uniqueDevicesList;
// console.log(this.devicesList, 'this.devicesListthis.devicesList');
// let istrue = false
// this.devicesList.forEach(device => {
// // MAC MAC 6
// let macFromName = device.name.substring(device.name.length - 12);
// console.log(macFromName, 'macFromNamemacFromName');
// // this.mac
// if (macFromName == this.mac) {
// // this.ishave true
// console.log(device);
// this.deviceInfoss = device
// // this.ishave = true;
// istrue = true
// this.createBLEConnection(device)
// console.log('1111111111');
// } else {
// console.log('');
// }
// });
// setTimeout(() => {
// if (!istrue) {
// this.loadingtxt = '...'
// setTimeout(() => {
// this.loadingmask = false
// }, 500)
// }
// }, 500)
// }
// }, 200)
// //
// // this.status = true
// }, 5000)
// },
reboot() {
let vm = this; // this vm
uni.getNetworkType({
@ -3244,83 +3167,8 @@
// }
// }
},
//
Search() {
if (this.status) {
xBlufi.notifyStartDiscoverBle({
'isStart': true
});
//
this.bluthlist = []
this.devicesList = []
//
// this.startBluetoothDevicesDiscovery()
this.statusflag = true
this.status = false
this.texts = '正在扫描蓝牙设备...'
setTimeout(() => {
this.statusflag = false
this.status = true
if (this.searching) {
xBlufi.notifyStartDiscoverBle({
'isStart': false
});
//
if (this.devicesList.length == 0) {
uni.showToast({
title: '暂无发现对应设备,请靠近设备',
icon: 'none'
});
} else {
this.texts = '扫描到以下设备,请点击连接!'
}
} else {
xBlufi.notifyStartDiscoverBle({
'isStart': true
});
}
}, 2000)
}
},
funListenDeviceMsgEvents: function(options) {
let that = this;
switch (options.type) {
case xBlufi.XBLUFI_TYPE.TYPE_STATUS_CONNECTED: {
console.log('状态', options.result)
if (options.result == false) {
this.carstause = false
uni.showToast({
title: '设备断开链接,请重新点击蓝牙链接',
icon: 'none'
});
// uni.showModal({
// title: '',
// content: '',
// showCancel: false,
// success: function(res) {
// // uni.navigateBack({
// // url: '../search/search'
// // });
// }
// });
// this.statusflag = false
// uni.hideLoading();
}
}
break;
}
},
//
btnhd() {
this.tishiflag = false
},
starTime() {
uni.hideLoading()
this.showtcs = false
@ -3340,23 +3188,7 @@
}
}
// OrderdeviceInfos
// const newMarker = {
// id: parseFloat(this.OrderdeviceInfos.sn),
// latitude: parseFloat(this.OrderdeviceInfos.latitude),
// longitude: parseFloat(this.OrderdeviceInfos.longitude),
// width: 40,
// height: 28,
// isDeviceMarker: true, //
// iconPath: 'https://api.ccttiot.com/smartmeter/img/static/uF9qLejuAZErNTrRuHq7',
// };
// //
// const preservedMarkers = this.markers.filter(marker => marker.isCalloutVisible || marker
// .isDeviceMarker);
// // 使markers
// this.markers = [newMarker, ...preservedMarkers];
// this.oldMarkers = [...this.markers];
} else {
//
@ -4351,47 +4183,7 @@
setTimeout(() => {
this.getinfo()
}, )
// let that =this
// wx.login({
// success(res) {
// if (res.code) {
// console.log('', res);
// let data = {
// wxOpenId: res.code,
// };
// let areaId = uni.getStorageSync('areaId');
// that.$u.post('/loginByopenid?jsCode=' + res.code + '&areaId=' + areaId).then(
// res => {
// uni.hideLoading();
// if (res.code == 200) {
// uni.setStorageSync('token', res.token);
// that.$u.get('/app/device/info?sn=' + that.sn).then((res) => {
// if (res.code === 200) {
// } else {
// }
// })
// } else if (res.code == 501) {
// uni.showToast({
// title: res.msg,
// icon: 'none',
// duration: 2000
// });
// } else {
// // console.log("",res.data)
// uni.redirectTo({
// url: '/pages/login/login'
// })
// }
// });
// }
// },
// });
}
});
@ -4803,6 +4595,8 @@
})
}
},
deviceInfo(num) {
if (uni.getStorageSync('token')) {

View File

@ -27,15 +27,12 @@
</view> -->
<view class="top_box" style="margin-top: 20rpx;">
<view class="left_text" @click="shows=true">
{{tit}} <view class="iconfont icon-xiangxia1"></view>
{{tit}}
<view class="iconfont icon-xiangxia1"></view>
</view>
<view class="sear_ipt">
<input type="text"
v-model="searchKeyword"
placeholder="请输入内容"
class="input"
placeholder-style="color:#C7CDD3"
@input="search()">
<input type="text" v-model="searchKeyword" placeholder="请输入内容" class="input"
placeholder-style="color:#C7CDD3" @input="search()">
</view>
</view>
<view class="tap">
@ -104,23 +101,23 @@
<view class="half_info_li">
车辆编号{{item.sn}}
</view>
<view class="half_info_li" >
<view class="half_info_li">
租赁时长{{computedList(item)}}
</view>
</view>
<view class="info_li">
<view class="half_info_li">
订单费用{{item.totalFee}}
</view>
<view class="half_info_li" v-if="item.status==4" >
<view class="half_info_li" v-if="item.status==4">
有无退款<span v-if="item.etRefund==null"></span>
<span v-else style="color: red;"></span>
</view>
</view>
<view class="info_li" v-if="item.unlock_time">
开关时间{{item.unlock_time}} {{ item.return_time ? item.return_time : '--' }}
</view>
@ -175,16 +172,24 @@
<view class="lines"></view>
<view class="order_info">
<view class="info_li">
租赁用户{{item.phonenumber}}
<view class="half_info_li">
租赁用户{{item.phonenumber}}
</view>
<view class="half_info_li" v-if="item.vehicleNum">
车牌号{{item.vehicleNum}}
</view>
<view class="half_info_li" v-else>
车牌号--
</view>
</view>
<view class="info_li">
<view class="half_info_li">
车辆编号{{item.sn}}
</view>
<view class="half_info_li" >
<view class="half_info_li">
租赁时长{{computedList(item)}}
</view>
</view>
<view class="info_li">
订单费用{{item.totalFee}}
@ -240,14 +245,22 @@
<view class="lines"></view>
<view class="order_info">
<view class="info_li">
<view class="info_li">
<view class="half_info_li">
租赁用户{{item.phonenumber}}
</view>
<view class="half_info_li" v-if="item.vehicleNum">
车牌号{{item.vehicleNum}}
</view>
<view class="half_info_li" v-else>
车牌号--
</view>
</view>
<view class="info_li">
<view class="half_info_li">
车辆编号{{item.sn}}
</view>
<view class="half_info_li" >
<view class="half_info_li">
租赁时长{{computedList(item)}}
</view>
</view>
@ -307,27 +320,35 @@
<view class="lines"></view>
<view class="order_info">
<view class="info_li">
租赁用户{{item.phonenumber}}
<view class="half_info_li">
租赁用户{{item.phonenumber}}
</view>
<view class="half_info_li" v-if="item.vehicleNum">
车牌号{{item.vehicleNum}}
</view>
<view class="half_info_li" v-else>
车牌号--
</view>
</view>
<view class="info_li">
<view class="half_info_li">
车辆编号{{item.sn}}
</view>
<view class="half_info_li" >
<view class="half_info_li">
租赁时长{{computedList(item)}}
</view>
</view>
<view class="info_li">
<view class="half_info_li">
订单费用{{item.totalFee}}
<view class="info_li">
<view class="half_info_li">
订单费用{{item.totalFee}}
</view>
<view class="half_info_li" v-if="item.status==4">
有无退款<span v-if="item.etRefund==null"></span>
<span v-else style="color: red;"></span>
</view>
</view>
<view class="half_info_li" v-if="item.status==4" >
有无退款<span v-if="item.etRefund==null"></span>
<span v-else style="color: red;"></span>
</view>
</view>
<view class="info_li" v-if="item.unlock_time">
开关时间{{item.unlock_time}} {{ item.return_time ? item.return_time : '--' }}
</view>
@ -372,7 +393,7 @@
</view>
</view>
</view>
<view class="tip_box" v-if="showgj">
<view class="tip_box" v-if="showgj">
<view class="top">
<view class="tip">
改价
@ -390,7 +411,7 @@
</view>
<view class="ipt_box">
<view class="text">
停车点外调度费
停车点外调度费
</view>
<view class="ipt">
<input type="text" v-model="orderInfo.manageFee" placeholder="0.00" class="input"
@ -536,9 +557,9 @@
initialValues: {
},
areaId:false,
tit:'手机号',
shows:false,
areaId: false,
tit: '手机号',
shows: false,
list: [{
value: '1',
label: '手机号'
@ -547,10 +568,10 @@
value: '2',
label: '车牌号'
},
],
typeidx:'1',
typeidx: '1',
}
},
@ -559,12 +580,12 @@
// ...
});
if(uni.getStorageSync('adminAreaid')){
if (uni.getStorageSync('adminAreaid')) {
this.areaId = uni.getStorageSync('adminAreaid')
this.orderList()
}
},
watch: {
curtitidx(newValue, oldValue) {
@ -593,53 +614,53 @@
searchconfirm(e) {
// console.log(e,'eeeeeeeeee');
this.typeidx = e[0].value
this.tit= e[0].label
this.tit = e[0].label
// console.log(e);
// this.mode = e[0].label
// this.gettype()
},
computedList(item) {
if(item.status==0||item.status==2){
const createTime = new Date(item.createTime);
const payTime = Date.now();
const timeDifference = Math.abs(createTime - payTime);
const hours = Math.floor(timeDifference / (1000 * 60 * 60));
const minutes = Math.floor((timeDifference % (1000 * 60 * 60)) / (1000 * 60));
const seconds = Math.floor((timeDifference % (1000 * 60)) / 1000);
let result = '';
if (hours > 0) {
result += `${hours}小时`;
}
if (minutes > 0 || hours > 0) { //
result += `${minutes}`;
}
// result += `${seconds}`; //
return result;
}else{
const createTime = new Date(item.createTime);
const payTime = new Date(item.returnTime);
const timeDifference = Math.abs(createTime - payTime);
const hours = Math.floor(timeDifference / (1000 * 60 * 60));
const minutes = Math.floor((timeDifference % (1000 * 60 * 60)) / (1000 * 60));
const seconds = Math.floor((timeDifference % (1000 * 60)) / 1000);
let result = '';
if (hours > 0) {
result += `${hours}小时`;
}
if (minutes > 0 || hours > 0) { //
result += `${minutes}`;
}
// result += `${seconds}`; //
return result;
}
if (item.status == 0 || item.status == 2) {
const createTime = new Date(item.createTime);
const payTime = Date.now();
const timeDifference = Math.abs(createTime - payTime);
const hours = Math.floor(timeDifference / (1000 * 60 * 60));
const minutes = Math.floor((timeDifference % (1000 * 60 * 60)) / (1000 * 60));
const seconds = Math.floor((timeDifference % (1000 * 60)) / 1000);
let result = '';
if (hours > 0) {
result += `${hours}小时`;
}
if (minutes > 0 || hours > 0) { //
result += `${minutes}`;
}
// result += `${seconds}`; //
return result;
} else {
const createTime = new Date(item.createTime);
const payTime = new Date(item.returnTime);
const timeDifference = Math.abs(createTime - payTime);
const hours = Math.floor(timeDifference / (1000 * 60 * 60));
const minutes = Math.floor((timeDifference % (1000 * 60 * 60)) / (1000 * 60));
const seconds = Math.floor((timeDifference % (1000 * 60)) / 1000);
let result = '';
if (hours > 0) {
result += `${hours}小时`;
}
if (minutes > 0 || hours > 0) { //
result += `${minutes}`;
}
// result += `${seconds}`; //
return result;
}
},
toOrderDetail(id) {
uni.navigateTo({
@ -788,23 +809,23 @@
orderList() {
let data = {};
if (this.typeidx == 1) {
data = {
phonenumber: this.searchKeyword,
type: '1',
status: '',
startTime: this.firsTime,
endTime: this.lasTime,
areaId: this.areaId
};
data = {
phonenumber: this.searchKeyword,
type: '1',
status: '',
startTime: this.firsTime,
endTime: this.lasTime,
areaId: this.areaId
};
} else if (this.typeidx == 2) { // this.typeidx == 2
data = {
vehicleNum: this.searchKeyword,
type: '1',
status: '',
startTime: this.firsTime,
endTime: this.lasTime,
areaId: this.areaId
};
data = {
vehicleNum: this.searchKeyword,
type: '1',
status: '',
startTime: this.firsTime,
endTime: this.lasTime,
areaId: this.areaId
};
}
this.loading = false
this.$u.get('/appVerify/order/list?', data).then((res) => {
@ -823,23 +844,23 @@
orderList1() {
let data = {};
if (this.typeidx == 1) {
data = {
phonenumber: this.searchKeyword,
type: '1',
status: '',
startTime: this.firsTime,
endTime: this.lasTime,
areaId: this.areaId
};
data = {
phonenumber: this.searchKeyword,
type: '1',
statusList: '0,2',
startTime: this.firsTime,
endTime: this.lasTime,
areaId: this.areaId
};
} else if (this.typeidx == 2) { // this.typeidx == 2
data = {
vehicleNum: this.searchKeyword,
type: '1',
status: '',
startTime: this.firsTime,
endTime: this.lasTime,
areaId: this.areaId
};
data = {
vehicleNum: this.searchKeyword,
type: '1',
statusList: '0,2',
startTime: this.firsTime,
endTime: this.lasTime,
areaId: this.areaId
};
}
this.loading = false
this.$u.get('/appVerify/order/list?', data).then((res) => {
@ -857,23 +878,23 @@
orderList2() {
let data = {};
if (this.typeidx == 1) {
data = {
phonenumber: this.searchKeyword,
type: '1',
status: '',
startTime: this.firsTime,
endTime: this.lasTime,
areaId: this.areaId
};
data = {
phonenumber: this.searchKeyword,
type: '1',
statusList: '1,3',
startTime: this.firsTime,
endTime: this.lasTime,
areaId: this.areaId
};
} else if (this.typeidx == 2) { // this.typeidx == 2
data = {
vehicleNum: this.searchKeyword,
type: '1',
status: '',
startTime: this.firsTime,
endTime: this.lasTime,
areaId: this.areaId
};
data = {
vehicleNum: this.searchKeyword,
type: '1',
statusList: '1,3',
startTime: this.firsTime,
endTime: this.lasTime,
areaId: this.areaId
};
}
this.loading = false
this.$u.get('/appVerify/order/list?', data).then((res) => {
@ -891,23 +912,23 @@
orderList3() {
let data = {};
if (this.typeidx == 1) {
data = {
phonenumber: this.searchKeyword,
type: '1',
status: '',
startTime: this.firsTime,
endTime: this.lasTime,
areaId: this.areaId
};
data = {
phonenumber: this.searchKeyword,
type: '1',
status: '4',
startTime: this.firsTime,
endTime: this.lasTime,
areaId: this.areaId
};
} else if (this.typeidx == 2) { // this.typeidx == 2
data = {
vehicleNum: this.searchKeyword,
type: '1',
status: '',
startTime: this.firsTime,
endTime: this.lasTime,
areaId: this.areaId
};
data = {
vehicleNum: this.searchKeyword,
type: '1',
status: '4',
startTime: this.firsTime,
endTime: this.lasTime,
areaId: this.areaId
};
}
this.loading = false
this.$u.get('/appVerify/order/list?', data).then((res) => {
@ -934,7 +955,7 @@
this.orderList3()
}
},
swiperchange(e) {
swiperchange(e) {
this.curtitidx = e.detail.current
console.log(e, 'eeeeeeeee');
},
@ -1234,20 +1255,20 @@
}
.top_box {
display: flex;
flex-wrap: nowrap;
align-items: center;
padding: 28rpx 30rpx;
// padding: 20rpx 0;
margin: 0 auto;
width: 672rpx;
height: 100rpx;
background: #FFFFFF;
box-shadow: 0rpx 4rpx 22rpx 0rpx rgba(0, 0, 0, 0.07);
border-radius: 10rpx 10rpx 10rpx 10rpx;
.left_text {
display: flex;
flex-wrap: nowrap;
@ -1256,18 +1277,19 @@
font-weight: 400;
font-size: 32rpx;
color: #3D3D3D;
.icon-xiangxia1{
.icon-xiangxia1 {
font-size: 26rpx;
}
}
.timebox {
width: 75%;
display: flex;
flex-wrap: nowrap;
align-items: center;
margin-left: 34rpx;
.left_time {
text-align: center;
margin-right: 6rpx;
@ -1279,7 +1301,7 @@
font-size: 32rpx;
color: #979797;
}
.right_time {
text-align: center;
margin-left: 6rpx;
@ -1293,7 +1315,7 @@
}
}
}
}
</style>

View File

@ -106,7 +106,7 @@
</view>
</view>
</view>
<view class="info_card" style="margin-top: 20rpx;" v-if="deviceInfos.etOrders!=''">
<view class="info_card" style="margin-top: 20rpx;" v-if="deviceInfos.etOrders[0]">
<view class="info_tit">
最后订单信息
</view>
@ -158,7 +158,7 @@
<view class="btn" @click="btn(4)">
响铃寻车
</view>
<view class="btn" @click="bulebtn(1)">
<!-- <view class="btn" @click="bulebtn(1)">
蓝牙响铃
</view>
<view class="btn" @click="bulebtn(2)">
@ -166,16 +166,16 @@
</view>
<view class="btn" @click="bulebtn(3)">
蓝牙关锁
</view>
</view> -->
<view class="btn" @click="bulebtn(4)">
设备重启
</view>
<view class="btn" @click="tipshow=true" v-if="info.type==1">
<!-- <view class="btn" @click="tipshow=true" v-if="info.type==1">
维修处理
</view>
<view class="btn" @click="tipshow=true" v-if="info.type==2">
换电处理
</view>
</view> -->
</view>
<u-mask :show="false" @click="show = false" :z-index='100' />
<view class="tip_box" v-if="false">
@ -412,6 +412,71 @@
}
}
},
btn(num) {
if (num == 0) {
this.$u.post('/appVerify/admin/unlocking?sn=' + this.sn).then((res) => {
if (res.code === 200) {
// 线
this.deviceInfo()
}else{
this.bulebtn(2)
}
}).catch(error => {
console.error("Error fetching area data:", error);
});
} else if (num == 1) {
this.$u.post('/appVerify/admin/lock?sn=' + this.sn).then((res) => {
if (res.code === 200) {
// 线
this.deviceInfo()
}else{
this.bulebtn(3)
}
}).catch(error => {
console.error("Error fetching area data:", error);
});
} else if (num == 2) {
this.$u.post('/appVerify/device/offline?sn=' + this.sn).then((res) => {
if (res.code === 200) {
// 线
this.deviceInfo()
}
}).catch(error => {
console.error("Error fetching area data:", error);
});
} else if (num == 3) {
this.$u.post('/appVerify/device/online?sn=' + this.sn).then((res) => {
if (res.code === 200) {
// 线
this.deviceInfo()
}
}).catch(error => {
console.error("Error fetching area data:", error);
});
} else if (num == 4) {
uni.showLoading({})
this.$u.post('/app/device/ring?sn=' + this.sn).then((res) => {
if (res.code === 200) {
uni.hideLoading()
} else {
uni.hideLoading()
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
});
this.bulebtn(1)
}
})
}
},
Binddevice() {
uni.getBluetoothAdapterState({
@ -540,6 +605,7 @@
customData: "11open"
});
vm.maskloading=false
vm.deviceInfo()
// uni.hideLoading()
// vm.remakr()
},
@ -567,6 +633,7 @@
customData: "11close"
});
vm.maskloading=false
vm.deviceInfo()
// uni.hideLoading()
// vm.remakr()
},
@ -594,6 +661,7 @@
customData: "11play1@"
});
vm.maskloading=false
vm.deviceInfo()
// uni.hideLoading()
// vm.remakr()
},
@ -936,65 +1004,7 @@
this.tishiflag = false
},
btn(num) {
if (num == 0) {
this.$u.post('/appVerify/admin/unlocking?sn=' + this.sn).then((res) => {
if (res.code === 200) {
// 线
this.deviceInfo()
}
}).catch(error => {
console.error("Error fetching area data:", error);
});
} else if (num == 1) {
this.$u.post('/appVerify/admin/lock?sn=' + this.sn).then((res) => {
if (res.code === 200) {
// 线
this.deviceInfo()
}
}).catch(error => {
console.error("Error fetching area data:", error);
});
} else if (num == 2) {
this.$u.post('/appVerify/device/offline?sn=' + this.sn).then((res) => {
if (res.code === 200) {
// 线
this.deviceInfo()
}
}).catch(error => {
console.error("Error fetching area data:", error);
});
} else if (num == 3) {
this.$u.post('/appVerify/device/online?sn=' + this.sn).then((res) => {
if (res.code === 200) {
// 线
this.deviceInfo()
}
}).catch(error => {
console.error("Error fetching area data:", error);
});
} else if (num == 4) {
uni.showLoading({})
this.$u.post('/app/device/ring?sn=' + this.sn).then((res) => {
if (res.code === 200) {
uni.hideLoading()
} else {
uni.hideLoading()
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
});
}
})
}
},
status() {
if (this.deviceInfos.onlineStatus == 0) {
return '离线'