小鹿骑行

This commit is contained in:
3321822538@qq.com 2025-06-23 11:26:03 +08:00
parent 81559044f4
commit 8172e79a76
7 changed files with 190 additions and 133 deletions

View File

@ -1,7 +1,7 @@
const install = (Vue, vm) => { const install = (Vue, vm) => {
uni.setStorageSync('deptId', 100); uni.setStorageSync('deptId', 100);
Vue.prototype.$u.http.setConfig({ Vue.prototype.$u.http.setConfig({
// baseUrl: 'http://192.168.2.89:4101', //键辉本地 // baseUrl: 'http://192.168.2.19:4101', //键辉本地
// baseUrl: 'http://192.168.0.102:4101', //景森本地 // baseUrl: 'http://192.168.0.102:4101', //景森本地
baseUrl: 'https://ele.ccttiot.com/prod-api', //线上 baseUrl: 'https://ele.ccttiot.com/prod-api', //线上
// baseUrl: 'https://cc.ccttiot.com/prod-api', //叉车线上 // baseUrl: 'https://cc.ccttiot.com/prod-api', //叉车线上

View File

@ -507,6 +507,17 @@
}, },
onLoad(option) { onLoad(option) {
xBlufi.initXBlufi(1) xBlufi.initXBlufi(1)
this.$u.get("/app/orderDevice/mineUsing").then((res) => {
if (res.code == 200) {
if (res.data) {
uni.switchTab({
url:'/pages/myorder/returned/index'
})
} else {
}
}
})
this.getQiniuToken() this.getQiniuToken()
console.log(option) console.log(option)
if (option.modelId) { if (option.modelId) {

View File

@ -493,7 +493,7 @@
this.status4 = [] this.status4 = []
this.status8 = [] this.status8 = []
this.status9 = [] this.status9 = []
this.status6 = [] this.status6 = []
// //
this.listData.forEach(item => { this.listData.forEach(item => {
if (item.status == 0) { if (item.status == 0) {

View File

@ -45,6 +45,33 @@
开启后用户必须先进行实名认证才可使用 开启后用户必须先进行实名认证才可使用
</view> </view>
</view> </view>
<view class="card_li" v-if="shimflag == true">
<view class="tops">
<view class="card_left">
最低用车年龄
</view>
<view class="card_right">
<input type="number" v-model="form.minAge" placeholder=" " class="input"
placeholder-style="color:#C7CDD3" style="width: 100rpx;">
</view>
</view>
<view class="tips">
用户年龄不满足最低年龄不可使用
</view>
</view>
<view class="card_li">
<view class="tops">
<view class="card_left">
换车校验位置
</view>
<view class="card_right">
<u-switch v-model="form.changeCheck"></u-switch>
</view>
</view>
<view class="tips">
开启后用户换车是否需要校验位置
</view>
</view>
<view class="card_li"> <view class="card_li">
<view class="tops"> <view class="tops">
<view class="card_left"> <view class="card_left">

View File

@ -977,7 +977,6 @@ import { showLoading } from "../../components/blufi/util"
setTimeout(()=>{ setTimeout(()=>{
this.jieliuflag = true this.jieliuflag = true
},2000) },2000)
}else { }else {
uni.hideLoading() uni.hideLoading()
uni.showToast({ uni.showToast({
@ -1030,19 +1029,6 @@ import { showLoading } from "../../components/blufi/util"
setTimeout(()=>{ setTimeout(()=>{
this.jieliuflag = true this.jieliuflag = true
},2000) },2000)
// let that = this
// uni.showModal({
// title: '',
// content: '使',
// showCancel: true,
// success: function(res) {
// if (res.confirm) {
// that.lanya(0)
// } else if (res.cancel) {
// }
// }
// })
}else{ }else{
uni.hideLoading() uni.hideLoading()
uni.showToast({ uni.showToast({
@ -1334,7 +1320,7 @@ import { showLoading } from "../../components/blufi/util"
// iconPath: 'https://lxnapi.ccttiot.com/bike/img/static/u6jBvj7S50FPgsHaHXai', // iconPath: 'https://lxnapi.ccttiot.com/bike/img/static/u6jBvj7S50FPgsHaHXai',
iconPath: this.deviceInfos.onlineStatus == 0 ? iconPath: this.deviceInfos.onlineStatus == 0 ?
'https://lxnapi.ccttiot.com/bike/img/static/uQRng4QNKA38Amk8Wgt5' : 'https://lxnapi.ccttiot.com/bike/img/static/uQRng4QNKA38Amk8Wgt5' :
'https://lxnapi.ccttiot.com/bike/img/static/uocjFo8Ar2BJVpzC2G2f', 'https://lxnapi.ccttiot.com/bike/img/static/uocjFo8Ar2BJVpzC2G2f',
callout: { callout: {
content: this.deviceInfos.remainingPower + '%', // content: this.deviceInfos.remainingPower + '%', //
color: '#ffffff', // color: '#ffffff', //
@ -1854,18 +1840,6 @@ import { showLoading } from "../../components/blufi/util"
transform: scale(0.95); transform: scale(0.95);
filter: drop-shadow(0 0 5px rgba(255, 0, 0, 0.3)); /* 减弱发光 */ filter: drop-shadow(0 0 5px rgba(255, 0, 0, 0.3)); /* 减弱发光 */
} }
// .lypic{
// display: flex;
// align-items: center;
// font-size: 24rpx;
// color: #3D3D3D;
// margin-right: 22rpx;
// image{
// width: 36rpx;
// height: 36rpx;
// margin-right: 8rpx;
// }
// }
} }
.bikexx{ .bikexx{
margin-top: 26rpx; margin-top: 26rpx;

View File

@ -201,29 +201,6 @@
duration: 2000 duration: 2000
}) })
} }
// if(res.code == 200){
// uni.showToast({
// title: '',
// icon: 'success',
// duration: 2000
// })
// setTimeout(()=>{
// uni.hideLoading()
// // uni.switchTab({
// // url:'/pages/myorder/returned/index'
// // })
// uni.redirectTo({
// url:'/page_user/yongche/orderxq?id=' + this.orderId
// })
// },2000)
// }else{
// uni.hideLoading()
// uni.showToast({
// title: res.msg,
// icon: 'none',
// duration: 2000
// })
// }
}) })
}, },

View File

@ -26,7 +26,7 @@
<image src="https://api.ccttiot.com/smartmeter/img/static/uO1TOFA1vdxQlz3NJenN" class="ljimg" <image src="https://api.ccttiot.com/smartmeter/img/static/uO1TOFA1vdxQlz3NJenN" class="ljimg"
mode=""></image> 连接中... mode=""></image> 连接中...
</view> </view>
<view class="lanya" @click="btnlj" v-if="ver_dataflag == 1" style="display: flex;align-items: center;color: rgb(245, 108, 108);"> <view class="lanya" @click="findDevice" v-if="ver_dataflag == 1" style="display: flex;align-items: center;color: rgb(245, 108, 108);">
<image src="https://api.ccttiot.com/smartmeter/img/static/uO1TOFA1vdxQlz3NJenN" class="ljimg" <image src="https://api.ccttiot.com/smartmeter/img/static/uO1TOFA1vdxQlz3NJenN" class="ljimg"
mode=""></image> 点击连接 mode=""></image> 点击连接
</view> </view>
@ -87,7 +87,7 @@
<image src="https://api.ccttiot.com/smartmeter/img/static/uTgSwUguPEJ56MSeZo4c" mode=""></image> <image src="https://api.ccttiot.com/smartmeter/img/static/uTgSwUguPEJ56MSeZo4c" mode=""></image>
<view class="zuqi"> <view class="zuqi">
<view class="one"> <view class="one">
您已骑行<text>{{Number(remainingTime) < 0 ? '0' : remainingTime}}</text> 您已骑行<text>{{getRemainingTimeText}}</text>
</view> </view>
<view class="two"> <view class="two">
预计金额{{qixingobj.rideFee}} 预计金额{{qixingobj.rideFee}}
@ -242,9 +242,15 @@
isUploading: false,// isUploading: false,//
isRefreshing: false, isRefreshing: false,
orderid:'', orderid:'',
qixingobj:{} qixingobj:{},
shibainum:0
}; };
}, },
computed: {
getRemainingTimeText() {
return Number(this.remainingTime) < 0 ? '0' : this.remainingTime;
}
},
onLoad(option) { onLoad(option) {
if (option.id) { if (option.id) {
this.orderid = option.id this.orderid = option.id
@ -261,7 +267,7 @@
onShow() { onShow() {
setTimeout(()=>{ setTimeout(()=>{
if(this.ver_dataflag == 3){ if(this.ver_dataflag == 3){
console.log('11') // console.log('11')
}else{ }else{
xBlufi.initXBlufi(1) xBlufi.initXBlufi(1)
xBlufi.notifyStartDiscoverBle({ xBlufi.notifyStartDiscoverBle({
@ -287,7 +293,7 @@
if (this.findDeviceTimer) { if (this.findDeviceTimer) {
clearTimeout(this.findDeviceTimer) clearTimeout(this.findDeviceTimer)
this.findDeviceTimer = null this.findDeviceTimer = null
console.log('清除定时器1') // console.log('1')
} }
}, },
onUnload() { onUnload() {
@ -296,7 +302,7 @@
if (this.findDeviceTimer) { if (this.findDeviceTimer) {
clearTimeout(this.findDeviceTimer) clearTimeout(this.findDeviceTimer)
this.findDeviceTimer = null this.findDeviceTimer = null
console.log('清除定时器2') // console.log('2')
} }
}, },
// //
@ -304,18 +310,26 @@
clearTimeout(this.uploadTimer) clearTimeout(this.uploadTimer)
}, },
methods: { methods: {
//
btnlj(){
this.findDevice()
},
// //
btndk(){ btndk(){
xBlufi.notifyConnectBle({ let that = this
isStart: false, uni.showModal({
deviceId: this.deviceid, title: '提示',
name: this.name content: '您确定要断开蓝牙连接吗?',
showCancel: true,
success: function(res) {
if (res.confirm) {
xBlufi.notifyConnectBle({
isStart: false,
deviceId: that.deviceid,
name: that.name
})
that.ver_dataflag = 1
} else if (res.cancel) {
}
}
}) })
this.ver_dataflag = 1
}, },
// //
btnkzds(){ btnkzds(){
@ -324,7 +338,7 @@
isHighAccuracy: true, isHighAccuracy: true,
accuracy:'best', accuracy:'best',
success: (res) => { success: (res) => {
console.log('精确坐标:', res) // console.log(':', res)
this.lslat = res.latitude this.lslat = res.latitude
this.lslon = res.longitude this.lslon = res.longitude
}, },
@ -358,7 +372,7 @@
title: '加载中...', title: '加载中...',
mask: true mask: true
}) })
console.log(that.lslat,that.lslon,'开坐垫锁'); // console.log(that.lslat,that.lslon,'');
if (that.ver_dataflag == 3) { if (that.ver_dataflag == 3) {
xBlufi.notifySendCustomData({ xBlufi.notifySendCustomData({
customData: "11hpen@" customData: "11hpen@"
@ -384,17 +398,7 @@
showCancel: true, showCancel: true,
success: function(res) { success: function(res) {
if (res.confirm) { if (res.confirm) {
if(that.ver_dataflag != 3){
// if(that.ljflag == true){
// uni.showLoading({
// title: '...',
// mask: true
// })
// that.ljflag = false
// that.findDevice()
// that.getchaoshi()
// }
}
} else if (res.cancel) { } else if (res.cancel) {
} }
@ -447,7 +451,7 @@
} }
}) })
} else if (res.cancel) { } else if (res.cancel) {
console.log('取消') // // console.log('') //
} }
} }
}) })
@ -533,7 +537,7 @@
this.ver_dataflag = 2 this.ver_dataflag = 2
// 使 find // 使 find
const matchedDevice = this.devicesarr.find(device => { const matchedDevice = this.devicesarr.find(device => {
console.log(device.name, this.mac, '111') // console.log(device.name, this.mac, '111')
return device.name.slice(-12) == this.mac.slice(-12) return device.name.slice(-12) == this.mac.slice(-12)
}) })
if (matchedDevice) { if (matchedDevice) {
@ -548,9 +552,27 @@
}) })
this.deviceid = matchedDevice.deviceId this.deviceid = matchedDevice.deviceId
this.devicename = matchedDevice.name this.devicename = matchedDevice.name
console.log(this.deviceid, '11221')
} else { } else {
this.findDeviceTimer = setTimeout(this.findDevice.bind(this), 1000) // 使 bind this console.log(this.shibainum,'000000000000000000000000000000000000000000000000000');
if(this.shibainum < 3){
this.shibainum++
this.findDeviceTimer = setTimeout(this.findDevice.bind(this), 1000) // 使 bind this
}else{
this.ver_dataflag = 1
this.shibainum = 0
uni.showModal({
title: '提示',
content: '设备连接失败,请重新点击连接',
showCancel: false,
success: function(res) {
if (res.confirm) {
} else if (res.cancel) {
}
}
})
}
} }
}, },
// //
@ -606,37 +628,84 @@
const dataStr = data.toString(); const dataStr = data.toString();
// console.log(':', dataStr); // console.log(':', dataStr);
const dataObj = {}; const dataObj = {};
dataStr.split(',').forEach(part => {
const [key, value] = part.split(':').map(item => item.trim()); // @,
if (!key || value === undefined) return; let separator = ',';
switch (key) { if (dataStr.includes('@')) {
case 'status': dataObj.status = value; break; separator = '@';
case 'bat': dataObj.bat = parseFloat(value); break; }
case 'csq': dataObj.csq = parseInt(value); break;
case 'lat': dataObj.lat = parseFloat(value); break; // console.log('使:', separator);
case 'lon': dataObj.lon = parseFloat(value); break;
case 'q': dataObj.q = parseInt(value); break; dataStr.split(separator).forEach(part => {
case 's': dataObj.s = parseInt(value); break; if (!part) return; //
}
}) let key, value;
// 使@ key-value : status0@csq0@bat125@...
if (separator === '@') {
// 使
const match = part.match(/^([a-zA-Z]+)(.*)$/);
if (!match) return;
key = match[1];
value = match[2];
} else {
// 使, key:value : status:0,csq:0,bat:125,...
const [keyPart, valuePart] = part.split(':').map(item => item.trim());
if (!keyPart || valuePart === undefined) return;
key = keyPart;
value = valuePart;
}
if (key && value !== undefined) {
switch (key) {
case 'status':
dataObj.status = value;
break;
case 'bat':
dataObj.bat = parseFloat(value);
break;
case 'csq':
dataObj.csq = parseInt(value, 10);
break;
case 'lat':
dataObj.lat = parseFloat(value);
break;
case 'lon':
dataObj.lon = parseFloat(value);
break;
case 'q':
dataObj.q = parseInt(value, 10);
break;
case 's':
dataObj.s = parseInt(value, 10);
break;
}
}
});
// console.log(':', dataObj);
// 2. // 2.
uni.getLocation({ uni.getLocation({
type: 'gcj02', type: 'gcj02',
isHighAccuracy: true, isHighAccuracy: true,
success: (res) => { success: (res) => {
this.submitData({ this.submitData({
...dataObj, ...dataObj,
lon: res.longitude, lon: res.longitude,
lat: res.latitude lat: res.latitude
}) })
}, },
fail: () => { fail: () => {
this.submitData({ this.submitData({
...dataObj, ...dataObj,
lon: 0, lon: dataObj.lon || 0,
lat: 0 lat: dataObj.lat || 0
}) })
} }
}) })
}, },
@ -645,13 +714,13 @@
const payload = { const payload = {
mac: this.mac, mac: this.mac,
sys: { sys: {
bat: Number(data.bat) || 0, bat: data.bat !== undefined && data.bat !== null ? Number(data.bat) : 0,
csq: Number(data.csq) || 0, csq: data.csq !== undefined && data.csq !== null ? Number(data.csq) : 0,
s: Number(data.s) ?? null, s: data.s !== undefined && data.s !== null ? Number(data.s) : null,
q: Number(data.q) ?? null, q: data.q !== undefined && data.q !== null ? Number(data.q) : null,
status: String(data.status || '0'), status: String(data.status || '0'),
lon: Number(data.lon) || 0, lon: data.lon !== undefined && data.lon !== null ? Number(data.lon) : 0,
lat: Number(data.lat) || 0 lat: data.lat !== undefined && data.lat !== null ? Number(data.lat) : 0
} }
} }
this.bluetoothData = payload this.bluetoothData = payload
@ -680,7 +749,7 @@
if (!this.bluetoothData || this.isUploading) return if (!this.bluetoothData || this.isUploading) return
this.isUploading = true this.isUploading = true
this.lastUploadTime = Date.now() this.lastUploadTime = Date.now()
console.log(this.bluetoothData,'this.bluetoothDatathis.bluetoothData') // console.log(this.bluetoothData,'this.bluetoothDatathis.bluetoothData')
this.$u.put(`/app/device/iot/bltUpload`, this.bluetoothData).then(res => { this.$u.put(`/app/device/iot/bltUpload`, this.bluetoothData).then(res => {
if(res.code == 200) { if(res.code == 200) {
console.log('上传蓝牙数据成功',this.bluetoothData, new Date().toLocaleTimeString()) console.log('上传蓝牙数据成功',this.bluetoothData, new Date().toLocaleTimeString())
@ -1055,7 +1124,7 @@
} else if (res.cancel) { } else if (res.cancel) {
} }
} }
}) })
} }
}else{ }else{
@ -1193,17 +1262,7 @@
showCancel: true, showCancel: true,
success: function(res) { success: function(res) {
if (res.confirm) { if (res.confirm) {
// if(that.ver_dataflag != 3){
// if(that.ljflag == true){
// uni.showLoading({
// title: '...',
// mask: true
// })
// that.ljflag = false
// that.findDevice()
// that.getchaoshi()
// }
// }
} else if (res.cancel) { } else if (res.cancel) {
} }
@ -1246,7 +1305,6 @@
duration: 2000 duration: 2000
}) })
setTimeout(()=>{ setTimeout(()=>{
// that.getorderdevice()
uni.navigateTo({ uni.navigateTo({
url:'/page_user/yongche/orderxq?id=' + that.deivceobj.orderId url:'/page_user/yongche/orderxq?id=' + that.deivceobj.orderId
}) })
@ -1277,6 +1335,11 @@
name: that.name name: that.name
}) })
that.getorderdevice() that.getorderdevice()
setTimeout(()=>{
uni.navigateTo({
url:'/page_user/yongche/orderxq?id=' + that.deivceobj.orderId
})
},1000)
},1000) },1000)
} }
}else if(res.msg == null) { }else if(res.msg == null) {
@ -1351,6 +1414,11 @@
}) })
uni.hideLoading() uni.hideLoading()
that.getorderdevice() that.getorderdevice()
setTimeout(()=>{
uni.navigateTo({
url:'/page_user/yongche/orderxq?id=' + that.deivceobj.orderId
})
},1000)
},1000) },1000)
} }
}else if(res.msg == null) { }else if(res.msg == null) {