床垫基本完

This commit is contained in:
3321822538@qq.com 2024-09-13 18:02:36 +08:00
parent ddefdbce5f
commit 3bd17e7245
21 changed files with 442 additions and 310 deletions

View File

@ -176,5 +176,6 @@
} }
page{ page{
background-color: #f8f8f8; background-color: #f8f8f8;
} }
</style> </style>

View File

@ -20,8 +20,8 @@ const install = (Vue, vm) => {
// }, // },
// }); // });
Vue.prototype.$u.http.setConfig({ Vue.prototype.$u.http.setConfig({
// baseUrl: 'http://192.168.2.81:3302', baseUrl: 'http://192.168.2.81:3302',
baseUrl: 'https://kang.chuangtewl.com/prod-api', // baseUrl: 'https://kang.chuangtewl.com/prod-api',
loadingText: '努力加载中~', loadingText: '努力加载中~',
loadingTime: 800, loadingTime: 800,
// 设置自定义头部content-type // 设置自定义头部content-type

View File

@ -1145,8 +1145,8 @@ 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("CCYK") != -1 || devices.devices[0].name.indexOf("BBLE") != -1){ if (devices.devices[0].name.indexOf("CCYK") != -1){
// console.log("跳过",devices.devices[0].name) // console.log("跳过",devices.devices[0].name) || devices.devices[0].name.indexOf("BBLE") != -1
// isnotexist = false; // isnotexist = false;
isnotexist = true; isnotexist = true;
} }

View File

@ -123,7 +123,7 @@
width: 100%; width: 100%;
.rxdetail{ .rxdetail{
width: 672rpx; width: 672rpx;
height: 718rpx; max-height: 718rpx;
background: #FFFFFF; background: #FFFFFF;
box-shadow: 0rpx 4rpx 22rpx 0rpx rgba(0,0,0,0.07); box-shadow: 0rpx 4rpx 22rpx 0rpx rgba(0,0,0,0.07);
border-radius: 20rpx 20rpx 20rpx 20rpx; border-radius: 20rpx 20rpx 20rpx 20rpx;

View File

@ -266,8 +266,6 @@
url:'/page_user/dianpu' url:'/page_user/dianpu'
}) })
} }
} }
} }
</script> </script>

View File

