11
This commit is contained in:
parent
fbe59000dd
commit
3367519fcb
|
@ -20,7 +20,7 @@ const install = (Vue, vm) => {
|
||||||
// },
|
// },
|
||||||
// });
|
// });
|
||||||
Vue.prototype.$u.http.setConfig({
|
Vue.prototype.$u.http.setConfig({
|
||||||
// baseUrl: 'http://124.221.246.124:2288/dev-api/',
|
// baseUrl: 'http://192.168.2.88/dev-api',
|
||||||
baseUrl: 'https://znb.ccttiot.com/prod-api/',
|
baseUrl: 'https://znb.ccttiot.com/prod-api/',
|
||||||
loadingText: '努力加载中~',
|
loadingText: '努力加载中~',
|
||||||
loadingTime: 800,
|
loadingTime: 800,
|
||||||
|
|
|
@ -131,14 +131,20 @@
|
||||||
channelId:0,
|
channelId:0,
|
||||||
orderid:'',
|
orderid:'',
|
||||||
realprice:0,
|
realprice:0,
|
||||||
payinfo:{}
|
payinfo:{},
|
||||||
|
fl:0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
this.getsxf()
|
this.getsxf()
|
||||||
// this.getdevice()
|
// this.getdevice()
|
||||||
this.eleprice=options.price
|
this.eleprice=options.price
|
||||||
this.tenantBearServiceFee=options.tenantBearServiceFee
|
if(options.tenantBearServiceFee=='true'){
|
||||||
|
this.tenantBearServiceFee=true
|
||||||
|
}else if(options.tenantBearServiceFee=='false'){
|
||||||
|
this.tenantBearServiceFee=false
|
||||||
|
}
|
||||||
|
|
||||||
this.deviceId=options.deviceId
|
this.deviceId=options.deviceId
|
||||||
setTimeout(()=>{
|
setTimeout(()=>{
|
||||||
this.checkPrice('50')
|
this.checkPrice('50')
|
||||||
|
@ -218,14 +224,15 @@
|
||||||
|
|
||||||
checkPrice(item) {
|
checkPrice(item) {
|
||||||
const price = parseFloat(item.replace('元', ''));
|
const price = parseFloat(item.replace('元', ''));
|
||||||
if (this.tenantBearServiceFee==false) {
|
if (this.tenantBearServiceFee==true) {
|
||||||
|
console.log('111');
|
||||||
this.price = price;
|
this.price = price;
|
||||||
this.arrivalAmount=price
|
this.arrivalAmount=price
|
||||||
this.xsf =price*this.fl
|
this.xsf =price*this.fl
|
||||||
this.realprice = parseFloat((this.price + this.xsf).toFixed(2));
|
this.realprice = parseFloat((this.price + this.xsf).toFixed(2));
|
||||||
this.Quantity = price/this.eleprice
|
this.Quantity = price/this.eleprice
|
||||||
} else {
|
} else {
|
||||||
|
console.log('2');
|
||||||
this.price = price;
|
this.price = price;
|
||||||
this.xsf =price*this.fl
|
this.xsf =price*this.fl
|
||||||
this.realprice = parseFloat((this.price).toFixed(2));
|
this.realprice = parseFloat((this.price).toFixed(2));
|
||||||
|
|
|
@ -555,6 +555,7 @@
|
||||||
switch (options.type) {
|
switch (options.type) {
|
||||||
case xBlufi.XBLUFI_TYPE.TYPE_STATUS_CONNECTED: {
|
case xBlufi.XBLUFI_TYPE.TYPE_STATUS_CONNECTED: {
|
||||||
console.log('状态', options.result)
|
console.log('状态', options.result)
|
||||||
|
if( options.result==false){
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '很抱歉提醒你!',
|
title: '很抱歉提醒你!',
|
||||||
content: '小程序与设备异常断开',
|
content: '小程序与设备异常断开',
|
||||||
|
@ -568,6 +569,7 @@
|
||||||
this.statusflag = false
|
this.statusflag = false
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case xBlufi.XBLUFI_TYPE.TYPE_CONNECT_ROUTER_RESULT:
|
case xBlufi.XBLUFI_TYPE.TYPE_CONNECT_ROUTER_RESULT:
|
||||||
|
|
|
@ -163,11 +163,11 @@
|
||||||
if (options.result) {
|
if (options.result) {
|
||||||
let devicesarr = options.data
|
let devicesarr = options.data
|
||||||
// this.devicesList = options.data
|
// this.devicesList = options.data
|
||||||
// console.log(mac,'devicesarrdevicesarr');
|
console.log(devicesarr,'devicesarrdevicesarr');
|
||||||
devicesarr.forEach(device => {
|
devicesarr.forEach(device => {
|
||||||
const mac = device.name.substring(6);
|
const mac = device.name.substring(6);
|
||||||
|
|
||||||
if (device.name.substring(0, 5) === "CTPOW") {
|
if (device.name.substring(0, 4) === "CTPO") {
|
||||||
// this.$u.get(`/app/device/${mac}/isBind`).then((res) => {
|
// this.$u.get(`/app/device/${mac}/isBind`).then((res) => {
|
||||||
// if (res.data == false) {
|
// if (res.data == false) {
|
||||||
this.devicesLists.push(device);
|
this.devicesLists.push(device);
|
||||||
|
|
|
@ -55,7 +55,7 @@
|
||||||
</view>
|
</view>
|
||||||
</view> -->
|
</view> -->
|
||||||
|
|
||||||
<view class="anniu">
|
<view class="anniu" @click="Search">
|
||||||
<button>重新扫描</button>
|
<button>重新扫描</button>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
@ -124,36 +124,16 @@
|
||||||
isband: false,
|
isband: false,
|
||||||
status: false,
|
status: false,
|
||||||
showConfirmModal: false, // 控制弹窗显示的标志
|
showConfirmModal: false, // 控制弹窗显示的标志
|
||||||
|
sn:''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(e) {
|
onLoad(e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
this.mac = e.mac
|
if(e.mac){
|
||||||
this.$u.get(`/app/device/${this.mac}/isBind`).then((res) => {
|
this.sn=e.mac
|
||||||
|
this.$u.get(`/app/device/${ e.mac}/isBind`).then((res) => {
|
||||||
if (res.data == false) {
|
if (res.data == false) {
|
||||||
xBlufi.initXBlufi(1);
|
this.getmacInfo()
|
||||||
console.log("xBlufi", xBlufi.XMQTT_SYSTEM);
|
|
||||||
xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent);
|
|
||||||
xBlufi.notifyStartDiscoverBle({
|
|
||||||
'isStart': true
|
|
||||||
});
|
|
||||||
|
|
||||||
// 两秒后停止蓝牙搜索
|
|
||||||
setTimeout(() => {
|
|
||||||
xBlufi.notifyStartDiscoverBle({
|
|
||||||
'isStart': false
|
|
||||||
});
|
|
||||||
// 判断是否存在浇花器设备
|
|
||||||
if (this.devicesList.length == 0) {
|
|
||||||
uni.showToast({
|
|
||||||
title: '暂无发现对应设备,请靠近设备',
|
|
||||||
icon: 'none'
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
this.texts = '扫描到以下设备,请点击连接!'
|
|
||||||
}
|
|
||||||
this.status = true
|
|
||||||
}, 2000)
|
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '改设备已经被绑定',
|
title: '改设备已经被绑定',
|
||||||
|
@ -162,6 +142,8 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
onShow: function() {
|
onShow: function() {
|
||||||
|
@ -218,6 +200,43 @@
|
||||||
this.videoContext = uni.createVideoContext('myVideo', this)
|
this.videoContext = uni.createVideoContext('myVideo', this)
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getmacInfo(){
|
||||||
|
this.$u.get(`/app/device/sn/${ this.sn}`).then((res) => {
|
||||||
|
if (res.code == 200) {
|
||||||
|
this.mac=res.data.mac
|
||||||
|
xBlufi.initXBlufi(1);
|
||||||
|
console.log("xBlufi", xBlufi.XMQTT_SYSTEM);
|
||||||
|
xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent);
|
||||||
|
xBlufi.notifyStartDiscoverBle({
|
||||||
|
'isStart': true
|
||||||
|
});
|
||||||
|
|
||||||
|
// 两秒后停止蓝牙搜索
|
||||||
|
setTimeout(() => {
|
||||||
|
xBlufi.notifyStartDiscoverBle({
|
||||||
|
'isStart': false
|
||||||
|
});
|
||||||
|
// 判断是否存在浇花器设备
|
||||||
|
if (this.devicesList.length == 0) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '暂无发现对应设备,请靠近设备',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.texts = '扫描到以下设备,请点击连接!'
|
||||||
|
}
|
||||||
|
this.status = true
|
||||||
|
}, 2000)
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: '改设备已经被绑定',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 3000
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
},
|
||||||
openConfirmModal() {
|
openConfirmModal() {
|
||||||
this.showConfirmModal = true;
|
this.showConfirmModal = true;
|
||||||
},
|
},
|
||||||
|
@ -248,65 +267,65 @@
|
||||||
if (this.ishave && this.isband) {
|
if (this.ishave && this.isband) {
|
||||||
uni.setStorageSync('mac', this.mac);
|
uni.setStorageSync('mac', this.mac);
|
||||||
let that = this
|
let that = this
|
||||||
|
// setTimeout(() => {
|
||||||
|
// uni.switchTab({
|
||||||
|
// url: '/pages/index/index'
|
||||||
|
// })
|
||||||
|
// }, )
|
||||||
|
uni.getLocation({
|
||||||
|
type: 'wgs84',
|
||||||
|
success: function (lb) {
|
||||||
|
|
||||||
|
that.gps.lat = lb.latitude;
|
||||||
|
that.gps.lon = lb.longitude;
|
||||||
|
that.$u.put(`/app/device/bind/${that.mac}`, that.gps).then((res) => {
|
||||||
|
if(res.code==200){
|
||||||
|
uni.showToast({
|
||||||
|
title: '绑定成功',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 2000
|
||||||
|
});
|
||||||
|
uni.removeStorageSync('mac');
|
||||||
setTimeout(()=>{
|
setTimeout(()=>{
|
||||||
uni.switchTab({
|
uni.switchTab({
|
||||||
url:'/pages/index/index'
|
url:'/pages/index/index'
|
||||||
})
|
})
|
||||||
},)
|
},)
|
||||||
// uni.getLocation({
|
}else{
|
||||||
// type: 'wgs84',
|
|
||||||
// success: function (lb) {
|
|
||||||
|
|
||||||
// that.gps.lat = lb.latitude;
|
|
||||||
// that.gps.lon = lb.longitude;
|
|
||||||
// that.$u.put(`/app/device/bind/${that.mac}`, that.gps).then((res) => {
|
|
||||||
// if(res.code==200){
|
|
||||||
// uni.showToast({
|
|
||||||
// title: '绑定成功',
|
|
||||||
// icon: 'none',
|
|
||||||
// duration: 2000
|
|
||||||
// });
|
|
||||||
// uni.removeStorageSync('mac');
|
|
||||||
// setTimeout(()=>{
|
|
||||||
// uni.switchTab({
|
|
||||||
// url:'/pages/index/index'
|
|
||||||
// })
|
|
||||||
// },)
|
|
||||||
// }else{
|
|
||||||
|
|
||||||
|
|
||||||
// }
|
}
|
||||||
// })
|
})
|
||||||
|
|
||||||
// }, fail: function (error) {
|
}, fail: function (error) {
|
||||||
// console.error('获取位置信息失败:', error);
|
console.error('获取位置信息失败:', error);
|
||||||
// that.gps.lat = 0;
|
that.gps.lat = 0;
|
||||||
// that.gps.lon = 0;
|
that.gps.lon = 0;
|
||||||
// that.$u.put(`/app/device/bind/${that.mac}`, that.gps).then((res) => {
|
that.$u.put(`/app/device/bind/${that.mac}`, that.gps).then((res) => {
|
||||||
// if(res.code==200){
|
if(res.code==200){
|
||||||
// uni.showToast({
|
uni.showToast({
|
||||||
// title: '绑定成功',
|
title: '绑定成功',
|
||||||
// icon: 'none',
|
icon: 'none',
|
||||||
// duration: 2000
|
duration: 2000
|
||||||
// });
|
});
|
||||||
// uni.removeStorageSync('mac');
|
uni.removeStorageSync('mac');
|
||||||
// setTimeout(()=>{
|
setTimeout(()=>{
|
||||||
// uni.switchTab({
|
uni.switchTab({
|
||||||
// url:'/pages/index/index'
|
url:'/pages/index/index'
|
||||||
// })
|
})
|
||||||
// },)
|
},)
|
||||||
// }else{
|
}else{
|
||||||
// setTimeout(()=>{
|
setTimeout(()=>{
|
||||||
// uni.switchTab({
|
uni.switchTab({
|
||||||
// url:'/pages/index/index'
|
url:'/pages/index/index'
|
||||||
// })
|
})
|
||||||
// },)
|
},)
|
||||||
// }
|
}
|
||||||
// })
|
})
|
||||||
// // 在这里处理获取位置信息失败的情况
|
// 在这里处理获取位置信息失败的情况
|
||||||
// }
|
}
|
||||||
|
|
||||||
// })
|
})
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -353,6 +372,7 @@
|
||||||
|
|
||||||
// 将去重后的数组重新赋值给 this.devicesList
|
// 将去重后的数组重新赋值给 this.devicesList
|
||||||
this.devicesList = uniqueDevicesList;
|
this.devicesList = uniqueDevicesList;
|
||||||
|
|
||||||
// }
|
// }
|
||||||
// })
|
// })
|
||||||
|
|
||||||
|
@ -427,7 +447,7 @@
|
||||||
filteredDevices.forEach(device => {
|
filteredDevices.forEach(device => {
|
||||||
// 从设备名称中提取 MAC 地址(假设 MAC 地址是设备名称的后6个字符)
|
// 从设备名称中提取 MAC 地址(假设 MAC 地址是设备名称的后6个字符)
|
||||||
let macFromName = device.name.substring(device.name.length - 12);
|
let macFromName = device.name.substring(device.name.length - 12);
|
||||||
// console.log(macFromName);
|
console.log(macFromName,'macFromName',this.mac);
|
||||||
// 与 this.mac 进行比较
|
// 与 this.mac 进行比较
|
||||||
if (macFromName == this.mac) {
|
if (macFromName == this.mac) {
|
||||||
// 如果相同,则将 this.ishave 设置为 true
|
// 如果相同,则将 this.ishave 设置为 true
|
||||||
|
@ -495,24 +515,21 @@
|
||||||
// 重新搜索
|
// 重新搜索
|
||||||
// this.startBluetoothDevicesDiscovery()
|
// this.startBluetoothDevicesDiscovery()
|
||||||
this.statusflag = true
|
this.statusflag = true
|
||||||
this.status = false
|
|
||||||
this.texts = '正在扫描蓝牙设备...'
|
this.texts = '正在扫描蓝牙设备...'
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.statusflag = false
|
this.statusflag = false
|
||||||
this.status = true
|
|
||||||
if (this.searching) {
|
if (this.searching) {
|
||||||
xBlufi.notifyStartDiscoverBle({
|
|
||||||
'isStart': false
|
|
||||||
});
|
|
||||||
// 判断是否存在浇花器设备
|
// 判断是否存在浇花器设备
|
||||||
if (this.devicesList.length == 0) {
|
if (this.devicesList.length == 0) {
|
||||||
uni.showToast({
|
this.tishiflag = true
|
||||||
title: '暂无发现对应设备,请靠近设备',
|
this.texts = '扫描完毕,暂无发现浇花器设备'
|
||||||
icon: 'none'
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
this.texts = '扫描到以下设备,请点击连接!'
|
this.texts = '扫描到以下设备,请点击连接!'
|
||||||
}
|
}
|
||||||
|
xBlufi.notifyStartDiscoverBle({
|
||||||
|
'isStart': false
|
||||||
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
xBlufi.notifyStartDiscoverBle({
|
xBlufi.notifyStartDiscoverBle({
|
||||||
'isStart': true
|
'isStart': true
|
||||||
|
@ -520,13 +537,13 @@
|
||||||
}
|
}
|
||||||
}, 2000)
|
}, 2000)
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
funListenDeviceMsgEvents: function(options) {
|
funListenDeviceMsgEvents: function(options) {
|
||||||
let that = this;
|
let that = this;
|
||||||
switch (options.type) {
|
switch (options.type) {
|
||||||
case xBlufi.XBLUFI_TYPE.TYPE_STATUS_CONNECTED: {
|
case xBlufi.XBLUFI_TYPE.TYPE_STATUS_CONNECTED: {
|
||||||
console.log('状态', options.result)
|
console.log('状态', options.result)
|
||||||
|
if( options.result==false){
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '很抱歉提醒你!',
|
title: '很抱歉提醒你!',
|
||||||
content: '小程序与设备异常断开',
|
content: '小程序与设备异常断开',
|
||||||
|
@ -540,6 +557,9 @@
|
||||||
this.statusflag = false
|
this.statusflag = false
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case xBlufi.XBLUFI_TYPE.TYPE_CONNECT_ROUTER_RESULT:
|
case xBlufi.XBLUFI_TYPE.TYPE_CONNECT_ROUTER_RESULT:
|
||||||
|
|
|
@ -506,7 +506,7 @@
|
||||||
switch (options.type) {
|
switch (options.type) {
|
||||||
case xBlufi.XBLUFI_TYPE.TYPE_STATUS_CONNECTED:
|
case xBlufi.XBLUFI_TYPE.TYPE_STATUS_CONNECTED:
|
||||||
{
|
{
|
||||||
console.log('状态', options.result)
|
if( options.result==false){
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '很抱歉提醒你!',
|
title: '很抱歉提醒你!',
|
||||||
content: '小程序与设备异常断开',
|
content: '小程序与设备异常断开',
|
||||||
|
@ -520,6 +520,7 @@
|
||||||
this.statusflag = false
|
this.statusflag = false
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case xBlufi.XBLUFI_TYPE.TYPE_CONNECT_ROUTER_RESULT:
|
case xBlufi.XBLUFI_TYPE.TYPE_CONNECT_ROUTER_RESULT:
|
||||||
|
|
|
@ -46,8 +46,11 @@
|
||||||
<image src="https://api.ccttiot.com/smartmeter/img/static/uoQO0pUZ1UHcW5uVKkuR" mode=""></image>
|
<image src="https://api.ccttiot.com/smartmeter/img/static/uoQO0pUZ1UHcW5uVKkuR" mode=""></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="mid_right">
|
<view class="mid_right">
|
||||||
<view class="mid_top">
|
<view class="mid_top" v-if="deviceInfo.remark!=null">
|
||||||
{{ deviceInfo.deviceName }}
|
{{ deviceInfo.remark }}
|
||||||
|
</view>
|
||||||
|
<view class="mid_top" v-if="deviceInfo.remark==null">
|
||||||
|
{{ deviceInfo.deviceName}}电表
|
||||||
</view>
|
</view>
|
||||||
<view class="mid_bot">
|
<view class="mid_bot">
|
||||||
<view class="txt" v-if="deviceInfo">电表号:{{ deviceInfo.deviceId }}</view>
|
<view class="txt" v-if="deviceInfo">电表号:{{ deviceInfo.deviceId }}</view>
|
||||||
|
@ -69,6 +72,8 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="bot_right">
|
<view class="bot_right">
|
||||||
|
<div class="tip" v-if="deviceInfo.powerStatus==0">断电</div>
|
||||||
|
<div class="tip" v-if="deviceInfo.powerStatus==1">正常</div>
|
||||||
<view class="cont">
|
<view class="cont">
|
||||||
<view class="tit">
|
<view class="tit">
|
||||||
{{deviceInfo.totalElectriQuantity}}KWH
|
{{deviceInfo.totalElectriQuantity}}KWH
|
||||||
|
@ -141,6 +146,13 @@
|
||||||
</view>
|
</view>
|
||||||
<view class="bot">配网</view>
|
<view class="bot">配网</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="cont" @click="offdevice(deviceInfo.deviceId)" style="width: 112rpx;">
|
||||||
|
<view class="top">
|
||||||
|
<image src="https://api.ccttiot.com/smartmeter/img/static/umIcXWUnUfhQMlRG4k35" mode="">
|
||||||
|
</image>
|
||||||
|
</view>
|
||||||
|
<view class="bot">解绑设备</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
@ -397,10 +409,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
setTimeout(() => {
|
|
||||||
|
|
||||||
this.$refs.canvas.init(this.initChart)
|
this.$refs.canvas.init(this.initChart)
|
||||||
}, 500);
|
|
||||||
if (uni.getStorageSync('billNo')) {
|
if (uni.getStorageSync('billNo')) {
|
||||||
let billNo = uni.getStorageSync('billNo')
|
let billNo = uni.getStorageSync('billNo')
|
||||||
this.$u.get(`/app/bill/recharge/${billNo}/bluetoothSuccess`).then((res) => {
|
this.$u.get(`/app/bill/recharge/${billNo}/bluetoothSuccess`).then((res) => {
|
||||||
|
@ -415,7 +425,7 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, 2000);
|
}, 1000);
|
||||||
},
|
},
|
||||||
onPullDownRefresh() {
|
onPullDownRefresh() {
|
||||||
this.logins();
|
this.logins();
|
||||||
|
@ -425,6 +435,17 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
offdevice(deviceId){
|
||||||
|
this.$u.put(`/app/device/tenant/unbind/${deviceId}`).then((res) => {
|
||||||
|
|
||||||
|
|
||||||
|
if(res.code==200){
|
||||||
|
this.logins();
|
||||||
|
}
|
||||||
|
// console.log(this.deviceInfo,'this.deviceInfo');
|
||||||
|
|
||||||
|
});
|
||||||
|
},
|
||||||
tocz() {
|
tocz() {
|
||||||
this.showtip = false
|
this.showtip = false
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
|
@ -485,6 +506,7 @@
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
opendevice() {
|
opendevice() {
|
||||||
|
if(this.deviceInfo.deviceId){
|
||||||
let stause = 0
|
let stause = 0
|
||||||
if (this.deviceInfo.powerStatus == 1) {
|
if (this.deviceInfo.powerStatus == 1) {
|
||||||
stause = 0
|
stause = 0
|
||||||
|
@ -509,6 +531,8 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
getgroup() {
|
getgroup() {
|
||||||
// this.isLoading=true
|
// this.isLoading=true
|
||||||
|
@ -570,8 +594,26 @@
|
||||||
onlyFromCamera: true,
|
onlyFromCamera: true,
|
||||||
scanType: ['qrCode'],
|
scanType: ['qrCode'],
|
||||||
success: res => {
|
success: res => {
|
||||||
console.log('扫描结果:', res);
|
let qParam = res.result;
|
||||||
this.qrResult = res.result; // 将扫描结果存储在数据中
|
|
||||||
|
// 第2步: URL解码q参数
|
||||||
|
let decodedUrl = decodeURIComponent(qParam);
|
||||||
|
|
||||||
|
// 第3步: 使用正则表达式解析解码后的URL并提取查询参数
|
||||||
|
let sn = null;
|
||||||
|
let queryParams = decodedUrl.split('?')[1];
|
||||||
|
if (queryParams) {
|
||||||
|
let params = queryParams.split('&');
|
||||||
|
params.forEach(param => {
|
||||||
|
let [key, value] = param.split('=');
|
||||||
|
if (key === 'sn') {
|
||||||
|
sn = value;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
uni.navigateTo({
|
||||||
|
url:'/pages/device/joinDevice?mac='+sn
|
||||||
|
})
|
||||||
},
|
},
|
||||||
fail: err => {
|
fail: err => {
|
||||||
console.error('扫描失败:', err);
|
console.error('扫描失败:', err);
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
</view>
|
</view>
|
||||||
<view class="right">
|
<view class="right">
|
||||||
<image class="img1" src="https://api.ccttiot.com/smartmeter/img/static/uGvS4RQvbw7OOfhzy6xf"
|
<image class="img1" src="https://api.ccttiot.com/smartmeter/img/static/uGvS4RQvbw7OOfhzy6xf"
|
||||||
mode="" style="margin-right: 30rpx;" @click="opendevices"></image>
|
mode="" style="margin-right: 30rpx;" @click="opendevice"></image>
|
||||||
<image class="img1" src="https://api.ccttiot.com/smartmeter/img/static/uNEKwe2WKsJdtQzOdEay"
|
<image class="img1" src="https://api.ccttiot.com/smartmeter/img/static/uNEKwe2WKsJdtQzOdEay"
|
||||||
mode="" @click="toewm()"></image>
|
mode="" @click="toewm()"></image>
|
||||||
</view>
|
</view>
|
||||||
|
@ -95,7 +95,7 @@
|
||||||
</view>
|
</view>
|
||||||
<view class="card3">
|
<view class="card3">
|
||||||
<view class="tit">其他</view>
|
<view class="tit">其他</view>
|
||||||
<view class="cont_box">
|
<view class="cont_box" style="padding-left: 50rpx;" >
|
||||||
<!-- <view class="cont" style="width: 56rpx;" @click="topage(0)">
|
<!-- <view class="cont" style="width: 56rpx;" @click="topage(0)">
|
||||||
<view class="top">
|
<view class="top">
|
||||||
<image src="https://api.ccttiot.com/smartmeter/img/static/uj4DT6WructS782RY0J7" mode="" style="width: 58rpx;height: 56rpx;" ></image>
|
<image src="https://api.ccttiot.com/smartmeter/img/static/uj4DT6WructS782RY0J7" mode="" style="width: 58rpx;height: 56rpx;" ></image>
|
||||||
|
@ -138,10 +138,36 @@
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
<view class="cont_box" style="padding-left: 30rpx;">
|
<view class="cont_box" style="justify-content: flex-start;margin-left: -20rpx;" >
|
||||||
|
<view class="cont" style="width: 115rpx;" @click="showpopup=true">
|
||||||
|
<view class="top">
|
||||||
|
<image src="https://api.ccttiot.com/smartmeter/img/static/uVrCrCViHDwZ8eOFB2dP" mode=""
|
||||||
|
style="width: 58rpx;height: 58rpx;"></image>
|
||||||
|
</view>
|
||||||
|
<view class="bot">添加电量</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<u-popup v-model="showpopup" mode="center" border-radius='20'>
|
||||||
|
<view class="popcard" v-if="showpopup">
|
||||||
|
<view class="tit">
|
||||||
|
充值电量
|
||||||
|
</view>
|
||||||
|
<view class="ipt">
|
||||||
|
<u-input v-model="money" placeholder=" " border='surround' placeholder-style='font-size: 24rpx;' />
|
||||||
|
</view>
|
||||||
|
<view class="btnbox">
|
||||||
|
<view class="btn2" @click="showpopup=false">
|
||||||
|
取消
|
||||||
|
</view>
|
||||||
|
<view class="btn1" @click="addele()">
|
||||||
|
确定
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
|
||||||
|
</u-popup>
|
||||||
<!-- <view class="button">电费充值</view> -->
|
<!-- <view class="button">电费充值</view> -->
|
||||||
<!-- <view class="zhanwei" style="width: 100%;height: 300rpx;">
|
<!-- <view class="zhanwei" style="width: 100%;height: 300rpx;">
|
||||||
|
|
||||||
|
@ -179,8 +205,10 @@
|
||||||
"水表",
|
"水表",
|
||||||
|
|
||||||
],
|
],
|
||||||
|
showpopup:false,
|
||||||
curtitidx: 0,
|
curtitidx: 0,
|
||||||
id: ''
|
id: '',
|
||||||
|
money:''
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -188,7 +216,7 @@
|
||||||
onLoad(option) {
|
onLoad(option) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
console.log(this.$refs)
|
console.log(this.$refs)
|
||||||
this.$refs.canvas.init(this.initChart)
|
|
||||||
}, 1000)
|
}, 1000)
|
||||||
let id = option.id
|
let id = option.id
|
||||||
this.id = id
|
this.id = id
|
||||||
|
@ -201,11 +229,25 @@
|
||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
addele(){
|
||||||
|
this.$u.post(`/app/device/addElectricity/${this.id}?amount=` + this.money).then((res) => {
|
||||||
|
// this.$forceUpdate()
|
||||||
|
if (res.code == 200) {
|
||||||
|
this.showpopup=false
|
||||||
|
this.getDevice(this.id)
|
||||||
|
}else{
|
||||||
|
uni.showToast({
|
||||||
|
title: res.msg,
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
initChart(canvas, width, height, canvasDpr) {
|
initChart(canvas, width, height, canvasDpr) {
|
||||||
let that = this
|
let that = this
|
||||||
console.log(canvas, width, height, canvasDpr)
|
console.log(canvas, width, height, canvasDpr)
|
||||||
let value = 100;
|
let value = 100;
|
||||||
let value2 = this.deviceInfo.totalElectriQuantity
|
let value2 = this.deviceInfo.surplusElectriQuantity
|
||||||
const option = {
|
const option = {
|
||||||
// backgroundColor:"#061740",
|
// backgroundColor:"#061740",
|
||||||
// title: {
|
// title: {
|
||||||
|
@ -331,7 +373,7 @@
|
||||||
this.deviceInfo = res.data
|
this.deviceInfo = res.data
|
||||||
console.log(this.deviceInfo, 'resres');
|
console.log(this.deviceInfo, 'resres');
|
||||||
this.loadings = true
|
this.loadings = true
|
||||||
this.initChart()
|
this.$refs.canvas.init(this.initChart)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -348,10 +390,7 @@
|
||||||
// this.$forceUpdate()
|
// this.$forceUpdate()
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
// this.groupList=res.rows
|
// this.groupList=res.rows
|
||||||
setTimeout(() => {
|
|
||||||
this.getDevice(this.id)
|
this.getDevice(this.id)
|
||||||
}, 2000)
|
|
||||||
|
|
||||||
// this.loadings=true
|
// this.loadings=true
|
||||||
// this.initChart()
|
// this.initChart()
|
||||||
} else {
|
} else {
|
||||||
|
@ -362,9 +401,9 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
opendevices() {
|
// opendevices() {
|
||||||
|
|
||||||
},
|
// },
|
||||||
swiperchange(e) {
|
swiperchange(e) {
|
||||||
this.curtitidx = e.detail.current
|
this.curtitidx = e.detail.current
|
||||||
console.log(e, 'aaaa');
|
console.log(e, 'aaaa');
|
||||||
|
@ -435,6 +474,72 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.page {
|
.page {
|
||||||
|
.popcard{
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
// padding: 40rpx;
|
||||||
|
width: 550rpx;
|
||||||
|
height: 400rpx;
|
||||||
|
border-radius: 20rpx;
|
||||||
|
.tit{
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
width: 100%;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 28rpx;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
.ipt{
|
||||||
|
margin-top: 60rpx;
|
||||||
|
width: 80%;
|
||||||
|
// width: 60%;
|
||||||
|
.u-input::placeholder {
|
||||||
|
font-size: 20px;
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.btnbox{
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: nowrap;
|
||||||
|
border-radius: 0 0 20rpx 20rpx;
|
||||||
|
.btn2{
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 50%;
|
||||||
|
// justify-content: center;
|
||||||
|
|
||||||
|
// width: 200rpx;
|
||||||
|
// height: 70rpx;
|
||||||
|
// border-radius: 20rpx;
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-family: HarmonyOS Sans SC, HarmonyOS Sans SC;
|
||||||
|
font-weight: 400;
|
||||||
|
color: #FFFFFF;
|
||||||
|
background-color: #2A82E4;
|
||||||
|
}
|
||||||
|
.btn1{
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 50%;
|
||||||
|
// justify-content: center;
|
||||||
|
|
||||||
|
// width: 200rpx;
|
||||||
|
// height: 70rpx;
|
||||||
|
// border-radius: 20rpx;
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-family: HarmonyOS Sans SC, HarmonyOS Sans SC;
|
||||||
|
font-weight: 400;
|
||||||
|
color: #000;
|
||||||
|
background-color: #fff;
|
||||||
|
border: 1rpx solid #ccc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
.zhuhu {
|
.zhuhu {
|
||||||
margin-top: 20rpx;
|
margin-top: 20rpx;
|
||||||
padding: 0 40rpx;
|
padding: 0 40rpx;
|
||||||
|
|
|
@ -8,9 +8,10 @@
|
||||||
备注
|
备注
|
||||||
</view>
|
</view>
|
||||||
<view class="info">
|
<view class="info">
|
||||||
<view class="txt">
|
<view class="txt" v-if="deviceInfo.remark">
|
||||||
{{deviceInfo.remark}}
|
{{deviceInfo.remark}}
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="iconfont icon-xiangyou1"></view>
|
<view class="iconfont icon-xiangyou1"></view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
@ -247,7 +248,7 @@
|
||||||
duration: 2000
|
duration: 2000
|
||||||
});
|
});
|
||||||
uni.navigateBack({
|
uni.navigateBack({
|
||||||
delta: 1 // 返回上级页面
|
delta: 2 // 返回上级页面
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -172,7 +172,7 @@
|
||||||
|
|
||||||
year: this.yeartime.year,
|
year: this.yeartime.year,
|
||||||
month: this.yeartime.month,
|
month: this.yeartime.month,
|
||||||
groupBy: 'create_day'
|
groupBy: 'create_date'
|
||||||
}
|
}
|
||||||
this.loging=false
|
this.loging=false
|
||||||
this.$u.get('app/bill/landlordCount', data).then((res) => {
|
this.$u.get('app/bill/landlordCount', data).then((res) => {
|
||||||
|
@ -543,8 +543,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.page {
|
.page {
|
||||||
padding: 0 59rpx;
|
|
||||||
|
|
||||||
|
padding: 0 59rpx;
|
||||||
|
padding-bottom: 150rpx;
|
||||||
.title {
|
.title {
|
||||||
margin-top: 120rpx;
|
margin-top: 120rpx;
|
||||||
font-size: 48rpx;
|
font-size: 48rpx;
|
||||||
|
|
|
@ -104,7 +104,7 @@ export default {
|
||||||
switch (options.type) {
|
switch (options.type) {
|
||||||
case xBlufi.XBLUFI_TYPE.TYPE_STATUS_CONNECTED:
|
case xBlufi.XBLUFI_TYPE.TYPE_STATUS_CONNECTED:
|
||||||
{
|
{
|
||||||
console.log('状态', options.result)
|
if( options.result==false){
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '很抱歉提醒你!',
|
title: '很抱歉提醒你!',
|
||||||
content: '小程序与设备异常断开',
|
content: '小程序与设备异常断开',
|
||||||
|
@ -118,6 +118,7 @@ export default {
|
||||||
this.statusflag = false
|
this.statusflag = false
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case xBlufi.XBLUFI_TYPE.TYPE_CONNECT_ROUTER_RESULT:
|
case xBlufi.XBLUFI_TYPE.TYPE_CONNECT_ROUTER_RESULT:
|
||||||
|
|
|
@ -1145,7 +1145,7 @@ function init() {
|
||||||
// && devices.devices[0].name != 'SMART_R2XS'
|
// && devices.devices[0].name != 'SMART_R2XS'
|
||||||
// && devices.devices[0].name != 'SMART_R2XS'
|
// && devices.devices[0].name != 'SMART_R2XS'
|
||||||
// )
|
// )
|
||||||
if (devices.devices[0].name.indexOf("CTPOW") != -1){
|
if (devices.devices[0].name.indexOf("CTKG") != -1||devices.devices[0].name.indexOf("CTPO") != -1){
|
||||||
// console.log("跳过",devices.devices[0].name)
|
// console.log("跳过",devices.devices[0].name)
|
||||||
// isnotexist = false;
|
// isnotexist = false;
|
||||||
isnotexist = true;
|
isnotexist = true;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user