小鹿骑行
This commit is contained in:
parent
81559044f4
commit
8172e79a76
|
@ -1,7 +1,7 @@
|
|||
const install = (Vue, vm) => {
|
||||
uni.setStorageSync('deptId', 100);
|
||||
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: 'https://ele.ccttiot.com/prod-api', //线上
|
||||
// baseUrl: 'https://cc.ccttiot.com/prod-api', //叉车线上
|
||||
|
|
|
@ -507,6 +507,17 @@
|
|||
},
|
||||
onLoad(option) {
|
||||
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()
|
||||
console.log(option)
|
||||
if (option.modelId) {
|
||||
|
|
|
@ -493,7 +493,7 @@
|
|||
this.status4 = []
|
||||
this.status8 = []
|
||||
this.status9 = []
|
||||
this.status6 = []
|
||||
this.status6 = []
|
||||
// 重新分类设备
|
||||
this.listData.forEach(item => {
|
||||
if (item.status == 0) {
|
||||
|
|
|
@ -45,6 +45,33 @@
|
|||
开启后用户必须先进行实名认证才可使用
|
||||
</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="tops">
|
||||
<view class="card_left">
|
||||
|
|
|
@ -977,7 +977,6 @@ import { showLoading } from "../../components/blufi/util"
|
|||
setTimeout(()=>{
|
||||
this.jieliuflag = true
|
||||
},2000)
|
||||
|
||||
}else {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
|
@ -1030,19 +1029,6 @@ import { showLoading } from "../../components/blufi/util"
|
|||
setTimeout(()=>{
|
||||
this.jieliuflag = true
|
||||
},2000)
|
||||
// let that = this
|
||||
// uni.showModal({
|
||||
// title: '提示',
|
||||
// content: '正在尝试使用蓝牙控制,蓝牙连接需尽可能靠近车辆!',
|
||||
// showCancel: true,
|
||||
// success: function(res) {
|
||||
// if (res.confirm) {
|
||||
// that.lanya(0)
|
||||
// } else if (res.cancel) {
|
||||
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
}else{
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
|
@ -1334,7 +1320,7 @@ import { showLoading } from "../../components/blufi/util"
|
|||
// iconPath: 'https://lxnapi.ccttiot.com/bike/img/static/u6jBvj7S50FPgsHaHXai',
|
||||
iconPath: this.deviceInfos.onlineStatus == 0 ?
|
||||
'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: {
|
||||
content: this.deviceInfos.remainingPower + '%', // 修改为你想要显示的文字内容
|
||||
color: '#ffffff', // 修改为文字颜色
|
||||
|
@ -1854,18 +1840,6 @@ import { showLoading } from "../../components/blufi/util"
|
|||
transform: scale(0.95);
|
||||
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{
|
||||
margin-top: 26rpx;
|
||||
|
|
|
@ -201,29 +201,6 @@
|
|||
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
|
||||
// })
|
||||
// }
|
||||
})
|
||||
},
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
<image src="https://api.ccttiot.com/smartmeter/img/static/uO1TOFA1vdxQlz3NJenN" class="ljimg"
|
||||
mode=""></image> 连接中...
|
||||
</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"
|
||||
mode=""></image> 点击连接
|
||||
</view>
|
||||
|
@ -87,7 +87,7 @@
|
|||
<image src="https://api.ccttiot.com/smartmeter/img/static/uTgSwUguPEJ56MSeZo4c" mode=""></image>
|
||||
<view class="zuqi">
|
||||
<view class="one">
|
||||
您已骑行<text>{{Number(remainingTime) < 0 ? '0' : remainingTime}}</text>
|
||||
您已骑行<text>{{getRemainingTimeText}}</text>
|
||||
</view>
|
||||
<view class="two">
|
||||
预计金额¥{{qixingobj.rideFee}}
|
||||
|
@ -242,9 +242,15 @@
|
|||
isUploading: false,// 上传状态锁
|
||||
isRefreshing: false,
|
||||
orderid:'',
|
||||
qixingobj:{}
|
||||
qixingobj:{},
|
||||
shibainum:0
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
getRemainingTimeText() {
|
||||
return Number(this.remainingTime) < 0 ? '0' : this.remainingTime;
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
if (option.id) {
|
||||
this.orderid = option.id
|
||||
|
@ -261,7 +267,7 @@
|
|||
onShow() {
|
||||
setTimeout(()=>{
|
||||
if(this.ver_dataflag == 3){
|
||||
console.log('11')
|
||||
// console.log('11')
|
||||
}else{
|
||||
xBlufi.initXBlufi(1)
|
||||
xBlufi.notifyStartDiscoverBle({
|
||||
|
@ -287,7 +293,7 @@
|
|||
if (this.findDeviceTimer) {
|
||||
clearTimeout(this.findDeviceTimer)
|
||||
this.findDeviceTimer = null
|
||||
console.log('清除定时器1')
|
||||
// console.log('清除定时器1')
|
||||
}
|
||||
},
|
||||
onUnload() {
|
||||
|
@ -296,7 +302,7 @@
|
|||
if (this.findDeviceTimer) {
|
||||
clearTimeout(this.findDeviceTimer)
|
||||
this.findDeviceTimer = null
|
||||
console.log('清除定时器2')
|
||||
// console.log('清除定时器2')
|
||||
}
|
||||
},
|
||||
// 组件销毁时清除定时器
|
||||
|
@ -304,18 +310,26 @@
|
|||
clearTimeout(this.uploadTimer)
|
||||
},
|
||||
methods: {
|
||||
// 点击连接
|
||||
btnlj(){
|
||||
this.findDevice()
|
||||
},
|
||||
// 点击断开
|
||||
btndk(){
|
||||
xBlufi.notifyConnectBle({
|
||||
isStart: false,
|
||||
deviceId: this.deviceid,
|
||||
name: this.name
|
||||
let that = this
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
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(){
|
||||
|
@ -324,7 +338,7 @@
|
|||
isHighAccuracy: true,
|
||||
accuracy:'best',
|
||||
success: (res) => {
|
||||
console.log('精确坐标:', res)
|
||||
// console.log('精确坐标:', res)
|
||||
this.lslat = res.latitude
|
||||
this.lslon = res.longitude
|
||||
},
|
||||
|
@ -358,7 +372,7 @@
|
|||
title: '加载中...',
|
||||
mask: true
|
||||
})
|
||||
console.log(that.lslat,that.lslon,'开坐垫锁');
|
||||
// console.log(that.lslat,that.lslon,'开坐垫锁');
|
||||
if (that.ver_dataflag == 3) {
|
||||
xBlufi.notifySendCustomData({
|
||||
customData: "11hpen@"
|
||||
|
@ -384,17 +398,7 @@
|
|||
showCancel: true,
|
||||
success: function(res) {
|
||||
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) {
|
||||
|
||||
}
|
||||
|
@ -447,7 +451,7 @@
|
|||
}
|
||||
})
|
||||
} else if (res.cancel) {
|
||||
console.log('取消') // 用户点击取消
|
||||
// console.log('取消') // 用户点击取消
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -533,7 +537,7 @@
|
|||
this.ver_dataflag = 2
|
||||
// 使用 find 方法查找匹配的设备
|
||||
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)
|
||||
})
|
||||
if (matchedDevice) {
|
||||
|
@ -548,9 +552,27 @@
|
|||
})
|
||||
this.deviceid = matchedDevice.deviceId
|
||||
this.devicename = matchedDevice.name
|
||||
console.log(this.deviceid, '11221')
|
||||
} 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();
|
||||
// console.log('原始数据:', dataStr);
|
||||
const dataObj = {};
|
||||
dataStr.split(',').forEach(part => {
|
||||
const [key, value] = part.split(':').map(item => item.trim());
|
||||
if (!key || value === undefined) return;
|
||||
switch (key) {
|
||||
case 'status': dataObj.status = value; break;
|
||||
case 'bat': dataObj.bat = parseFloat(value); break;
|
||||
case 'csq': dataObj.csq = parseInt(value); break;
|
||||
case 'lat': dataObj.lat = parseFloat(value); break;
|
||||
case 'lon': dataObj.lon = parseFloat(value); break;
|
||||
case 'q': dataObj.q = parseInt(value); break;
|
||||
case 's': dataObj.s = parseInt(value); break;
|
||||
}
|
||||
})
|
||||
|
||||
// 判断数据格式:检查是否包含@或,分隔符
|
||||
let separator = ',';
|
||||
if (dataStr.includes('@')) {
|
||||
separator = '@';
|
||||
}
|
||||
|
||||
// console.log('使用分隔符:', separator);
|
||||
|
||||
dataStr.split(separator).forEach(part => {
|
||||
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. 获取定位
|
||||
uni.getLocation({
|
||||
type: 'gcj02',
|
||||
isHighAccuracy: true,
|
||||
success: (res) => {
|
||||
this.submitData({
|
||||
...dataObj,
|
||||
lon: res.longitude,
|
||||
lat: res.latitude
|
||||
})
|
||||
},
|
||||
fail: () => {
|
||||
this.submitData({
|
||||
...dataObj,
|
||||
lon: 0,
|
||||
lat: 0
|
||||
})
|
||||
}
|
||||
type: 'gcj02',
|
||||
isHighAccuracy: true,
|
||||
success: (res) => {
|
||||
this.submitData({
|
||||
...dataObj,
|
||||
lon: res.longitude,
|
||||
lat: res.latitude
|
||||
})
|
||||
},
|
||||
fail: () => {
|
||||
this.submitData({
|
||||
...dataObj,
|
||||
lon: dataObj.lon || 0,
|
||||
lat: dataObj.lat || 0
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
|
@ -645,13 +714,13 @@
|
|||
const payload = {
|
||||
mac: this.mac,
|
||||
sys: {
|
||||
bat: Number(data.bat) || 0,
|
||||
csq: Number(data.csq) || 0,
|
||||
s: Number(data.s) ?? null,
|
||||
q: Number(data.q) ?? null,
|
||||
bat: data.bat !== undefined && data.bat !== null ? Number(data.bat) : 0,
|
||||
csq: data.csq !== undefined && data.csq !== null ? Number(data.csq) : 0,
|
||||
s: data.s !== undefined && data.s !== null ? Number(data.s) : null,
|
||||
q: data.q !== undefined && data.q !== null ? Number(data.q) : null,
|
||||
status: String(data.status || '0'),
|
||||
lon: Number(data.lon) || 0,
|
||||
lat: Number(data.lat) || 0
|
||||
lon: data.lon !== undefined && data.lon !== null ? Number(data.lon) : 0,
|
||||
lat: data.lat !== undefined && data.lat !== null ? Number(data.lat) : 0
|
||||
}
|
||||
}
|
||||
this.bluetoothData = payload
|
||||
|
@ -680,7 +749,7 @@
|
|||
if (!this.bluetoothData || this.isUploading) return
|
||||
this.isUploading = true
|
||||
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 => {
|
||||
if(res.code == 200) {
|
||||
console.log('上传蓝牙数据成功',this.bluetoothData, new Date().toLocaleTimeString())
|
||||
|
@ -1055,7 +1124,7 @@
|
|||
} else if (res.cancel) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}else{
|
||||
|
@ -1193,17 +1262,7 @@
|
|||
showCancel: true,
|
||||
success: function(res) {
|
||||
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) {
|
||||
|
||||
}
|
||||
|
@ -1246,7 +1305,6 @@
|
|||
duration: 2000
|
||||
})
|
||||
setTimeout(()=>{
|
||||
// that.getorderdevice()
|
||||
uni.navigateTo({
|
||||
url:'/page_user/yongche/orderxq?id=' + that.deivceobj.orderId
|
||||
})
|
||||
|
@ -1277,6 +1335,11 @@
|
|||
name: that.name
|
||||
})
|
||||
that.getorderdevice()
|
||||
setTimeout(()=>{
|
||||
uni.navigateTo({
|
||||
url:'/page_user/yongche/orderxq?id=' + that.deivceobj.orderId
|
||||
})
|
||||
},1000)
|
||||
},1000)
|
||||
}
|
||||
}else if(res.msg == null) {
|
||||
|
@ -1351,6 +1414,11 @@
|
|||
})
|
||||
uni.hideLoading()
|
||||
that.getorderdevice()
|
||||
setTimeout(()=>{
|
||||
uni.navigateTo({
|
||||
url:'/page_user/yongche/orderxq?id=' + that.deivceobj.orderId
|
||||
})
|
||||
},1000)
|
||||
},1000)
|
||||
}
|
||||
}else if(res.msg == null) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user