@ -88,7 +88,7 @@
} }
}, },
// //
onShareTimeline: function() { onShareTimeline: function() {
return { return {
title: '创亿康', title: '创亿康',
@ -114,9 +114,7 @@
onScrollToLower() { onScrollToLower() {
if (this.total > this.wateringList.length) { if (this.total > this.wateringList.length) {
this.getlist() // this.getlist() //
} else { }
}
}, },
btnscreh(){ btnscreh(){
this.wateringList = [] this.wateringList = []

View File

@ -206,7 +206,7 @@
.list_item { .list_item {
margin-top: 32rpx; margin-top: 32rpx;
height: 348rpx; max-height: 348rpx;
padding: 24rpx 28rpx; padding: 24rpx 28rpx;
box-sizing: border-box; box-sizing: border-box;
background-color: #fff; background-color: #fff;

View File

@ -445,8 +445,6 @@
.list { .list {
padding: 0 38rpx; padding: 0 38rpx;
box-sizing: border-box; box-sizing: border-box;
// height: 1130rpx;
// overflow: scroll;
padding-bottom: 200rpx; padding-bottom: 200rpx;
box-sizing: border-box; box-sizing: border-box;

View File

@ -446,7 +446,7 @@
.list { .list {
width: 680rpx; width: 680rpx;
height: 1080rpx; height: 980rpx;
background: #FFFFFF; background: #FFFFFF;
border-radius: 24rpx 24rpx 24rpx 24rpx; border-radius: 24rpx 24rpx 24rpx 24rpx;
margin: auto; margin: auto;

View File

@ -454,7 +454,7 @@
.list { .list {
width: 680rpx; width: 680rpx;
height: 1080rpx; height: 980rpx;
background: #FFFFFF; background: #FFFFFF;
border-radius: 24rpx 24rpx 24rpx 24rpx; border-radius: 24rpx 24rpx 24rpx 24rpx;
margin: auto; margin: auto;

View File

@ -43,8 +43,8 @@
<view class="shuomtit"> <view class="shuomtit">
功能介绍 功能介绍
</view> </view>
<view class="cont" style="height: 208rpx;"> <view class="cont" style="height: 208rpx;" v-html="obj.funcInfo">
{{obj.funcInfo == undefined ? '暂无介绍...' : obj.funcInfo}} <!-- {{obj.funcInfo == undefined ? '暂无介绍...' : obj.funcInfo}} -->
</view> </view>
</view> </view>
<view class="shuom" style="max-height: 220rpx;margin-top: 30rpx;"> <view class="shuom" style="max-height: 220rpx;margin-top: 30rpx;">

View File

@ -292,31 +292,6 @@
width: 64rpx; width: 64rpx;
height: 64rpx; height: 64rpx;
} }
// view {
// border-radius: 15rpx;
// border: 2rpx solid #C4C4C4;
// padding: 14rpx 34rpx 14rpx 34rpx;
// box-sizing: border-box;
// margin-right: 28rpx;
// margin-top: 40rpx;
// position: relative;
// overflow: hidden;
// text {
// position: absolute;
// bottom: 0;
// right: 0;
// display: inline-block;
// width: 31rpx;
// height: 19rpx;
// background: #8883F0;
// color: #fff;
// border-radius: 5rpx;
// font-size: 18rpx;
// text-align: center;
// line-height: 19rpx;
// }
// }
} }
} }

View File

@ -130,6 +130,14 @@
<u-icon name="arrow-right" color="#3D3D3D" size="28"></u-icon> <u-icon name="arrow-right" color="#3D3D3D" size="28"></u-icon>
</view> </view>
</view> </view>
<view class="list_val" @click="btnpage(6)" v-if="infoobj.deviceAdmin == true">
<view class="lt">
<image src="https://api.ccttiot.com/smartmeter/img/static/uPve6WkZnAXSIqfGqA32" mode=""></image> <text>设备录入</text>
</view>
<view class="rt">
<u-icon name="arrow-right" color="#3D3D3D" size="28"></u-icon>
</view>
</view>
</view> </view>
</view> </view>
@ -242,6 +250,10 @@
uni.navigateTo({ uni.navigateTo({
url:'/page_fenbao/listtaocan' url:'/page_fenbao/listtaocan'
}) })
}else if(num == 6){
uni.navigateTo({
url:'/pages/zhuce'
})
} }
}, },
// //
@ -353,6 +365,7 @@
.gn_list{ .gn_list{
width: 658rpx; width: 658rpx;
max-height: 430rpx; max-height: 430rpx;
overflow: scroll;
background: #FFFFFF; background: #FFFFFF;
border-radius: 24rpx 24rpx 24rpx 24rpx; border-radius: 24rpx 24rpx 24rpx 24rpx;
margin-top: 20rpx; margin-top: 20rpx;

View File

@ -194,19 +194,37 @@
name: '', name: '',
setMode: null, setMode: null,
qrResult: '', qrResult: '',
isUsing:false isUsing: false,
timer: null,
timers: null,
} }
}, },
onShow() {
//
this.startTimers();
},
onHide() {
//
if (this.timers) {
clearInterval(this.timers);
this.timers = null;
console.log('消除');
}
},
onUnload() {
if (this.timers) {
clearInterval(this.timers);
this.timers = null;
console.log('消除');
}
},
onLoad(option) { onLoad(option) {
if (option.billId) { if (option.billId) {
this.billId = option.billId this.billId = option.billId
this.getlist()
// this.getad()
} else { } else {
this.billId = option.id this.billId = option.id
this.getlist()
// this.getad()
} }
this.getlist()
}, },
// //
onShareAppMessage: function() { onShareAppMessage: function() {
@ -235,9 +253,9 @@
} else if (this.timeday.minutes > 0) { } else if (this.timeday.minutes > 0) {
// //
return `${this.timeday.minutes}分钟${this.timeday.seconds}` return `${this.timeday.minutes}分钟${this.timeday.seconds}`
} else if(this.timeday.seconds == 0){ } else if (this.timeday.seconds == 0) {
this.getlist() this.getlist()
}else{ } else {
// 00 // 00
this.isUsing = false this.isUsing = false
return this.timeday.seconds > 0 ? `${this.timeday.seconds}` : '0' return this.timeday.seconds > 0 ? `${this.timeday.seconds}` : '0'
@ -245,6 +263,14 @@
} }
}, },
methods: { methods: {
startTimers() {
if (this.timers) {
clearInterval(this.timers); //
}
this.timers = setInterval(() => {
this.getlist()
}, 60000); // 60
},
// //
btnlyqx() { btnlyqx() {
this.shibaiflag = false this.shibaiflag = false
@ -334,11 +360,11 @@
success(res) { success(res) {
if (res.networkType !== 'none') { if (res.networkType !== 'none') {
uni.getConnectedBluetoothDevices({ uni.getConnectedBluetoothDevices({
success(res) { success(res) {
setTimeout(() => { setTimeout(() => {
xBlufi.notifySendCustomData({ xBlufi.notifySendCustomData({
customData: 'time0@' customData: 'time0@'
}) })
uni.showToast({ uni.showToast({
title: '操作成功', title: '操作成功',
icon: 'success', icon: 'success',
@ -348,21 +374,22 @@
billId: that.billId, billId: that.billId,
totalEle: 0 totalEle: 0
} }
that.$u.put(`/app/bill/endUse`, data).then(res => { that.$u.put(`/app/bill/endUse`, data).then(
if (res.code == 200) { res => {
that.getlist() if (res.code == 200) {
that.msakflag = false that.getlist()
that.btnmsk = false that.msakflag = false
that.shibaiflag = false that.btnmsk = false
that.bluetoothflag = false that.shibaiflag = false
} else { that.bluetoothflag = false
uni.showToast({ } else {
title: res.msg, uni.showToast({
icon: 'none', title: res.msg,
duration: 1000 icon: 'none',
}) duration: 1000
} })
}) }
})
}, 1000) }, 1000)
}, },
fail(err) { fail(err) {
@ -390,7 +417,7 @@
}) })
} }
}) })
}else{ } else {
if (this.setMode == null) { if (this.setMode == null) {
this.btnmsk = false this.btnmsk = false
this.shibaiflag = false this.shibaiflag = false
@ -420,11 +447,11 @@
success(res) { success(res) {
if (res.networkType !== 'none') { if (res.networkType !== 'none') {
uni.getConnectedBluetoothDevices({ uni.getConnectedBluetoothDevices({
success(res) { success(res) {
setTimeout(() => { setTimeout(() => {
xBlufi.notifySendCustomData({ xBlufi.notifySendCustomData({
customData: 'close' customData: 'close'
}) })
uni.showToast({ uni.showToast({
title: '操作成功', title: '操作成功',
icon: 'success', icon: 'success',
@ -434,7 +461,7 @@
that.getlist() that.getlist()
that.msakflag = false that.msakflag = false
that.btnmsk = false that.btnmsk = false
that.shibaiflag = false that.shibaiflag = false
that.bluetoothflag = false that.bluetoothflag = false
}, 1000) }, 1000)
}, },
@ -449,7 +476,7 @@
} }
}, },
btnimgs() { btnimgs() {
if(this.detailobj.deviceOnlineStatus == 1){ if (this.detailobj.deviceOnlineStatus == 1) {
this.$u.put(`/app/bill/switchDevice?billId=${this.billId}&open=true`).then(res => { this.$u.put(`/app/bill/switchDevice?billId=${this.billId}&open=true`).then(res => {
if (res.code == 200) { if (res.code == 200) {
this.imgflag = true this.imgflag = true
@ -461,7 +488,7 @@
}) })
} }
}) })
}else{ } else {
if (this.setMode == null) { if (this.setMode == null) {
this.btnmsk = false this.btnmsk = false
this.shibaiflag = false this.shibaiflag = false
@ -491,11 +518,11 @@
success(res) { success(res) {
if (res.networkType !== 'none') { if (res.networkType !== 'none') {
uni.getConnectedBluetoothDevices({ uni.getConnectedBluetoothDevices({
success(res) { success(res) {
setTimeout(() => { setTimeout(() => {
xBlufi.notifySendCustomData({ xBlufi.notifySendCustomData({
customData: 'open' customData: 'open'
}) })
uni.showToast({ uni.showToast({
title: '操作成功', title: '操作成功',
icon: 'success', icon: 'success',
@ -505,7 +532,7 @@
that.getlist() that.getlist()
that.msakflag = false that.msakflag = false
that.btnmsk = false that.btnmsk = false
that.shibaiflag = false that.shibaiflag = false
that.bluetoothflag = false that.bluetoothflag = false
}, 1000) }, 1000)
}, },
@ -557,7 +584,7 @@
}) })
}, },
// //
getlist() { getlist() {
this.$u.get(`/app/bill/${this.billId}`).then((res) => { this.$u.get(`/app/bill/${this.billId}`).then((res) => {
if (res.code == 200) { if (res.code == 200) {
@ -576,8 +603,8 @@
let expireTimeParts = expireTimeStr.split(" ") let expireTimeParts = expireTimeStr.split(" ")
let expireDateParts = expireTimeParts[0].split("-") let expireDateParts = expireTimeParts[0].split("-")
let expireTimePartsTime = expireTimeParts[1].split(":") let expireTimePartsTime = expireTimeParts[1].split(":")
let expireDate = new Date(expireDateParts[0], expireDateParts[1] - 1, expireDateParts[ let expireDate = new Date(expireDateParts[0], expireDateParts[1] - 1,
2], expireDateParts[2],
expireTimePartsTime[0], expireTimePartsTime[1], expireTimePartsTime[2]) expireTimePartsTime[0], expireTimePartsTime[1], expireTimePartsTime[2])
let now = new Date() let now = new Date()
let differenceInMs = expireDate - now let differenceInMs = expireDate - now
@ -593,6 +620,7 @@
} }
}) })
}, },
// //
startTimer() { startTimer() {
this.timer = setInterval(() => { this.timer = setInterval(() => {
@ -652,7 +680,6 @@
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS: case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS:
if (options.result) { if (options.result) {
let devicesarr = options.data let devicesarr = options.data
// console.log(devicesarr,'000');
devicesarr.forEach(device => { devicesarr.forEach(device => {
const mac = device.name.substring(5) const mac = device.name.substring(5)
if (device.name.slice(5, 17) == this.qrResult) { if (device.name.slice(5, 17) == this.qrResult) {
@ -666,9 +693,9 @@
case xBlufi.XBLUFI_TYPE.TYPE_CONNECTED: case xBlufi.XBLUFI_TYPE.TYPE_CONNECTED:
// console.log("" + JSON.stringify(options)) // console.log("" + JSON.stringify(options))
if (options.result) { if (options.result) {
setTimeout(()=>{ setTimeout(() => {
this.bluetoothflag = false this.bluetoothflag = false
},3000) }, 3000)
uni.hideLoading(); { uni.hideLoading(); {
console.log("连接回调options.data.deviceId" + options.data.deviceId, console.log("连接回调options.data.deviceId" + options.data.deviceId,
"连接回调options.data.name" + options.data.name) "连接回调options.data.name" + options.data.name)
@ -848,7 +875,8 @@
left: 50%; left: 50%;
transform: translateX(-50%); transform: translateX(-50%);
z-index: 2; z-index: 2;
.jieshus{
.jieshus {
width: 500rpx; width: 500rpx;
max-height: 430rpx; max-height: 430rpx;
border-radius: 20rpx 20rpx 0 0; border-radius: 20rpx 20rpx 0 0;
@ -856,6 +884,7 @@
box-sizing: border-box; box-sizing: border-box;
background-color: #fff; background-color: #fff;
} }
.tishi { .tishi {
font-size: 32rpx; font-size: 32rpx;
width: 100%; width: 100%;
@ -864,9 +893,10 @@
.img { .img {
width: 100%; width: 100%;
margin-top: 20rpx; margin-top: 20rpx;
text-align: center; text-align: center;
margin-bottom: 20rpx; margin-bottom: 20rpx;
image { image {
width: 160rpx; width: 160rpx;
height: 140rpx; height: 140rpx;
@ -884,8 +914,9 @@
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
background-color: #fff; background-color: #fff;
border-radius: 0 0 20rpx 20rpx; border-radius: 0 0 20rpx 20rpx;
.qux { .qux {
text-align: center; text-align: center;
width: 100%; width: 100%;

View File

@ -3,12 +3,13 @@
<u-navbar title="我的订单" :border-bottom="false" :background="bgc" title-color='#3D3D3D' back-icon-color="#3D3D3D" <u-navbar title="我的订单" :border-bottom="false" :background="bgc" title-color='#3D3D3D' back-icon-color="#3D3D3D"
title-size='36' height='44'></u-navbar> title-size='36' height='44'></u-navbar>
<scroll-view class="list" scroll-y="true" @scrolltolower="onScrollToLower" style="height: 90vh;"> <scroll-view class="list" scroll-y="true" @scrolltolower="onScrollToLower" style="height: 90vh;">
<view class="list_item" v-for="(item,index) in wateringList" :key="index" @scrolltolower="onReachBottom" @click="btnxq(item.billId)"> <view class="list_item" v-for="(item,index) in wateringList" :key="index" @scrolltolower="onReachBottom"
@click="btnxq(item.billId)">
<view class="top"> <view class="top">
<view class="bh"> <view class="bh">
设备编号{{item.deviceNo}} 设备编号{{item.deviceNo}}
</view> </view>
<view class="wc" v-if="item.status == 2" style="color: #e6b000;"> <!-- <view class="wc" v-if="item.status == 2" style="color: #e6b000;">
已支付 已支付
</view> </view>
<view class="wc" v-if="item.status == 1" style="color: #004fd8;"> <view class="wc" v-if="item.status == 1" style="color: #004fd8;">
@ -28,9 +29,33 @@
</view> </view>
<view class="wc" v-if="item.status == 7" style="color: #e10328;"> <view class="wc" v-if="item.status == 7" style="color: #e10328;">
退款中 退款中
</view> -->
<view style="color: #17b402;" v-if="item.isUsing == true"> <text
style="background-color: #17b402;"></text> 进行中 </view>
<view style="color: #8883F0;" v-if="item.isFinished == true"> <text
style="background-color: #8883F0;"></text> 已完成 </view>
<view class="" v-if="item.isUsing == false && item.isFinished == false">
<view v-if="item.status == 1" style="color: #004fd8;"><text
style="background-color: #004fd8;"></text> 未支付</view>
<view v-if="item.status == 2" style="color: #e6b000;"><text
style="background-color: #e6b000;"></text> 支付成功</view>
<view v-if="item.status == 3" style="color: #e10328;"><text
style="background-color: #e10328;"></text> 已退款</view>
<view v-if="item.status == 4" style="color: #5d5d5d;"><text
style="background-color: #5d5d5d;"></text> 用户取消</view>
<view v-if="item.status == 5" style="color: #5d5d5d;"><text
style="background-color: #5d5d5d;"></text> 系统超时取消</view>
<view v-if="item.status == 6" style="color: #e6b000;"><text
style="background-color: #e6b000;"></text> 支付中</view>
<view v-if="item.status == 7" style="color: #e10328;"><text
style="background-color: #e10328;"></text> 退款中</view>
<view v-if="item.status == 8" style="color: #004fd8;"><text
style="background-color: #004fd8;"></text> 押金未支付</view>
<view v-if="item.status == 9" style="color: #e6b000;"><text
style="background-color: #e6b000;"></text> 押金已支付</view>
</view> </view>
</view> </view>
<view class="item_xx"> <view class="item_xx">
<view class=""> <view class="">
订单号 订单号
</view> </view>
@ -101,7 +126,7 @@
} }
}, },
onLoad(option) { onLoad(option) {
}, },
onShow() { onShow() {
this.wateringList = [] this.wateringList = []
@ -130,7 +155,7 @@
if (this.total > this.wateringList.length) { if (this.total > this.wateringList.length) {
this.getlist() // this.getlist() //
} else { } else {
} }
}, },
// billId // billId

View File

@ -187,7 +187,7 @@
icon: 'success', icon: 'success',
duration: 3000 duration: 3000
}) })
setInterval(()=>{ setTimeout(()=>{
uni.navigateBack() uni.navigateBack()
},1000) },1000)
}else{ }else{

View File

@ -9,7 +9,7 @@
时间范围 时间范围
</view> </view>
<view class="date"> <view class="date">
<text @click="btnks(1)">{{firsTime}}</text> - <text @click="btnks(2)">{{lasTime}}</text> <text style="margin-right: 20rpx;" @click="btnks(1)">{{firsTime}}</text> - <text style="margin-left: 20rpx;" @click="btnks(2)">{{lasTime}}</text>
</view> </view>
</view> </view>
<view class="serch"> <view class="serch">
@ -26,17 +26,17 @@
<view class="order_item" v-for="(item,index) in wateringList" :key="index" @click="btndetail(item.billId)"> <view class="order_item" v-for="(item,index) in wateringList" :key="index" @click="btndetail(item.billId)">
<view class="tops"> <view class="tops">
<view>订单编号{{item.billNo}}</view> <view>订单编号{{item.billNo}}</view>
<view style="color: #17b402;" v-if="item.isUsing == true"> <text></text> 进行中 </view> <view style="color: #17b402;" v-if="item.isUsing == true"> <text style="background-color: #17b402;"></text> 进行中 </view>
<view style="color: #ec6941;" v-if="item.isFinished == true"> <text style="background-color: #ec6941;"></text> 已完成 </view> <view style="color: #8883F0;" v-if="item.isFinished == true"> <text style="background-color: #8883F0;"></text> 已完成 </view>
<view class="" v-if="item.isUsing == false && item.isFinished == false"> <view class="" v-if="item.isUsing == false && item.isFinished == false">
<view v-if="item.status == 1" style="color: #004fd8;"><text style="background-color: #004fd8;"></text> 未支付</view> <view v-if="item.status == 1" style="color: rgb(99, 178, 168);"><text style="background-color: rgb(99, 178, 168);"></text> 未支付</view>
<view v-if="item.status == 2" style="color: #e6b000;"><text style="background-color: #e6b000;"></text> 支付成功</view> <view v-if="item.status == 2" style="color: #e6b000;"><text style="background-color: #e6b000;"></text> 支付成功</view>
<view v-if="item.status == 3" style="color: #e10328;"><text style="background-color: #e10328;"></text> 已退款</view> <view v-if="item.status == 3" style="color: #e10328;"><text style="background-color: #e10328;"></text> 已退款</view>
<view v-if="item.status == 4" style="color: #5d5d5d;"><text style="background-color: #5d5d5d;"></text> 用户取消</view> <view v-if="item.status == 4" style="color: #5d5d5d;"><text style="background-color: #5d5d5d;"></text> 用户取消</view>
<view v-if="item.status == 5" style="color: #5d5d5d;"><text style="background-color: #5d5d5d;"></text> 系统超时取消</view> <view v-if="item.status == 5" style="color: #5d5d5d;"><text style="background-color: #5d5d5d;"></text> 系统超时取消</view>
<view v-if="item.status == 6" style="color: #e6b000;"><text style="background-color: #e6b000;"></text> 支付中</view> <view v-if="item.status == 6" style="color: #e6b000;"><text style="background-color: #e6b000;"></text> 支付中</view>
<view v-if="item.status == 7" style="color: #e10328;"><text style="background-color: #e10328;"></text> 退款中</view> <view v-if="item.status == 7" style="color: #e10328;"><text style="background-color: #e10328;"></text> 退款中</view>
<view v-if="item.status == 8" style="color: #004fd8;"><text style="background-color: #004fd8;"></text> 押金未支付</view> <view v-if="item.status == 8" style="color: rgb(99, 178, 168);"><text style="background-color: rgb(99, 178, 168);"></text> 押金未支付</view>
<view v-if="item.status == 9" style="color: #e6b000;"><text style="background-color: #e6b000;"></text> 押金已支付</view> <view v-if="item.status == 9" style="color: #e6b000;"><text style="background-color: #e6b000;"></text> 押金已支付</view>
</view> </view>
</view> </view>
@ -353,6 +353,9 @@
.date{ .date{
font-size: 32rpx; font-size: 32rpx;
color: #979797; color: #979797;
text{
display: inline-block;
}
} }
} }
.serch{ .serch{

View File

@ -111,7 +111,7 @@
this.$u.get("/app/user/userInfo").then((res) => { this.$u.get("/app/user/userInfo").then((res) => {
if (res.code == 200) { if (res.code == 200) {
} else { } else if(res.code == 401){
uni.reLaunch({ uni.reLaunch({
url:'/pages/login/login' url:'/pages/login/login'
}) })

View File

@ -170,8 +170,6 @@
.order_list { .order_list {
padding-bottom: 100rpx; padding-bottom: 100rpx;
box-sizing: border-box; box-sizing: border-box;
// height: 1260rpx;
// overflow: scroll;
.order_item { .order_item {
width: 672rpx; width: 672rpx;
max-height: 370rpx; max-height: 370rpx;
@ -264,7 +262,6 @@
width: 100%; width: 100%;
border-radius: 20rpx; border-radius: 20rpx;
justify-content: space-between; justify-content: space-between;
// padding-right: 24rpx;
box-sizing: border-box; box-sizing: border-box;
.sousuo { .sousuo {

View File

@ -552,7 +552,6 @@
url: '/page_user/shiming' url: '/page_user/shiming'
}) })
} }
} else if (num == 6) { } else if (num == 6) {
uni.navigateTo({ uni.navigateTo({
url: '/page_user/sjhezuo' url: '/page_user/sjhezuo'
@ -621,6 +620,7 @@
// this.iconflag = false // this.iconflag = false
} }
}, },
// //
async setMapScale(e, val) { async setMapScale(e, val) {
let mapContext = uni.createMapContext('map', this); let mapContext = uni.createMapContext('map', this);
@ -795,8 +795,6 @@
}) })
}, },
gethuidaio() { gethuidaio() {
this.$u.get('/app/bill/recharge/device/fail/list').then(res => { this.$u.get('/app/bill/recharge/device/fail/list').then(res => {
if (res.code == 200) { if (res.code == 200) {
@ -833,7 +831,7 @@
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
.bjimg { .bjimg {
position: fixed; position: fixed;
top: 0; top: 0;

View File

@ -4,18 +4,20 @@
back-icon-color="#fff" height='50'></u-navbar> back-icon-color="#fff" height='50'></u-navbar>
<view class="title"> <view class="title">
<text>设备录入列表</text> <text>设备录入列表</text>
<!-- <image src="https://api.ccttiot.com/smartmeter/img/static/uCfe9273aC89tGOT7n1G" mode="widthFix"></image>
<text class="sm"> {{texts}} </text -->
</view> </view>
<view class="dblist" v-for="(item, index) in devicesLists" :key="index"> <view class="dblist" v-for="(item, index) in devicesLists" :key="index">
<!-- <view class="dblist"> -->
<view class="lt">
<image src="https://api.ccttiot.com/smartmeter/img/static/uGVs6cbSjcuQNXuHhoWi" mode="aspectFit"></image>
</view>
<view class="cen"> <view class="cen">
<view class="name"> <view class="name">
设备录入 <view class="">
状态<text v-if="item.flags == true" style="color: red;">已录入</text> <text v-else
style="color:seagreen;">未录入</text>
</view>
<view class="" style="display: flex;">
SN码: <input
style="width: 200rpx;background-color: #ccc;padding: 5rpx;box-sizing: border-box;text-align: center;"
v-model="item.sn" placeholder="输入SN" />
</view>
</view> </view>
<view class="mac"> <view class="mac">
MAC{{item.name.substring(5)}} MAC{{item.name.substring(5)}}
@ -23,12 +25,14 @@
<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;"> <view @click="btnshows(item,index)"
style="color: #8883F0;margin-top: 10rpx;margin-bottom: 10rpx;text-align: left;">
型号选择:{{item.xuanz == undefined ? '--' : item.xuanz}} 型号选择:{{item.xuanz == undefined ? '--' : item.xuanz}}
</view> </view>
</view> </view>
<view class="rt"> <view class="rt">
<!-- <text style="margin-bottom: 10rpx;" :id="item.deviceId" @tap="createBLEConnections(item)">响铃</text> --> <text style="margin-bottom: 10rpx;" :id="item.deviceId" @click="createBLEConnections(item)">开关</text>
<text @click="scanQRCode(item)" style="margin-bottom: 10rpx;">扫码</text>
<text :id="item.deviceId" @click="createBLEConnection(item)">录入</text> <text :id="item.deviceId" @click="createBLEConnection(item)">录入</text>
</view> </view>
</view> </view>
@ -47,27 +51,22 @@
<text>3.确保设备未被添加过</text> <text>3.确保设备未被添加过</text>
<button @click="btnyc">好的</button> <button @click="btnyc">好的</button>
</view> </view>
<view v-if="mengcflag" class="mengc" style="width: 100%;height: 100vh;background-color: #000;opacity: .5;position: fixed;top: 0;left: 0;"></view> <view v-if="mengcflag" class="mengc"
style="width: 100%;height: 100vh;background-color: #000;opacity: .5;position: fixed;top: 0;left: 0;"></view>
<!-- 选择蓝牙型号 --> <!-- 选择蓝牙型号 -->
<u-select v-model="shows" :list="arr" @confirm="confirm"></u-select> <u-select v-model="shows" :list="arr" @confirm="confirm"></u-select>
<!-- <view class="containers" v-show="statusflag">
<uni-section>
<uni-load-more :status="status" />
</uni-section>
</view> -->
</view> </view>
</template> </template>
<script> <script>
const app = getApp(); const app = getApp();
var xBlufi = require("@/components/blufi/xBlufi.js"); var xBlufi = require("@/components/blufi/xBlufi.js");
// let _this = null;
export default { export default {
data() { data() {
return { return {
mengcflag:false, mengcflag: false,
titleflag: false, // titleflag: false, //
bgc: { bgc: {
backgroundColor: "#F7FAFE", backgroundColor: "#F7FAFE",
@ -76,24 +75,7 @@
// {name:'110000', // {name:'110000',
// mac:'11111'} // mac:'11111'}
], ],
devicesLists: [ devicesLists: [],
// {name:'110000',
// mac:'11111',ssid:'RSSI'},
// {name:'110000',
// mac:'11111',ssid:'RSSI'},{name:'110000',
// mac:'11111',ssid:'RSSI'},{name:'110000',
// mac:'11111',ssid:'RSSI'},{name:'110000',
// mac:'11111',ssid:'RSSI'},{name:'110000',
// mac:'11111',ssid:'RSSI'},{name:'110000',
// mac:'11111',ssid:'RSSI'},{name:'110000',
// mac:'11111',ssid:'RSSI'},{name:'110000',
// mac:'11111',ssid:'RSSI'},{name:'110000',
// mac:'11111',ssid:'RSSI'},{name:'110000',
// mac:'11111',ssid:'RSSI'},{name:'110000',
// mac:'11111',ssid:'RSSI'},{name:'110000',
// mac:'11111',ssid:'RSSI'},{name:'110000',
// mac:'11111',ssid:'RSSI'},
],
searching: false, searching: false,
texts: '正在扫描设备...', texts: '正在扫描设备...',
btnflag: true, btnflag: true,
@ -111,10 +93,17 @@
backgroundColor: "#8883f0", backgroundColor: "#8883f0",
}, },
lurulist: [], lurulist: [],
arr:[], arr: [],
shows:false, shows: false,
arrname:'', arrname: '',
valuexh:'' valuexh: '',
deviceId: '',
arrs: '',
sn: '输入SN',
snname: '',
qrResult:'',
name:'',
ver_data:null
} }
}, },
onLoad(option) { onLoad(option) {
@ -123,253 +112,354 @@
this.getxingh() this.getxingh()
this.storeId = option.sn this.storeId = option.sn
}, },
onUnload: function() {
console.log("unload ");
xBlufi.listenDeviceMsgEvent(false, this.funListenDeviceMsgEvent);
wx.closeBLEConnection({
deviceId: this.deviceId,
})
},
// //
onShareAppMessage: function () { onShareAppMessage: function() {
return { return {
title: '创亿康', title: '创想物联',
path: '/pages/index/index' path: '/pages/shouye/index'
} }
}, },
// //
onShareTimeline: function () { onShareTimeline: function() {
return { return {
title: '创亿康', title: '创想物联',
query: '', query: '',
path: '/pages/index/index' path: '/pages/shouye/index'
} }
}, },
mounted() { mounted() {
// this.videoContext = uni.createVideoContext('myVideo', this) // this.videoContext = uni.createVideoContext('myVideo', this)
}, },
methods: { methods: {
getxingh(){ // sn
this.$u.get(`/app/model/all`).then(res => { scanQRCode(item) {
if(res.code == 200){ this.snname = item.name
this.arr = res.data uni.scanCode({
this.arr.forEach(item => { onlyFromCamera: true,
if (item.hasOwnProperty('modelId')) { scanType: ['qrCode'],
item.value = item.modelId; success: res => {
} function getQueryParam(url, paramName) {
if (item.hasOwnProperty('modelName')) { let regex = new RegExp(`[?&]${paramName}=([^&]*)`)
item.label = item.modelName; let results = regex.exec(url);
} return results ? decodeURIComponent(results[1].replace(/\+/g, ' ')) : null
}) }
console.log(this.arr,'2121212') let sceneValue = res.result
let decodedValue = decodeURIComponent(sceneValue)
let id = getQueryParam(decodedValue, 's')
this.storeId = id
this.devicesLists.forEach(item => {
if (item.name == this.snname) {
item.sn = id
}
})
},
fail: err => {
console.error('扫描失败:', err)
uni.showToast({
title: '扫描失败',
icon: 'none'
})
} }
}) })
}, },
btnshows(item,index){
getxingh() {
this.$u.get(`/app/model/all`).then(res => {
if (res.code == 200) {
this.arr = res.data
this.arr.forEach(item => {
if (item.hasOwnProperty('modelId')) {
item.value = item.modelId;
}
if (item.hasOwnProperty('modelName')) {
item.label = item.modelName;
}
})
console.log(this.arr, '2121212')
}
})
},
btnshows(item, index) {
this.arrname = item.name this.arrname = item.name
this.shows = true this.shows = true
}, },
// //
confirm(e){ confirm(e) {
this.devicesLists.forEach(item => { this.devicesLists.forEach(item => {
if(item.name == this.arrname){ if (item.name == this.arrname) {
item.xuanz = e[0].label item.xuanz = e[0].label
this.valuexh = e[0].value this.valuexh = e[0].value
} }
}) })
// console.log(this.devicesLists,'021515615');
}, },
btnyc() { btnyc() {
this.titleflag = false this.titleflag = false
}, },
funListenDeviceMsgEvent: function(options) { funListenDeviceMsgEvent: function(options) {
switch (options.type) { switch (options.type) {
case xBlufi.XBLUFI_TYPE.TYPE_RECIEVE_MY_DATA:
let loadPercent = options.data;
let loadText = '文件读取中'
break;
case xBlufi.XBLUFI_TYPE.TYPE_RECIEVE_CUSTON_DATA:
this.ver_data = this.parseCustomData(options.data)
console.log("1收到设备发来的自定义数据结果", this.ver_data)
break;
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS: case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS:
if (options.result) { if (options.result) {
this.devicesList = options.data this.devicesList = options.data
// let devicesarr = options.data this.devicesList.forEach(device => {
console.log(options.data,100100); const mac = device.name.substring(5)
// devicesarr.forEach(device => { if (device.name == this.qrResult) {
// if (device.name.substring(0, 4) == "CTKG" || device.name.substring(0, 4) == "CTPO") { this.deviceId = device.deviceId
// this.devicesList.push(device); this.name = device.name
// let uniqueDevicesList = Array.from(new Set(this.devicesList)); this.mac = device.name.slice(5, 17)
// this.devicesLists = uniqueDevicesList.filter(device => { }
// const deviceId = device.name.substring(5); })
// return !this.lurulist.includes(deviceId);
// })
// // console.log(this.devicesLists);
// }
// });
} }
break; break;
case xBlufi.XBLUFI_TYPE.TYPE_CONNECTED: case xBlufi.XBLUFI_TYPE.TYPE_CONNECTED:
console.log("连接回调:" + JSON.stringify(options)); // console.log("" + JSON.stringify(options))
if (options.result) { if (options.result) {
// uni.hideLoading(); setTimeout(()=>{
// uni.showToast({ this.bluetoothflag = false
// title: '', },3000)
// icon: 'none' {
// });
{
console.log("连接回调options.data.deviceId" + options.data.deviceId, console.log("连接回调options.data.deviceId" + options.data.deviceId,
"连接回调options.data.name" + options.data.name); "连接回调options.data.name" + options.data.name)
} }
} else {
this.shibaiflag = true
this.bluetoothflag = false
} }
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.mengcflag = false
uni.hideLoading()
console.log("蓝牙未开启", options); console.log("蓝牙未开启", options);
uni.showToast({ uni.showToast({
title: '蓝牙未开启,请打开手机蓝牙', title: '蓝牙未开启,请打开手机蓝牙',
icon: 'none', icon: 'none',
duration: 3000 duration: 3000
}); })
} else { } else {
this.searching = true this.searching = true
//
// _this.setData({
// searching: true
// });
} }
break; break;
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_STOP: case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_STOP:
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.substring(5);
const newDevice = { ...device, xuanz: "请选择" }; // xuanz const newDevice = {
return newDevice; ...device,
xuanz: "请选择",
}; // xuanz
return newDevice;
}) })
let devicesarr = options.data let devicesarr = options.data
this.devicesList.forEach(device => { this.devicesList.forEach(device => {
if (device.name.substring(0, 4) == "CTKG" || device.name.substring(0, 4) == "CTPO") { if (device.name.substring(0, 4) == "CCYK") {
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.substring(5);
return !this.lurulist.includes(deviceId); return deviceId
}) })
// console.log(this.devicesLists);
} }
}) })
// console.log(devicesarr,100100); // console.log('ok')
this.mengcflag = false
console.log('蓝牙停止搜索ok')
if (this.devicesLists.length == 0) { if (this.devicesLists.length == 0) {
this.titleflag = true this.titleflag = true
} else {
let arr = []
this.devicesLists.forEach(item => {
arr.push(item.name.slice(5))
})
this.arrs = arr.join(',')
this.$u.get(`/app/device/getExistMac/${this.arrs}`).then(res => {
if (res.code == 200) {
const existingDevices = new Set(res.data); // res.data Set
this.devicesLists = this.devicesLists.map(device => {
const trimmedName = device.name.slice(5); // 5
const flags = existingDevices.has(trimmedName); // true false
return {
...device,
flags, // 使 flags
sn: '',
}
})
}
})
console.log(this.devicesLists,'0202')
setTimeout(()=>{
uni.hideLoading()
},2000)
} }
} else { } else {
// //
this.mengcflag = false
uni.hideLoading()
console.log('蓝牙停止搜索失败'); console.log('蓝牙停止搜索失败');
} }
this.searching = false this.searching = false
// _this.setData({ break
// searching: false }
// }); },
break; //
createBLEConnections(e) {
uni.showLoading({
title: '执行中...'
})
this.arrs = ''
this.qrResult = e.name //mac
if (this.ver_data == null) { //
xBlufi.initXBlufi(1)
xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent)
xBlufi.notifyStartDiscoverBle({
'isStart': true
})
//
setTimeout(() => {
xBlufi.notifyStartDiscoverBle({
'isStart': false
})
xBlufi.notifyConnectBle({
isStart: true,
deviceId: this.deviceId,
name: this.name
})
xBlufi.notifyInitBleEsp32({
deviceId: this.deviceId
})
}, 1000)
}else{ //
let that = this //this
uni.getNetworkType({
success(res) {
if (res.networkType !== 'none') {
uni.getConnectedBluetoothDevices({
success(res) {
setTimeout(() => { //
xBlufi.notifySendCustomData({
customData: 'open'
})
setTimeout(()=>{ //
xBlufi.notifySendCustomData({
customData: 'close'
})
setTimeout(()=>{ //
uni.hideLoading()
that.ver_data = null
xBlufi.listenDeviceMsgEvent(false, that.funListenDeviceMsgEvent);
wx.closeBLEConnection({
deviceId: that.deviceId,
})
// console.log('guanbi');
},1000)
},2000)
}, 1000)
},
fail(err) {
console.error('获取已连接蓝牙设备信息失败:', err)
}
})
}
}
})
} }
}, },
// createBLEConnections(e) {
// xBlufi.notifyStartDiscoverBle({
// 'isStart': false
// });
// console.log(e, '101010')
// const deviceId = e.deviceId
// this.Bluetoothmac = e.localName.substring(5) // mac
// this.mac = e.localName.substring(5)
// let name = e.name;
// xBlufi.notifyConnectBle({
// isStart: true,
// deviceId: e.deviceId,
// name:e.name
// })
// //
// xBlufi.notifySendCustomData({
// customData: "BEEP2@"
// })
// let that = this
// },
// mac // mac
getluru() { getluru() {
this.$u.get(`/app/device/listAllMac`).then(res => { // this.$u.get(`/app/device/listAllMac`).then(res => {
if (res.code == 200) { // if (res.code == 200) {
this.lurulist = res.data // this.lurulist = res.data
if(this.lurulist){ // if(this.lurulist){
xBlufi.initXBlufi(1); xBlufi.initXBlufi(1);
xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent); xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent);
xBlufi.notifyStartDiscoverBle({ xBlufi.notifyStartDiscoverBle({
'isStart': true 'isStart': true
}) })
// //
setTimeout(() => { setTimeout(() => {
xBlufi.notifyStartDiscoverBle({ xBlufi.notifyStartDiscoverBle({
'isStart': false 'isStart': false
}); });
this.status = true this.status = true
}, 1000) }, 1000)
// }
// }
// })
},
parseCustomData(data) {
const dataArray = data.split('@');
const parsedData = {};
const prefixMap = {
'V': 'voltage',
'S': 'switchState',
'A': 'current',
'P': 'power',
'M': 'remainingPower',
'T': 'setMode',
'W': 'temperature'
};
//
for (let i = 0; i < dataArray.length; i++) {
const field = dataArray[i];
for (const prefix in prefixMap) {
if (field.startsWith(prefix)) {
const value = field.substring(1);
const propertyName = prefixMap[prefix];
parsedData[propertyName] = isNaN(parseFloat(value)) ? value : parseFloat(value);
break;
} }
} }
}) }
return parsedData;
}, },
//4 //4
createBLEConnection(e) { createBLEConnection(e) {
console.log(11); // this.deviceId = e.name
this.mengcflag = true this.mengcflag = true
uni.showLoading({ uni.showLoading({
title: '录入中...' title: '录入中...'
}) })
// xBlufi.notifyStartDiscoverBle({
// 'isStart': false
// });
// console.log(e, '101010')
this.mac = e.name.substring(5) this.mac = e.name.substring(5)
// console.log(this.mac, '54545454');
// xBlufi.notifyConnectBle({
// isStart: true,
// deviceId: e.deviceId,
// name:e.name
// })
// //
let data = { let data = {
sn: this.storeId, sn: this.storeId,
mac: this.mac, mac: this.mac,
modelId:this.valuexh modelId: this.valuexh
} }
this.$u.post('/app/device', data).then((res) => { this.$u.post('/app/device', data).then((res) => {
if (res.code == 200) { if (res.code == 200) {
uni.showToast({ uni.showToast({
title: '设备:'+ this.mac +'已录入成功', title: '设备:' + this.mac + '已录入成功',
icon: 'success', icon: 'success',
duration: 2000 duration: 2000
}) })
this.mengcflag = false this.mengcflag = false
uni.hideLoading() uni.hideLoading()
setTimeout(()=>{ this.Search()
uni.navigateBack() // setTimeout(() => {
},1000) // uni.navigateBack()
// }, 1000)
uni.removeStorageSync('mac'); uni.removeStorageSync('mac');
// uni.showModal({
// title: '',
// content: '',
// success: function (res) {
// if (res.confirm) {
// console.log('1111');
// setTimeout(()=>{
// uni.reLaunch({
// url:'/pages/index/index'
// })
// },500)
// } else if (res.cancel) {
// console.log('');
// }
// }
// })
} else { } else {
this.mengcflag = false this.mengcflag = false
uni.hideLoading() uni.hideLoading()
@ -383,8 +473,11 @@
}, },
// //
Search() { Search() {
// console.log(1);
// if (this.status) { // if (this.status) {
this.mengcflag = true
uni.showLoading({
title: '请稍后...'
})
xBlufi.notifyStartDiscoverBle({ xBlufi.notifyStartDiscoverBle({
'isStart': true 'isStart': true
}); });
@ -392,6 +485,7 @@
this.bluthlist = [] this.bluthlist = []
this.devicesList = [] this.devicesList = []
this.devicesLists = [] this.devicesLists = []
this.arrs = []
// //
// this.startBluetoothDevicesDiscovery() // this.startBluetoothDevicesDiscovery()
this.statusflag = true this.statusflag = true
@ -412,7 +506,7 @@
} else { } else {
xBlufi.notifyStartDiscoverBle({ xBlufi.notifyStartDiscoverBle({
'isStart': true 'isStart': true
}); })
} }
}, 2000) }, 2000)
// } // }
@ -490,11 +584,12 @@
.dblist { .dblist {
display: flex; display: flex;
justify-content: space-between;
width: 100%; width: 100%;
margin-top: 34rpx; margin-top: 34rpx;
background: #FFFFFF; background: #FFFFFF;
box-shadow: 0rpx 10rpx 64rpx 0rpx rgba(0, 0, 0, 0.08); box-shadow: 0rpx 10rpx 64rpx 0rpx rgba(0, 0, 0, 0.08);
padding: 20rpx 0 24rpx 18rpx; padding: 20rpx 20rpx 24rpx 18rpx;
box-sizing: border-box; box-sizing: border-box;
text-align: center; text-align: center;
border-radius: 10rpx; border-radius: 10rpx;
@ -542,10 +637,10 @@
.rt { .rt {
margin-top: 32rpx; margin-top: 32rpx;
padding-top: 50rpx;
box-sizing: border-box; box-sizing: border-box;
text { text {
display: inline-block; display: block;
width: 108rpx; width: 108rpx;
height: 60rpx; height: 60rpx;
background: rgba(255, 255, 255, 0); background: rgba(255, 255, 255, 0);