From e07dbe517c2c7b6017680ae3acb624bda8f58976 Mon Sep 17 00:00:00 2001
From: Sliverber <2622874537@qq.com>
Date: Sat, 6 Jul 2024 18:04:41 +0800
Subject: [PATCH] 11
---
common/http.interceptor.js | 6 +-
manifest.json | 2 +-
page_fix/repair/repair_detail.vue | 60 ++--
page_user/good_list.vue | 96 ++++--
page_user/xcjs.vue | 315 +++++++++++++++-----
pages/index/index.vue | 436 ++++++++--------------------
pages_admin/admin_order.vue | 336 +++++++++++----------
pages_admin/order/device_detail.vue | 138 +++++----
8 files changed, 723 insertions(+), 666 deletions(-)
diff --git a/common/http.interceptor.js b/common/http.interceptor.js
index 4313401..6664e34 100644
--- a/common/http.interceptor.js
+++ b/common/http.interceptor.js
@@ -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
diff --git a/manifest.json b/manifest.json
index da040ab..04af682 100644
--- a/manifest.json
+++ b/manifest.json
@@ -51,7 +51,7 @@
/* 小程序特有相关 */
"mp-weixin" : {
"libVersion" : "latest",
- "appid" : "wx3428c498d5061192",
+ "appid" : "wx4d178f8c80348214",
"setting" : {
"urlCheck" : false
},
diff --git a/page_fix/repair/repair_detail.vue b/page_fix/repair/repair_detail.vue
index 426bd1e..2802ff8 100644
--- a/page_fix/repair/repair_detail.vue
+++ b/page_fix/repair/repair_detail.vue
@@ -202,9 +202,12 @@
换电后电量
-
+
{{info.afterElectric}}%
+
+ --
+
@@ -241,7 +244,7 @@
响铃寻车
-
+
设备重启
@@ -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(){
diff --git a/page_user/good_list.vue b/page_user/good_list.vue
index b049d73..dddb1d6 100644
--- a/page_user/good_list.vue
+++ b/page_user/good_list.vue
@@ -2,7 +2,7 @@
-
+
电单车
@@ -10,15 +10,18 @@
已完成
-
+
待支付
+
+ 骑行中
+
时间:{{ item.createTime }}
- 时长:{{ item.duration }}
+ 时长:{{ computedList(item) }}
距离:{{ (item.distance / 1000).toFixed(2) }} 公里
@@ -26,7 +29,7 @@
距离:--公里
-
+
{{item.totalFee}}元
@@ -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() {
diff --git a/page_user/xcjs.vue b/page_user/xcjs.vue
index 6bb84c9..109211a 100644
--- a/page_user/xcjs.vue
+++ b/page_user/xcjs.vue
@@ -4,9 +4,9 @@
height='45'>
-
-
-
+
+
+
@@ -56,11 +56,11 @@
骑行距离
-
- {{ (orderInfo.distance / 1000).toFixed(2) }} 公里
+
+ {{ (orderInfo.distance / 1000).toFixed(2) }} 公里
- --公里
+ --公里
@@ -70,6 +70,9 @@
+
+ 去支付
+
@@ -103,10 +106,15 @@
orderId: '',
orderInfo: {},
loading: false,
- showIconAndCallout:false
+ showIconAndCallout: false,
+ ispaid: false,
+ _mapContext: null
}
},
+ created() {
+ this._mapContext = uni.createMapContext("map", this); //map为map组件id
+ },
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();
}
+
}
}
@@ -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;
diff --git a/pages/index/index.vue b/pages/index/index.vue
index f3979bf..1427278 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -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.$set触发Vue的响应式更新
- 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.$set触发Vue的响应式更新
+ 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')) {
diff --git a/pages_admin/admin_order.vue b/pages_admin/admin_order.vue
index d4685fa..a952779 100644
--- a/pages_admin/admin_order.vue
+++ b/pages_admin/admin_order.vue
@@ -27,15 +27,12 @@
-->
- {{tit}}
+ {{tit}}
+
-
+
@@ -104,23 +101,23 @@
车辆编号:{{item.sn}}
-
+
租赁时长:{{computedList(item)}}
-
+
订单费用:{{item.totalFee}}元
-
-
+
+
有无退款:无
有
-
+
-
+
开关时间:{{item.unlock_time}} {{ item.return_time ? item.return_time : '--' }}
@@ -175,16 +172,24 @@
- 租赁用户:{{item.phonenumber}}
+
+ 租赁用户:{{item.phonenumber}}
+
+
+ 车牌号:{{item.vehicleNum}}
+
+
+ 车牌号:--
+
车辆编号:{{item.sn}}
-
+
租赁时长:{{computedList(item)}}
-
+
订单费用:{{item.totalFee}}元
@@ -240,14 +245,22 @@
-
+
+
租赁用户:{{item.phonenumber}}
+
+ 车牌号:{{item.vehicleNum}}
+
+
+ 车牌号:--
+
+
车辆编号:{{item.sn}}
-
+
租赁时长:{{computedList(item)}}
@@ -307,27 +320,35 @@
- 租赁用户:{{item.phonenumber}}
+
+ 租赁用户:{{item.phonenumber}}
+
+
+ 车牌号:{{item.vehicleNum}}
+
+
+ 车牌号:--
+
车辆编号:{{item.sn}}
-
+
租赁时长:{{computedList(item)}}
-
-
- 订单费用:{{item.totalFee}}元
+
+
+ 订单费用:{{item.totalFee}}元
+
+
+
+ 有无退款:无
+ 有
+
+
-
-
- 有无退款:无
- 有
-
-
-
开关时间:{{item.unlock_time}} {{ item.return_time ? item.return_time : '--' }}
@@ -372,7 +393,7 @@
-
+
改价
@@ -390,7 +411,7 @@
- 停车点外调度费
+ 停车点外调度费
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 @@
}
}
}
-
-
+
+
}
\ No newline at end of file
diff --git a/pages_admin/order/device_detail.vue b/pages_admin/order/device_detail.vue
index 673e10f..402e45b 100644
--- a/pages_admin/order/device_detail.vue
+++ b/pages_admin/order/device_detail.vue
@@ -106,7 +106,7 @@
-
+
最后订单信息
@@ -158,7 +158,7 @@
响铃寻车
-
+
设备重启
-
+
@@ -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 '离线'