bug修复 新功能添加

This commit is contained in:
tx 2024-08-26 17:56:55 +08:00
parent 261c0f187a
commit 1ff9f1a705
7 changed files with 467 additions and 173 deletions

View File

@ -1,13 +1,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.46:8080',
baseUrl: 'https://che.chuangtewl.com/prod-api',
// baseUrl: 'https://che.chuangtewl.com/prod-api',
// 测试环境
// baseUrl: 'https://dianche.chuantewulian.cn/prod-api',
baseUrl: 'https://dianche.chuantewulian.cn/prod-api',
// 俞山岛
// baseUrl: 'https://dche.ccttiot.com/prod-api',
// 创特

View File

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

View File

@ -495,15 +495,75 @@
this.loading = true;
this.getArea();
if (res.data.tripRouteStr) {
// 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'
// }, {
// 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]);
// }
// }
this.getpolyline()
uni.hideLoading();
}
}).catch(error => {
console.error("Error fetching area data:", error);
});
},
getpolyline() {
this.$u.post("/system/device/trajectoryByOrderNo?orderNo=" + this.orderId).then((res) => {
if (res.code === 200) {
this.polyline[0].points = JSON.parse(res.data).map(coord => ({
latitude: coord[1],
longitude: coord[0]
}));
let abb;
try {
abb = JSON.parse(res.data.tripRouteStr);
abb = JSON.parse(res.data);
console.log(abb,'abbbb');
} 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]);
@ -525,31 +585,15 @@
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');

View File

@ -12,7 +12,7 @@
<view style="width: 650rpx;margin: 0 auto;">
<slider-range :value="rangeValue" :min="rangeMin" :max="rangMax" :step="1" :bar-height="3"
:block-size="20" background-color="#EEEEF6" active-color="#4C97E7" :format="format"
:decorationVisible="true" @change="handleRangeChange" ></slider-range>
:decorationVisible="true" @change="handleRangeChange" @regionchange="onMapRegionChange"></slider-range>
</view>
</view>
@ -24,6 +24,10 @@
<view class="park" @click="toggleIconAndCallout">
<image src="https://lxnapi.ccttiot.com/bike/img/static/uRiYQZQEb3l2LsltEsyW" mode=""></image>
</view>
<view class="park" @click="showdevList=!showdevList" style="bottom: 600rpx;">
<image src=" https://lxnapi.ccttiot.com/bike/img/static/uSMkyrHwO1sybH8diPuF" mode=""></image>
</view>
<view @touchmove.stop.prevent="() => {}">
<view class="btn_box">
<view class="btn1" @click="qecodelock()">
@ -133,7 +137,32 @@
</view> -->
</view>
</view>
<view class="fixdivce" v-if="nearbyMarkers.length>1&&showdevList">
<view class="scrollable-content">
<view class="divce_li" v-for="(item,index) in nearbyMarkers" :key="index" @click="tapsn(item.sn)">
<view class="left_img">
<image src="https://lxnapi.ccttiot.com/bike/img/static/uEW2Zm3sO8E5eqOf2wwl" mode=""></image>
</view>
<view class="right_cont">
<view class="right_top">
<view class="right_top_left">
<image src=" https://lxnapi.ccttiot.com/bike/img/static/u9pggdTCxcZgUTNsEvXQ" mode="" v-if="item.remainingPower<=39" ></image>
<image src="https://lxnapi.ccttiot.com/bike/img/static/uu1004113wsUShxo11X9" mode="" v-if="item.remainingPower>=40&&item.remainingPower<=69"></image>
<image src="https://lxnapi.ccttiot.com/bike/img/static/uRI1LMpzqfIM060BO7np" mode="" v-if="item.remainingPower>=70&&item.remainingPower<=100"></image>
{{item.remainingPower}}%
</view>
<view class="right_top_right">
状态{{status(item)}}
</view>
</view>
<view class="right_bot">
SN:{{item.sn}}
</view>
</view>
</view>
</view>
</view>
<tab-bar :indexs='1' style=""></tab-bar>
</view>
</template>
@ -174,7 +203,9 @@
statusidx: '-0',
deviceNum: {},
areaId: 0,
showIconAndCallout: false
showIconAndCallout: false,
nearbyMarkers: [],
showdevList:false
}
@ -237,6 +268,25 @@
},
},
methods: {
status(item) {
if (item.status == 0) {
return '仓库中'
} else if (item.status == 1) {
return '待租'
} else if (item.status == 2) {
return '预约中'
} else if (item.status == 3) {
return '骑行中'
} else if (item.status == 4) {
return '临时锁车中'
} else if (item.status == 6) {
return '调度中'
} else if (item.status == 7) {
return '未绑定'
} else if (item.status == 8) {
return '禁用中'
}
},
onMapRegionChange(event) {
// console.log('regionchange', event)
// console.log('', event.detail.scale);
@ -259,6 +309,27 @@
fail: (err) => {}
})
},
onMapRegionChange(event) {
// console.log('regionchange', event)
if (event.detail.type == 'end') {
this.getCenterLanLat()
}
//
},
getCenterLanLat() {
let that = this
uni.createMapContext("map", this).getCenterLocation({
type: 'gcj02',
success: (res) => {
// console.log("", res)
// that.deviceGps.latitude = res.latitude;
// that.deviceGps.longitude = res.longitude;
this.getNearbyMarkers(res.latitude, res.longitude);
//
},
fail: (err) => {}
})
},
getareaid() {
this.$u.post('/appVerify/getAreaId').then((res) => {
if (res.code == 200) {
@ -296,6 +367,11 @@
},
})
},
tapsn(sn){
uni.navigateTo({
url: '/pages_admin/order/device_detail?id=' + sn
})
},
qecodelock() {
uni.scanCode({
onlyFromCamera: true,
@ -411,6 +487,34 @@
}
},
getNearbyMarkers(clickedLat, clickedLon) {
console.log(clickedLat,clickedLon);
const nearbyMarkers = this.listData.filter(item => {
if (item.latitude && item.longitude) {
const distance = this.haversineDistance(
parseFloat(clickedLat),
parseFloat(clickedLon),
parseFloat(item.latitude),
parseFloat(item.longitude)
);
return distance <= 100;
}
return false;
});
this.nearbyMarkers = nearbyMarkers
console.log('Nearby markers within 15 meters:', nearbyMarkers);
},
haversineDistance(lat1, lon1, lat2, lon2) {
const R = 6371e3; // Earth radius in meters
const toRad = angle => angle * Math.PI / 180;
const dLat = toRad(lat2 - lat1);
const dLon = toRad(lon2 - lon1);
const a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +
Math.cos(toRad(lat1)) * Math.cos(toRad(lat2)) *
Math.sin(dLon / 2) * Math.sin(dLon / 2);
const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
return R * c;
},
todetail() {
for (let item of this.fixdata) {
if (item.sn == this.sn) {
@ -937,7 +1041,79 @@
.page {
width: 750rpx;
.fixdivce {
padding: 12rpx 22rpx 12rpx 22rpx;
position: fixed;
left: 0;
top: 25vh;
width: 334rpx;
height: 460rpx;
background: #FFFFFF;
border-radius: 0 40rpx 40rpx 0;
box-shadow: 0rpx 4rpx 10rpx 0rpx rgba(0, 0, 0, 0.3);
.scrollable-content::-webkit-scrollbar {
display: none;
}
.scrollable-content {
height: 100%;
overflow-y: auto;
.divce_li:last-child {
border-bottom: 1rpx solid #fff;
}
.divce_li {
padding: 10rpx 0;
display: flex;
flex-wrap: nowrap;
align-items: center;
border-bottom: 1rpx solid #D8D8D8;
.left_img {
image {
width: 44rpx;
height: 70rpx;
}
}
.right_cont {
margin-left: 20rpx;
display: flex;
flex-wrap: wrap;
font-weight: 400;
font-size: 24rpx;
color: #3D3D3D;
.right_top {
width: 100%;
display: flex;
flex-wrap: nowrap;
align-items: center;
.right_top_left {
display: flex;
flex-wrap: nowrap;
align-items: center;
image {
margin-right: 6rpx;
width: 12rpx;
height: 26rpx;
}
}
.right_top_right {
margin-left: auto;
}
}
.right_bot {
margin-top: 8rpx;
}
}
}
}
}
.decice_cont {
display: flex;
flex-wrap: wrap;

View File

@ -187,9 +187,12 @@
<view class="btn" @click="btn(7)">
车牌修改
</view>
<view class="btn" @click="btn(8)">
<view class="btn" @click="btn(9)">
坐垫锁
</view>
<view class="btn" @click="btn(10)">
定位更新
</view>
<!-- <view class="btn" @click="tipshow=true" v-if="info.type==1">
维修处理
</view>
@ -660,7 +663,7 @@
uni.showLoading({
title:'加载中...'
})
this.$u.post('/appVerify/device/seatCushionLock?sn=' + this.sn).then((res) => {
this.$u.post('/appVerify/device/reboot?sn=' + this.sn).then((res) => {
if (res.code == 200) {
this.deviceInfo()
uni.showToast({
@ -695,6 +698,26 @@
});
}
})
}else if (num == 10) {
uni.showLoading({
title:'加载中...'
})
this.$u.post('/appVerify/refreshDevice?sn=' + this.sn).then((res) => {
if (res.code == 200) {
this.deviceInfo()
uni.showToast({
title: '操作成功',
icon: 'none',
duration: 2000
});
} else {
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
});
}
})
}
},

View File

@ -55,13 +55,13 @@
网络状态<span style="color: #FF4444;">离线</span>
</view>
<view class="half_infoli" v-if="deviceInfos.onlineStatus==1">
网络状态<span >在线</span>
网络状态<span>在线</span>
</view>
<view class="half_infoli" v-if="deviceInfos.lockStatus==0">
锁状态<span >关锁</span>
锁状态<span>关锁</span>
</view>
<view class="half_infoli" v-if="deviceInfos.lockStatus==1">
锁状态<span >开锁</span>
锁状态<span>开锁</span>
</view>
</view>
<view class="info_li">
@ -132,7 +132,8 @@
实收<span>{{orderInfo.totalFee}}</span>
</view>
<view class="info_li">
支付方式<span v-if="orderInfo.payType=='yj'">押金抵扣</span><span v-if="orderInfo.payType=='wx'">微信支付</span>
支付方式<span v-if="orderInfo.payType=='yj'">押金抵扣</span><span
v-if="orderInfo.payType=='wx'">微信支付</span>
</view>
<view class="info_li" v-if="orderInfo.rule" style="display: inline-block;">
计费模板<span>{{orderInfo.rule.name}}</span>
@ -303,12 +304,10 @@
<view class="btn" @click="unpass" v-if="orderInfo.status==5">
有损坏
</view>
<view class="btn" @click="showck=true"
v-if="orderInfo.status==6">
<view class="btn" @click="showck=true" v-if="orderInfo.status==6">
押金扣款
</view>
<view class="btn" @click="backpass()"
v-if="orderInfo.status==6">
<view class="btn" @click="backpass()" v-if="orderInfo.status==6">
撤销损坏
</view>
<view class="btn" @click="callPhone">
@ -560,14 +559,14 @@
showck: false,
money: '',
areaNum: 1,
showload:false,
showfzhc:false,
showgj:false,
deviceInfos:{},
dispatchFee:0,
manageFee:0,
ridingFee:0,
appointmentFee:0,
showload: false,
showfzhc: false,
showgj: false,
deviceInfos: {},
dispatchFee: 0,
manageFee: 0,
ridingFee: 0,
appointmentFee: 0,
}
},
@ -619,17 +618,17 @@
},
methods: {
backpass(){
this.showload=true
backpass() {
this.showload = true
uni.showLoading({
title:'加载中...'
title: '加载中...'
})
let data = {
orderNo: this.orderId,
"status": "5"
}
this.$u.put("/appVerify/order/damaged", data).then((res) => {
this.showload=false
this.showload = false
if (res.code === 200) {
uni.hideLoading()
// 线
@ -666,7 +665,7 @@
return '骑行中'
} else if (this.deviceInfos.status == 4) {
return '临时锁车中'
}else if (this.deviceInfos.status == 6) {
} else if (this.deviceInfos.status == 6) {
return '调度中'
} else if (this.deviceInfos.status == 8) {
return '下线'
@ -675,7 +674,7 @@
},
deviceInfo() {
this.$u.get('/app/device/info?sn=' + this.orderInfo.sn).then((res) => {
console.log(res,'rererer');
console.log(res, 'rererer');
if (res.code === 200) {
this.deviceInfos = res.data
@ -683,7 +682,7 @@
this.$forceUpdate()
}else{
} else {
uni.showToast({
title: res.msg,
icon: 'none',
@ -693,9 +692,9 @@
})
},
//
openBtn(){
openBtn() {
uni.showLoading({
title:'加载中...'
title: '加载中...'
})
this.$u.post('/appVerify/admin/unlocking?sn=' + this.orderInfo.sn).then((res) => {
@ -707,7 +706,7 @@
icon: 'none',
duration: 2000
});
}else{
} else {
uni.showToast({
title: res.msg,
icon: 'none',
@ -719,9 +718,9 @@
});
},
//
closeBtn(){
closeBtn() {
uni.showLoading({
title:'加载中...'
title: '加载中...'
})
this.$u.post('/appVerify/admin/lock?sn=' + this.orderInfo.sn).then((res) => {
if (res.code == 200) {
@ -732,7 +731,7 @@
icon: 'none',
duration: 2000
});
}else{
} else {
uni.showToast({
title: res.msg,
icon: 'none',
@ -744,9 +743,9 @@
});
},
//
yjdkBtn(){
yjdkBtn() {
uni.showLoading({
title:'加载中'
title: '加载中'
})
let data = {
orderNo: this.orderInfo.orderNo,
@ -777,7 +776,7 @@
//
changeMoney() {
uni.showLoading({
title:'加载中'
title: '加载中'
})
let data = {
orderNo: this.orderInfo.orderNo,
@ -816,7 +815,7 @@
},
backDevice() {
uni.showLoading({
title:'加载中'
title: '加载中'
})
this.$u.post('/appVerify/device/return?orderNo=' + this.orderInfo.orderNo + '&returnType=2').then((
res) => {
@ -843,9 +842,9 @@
},
ckmoney() {
uni.showLoading({
title:'加载中...'
title: '加载中...'
})
this.showload=true
this.showload = true
if (this.money != '') {
let data = {
@ -855,7 +854,7 @@
audioFiles: ''
}
this.$u.put("/appVerify/order/submitAudit", data).then((res) => {
this.showload=false
this.showload = false
uni.hideLoading()
if (res.code === 200) {
// 线
@ -887,16 +886,16 @@
},
unpass() {
this.showload=true
this.showload = true
uni.showLoading({
title:'加载中...'
title: '加载中...'
})
let data = {
orderNo: this.orderId,
"status": "6"
}
this.$u.put("/appVerify/order/damaged", data).then((res) => {
this.showload=false
this.showload = false
if (res.code === 200) {
uni.hideLoading()
// 线
@ -918,13 +917,13 @@
});
},
pass() {
this.showload=true
this.showload = true
uni.showLoading({
title:'加载中...'
title: '加载中...'
})
this.$u.post("/appVerify/passAudit/" + this.orderId).then((res) => {
uni.hideLoading()
this.showload=false
this.showload = false
if (res.code === 200) {
// 线
this.getOrderDetail()
@ -1291,13 +1290,61 @@
this.loading = true
this.latitude = parseFloat(this.orderInfo.latitude)
this.longitude = parseFloat(this.orderInfo.longitude)
this.polyline[0].points = JSON.parse(res.data.tripRouteStr).map(coord => ({
this.getpolyline()
// this.polyline[0].points = JSON.parse(res.data.tripRouteStr).map(coord => ({
// latitude: coord[1],
// longitude: coord[0]
// }));
// 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'
// });
// }
}
// console.log(points,'');
// this.polyline[0].points=points
}).catch(error => {
console.error("Error fetching area data:", error);
});
},
getpolyline() {
this.$u.post("/system/device/trajectoryByOrderNo?orderNo=" + this.orderId).then((res) => {
if (res.code === 200) {
this.polyline[0].points = JSON.parse(res.data).map(coord => ({
latitude: coord[1],
longitude: coord[0]
}));
let abb;
try {
abb = JSON.parse(res.data.tripRouteStr);
abb = JSON.parse(res.data);
console.log(abb,'abbbb');
} catch (error) {
console.error("Error parsing tripRouteStr:", error);
return;
@ -1326,12 +1373,11 @@
});
}
}
// console.log(points,'');
// this.polyline[0].points=points
}).catch(error => {
console.error("Error fetching area data:", error);
});
}
}
}
@ -1346,6 +1392,7 @@
.page {
padding-bottom: 200rpx;
width: 750rpx;
.bot_btn {
position: fixed;
@ -1359,6 +1406,7 @@
// background: linear-gradient( 180deg, #FFFFFF 0%, rgba(255,255,255,0) 100%);
box-shadow: 0rpx 10rpx 64rpx 0rpx rgba(0, 0, 0, 0.08);
border-radius: 0rpx 0rpx 0rpx 0rpx;
// padding-bottom: 40rpx;
.btn:nth-child(4n) {
margin-right: 0;
@ -1381,6 +1429,7 @@
color: #3D3D3D;
}
}
.tip_box1 {
position: fixed;
left: 72rpx;

View File

@ -389,6 +389,8 @@
return '骑行中'
} else if (item.status == 4) {
return '临时锁车中'
} else if (item.status == 6) {
return '调度中'
} else if (item.status == 7) {
return '未绑定'
} else if (item.status == 8) {