开关
This commit is contained in:
parent
96ee640446
commit
98883d3017
|
@ -19,8 +19,8 @@ const install = (Vue, vm) => {
|
||||||
// },
|
// },
|
||||||
// });
|
// });
|
||||||
Vue.prototype.$u.http.setConfig({
|
Vue.prototype.$u.http.setConfig({
|
||||||
baseUrl: 'http://192.168.2.27:10002',
|
// baseUrl: 'http://192.168.2.27:10002',
|
||||||
// baseUrl: 'https://kg.chuangtewl.com/prod-api',
|
baseUrl: 'https://kg.chuangtewl.com/prod-api',
|
||||||
// loadingText: '加载中...',
|
// loadingText: '加载中...',
|
||||||
// loadingTime: 1000,
|
// loadingTime: 1000,
|
||||||
// 设置自定义头部content-type
|
// 设置自定义头部content-type
|
||||||
|
|
|
@ -407,7 +407,7 @@
|
||||||
let devicesarr = options.data
|
let devicesarr = options.data
|
||||||
// console.log(devicesarr,'devicesarrdevicesarr');
|
// console.log(devicesarr,'devicesarrdevicesarr');
|
||||||
devicesarr.forEach(device => {
|
devicesarr.forEach(device => {
|
||||||
const mac = device.name.substring(5)
|
const mac = device.name.slice(-12)
|
||||||
if (device.name.slice(5, 17) == this.qrResult) {
|
if (device.name.slice(5, 17) == this.qrResult) {
|
||||||
this.deviceId = device.deviceId
|
this.deviceId = device.deviceId
|
||||||
this.name = device.name
|
this.name = device.name
|
||||||
|
|
|
@ -510,7 +510,7 @@
|
||||||
let devicesarr = options.data
|
let devicesarr = options.data
|
||||||
// console.log(devicesarr,'devicesarrdevicesarr');
|
// console.log(devicesarr,'devicesarrdevicesarr');
|
||||||
devicesarr.forEach(device => {
|
devicesarr.forEach(device => {
|
||||||
const mac = device.name.substring(5)
|
const mac = device.name.slice(-12)
|
||||||
if (device.name.slice(5, 17) == this.qrResult) {
|
if (device.name.slice(5, 17) == this.qrResult) {
|
||||||
this.deviceId = device.deviceId
|
this.deviceId = device.deviceId
|
||||||
this.name = device.name
|
this.name = device.name
|
||||||
|
|
|
@ -665,7 +665,7 @@
|
||||||
let devicesarr = options.data
|
let devicesarr = options.data
|
||||||
// console.log(devicesarr,'devicesarrdevicesarr')
|
// console.log(devicesarr,'devicesarrdevicesarr')
|
||||||
devicesarr.forEach(device => {
|
devicesarr.forEach(device => {
|
||||||
const mac = device.name.substring(5)
|
const mac = device.name.slice(-12)
|
||||||
if (device.name.slice(5, 17) == this.qrResult) {
|
if (device.name.slice(5, 17) == this.qrResult) {
|
||||||
this.deviceId = device.deviceId
|
this.deviceId = device.deviceId
|
||||||
this.name = device.name
|
this.name = device.name
|
||||||
|
|
|
@ -118,7 +118,7 @@ function string2buffer(str) {
|
||||||
}
|
}
|
||||||
af += s;
|
af += s;
|
||||||
var n1 = parseInt('110' + af.substring(0, 5), 2);
|
var n1 = parseInt('110' + af.substring(0, 5), 2);
|
||||||
var n2 = parseInt('110' + af.substring(5), 2);
|
var n2 = parseInt('110' + af.slice(-12), 2);
|
||||||
if (n1 > 127) n1 -= 256;
|
if (n1 > 127) n1 -= 256;
|
||||||
if (n2 > 127) n2 -= 256;
|
if (n2 > 127) n2 -= 256;
|
||||||
bytes.push(n1);
|
bytes.push(n1);
|
||||||
|
|
|
@ -201,8 +201,8 @@
|
||||||
</view>
|
</view>
|
||||||
<view class="jieshu" v-else>
|
<view class="jieshu" v-else>
|
||||||
<text style="border-right: 1px solid;" @click="btnxudan">续单</text>
|
<text style="border-right: 1px solid;" @click="btnxudan">续单</text>
|
||||||
<text style="justify-content: center;" v-if="detaobj.status == 1" @click="btnljzf">立即支付</text>
|
<!-- <text style="justify-content: center;" v-if="detaobj.status == 1" @click="btnljzf">立即支付</text> -->
|
||||||
<text style="justify-content: center;width: 350rpx;" v-else @click="btnjieshu">结束订单</text>
|
<text style="justify-content: center;width: 350rpx;" @click="btnjieshu">结束订单</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="mask" v-if="jieshufalg"></view>
|
<view class="mask" v-if="jieshufalg"></view>
|
||||||
|
@ -457,7 +457,6 @@
|
||||||
}
|
}
|
||||||
// 格式化时间并打印到控制台
|
// 格式化时间并打印到控制台
|
||||||
this.formattedTime = this.formatTime(this.timeday);
|
this.formattedTime = this.formatTime(this.timeday);
|
||||||
// console.log(formattedTime, 'idsidsids');
|
|
||||||
}, 1000); // 每1000毫秒(1秒)执行一次
|
}, 1000); // 每1000毫秒(1秒)执行一次
|
||||||
},
|
},
|
||||||
formatTime(timeObj) {
|
formatTime(timeObj) {
|
||||||
|
@ -739,7 +738,16 @@
|
||||||
btnjieshu() {
|
btnjieshu() {
|
||||||
// this.getprice()
|
// this.getprice()
|
||||||
// if (this.detaobj.suitFeeMode == 1) {
|
// if (this.detaobj.suitFeeMode == 1) {
|
||||||
if (this.onlineStatus == 1) {
|
let currentTime = new Date();
|
||||||
|
let endTimeString = this.detaobj.suitEndTime
|
||||||
|
let endTimeParts = endTimeString.split(/[- :]/)
|
||||||
|
let endTime = new Date(endTimeParts[0], endTimeParts[1] - 1, endTimeParts[2], endTimeParts[3], endTimeParts[4], endTimeParts[5]);
|
||||||
|
// 比较当前时间和结束时间
|
||||||
|
if (currentTime > endTime) {
|
||||||
|
uni.reLaunch({
|
||||||
|
url:'/pages/shouye/index'
|
||||||
|
})
|
||||||
|
}else if (this.onlineStatus == 1) {
|
||||||
let that = this
|
let that = this
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '提示',
|
title: '提示',
|
||||||
|
@ -985,7 +993,7 @@
|
||||||
// console.log(devicesarr, this.mac, '111')
|
// console.log(devicesarr, this.mac, '111')
|
||||||
devicesarr.forEach(device => {
|
devicesarr.forEach(device => {
|
||||||
const mac = device.name.substring(4)
|
const mac = device.name.substring(4)
|
||||||
if (device.name.slice(5, 17) == this.qrResult) {
|
if (device.name.slice(-12) == this.qrResult) {
|
||||||
this.deviceId = device.deviceId
|
this.deviceId = device.deviceId
|
||||||
this.name = device.name
|
this.name = device.name
|
||||||
// console.log(device.name,this.mac,'222');
|
// console.log(device.name,this.mac,'222');
|
||||||
|
|
|
@ -53,11 +53,15 @@
|
||||||
<image style="width: 386rpx;height: 330rpx;"
|
<image style="width: 386rpx;height: 330rpx;"
|
||||||
src="https://api.ccttiot.com/smartmeter/img/static/uZ4XoCI2KNQzcPKbwGLN" mode="aspectFit"></image>
|
src="https://api.ccttiot.com/smartmeter/img/static/uZ4XoCI2KNQzcPKbwGLN" mode="aspectFit"></image>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="li">
|
||||||
|
<view class="wz">
|
||||||
|
第三:如以上还不行请重新进入小程序
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
<view class="jxcz" @click="btnjxcz">
|
<view class="jxcz" @click="btnjxcz">
|
||||||
我已知晓
|
我已知晓
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="box" v-else>
|
<view class="box" v-else>
|
||||||
<view class="tit" style="display: flex;justify-content: space-between;width: 100%;">
|
<view class="tit" style="display: flex;justify-content: space-between;width: 100%;">
|
||||||
<text>选择服务</text>
|
<text>选择服务</text>
|
||||||
|
@ -153,10 +157,29 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view v-if="swindleflag" class="" style="width: 100%;height: 100vh;position: fixed;top: 0;left: 0;background-color: #000;opacity: .5;z-index: 98;"></view>
|
<view v-if="swindleflag" class="" style="width: 100%;height: 100vh;position: fixed;top: 0;left: 0;background-color: #000;opacity: .5;z-index: 98;"></view>
|
||||||
<view class="mask" v-if="masksss">
|
<view class="mask" v-if="masksss"></view>
|
||||||
|
|
||||||
|
<!-- 服务协议弹框 -->
|
||||||
|
<view class="fuwutc" v-if="yinsiflag">
|
||||||
|
<view class="wenxin">
|
||||||
|
温馨提示
|
||||||
</view>
|
</view>
|
||||||
|
<view class="ty">
|
||||||
|
是否同意
|
||||||
|
</view>
|
||||||
|
<view class="yinsi">
|
||||||
|
《用户服务协议》及《隐私政策》?
|
||||||
|
</view>
|
||||||
|
<view class="anniu">
|
||||||
|
<view class="qx" @click="yinsiflag = false">
|
||||||
|
取消
|
||||||
|
</view>
|
||||||
|
<view class="qd" @click="btnqd">
|
||||||
|
确定
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="mask" v-if="yinsiflag"></view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
@ -166,6 +189,7 @@
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
yinsiflag:false,
|
||||||
flags:false,
|
flags:false,
|
||||||
jzflag:false,
|
jzflag:false,
|
||||||
progress: 0,
|
progress: 0,
|
||||||
|
@ -252,6 +276,9 @@
|
||||||
path: '/pages/shouye/index'
|
path: '/pages/shouye/index'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
mounted() {
|
||||||
|
this.getMyLocation() // 获取并设置自身位置的覆盖物
|
||||||
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
// this.getuserinfo()
|
// this.getuserinfo()
|
||||||
if(uni.getStorageSync('tcid')){
|
if(uni.getStorageSync('tcid')){
|
||||||
|
@ -273,10 +300,12 @@
|
||||||
this.userId = res.data.userId
|
this.userId = res.data.userId
|
||||||
wx.openBluetoothAdapter({
|
wx.openBluetoothAdapter({
|
||||||
success: function (res) {
|
success: function (res) {
|
||||||
|
this.lanyaflag = false
|
||||||
console.log('蓝牙适配器初始化成功');
|
console.log('蓝牙适配器初始化成功');
|
||||||
// 你可以在这里继续调用其他蓝牙相关的API
|
// 你可以在这里继续调用其他蓝牙相关的API
|
||||||
},
|
},
|
||||||
fail: function (err) {
|
fail: function (err) {
|
||||||
|
this.lanyaflag = true
|
||||||
console.error('蓝牙适配器初始化失败,可能是因为没有权限', err);
|
console.error('蓝牙适配器初始化失败,可能是因为没有权限', err);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -309,6 +338,18 @@
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
// 获取自身位置从而获得附近店铺
|
||||||
|
getMyLocation() {
|
||||||
|
uni.getLocation({
|
||||||
|
type: 'wgs84',
|
||||||
|
success: (res) => {
|
||||||
|
console.log(res,'resresres');
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
console.error('获取位置失败:', err);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
//选择套餐
|
//选择套餐
|
||||||
btnactive(item) {
|
btnactive(item) {
|
||||||
console.log(item);
|
console.log(item);
|
||||||
|
@ -451,8 +492,24 @@
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
btnjxcz() {
|
btnjxcz() {
|
||||||
|
wx.openBluetoothAdapter({
|
||||||
|
success: function (res) {
|
||||||
this.czflag = false
|
this.czflag = false
|
||||||
|
this.lanyaflag = false
|
||||||
this.getlanya()
|
this.getlanya()
|
||||||
|
console.log('蓝牙适配器初始化成功');
|
||||||
|
// 你可以在这里继续调用其他蓝牙相关的API
|
||||||
|
},
|
||||||
|
fail: function (err) {
|
||||||
|
this.lanyaflag = true
|
||||||
|
uni.showToast({
|
||||||
|
title: '蓝牙权限获取失败',
|
||||||
|
icon: 'none',
|
||||||
|
duration:2000
|
||||||
|
})
|
||||||
|
console.error('蓝牙适配器初始化失败,可能是因为没有权限', err);
|
||||||
|
}
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
call() {
|
call() {
|
||||||
|
@ -614,24 +671,30 @@
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}else if(this.checked == false) {
|
}else if(this.checked == false) {
|
||||||
let that = this
|
this.yinsiflag = true
|
||||||
uni.showModal({
|
// let that = this
|
||||||
title: '温馨提示',
|
// uni.showModal({
|
||||||
content: '是否同意《用户服务协议》及《隐私政策》?',
|
// title: '温馨提示',
|
||||||
showCancel: true,
|
// content: '是否同意《用户服务协议》及《隐私政策》?',
|
||||||
success: function(res) {
|
// showCancel: true,
|
||||||
if (res.confirm) {
|
// success: function(res) {
|
||||||
that.checked = true
|
// if (res.confirm) {
|
||||||
that.getzhifu()
|
|
||||||
} else if (res.cancel) {
|
// } else if (res.cancel) {
|
||||||
console.log('取消'); // 用户点击取消
|
// console.log('取消'); // 用户点击取消
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
} else{
|
} else{
|
||||||
this.getzhifu()
|
this.getzhifu()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
// 确定同意隐私政策
|
||||||
|
btnqd(){
|
||||||
|
this.yinsiflag = false
|
||||||
|
this.checked = true
|
||||||
|
this.getzhifu()
|
||||||
|
},
|
||||||
// 获取手机号
|
// 获取手机号
|
||||||
getPhoneNumber(e){
|
getPhoneNumber(e){
|
||||||
console.log(e)
|
console.log(e)
|
||||||
|
@ -1133,7 +1196,7 @@
|
||||||
console.log(devicesarr,this.mac,'111');
|
console.log(devicesarr,this.mac,'111');
|
||||||
devicesarr.forEach(device => {
|
devicesarr.forEach(device => {
|
||||||
const mac = device.name.substring(4);
|
const mac = device.name.substring(4);
|
||||||
if (device.name.slice(5, 17) == this.mac.slice(5, 17)) {
|
if (device.name.slice(-12) == this.mac.slice(-12)) {
|
||||||
this.deviceId = device.deviceId
|
this.deviceId = device.deviceId
|
||||||
this.name = device.name
|
this.name = device.name
|
||||||
// console.log(device.name,this.mac,'222');
|
// console.log(device.name,this.mac,'222');
|
||||||
|
@ -1191,7 +1254,7 @@
|
||||||
break;
|
break;
|
||||||
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_START:
|
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_START:
|
||||||
if (!options.result) {
|
if (!options.result) {
|
||||||
this.lanyaflag = true
|
console.log('蓝牙未开启');
|
||||||
// uni.showToast({
|
// uni.showToast({
|
||||||
// title: '蓝牙未开启',
|
// title: '蓝牙未开启',
|
||||||
// icon: 'none',
|
// icon: 'none',
|
||||||
|
@ -1251,6 +1314,59 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
.fuwutc{
|
||||||
|
width: 640rpx;
|
||||||
|
height: 400rpx;
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 30rpx;
|
||||||
|
position: fixed;
|
||||||
|
z-index: 9;
|
||||||
|
top: 600rpx;
|
||||||
|
left: 50%;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
.wenxin{
|
||||||
|
font-size: 36rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
width: 100%;
|
||||||
|
text-align: center;
|
||||||
|
margin-top: 40rpx;
|
||||||
|
}
|
||||||
|
.ty{
|
||||||
|
font-size: 32rpx;
|
||||||
|
width: 100%;
|
||||||
|
text-align: center;
|
||||||
|
margin-top: 40rpx;
|
||||||
|
}
|
||||||
|
.yinsi{
|
||||||
|
font-size: 32rpx;
|
||||||
|
width: 100%;
|
||||||
|
text-align: center;
|
||||||
|
margin-top: 20rpx;
|
||||||
|
}
|
||||||
|
.anniu{
|
||||||
|
display: flex;
|
||||||
|
border-top: 1px solid #D8D8D8;
|
||||||
|
margin-top: 60rpx;
|
||||||
|
.qx{
|
||||||
|
border-right: 1px solid #D8D8D8;
|
||||||
|
width: 50%;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
height: 120rpx;
|
||||||
|
line-height: 110rpx;
|
||||||
|
}
|
||||||
|
.qd{
|
||||||
|
width: 50%;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #000;
|
||||||
|
height: 120rpx;
|
||||||
|
line-height: 110rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
.fangswindle{
|
.fangswindle{
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 500rpx;
|
top: 500rpx;
|
||||||
|
|
|
@ -474,8 +474,6 @@
|
||||||
console.log(e, '蓝牙信息')
|
console.log(e, '蓝牙信息')
|
||||||
const deviceId = e.deviceId
|
const deviceId = e.deviceId
|
||||||
this.deviceId = e.deviceId
|
this.deviceId = e.deviceId
|
||||||
this.Bluetoothmac = e.localName.substring(5) //从第七位开始截取 只取后面的mac号
|
|
||||||
console.log(this.Bluetoothmac, '11111');
|
|
||||||
let name = e.name;
|
let name = e.name;
|
||||||
console.log('点击了,蓝牙准备连接的deviceId:' + e.deviceId);
|
console.log('点击了,蓝牙准备连接的deviceId:' + e.deviceId);
|
||||||
xBlufi.notifyConnectBle({
|
xBlufi.notifyConnectBle({
|
||||||
|
|
|
@ -408,7 +408,7 @@
|
||||||
});
|
});
|
||||||
console.log(e, '蓝牙信息')
|
console.log(e, '蓝牙信息')
|
||||||
const deviceId = e.deviceId
|
const deviceId = e.deviceId
|
||||||
this.Bluetoothmac = e.localName.substring(5) //从第七位开始截取 只取后面的mac号
|
this.Bluetoothmac = e.localName.slice(-12) //从第七位开始截取 只取后面的mac号
|
||||||
console.log(this.Bluetoothmac, '11111');
|
console.log(this.Bluetoothmac, '11111');
|
||||||
let name = e.name;
|
let name = e.name;
|
||||||
console.log('点击了,蓝牙准备连接的deviceId:' + e.deviceId);
|
console.log('点击了,蓝牙准备连接的deviceId:' + e.deviceId);
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
智能开关
|
智能开关
|
||||||
</view>
|
</view>
|
||||||
<view class="mac">
|
<view class="mac">
|
||||||
MAC:{{item.localName.substring(5)}}
|
MAC:{{item.localName.slice(-12)}}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="rt">
|
<view class="rt">
|
||||||
|
@ -302,8 +302,8 @@
|
||||||
});
|
});
|
||||||
console.log(e, '蓝牙信息101010')
|
console.log(e, '蓝牙信息101010')
|
||||||
const deviceId = e.deviceId
|
const deviceId = e.deviceId
|
||||||
this.Bluetoothmac = e.localName.substring(5) //从第七位开始截取 只取后面的mac号
|
this.Bluetoothmac = e.localName.slice(-12) //从第七位开始截取 只取后面的mac号
|
||||||
this.mac = e.localName.substring(5)
|
this.mac = e.localName.slice(-12)
|
||||||
|
|
||||||
let name = e.name;
|
let name = e.name;
|
||||||
xBlufi.notifyConnectBle({
|
xBlufi.notifyConnectBle({
|
||||||
|
|
|
@ -438,22 +438,15 @@
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
let uniqueDevicesList = Array.from(new Set(this.devicesList));
|
let uniqueDevicesList = Array.from(new Set(this.devicesList));
|
||||||
|
|
||||||
// 将去重后的数组重新赋值给 this.devicesList
|
|
||||||
this.devicesList = uniqueDevicesList;
|
this.devicesList = uniqueDevicesList;
|
||||||
// console.log(this.devicesList,'this.devicesListthis.devicesList');
|
|
||||||
this.devicesList.forEach(device => {
|
this.devicesList.forEach(device => {
|
||||||
// 从设备名称中提取 MAC 地址(假设 MAC 地址是设备名称的后6个字符)
|
|
||||||
let macFromName = device.name.substring(device.name.length - 12);
|
let macFromName = device.name.substring(device.name.length - 12);
|
||||||
console.log(macFromName, 'macFromNamemacFromName');
|
console.log(macFromName, 'macFromNamemacFromName');
|
||||||
// 与 this.mac 进行比较
|
// 与 this.mac 进行比较
|
||||||
if (macFromName == this.mac) {
|
if (macFromName == this.mac) {
|
||||||
// 如果相同,则将 this.ishave 设置为 true
|
|
||||||
console.log(device);
|
console.log(device);
|
||||||
this.deviceInfoss = device
|
this.deviceInfoss = device
|
||||||
// this.ishave = true;
|
|
||||||
this.createBLEConnection(device)
|
this.createBLEConnection(device)
|
||||||
|
|
||||||
console.log('对比正确1111111111');
|
console.log('对比正确1111111111');
|
||||||
} else {
|
} else {
|
||||||
console.log('对比错误');
|
console.log('对比错误');
|
||||||
|
@ -702,7 +695,7 @@
|
||||||
console.log(e, '蓝牙信息')
|
console.log(e, '蓝牙信息')
|
||||||
const deviceId = e.deviceId
|
const deviceId = e.deviceId
|
||||||
this.deviceId = e.deviceId
|
this.deviceId = e.deviceId
|
||||||
this.Bluetoothmac = e.localName.substring(5) //从第七位开始截取 只取后面的mac号
|
this.Bluetoothmac = e.localName.slice(-12) //从第七位开始截取 只取后面的mac号
|
||||||
console.log(this.Bluetoothmac, '11111');
|
console.log(this.Bluetoothmac, '11111');
|
||||||
let name = e.name;
|
let name = e.name;
|
||||||
console.log('点击了,蓝牙准备连接的deviceId:' + e.deviceId);
|
console.log('点击了,蓝牙准备连接的deviceId:' + e.deviceId);
|
||||||
|
|
|
@ -844,7 +844,7 @@
|
||||||
let devicesarr = options.data
|
let devicesarr = options.data
|
||||||
// console.log(devicesarr,'devicesarrdevicesarr');
|
// console.log(devicesarr,'devicesarrdevicesarr');
|
||||||
devicesarr.forEach(device => {
|
devicesarr.forEach(device => {
|
||||||
const mac = device.name.substring(5)
|
const mac = device.name.slice(-12)
|
||||||
if (device.name.slice(5, 17) == this.qrResult) {
|
if (device.name.slice(5, 17) == this.qrResult) {
|
||||||
this.deviceId = device.deviceId
|
this.deviceId = device.deviceId
|
||||||
this.name = device.name
|
this.name = device.name
|
||||||
|
|
|
@ -351,7 +351,7 @@
|
||||||
});
|
});
|
||||||
console.log(e, '蓝牙信息')
|
console.log(e, '蓝牙信息')
|
||||||
const deviceId = e.deviceId
|
const deviceId = e.deviceId
|
||||||
this.Bluetoothmac = e.localName.substring(5) //从第七位开始截取 只取后面的mac号
|
this.Bluetoothmac = e.localName.slice(-12) //从第七位开始截取 只取后面的mac号
|
||||||
console.log(this.Bluetoothmac, '11111');
|
console.log(this.Bluetoothmac, '11111');
|
||||||
let name = e.name;
|
let name = e.name;
|
||||||
console.log('点击了,蓝牙准备连接的deviceId:' + e.deviceId);
|
console.log('点击了,蓝牙准备连接的deviceId:' + e.deviceId);
|
||||||
|
|
|
@ -11,10 +11,10 @@
|
||||||
智能收费为按用时和用量智能动态计费,用户提前结束、异常结束、商家关闭订单等操作都将动态智能计算费用
|
智能收费为按用时和用量智能动态计费,用户提前结束、异常结束、商家关闭订单等操作都将动态智能计算费用
|
||||||
</view>
|
</view>
|
||||||
<view class="">
|
<view class="">
|
||||||
例如:1小时2元的收费模式,用户用半小时提前结束订单,实际消费为1元,多收费用将退回原支付账户!
|
例如:5元预存款,单价为1元1小时,用户使用2小时结束订单后,退回3元预存款
|
||||||
</view>
|
</view>
|
||||||
<view class="">
|
<view class="">
|
||||||
提示:当套餐的金额低于5元手续费都按0.05元收取!
|
提示:当订单金额低于5元,手续费都按0.05元收取!
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="tcname">
|
<view class="tcname">
|
||||||
|
|
|
@ -19,22 +19,15 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="mac">
|
<view class="mac">
|
||||||
MAC:{{item.name.substring(5)}}
|
MAC:{{item.name.slice(-12)}}
|
||||||
</view>
|
</view>
|
||||||
<view class="" style="color: #8883F0;margin-top: 10rpx;margin-bottom: 10rpx;text-align: left;">
|
<view class="" style="color: #8883F0;margin-top: 10rpx;margin-bottom: 10rpx;text-align: left;">
|
||||||
蓝牙强度:{{item.RSSI}}
|
蓝牙强度:{{item.RSSI}}
|
||||||
</view>
|
</view>
|
||||||
<!-- <view @click="btnshows(item,index)"
|
|
||||||
style="color: #8883F0;margin-top: 10rpx;margin-bottom: 10rpx;text-align: left;">
|
|
||||||
型号选择:{{item.xuanz == undefined ? '--' : item.xuanz}}
|
|
||||||
</view> -->
|
|
||||||
</view>
|
</view>
|
||||||
<view class="rt" :id="item.deviceId" @click="createBLEConnections(item)">
|
<view class="rt" :id="item.deviceId" @click="createBLEConnections(item)">
|
||||||
<!-- <text style="margin-bottom: 10rpx;" :id="item.deviceId" @click="createBLEConnections(item)">{{item.lj}}</text> -->
|
|
||||||
<text style="margin-bottom: 10rpx;">选择</text>
|
<text style="margin-bottom: 10rpx;">选择</text>
|
||||||
<text v-if="item.sn" style="margin-bottom: 10rpx;margin-top: 30rpx;" @click.stop="btnkongzhi(item.sn)">控制</text>
|
<text v-if="item.sn" style="margin-bottom: 10rpx;margin-top: 30rpx;" @click.stop="btnkongzhi(item.sn)">控制</text>
|
||||||
<!-- <text @click="scanQRCode(item)" style="margin-bottom: 10rpx;">扫码</text>
|
|
||||||
<text :id="item.deviceId" @click="createBLEConnection(item)">录入</text> -->
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
@ -229,7 +222,7 @@
|
||||||
if (options.result) {
|
if (options.result) {
|
||||||
this.devicesList = options.data
|
this.devicesList = options.data
|
||||||
this.devicesList.forEach(device => {
|
this.devicesList.forEach(device => {
|
||||||
const mac = device.name.substring(5)
|
const mac = device.name.slice(-12)
|
||||||
if (device.name == this.qrResult) {
|
if (device.name == this.qrResult) {
|
||||||
this.deviceId = device.deviceId
|
this.deviceId = device.deviceId
|
||||||
this.name = device.name
|
this.name = device.name
|
||||||
|
@ -273,7 +266,7 @@
|
||||||
if (options.result) {
|
if (options.result) {
|
||||||
let uniqueDevicesList = Array.from(new Set(this.devicesList));
|
let uniqueDevicesList = Array.from(new Set(this.devicesList));
|
||||||
this.devicesLists = uniqueDevicesList.map(device => {
|
this.devicesLists = uniqueDevicesList.map(device => {
|
||||||
const deviceId = device.name.substring(5)
|
const deviceId = device.name.slice(-12)
|
||||||
const newDevice = {
|
const newDevice = {
|
||||||
...device,
|
...device,
|
||||||
xuanz: "请选择",
|
xuanz: "请选择",
|
||||||
|
@ -286,7 +279,7 @@
|
||||||
this.devicesList.push(device)
|
this.devicesList.push(device)
|
||||||
let uniqueDevicesList = Array.from(new Set(this.devicesList))
|
let uniqueDevicesList = Array.from(new Set(this.devicesList))
|
||||||
this.devicesLists = uniqueDevicesList.filter(device => {
|
this.devicesLists = uniqueDevicesList.filter(device => {
|
||||||
const deviceId = device.name.substring(5)
|
const deviceId = device.name.slice(-12)
|
||||||
return deviceId
|
return deviceId
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -299,14 +292,14 @@
|
||||||
let arr = []
|
let arr = []
|
||||||
// console.log(this.devicesLists,'101010');
|
// console.log(this.devicesLists,'101010');
|
||||||
this.devicesLists.forEach(item => {
|
this.devicesLists.forEach(item => {
|
||||||
arr.push(item.name.slice(5))
|
arr.push(item.name.slice(-12))
|
||||||
})
|
})
|
||||||
this.arrs = arr.join(',')
|
this.arrs = arr.join(',')
|
||||||
this.$u.get(`/app/device/getExistMac/${this.arrs}`).then(res => {
|
this.$u.get(`/app/device/getExistMac/${this.arrs}`).then(res => {
|
||||||
if (res.code == 200 && Array.isArray(res.data)) {
|
if (res.code == 200 && Array.isArray(res.data)) {
|
||||||
const existingDevices = new Map(res.data.map(item => [item.mac, true]))// 使用Map来存储已找到的MAC
|
const existingDevices = new Map(res.data.map(item => [item.mac, true]))// 使用Map来存储已找到的MAC
|
||||||
this.devicesLists = this.devicesLists.map(device => {
|
this.devicesLists = this.devicesLists.map(device => {
|
||||||
const trimmedName = device.name.slice(5) // 假设name中包含MAC地址的一部分
|
const trimmedName = device.name.slice(-12) // 假设name中包含MAC地址的一部分
|
||||||
const mac = trimmedName // 如果trimmedName直接就是MAC,则不需要再处理
|
const mac = trimmedName // 如果trimmedName直接就是MAC,则不需要再处理
|
||||||
device.found = existingDevices.has(mac) // 添加一个found属性来标记是否找到
|
device.found = existingDevices.has(mac) // 添加一个found属性来标记是否找到
|
||||||
if (device.found) {
|
if (device.found) {
|
||||||
|
@ -346,7 +339,7 @@
|
||||||
|
|
||||||
// 发送开关
|
// 发送开关
|
||||||
createBLEConnections(e) {
|
createBLEConnections(e) {
|
||||||
let Bluetoothmac = e.name.substring(5)
|
let Bluetoothmac = e.name.slice(-12)
|
||||||
uni.reLaunch({
|
uni.reLaunch({
|
||||||
url:'/page_fenbao/device/joinDevice?mac='+Bluetoothmac
|
url:'/page_fenbao/device/joinDevice?mac='+Bluetoothmac
|
||||||
})
|
})
|
||||||
|
|
|
@ -581,6 +581,7 @@
|
||||||
},
|
},
|
||||||
// 连接蓝牙
|
// 连接蓝牙
|
||||||
Binddevice() {
|
Binddevice() {
|
||||||
|
this.devicesList = []
|
||||||
xBlufi.initXBlufi(1);
|
xBlufi.initXBlufi(1);
|
||||||
xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent);
|
xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent);
|
||||||
xBlufi.notifyStartDiscoverBle({
|
xBlufi.notifyStartDiscoverBle({
|
||||||
|
@ -597,17 +598,15 @@
|
||||||
} else {
|
} else {
|
||||||
let uniqueDevicesList = Array.from(new Set(this.devicesList));
|
let uniqueDevicesList = Array.from(new Set(this.devicesList));
|
||||||
this.devicesList = uniqueDevicesList;
|
this.devicesList = uniqueDevicesList;
|
||||||
|
console.log(this.devicesList);
|
||||||
this.devicesList.forEach(device => {
|
this.devicesList.forEach(device => {
|
||||||
let macFromName = device.name.substring(device.name.length - 12);
|
let macFromName = device.name.substring(device.name.length - 12);
|
||||||
console.log(macFromName, 'macFromNamemacFromName');
|
// console.log(macFromName, 'macFromNamemacFromName');
|
||||||
if (macFromName == this.qrResult) {
|
if (macFromName == this.qrResult) {
|
||||||
console.log(device);
|
|
||||||
this.deviceInfoss = device
|
this.deviceInfoss = device
|
||||||
this.createBLEConnection(device)
|
this.createBLEConnection(device)
|
||||||
console.log('对比正确1111111111');
|
|
||||||
} else {
|
} else {
|
||||||
console.log('对比错误');
|
// console.log('对比错误');
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -630,8 +629,6 @@
|
||||||
});
|
});
|
||||||
console.log(e, '蓝牙信息')
|
console.log(e, '蓝牙信息')
|
||||||
this.deviceId = e.deviceId
|
this.deviceId = e.deviceId
|
||||||
this.Bluetoothmac = e.localName.substring(5) //从第七位开始截取 只取后面的mac号
|
|
||||||
console.log(this.Bluetoothmac, '11111');
|
|
||||||
let name = e.name;
|
let name = e.name;
|
||||||
console.log('点击了,蓝牙准备连接的deviceId:' + e.deviceId);
|
console.log('点击了,蓝牙准备连接的deviceId:' + e.deviceId);
|
||||||
xBlufi.notifyConnectBle({
|
xBlufi.notifyConnectBle({
|
||||||
|
|
|
@ -1409,7 +1409,7 @@
|
||||||
let devicesarr = options.data
|
let devicesarr = options.data
|
||||||
console.log(devicesarr, 'devicesarrdevicesarr')
|
console.log(devicesarr, 'devicesarrdevicesarr')
|
||||||
devicesarr.forEach(device => {
|
devicesarr.forEach(device => {
|
||||||
const mac = device.name.substring(5)
|
const mac = device.name.slice(-12)
|
||||||
// console.log(device.name,device.name(5,15), 'macmacmac')
|
// console.log(device.name,device.name(5,15), 'macmacmac')
|
||||||
if (device.name.slice(5, 17) == this.qrResult) {
|
if (device.name.slice(5, 17) == this.qrResult) {
|
||||||
this.deviceId = device.deviceId
|
this.deviceId = device.deviceId
|
||||||
|
|
|
@ -394,7 +394,7 @@
|
||||||
let devicesarr = options.data
|
let devicesarr = options.data
|
||||||
// console.log(devicesarr,'devicesarrdevicesarr')
|
// console.log(devicesarr,'devicesarrdevicesarr')
|
||||||
devicesarr.forEach(device => {
|
devicesarr.forEach(device => {
|
||||||
const mac = device.name.substring(5)
|
const mac = device.name.slice(-12)
|
||||||
if (device.name.slice(5, 17) == this.qrResult) {
|
if (device.name.slice(5, 17) == this.qrResult) {
|
||||||
this.deviceId = device.deviceId
|
this.deviceId = device.deviceId
|
||||||
this.name = device.name
|
this.name = device.name
|
||||||
|
|
|
@ -397,7 +397,7 @@
|
||||||
let devicesarr = options.data
|
let devicesarr = options.data
|
||||||
// console.log(devicesarr,'devicesarrdevicesarr')
|
// console.log(devicesarr,'devicesarrdevicesarr')
|
||||||
devicesarr.forEach(device => {
|
devicesarr.forEach(device => {
|
||||||
const mac = device.name.substring(5)
|
const mac = device.name.slice(-12)
|
||||||
if (device.name.slice(5, 17) == this.qrResult) {
|
if (device.name.slice(5, 17) == this.qrResult) {
|
||||||
this.deviceId = device.deviceId
|
this.deviceId = device.deviceId
|
||||||
this.name = device.name
|
this.name = device.name
|
||||||
|
|
|
@ -540,7 +540,7 @@
|
||||||
console.log(e, '蓝牙信息')
|
console.log(e, '蓝牙信息')
|
||||||
const deviceId = e.deviceId
|
const deviceId = e.deviceId
|
||||||
this.deviceId = e.deviceId
|
this.deviceId = e.deviceId
|
||||||
this.Bluetoothmac = e.localName.substring(5) //从第七位开始截取 只取后面的mac号
|
this.Bluetoothmac = e.localName.slice(-12) //从第七位开始截取 只取后面的mac号
|
||||||
console.log(this.Bluetoothmac, '11111');
|
console.log(this.Bluetoothmac, '11111');
|
||||||
let name = e.name;
|
let name = e.name;
|
||||||
console.log('点击了,蓝牙准备连接的deviceId:' + e.deviceId);
|
console.log('点击了,蓝牙准备连接的deviceId:' + e.deviceId);
|
||||||
|
|
26
pages/tj.vue
26
pages/tj.vue
|
@ -110,8 +110,7 @@
|
||||||
</view>
|
</view>
|
||||||
<view class="shebei">
|
<view class="shebei">
|
||||||
<view class="name">
|
<view class="name">
|
||||||
当前运营情况 <image @click="smflag = !smflag" src="https://api.ccttiot.com/smartmeter/img/static/uvgciot52bbI8bBduvPK" mode=""></image>
|
当前运营情况
|
||||||
<!-- <text v-if="smflag">使用数/总数</text> -->
|
|
||||||
</view>
|
</view>
|
||||||
<view class="bd">
|
<view class="bd">
|
||||||
<view class="one">
|
<view class="one">
|
||||||
|
@ -147,7 +146,6 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// import * as echarts from '@/components/lime-echart/static/echarts.min.js';
|
|
||||||
import * as echarts from '@/components/uni-ec-canvas/echarts.js'
|
import * as echarts from '@/components/uni-ec-canvas/echarts.js'
|
||||||
let chart = null
|
let chart = null
|
||||||
export default {
|
export default {
|
||||||
|
@ -244,14 +242,6 @@
|
||||||
this.gettj()
|
this.gettj()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// getinfo(){
|
|
||||||
// this.$u.get("/app/user/userInfo").then((res) => {
|
|
||||||
// if (res.code == 200) {
|
|
||||||
// this.userobj = res.data
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
// },
|
|
||||||
|
|
||||||
// 点击导航栏回到首页
|
// 点击导航栏回到首页
|
||||||
btnshouye() {
|
btnshouye() {
|
||||||
uni.reLaunch({
|
uni.reLaunch({
|
||||||
|
@ -266,7 +256,7 @@
|
||||||
const day = String(date.getDate()).padStart(2, '0')
|
const day = String(date.getDate()).padStart(2, '0')
|
||||||
return `${year}-${month}-${day}`
|
return `${year}-${month}-${day}`
|
||||||
},
|
},
|
||||||
// 订单营收紫色 订单数蓝色
|
// 订单营收蓝色 订单数紫色
|
||||||
gettimes() {
|
gettimes() {
|
||||||
this.$u.get('/app/dashboard/mchRevenue').then((res) => {
|
this.$u.get('/app/dashboard/mchRevenue').then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
|
@ -285,6 +275,8 @@
|
||||||
this.revenuelist.push(item.incomeAmount)
|
this.revenuelist.push(item.incomeAmount)
|
||||||
this.quantitylist.push(item.orderCount)
|
this.quantitylist.push(item.orderCount)
|
||||||
})
|
})
|
||||||
|
console.log('营收',this.revenuelist);
|
||||||
|
console.log('订单',this.quantitylist);
|
||||||
this.$refs.canvas.init(this.initChart)
|
this.$refs.canvas.init(this.initChart)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -323,7 +315,6 @@
|
||||||
},
|
},
|
||||||
initChart(canvas, width, height, canvasDpr) {
|
initChart(canvas, width, height, canvasDpr) {
|
||||||
let that = this
|
let that = this
|
||||||
console.log(canvas, width, height, canvasDpr)
|
|
||||||
const option = {
|
const option = {
|
||||||
grid: {
|
grid: {
|
||||||
left: 35,
|
left: 35,
|
||||||
|
@ -378,7 +369,7 @@
|
||||||
symbol: 'none',
|
symbol: 'none',
|
||||||
lineStyle: {
|
lineStyle: {
|
||||||
color: '#E0DBFF',
|
color: '#E0DBFF',
|
||||||
width: 4,
|
width: 2,
|
||||||
},
|
},
|
||||||
areaStyle: {
|
areaStyle: {
|
||||||
normal: {
|
normal: {
|
||||||
|
@ -395,7 +386,7 @@
|
||||||
symbol: 'none',
|
symbol: 'none',
|
||||||
lineStyle: {
|
lineStyle: {
|
||||||
color: '#A9D2FF',
|
color: '#A9D2FF',
|
||||||
width: 4,
|
width: 2,
|
||||||
},
|
},
|
||||||
areaStyle: {
|
areaStyle: {
|
||||||
normal: {
|
normal: {
|
||||||
|
@ -407,6 +398,11 @@
|
||||||
},
|
},
|
||||||
data: that.chartData,
|
data: that.chartData,
|
||||||
}],
|
}],
|
||||||
|
tooltip: {
|
||||||
|
trigger: 'axis',
|
||||||
|
triggerOn: 'click',
|
||||||
|
formatter: '时间:{b} \n营收:{c}元\n订单:{c1}单'
|
||||||
|
},
|
||||||
}
|
}
|
||||||
chart = echarts.init(canvas, null, {
|
chart = echarts.init(canvas, null, {
|
||||||
width: width,
|
width: width,
|
||||||
|
|
|
@ -93,7 +93,7 @@ function string2buffer(str) {
|
||||||
}
|
}
|
||||||
af += s;
|
af += s;
|
||||||
var n1 = parseInt('110' + af.substring(0, 5), 2);
|
var n1 = parseInt('110' + af.substring(0, 5), 2);
|
||||||
var n2 = parseInt('110' + af.substring(5), 2);
|
var n2 = parseInt('110' + af.slice(-12), 2);
|
||||||
if (n1 > 127) n1 -= 256;
|
if (n1 > 127) n1 -= 256;
|
||||||
if (n2 > 127) n2 -= 256;
|
if (n2 > 127) n2 -= 256;
|
||||||
bytes.push(n1);
|
bytes.push(n1);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user