完善录入 支付等问题
This commit is contained in:
parent
c71b8eff34
commit
bda070dd89
|
@ -66,7 +66,7 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="li" @click.stop="sremakes()">
|
<view class="li" @click.stop="sremakes()" v-if="isMch">
|
||||||
<view class="tit">
|
<view class="tit">
|
||||||
店铺名称
|
店铺名称
|
||||||
</view>
|
</view>
|
||||||
|
@ -222,7 +222,8 @@
|
||||||
setMode:null,
|
setMode:null,
|
||||||
mac:'',
|
mac:'',
|
||||||
name:'',
|
name:'',
|
||||||
deviceId:''
|
deviceId:'',
|
||||||
|
isMch:false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(option) {
|
onLoad(option) {
|
||||||
|
@ -234,6 +235,7 @@
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
this.getgroup()
|
this.getgroup()
|
||||||
|
this.getuserinfo()
|
||||||
},
|
},
|
||||||
// 分享到好友(会话)
|
// 分享到好友(会话)
|
||||||
onShareAppMessage: function () {
|
onShareAppMessage: function () {
|
||||||
|
@ -258,7 +260,14 @@
|
||||||
url:'/page_components/newtaocan?id=' + this.id
|
url:'/page_components/newtaocan?id=' + this.id
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
// 获取当前用户信息
|
||||||
|
getuserinfo() {
|
||||||
|
this.$u.get("/app/user/userInfo").then((res) => {
|
||||||
|
if (res.code == 200) {
|
||||||
|
this.isMch = res.data.isMch
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
// 点击wifi进行配网
|
// 点击wifi进行配网
|
||||||
btnwifi(){
|
btnwifi(){
|
||||||
if(this.deviceId == ''){
|
if(this.deviceId == ''){
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
<view class="bot_right">
|
<view class="bot_right">
|
||||||
<view class="cont" style="text-align: center;">
|
<view class="cont" style="text-align: center;">
|
||||||
<view class="txt">
|
<view class="txt">
|
||||||
剩余时长:{{ setMode == null ? timeday : setMode}} 分钟
|
剩余时长:{{formattedTime}}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
@ -102,13 +102,14 @@
|
||||||
setMode:null,
|
setMode:null,
|
||||||
vipflag:false,
|
vipflag:false,
|
||||||
cztime:'',
|
cztime:'',
|
||||||
opflag:true
|
opflag:true,
|
||||||
|
timer: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(option) {
|
onLoad(option) {
|
||||||
let id = option.id
|
let id = option.id
|
||||||
this.id = id
|
this.id = id
|
||||||
this.getDevice(id)
|
// this.getDevice(id)
|
||||||
if(option.flag){
|
if(option.flag){
|
||||||
this.opflag = false
|
this.opflag = false
|
||||||
}else{
|
}else{
|
||||||
|
@ -116,6 +117,23 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
formattedTime() {
|
||||||
|
if (this.timeday.days > 0) {
|
||||||
|
// 只展示天和小时
|
||||||
|
return `${this.timeday.days}天${this.timeday.hours}小时`;
|
||||||
|
} else if (this.timeday.hours > 0) {
|
||||||
|
// 展示小时和分钟
|
||||||
|
return `${this.timeday.hours}小时${this.timeday.minutes}分钟`;
|
||||||
|
} else if (this.timeday.minutes > 0) {
|
||||||
|
// 展示分钟和秒
|
||||||
|
return `${this.timeday.minutes}分钟${this.timeday.seconds}秒`;
|
||||||
|
} else {
|
||||||
|
// 展示秒或0(如果秒也为0)
|
||||||
|
return this.timeday.seconds > 0 ? `${this.timeday.seconds}秒` : '0';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
// 分享到好友(会话)
|
// 分享到好友(会话)
|
||||||
onShareAppMessage: function () {
|
onShareAppMessage: function () {
|
||||||
return {
|
return {
|
||||||
|
@ -135,7 +153,7 @@
|
||||||
onShow() {
|
onShow() {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.getDevice(this.id)
|
this.getDevice(this.id)
|
||||||
}, 1000)
|
}, 100)
|
||||||
this.getQiniuToken()
|
this.getQiniuToken()
|
||||||
},
|
},
|
||||||
onUnload: function() {
|
onUnload: function() {
|
||||||
|
@ -165,6 +183,14 @@
|
||||||
deviceId: this.objlist.deviceId,
|
deviceId: this.objlist.deviceId,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
beforeDestroy() {
|
||||||
|
// 组件销毁前清除定时器,防止内存泄漏
|
||||||
|
if (this.timer) {
|
||||||
|
clearInterval(this.timer);
|
||||||
|
this.timer = null;
|
||||||
|
console.log('已销毁');
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getQiniuToken() {
|
getQiniuToken() {
|
||||||
this.$u.get("/common/qiniu/uploadInfo").then((res) => {
|
this.$u.get("/common/qiniu/uploadInfo").then((res) => {
|
||||||
|
@ -243,15 +269,55 @@
|
||||||
if (differenceInMs <= 0) {
|
if (differenceInMs <= 0) {
|
||||||
this.timeday = 0
|
this.timeday = 0
|
||||||
} else {
|
} else {
|
||||||
this.timeday = Math.abs(Math.floor(differenceInMs / (1000 * 60)));
|
this.timeday = this.formatMilliseconds(differenceInMs)
|
||||||
|
this.startTimer()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
this.loadings = true
|
this.loadings = true
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
},
|
||||||
|
startTimer() {
|
||||||
|
this.timer = setInterval(() => {
|
||||||
|
if (this.timeday.seconds > 0) {
|
||||||
|
this.timeday.seconds--;
|
||||||
|
} else if (this.timeday.minutes > 0) {
|
||||||
|
this.timeday.seconds = 59; // 重置秒数为59
|
||||||
|
this.timeday.minutes--;
|
||||||
|
} else if (this.timeday.hours > 0) {
|
||||||
|
this.timeday.minutes = 59; // 重置分钟数为59
|
||||||
|
this.timeday.hours--;
|
||||||
|
this.timeday.seconds = 0; // 同时重置秒数为0
|
||||||
|
} else if (this.timeday.days > 0) {
|
||||||
|
this.timeday.hours = 23; // 重置小时数为23
|
||||||
|
this.timeday.minutes = 59; // 重置分钟数为59
|
||||||
|
this.timeday.seconds = 0; // 重置秒数为0
|
||||||
|
this.timeday.days--;
|
||||||
|
} else {
|
||||||
|
// 所有时间单位都已减为0,停止定时器
|
||||||
|
clearInterval(this.timer);
|
||||||
|
this.timer = null;
|
||||||
|
console.log('时间已到期');
|
||||||
|
}
|
||||||
|
}, 1000); // 每秒执行一次
|
||||||
|
},
|
||||||
|
// 计算天时分秒
|
||||||
|
formatMilliseconds(milliseconds) {
|
||||||
|
// 计算天数
|
||||||
|
let days = Math.floor(milliseconds / (1000 * 60 * 60 * 24))
|
||||||
|
// 计算剩余的小时数
|
||||||
|
let hours = Math.floor((milliseconds % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60))
|
||||||
|
// 计算剩余的分钟数
|
||||||
|
let minutes = Math.floor((milliseconds % (1000 * 60 * 60)) / (1000 * 60))
|
||||||
|
// 计算剩余的秒数
|
||||||
|
let seconds = Math.floor((milliseconds % (1000 * 60)) / 1000)
|
||||||
|
// 返回一个对象,包含天、小时、分钟和秒
|
||||||
|
return {
|
||||||
|
days: days,
|
||||||
|
hours: hours,
|
||||||
|
minutes: minutes,
|
||||||
|
seconds: seconds
|
||||||
|
}
|
||||||
},
|
},
|
||||||
opendevice() {
|
opendevice() {
|
||||||
let stause = 0
|
let stause = 0
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
<!-- <u-navbar :border-bottom="false" :background="bgc" title-color='#fff' back-icon-color="#fff"
|
<!-- <u-navbar :border-bottom="false" :background="bgc" title-color='#fff' back-icon-color="#fff"
|
||||||
title-size='36' height='50'></u-navbar> -->
|
title-size='36' height='50'></u-navbar> -->
|
||||||
<view class="title">
|
<view class="title">
|
||||||
<u-icon name="home" color="#fff" size="48" @click="btnshouye"></u-icon> {{deviceobj.deviceName == undefined ? '--' : deviceobj.deviceName}}
|
<image src="https://api.ccttiot.com/smartmeter/img/static/uyr6T0Vfkefty2blkDmU" mode="" style="width: 52rpx;height: 52rpx;margin-right: 10rpx;vertical-align: bottom;vertical-align: bottom;" @click="btnshouye"></image>
|
||||||
|
{{deviceobj.deviceName == undefined ? '--' : deviceobj.deviceName}}
|
||||||
<view class="wz">
|
<view class="wz">
|
||||||
<!-- 该设备还剩余时长:{{expireTimeStr}}分钟 -->
|
<!-- 该设备还剩余时长:{{expireTimeStr}}分钟 -->
|
||||||
</view>
|
</view>
|
||||||
|
@ -189,7 +190,6 @@
|
||||||
}, 2000)
|
}, 2000)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
||||||
|
@ -213,7 +213,7 @@
|
||||||
onShow() {
|
onShow() {
|
||||||
this.getuserinfo()
|
this.getuserinfo()
|
||||||
if (this.orderno) {
|
if (this.orderno) {
|
||||||
this.gethuidaio()
|
// this.gethuidaio()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onUnload: function() {
|
onUnload: function() {
|
||||||
|
@ -481,9 +481,9 @@
|
||||||
// 111111111111111111111111
|
// 111111111111111111111111
|
||||||
that.$u.get('/app/bill/recharge/device/fail/list').then(res => {
|
that.$u.get('/app/bill/recharge/device/fail/list').then(res => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
// console.log('获取订单状态',res);
|
console.log('获取订单状态',res);
|
||||||
let dingobj = res.data[0].billNo
|
let dingobj = res.data[0].billNo
|
||||||
// console.log(dingobj);
|
console.log(dingobj,'订单号');
|
||||||
uni.getNetworkType({
|
uni.getNetworkType({
|
||||||
success(res) {
|
success(res) {
|
||||||
if (res.networkType !== 'none') {
|
if (res.networkType !== 'none') {
|
||||||
|
@ -549,7 +549,7 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
//选择套餐
|
||||||
btnactive(item) {
|
btnactive(item) {
|
||||||
this.sytime = item.value
|
this.sytime = item.value
|
||||||
this.zfobj = item
|
this.zfobj = item
|
||||||
|
@ -570,7 +570,7 @@
|
||||||
this.checked = e.value
|
this.checked = e.value
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// 获取附近蓝牙设备列表
|
||||||
funListenDeviceMsgEvent: function(options) {
|
funListenDeviceMsgEvent: function(options) {
|
||||||
switch (options.type) {
|
switch (options.type) {
|
||||||
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS:
|
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS:
|
||||||
|
@ -646,11 +646,10 @@
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
// 从蓝牙拿到数据进行解析
|
||||||
parseCustomData(data) {
|
parseCustomData(data) {
|
||||||
// 将字符串按照 "@" 分割成数组
|
// 将字符串按照 "@" 分割成数组
|
||||||
const dataArray = data.split('@');
|
const dataArray = data.split('@');
|
||||||
// 根据约定,解析各个字段的值
|
|
||||||
const voltage = parseFloat(dataArray[0].substring(1)); // 去除前缀 "V",并将字符串转换为浮点数
|
const voltage = parseFloat(dataArray[0].substring(1)); // 去除前缀 "V",并将字符串转换为浮点数
|
||||||
const switchState = dataArray[1].substring(1); // 去除前缀 "S"
|
const switchState = dataArray[1].substring(1); // 去除前缀 "S"
|
||||||
const current = parseFloat(dataArray[2].substring(1)); // 去除前缀 "A",并将字符串转换为浮点数
|
const current = parseFloat(dataArray[2].substring(1)); // 去除前缀 "A",并将字符串转换为浮点数
|
||||||
|
|
|
@ -43,6 +43,15 @@
|
||||||
<view class="nav">
|
<view class="nav">
|
||||||
<text class="shen">消费时间</text><text class="qian">{{detailobj.createTime == undefined ? '--' : detailobj.createTime}}</text>
|
<text class="shen">消费时间</text><text class="qian">{{detailobj.createTime == undefined ? '--' : detailobj.createTime}}</text>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="nav">
|
||||||
|
<text class="shen">套餐开始时间</text><text class="qian">{{detailobj.suitStartTime == undefined ? '--' : detailobj.suitStartTime}}</text>
|
||||||
|
</view>
|
||||||
|
<view class="nav">
|
||||||
|
<text class="shen">套餐结束时间</text><text class="qian">{{detailobj.suitEndTime == undefined ? '--' : detailobj.suitEndTime}}</text>
|
||||||
|
</view>
|
||||||
|
<view class="nav">
|
||||||
|
<text class="shen">套餐失效时间</text><text class="qian">{{detailobj.suitExpireTime == undefined ? '--' : detailobj.suitExpireTime}}</text>
|
||||||
|
</view>
|
||||||
<view class="nav">
|
<view class="nav">
|
||||||
<text class="shen">订单号</text><text class="qian">{{detailobj.billNo == undefined ? '--' : detailobj.billNo}}</text>
|
<text class="shen">订单号</text><text class="qian">{{detailobj.billNo == undefined ? '--' : detailobj.billNo}}</text>
|
||||||
</view>
|
</view>
|
||||||
|
@ -56,7 +65,9 @@
|
||||||
<text class="shen">套餐金额</text><text class="qian">{{detailobj.money == undefined ? '--' : detailobj.money}}</text>
|
<text class="shen">套餐金额</text><text class="qian">{{detailobj.money == undefined ? '--' : detailobj.money}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="nav">
|
<view class="nav">
|
||||||
<text class="shen">套餐时长</text><text class="qian">{{detailobj.suitTime == undefined ? '--' : detailobj.suitTime}} 分钟</text>
|
<text class="shen">套餐时长</text><text class="qian">{{detailobj.suitTime == undefined ? '--' : detailobj.suitTime}}
|
||||||
|
<text v-if="detailobj.suitTimeUnit == 1">天</text> <text v-if="detailobj.suitTimeUnit == 2">时</text> <text v-if="detailobj.suitTimeUnit == 3">分钟</text> <text v-if="detailobj.suitTimeUnit == 4">秒</text>
|
||||||
|
</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="xian"></view>
|
<view class="xian"></view>
|
||||||
|
@ -115,6 +126,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(option) {
|
onLoad(option) {
|
||||||
|
// console.log(uni.getStorageSync('userType'))
|
||||||
this.userType = uni.getStorageSync('userType')
|
this.userType = uni.getStorageSync('userType')
|
||||||
if(option.billId){
|
if(option.billId){
|
||||||
this.billId = option.billId
|
this.billId = option.billId
|
||||||
|
@ -206,6 +218,7 @@
|
||||||
}else{
|
}else{
|
||||||
this.userflag = false
|
this.userflag = false
|
||||||
}
|
}
|
||||||
|
// console.log(res.data.mchId ,this.userType.userId);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -259,9 +272,10 @@
|
||||||
|
|
||||||
.page {
|
.page {
|
||||||
width: 750rpx;
|
width: 750rpx;
|
||||||
position: fixed;
|
// position: fixed;
|
||||||
top: 0;
|
// top: 0;
|
||||||
left: 0;
|
// left: 0;
|
||||||
|
|
||||||
.tanc {
|
.tanc {
|
||||||
width: 594rpx;
|
width: 594rpx;
|
||||||
height: 420rpx;
|
height: 420rpx;
|
||||||
|
@ -350,6 +364,9 @@
|
||||||
background: #F4F5F7;
|
background: #F4F5F7;
|
||||||
border-radius: 0rpx 0rpx 0rpx 0rpx;
|
border-radius: 0rpx 0rpx 0rpx 0rpx;
|
||||||
padding-top: 24rpx;
|
padding-top: 24rpx;
|
||||||
|
overflow: scroll;
|
||||||
|
padding-bottom: 100rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
.pic{
|
.pic{
|
||||||
width: 680rpx;
|
width: 680rpx;
|
||||||
height: 238rpx;
|
height: 238rpx;
|
||||||
|
@ -359,7 +376,7 @@
|
||||||
}
|
}
|
||||||
.listxq{
|
.listxq{
|
||||||
width: 680rpx;
|
width: 680rpx;
|
||||||
height: 780rpx;
|
height: 1010rpx;
|
||||||
background: #FFFFFF;
|
background: #FFFFFF;
|
||||||
border-radius: 20rpx 20rpx 20rpx 20rpx;
|
border-radius: 20rpx 20rpx 20rpx 20rpx;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<view class="list_val">
|
<view class="list_val">
|
||||||
<view class="lt">
|
<view class="lt">
|
||||||
<view class="tit">{{item.deviceName}}</view>
|
<view class="tit">{{item.deviceName}}</view>
|
||||||
<view class="wz">地点:{{item.storeName == null ? '--' : ''}}</view>
|
<view class="wz">地点:{{item.storeAddress == null ? '--' : item.storeAddress.length > 13 ? item.storeAddress.slice(0, 13) + '...' : item.storeAddress}}</view>
|
||||||
<view class="wz">订单号:{{item.billNo}}</view>
|
<view class="wz">订单号:{{item.billNo}}</view>
|
||||||
<view class="wz">消费时间:{{item.createTime}}</view>
|
<view class="wz">消费时间:{{item.createTime}}</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
|
@ -131,7 +131,6 @@
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
btnpag(num) {
|
btnpag(num) {
|
||||||
if (num == 1) {
|
if (num == 1) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
|
@ -249,7 +248,7 @@
|
||||||
this.devicesList = uniqueDevicesList;
|
this.devicesList = uniqueDevicesList;
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
})
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '没有发现设备',
|
title: '没有发现设备',
|
||||||
|
@ -269,11 +268,11 @@
|
||||||
// });
|
// });
|
||||||
{
|
{
|
||||||
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)
|
||||||
let name = ''
|
let name = ''
|
||||||
let index = this.name.indexOf('-');
|
let index = this.name.indexOf('-')
|
||||||
if (index !== -1) {
|
if (index !== -1) {
|
||||||
name = this.name.slice(index + 1);
|
name = this.name.slice(index + 1)
|
||||||
}
|
}
|
||||||
let data = {
|
let data = {
|
||||||
storeId: this.storeId,
|
storeId: this.storeId,
|
||||||
|
@ -286,7 +285,7 @@
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
duration: 2000
|
duration: 2000
|
||||||
});
|
});
|
||||||
uni.hideLoading();
|
uni.hideLoading()
|
||||||
uni.removeStorageSync('mac');
|
uni.removeStorageSync('mac');
|
||||||
let vm = this
|
let vm = this
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
|
@ -296,7 +295,7 @@
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
if(vm.mac == ''){
|
if(vm.mac == ''){
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '当前设备不在线',
|
title: '请靠近设备,未找到设备',
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
duration: 2000
|
duration: 2000
|
||||||
});
|
});
|
||||||
|
@ -314,10 +313,8 @@
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} else if (res.cancel) {
|
} else if (res.cancel) {
|
||||||
console.log('用户点击了取消');
|
console.log('用户点击了取消')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -330,7 +327,7 @@
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '连接失败',
|
title: '绑定失败',
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
duration: 2000
|
duration: 2000
|
||||||
});
|
});
|
||||||
|
@ -344,7 +341,7 @@
|
||||||
|
|
||||||
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_START:
|
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_START:
|
||||||
if (!options.result) {
|
if (!options.result) {
|
||||||
console.log("蓝牙未开启", options);
|
console.log("蓝牙未开启", options)
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '蓝牙未开启',
|
title: '蓝牙未开启',
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
|
@ -365,12 +362,12 @@
|
||||||
let uniqueDevicesList = Array.from(new Set(this.devicesList));
|
let uniqueDevicesList = Array.from(new Set(this.devicesList));
|
||||||
|
|
||||||
// 将去重后的数组重新赋值给 this.devicesList
|
// 将去重后的数组重新赋值给 this.devicesList
|
||||||
this.devicesList = uniqueDevicesList;
|
this.devicesList = uniqueDevicesList
|
||||||
let list = []
|
let list = []
|
||||||
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)
|
||||||
// 与 this.mac 进行比较
|
// 与 this.mac 进行比较
|
||||||
this.$u.get(`/app/device/${macFromName}/isBind`).then((res) => {
|
this.$u.get(`/app/device/${macFromName}/isBind`).then((res) => {
|
||||||
if (res.data == false) {
|
if (res.data == false) {
|
||||||
|
@ -385,17 +382,17 @@
|
||||||
this.devicesList = list
|
this.devicesList = list
|
||||||
}, 200)
|
}, 200)
|
||||||
|
|
||||||
console.log('蓝牙停止搜索ok');
|
console.log('蓝牙停止搜索ok')
|
||||||
} else {
|
} else {
|
||||||
//蓝牙停止搜索失败
|
//蓝牙停止搜索失败
|
||||||
console.log('蓝牙停止搜索失败');
|
console.log('蓝牙停止搜索失败')
|
||||||
}
|
}
|
||||||
this.searching = false
|
this.searching = false
|
||||||
// _this.setData({
|
// _this.setData({
|
||||||
// searching: false
|
// searching: false
|
||||||
// });
|
// });
|
||||||
|
|
||||||
break;
|
break
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<view class="list_val">
|
<view class="list_val">
|
||||||
<view class="lt">
|
<view class="lt">
|
||||||
<view class="tit">{{item.deviceName}}</view>
|
<view class="tit">{{item.deviceName}}</view>
|
||||||
<view class="wz">地点:{{item.storeName == null ? '--' : item.storeName}}</view>
|
<view class="wz">地点:{{item.storeAddress == null ? '--' : item.storeAddress.length > 15 ? item.storeAddress.slice(0, 15) + '...' : item.storeAddress}}</view>
|
||||||
<view class="wz">订单号:{{item.billNo}}</view>
|
<view class="wz">订单号:{{item.billNo}}</view>
|
||||||
<view class="wz">消费时间:{{item.createTime}}</view>
|
<view class="wz">消费时间:{{item.createTime}}</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
|
@ -66,7 +66,7 @@
|
||||||
</view>
|
</view>
|
||||||
<view class="cont" style="text-align: center;">
|
<view class="cont" style="text-align: center;">
|
||||||
<view class="tit">
|
<view class="tit">
|
||||||
{{ setMode == null ? timeday : setMode}} 分钟
|
{{formattedTime}}
|
||||||
<!-- sb:{{setMode}} -->
|
<!-- sb:{{setMode}} -->
|
||||||
</view>
|
</view>
|
||||||
<view class="txt">
|
<view class="txt">
|
||||||
|
@ -113,7 +113,7 @@
|
||||||
<view class="top">
|
<view class="top">
|
||||||
<image src="https://api.ccttiot.com/smartmeter/img/static/uAnBmmayp3tVGwXntdaM" mode=""></image>
|
<image src="https://api.ccttiot.com/smartmeter/img/static/uAnBmmayp3tVGwXntdaM" mode=""></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="bot">电量充值</view>
|
<view class="bot">充值</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="" style="display: flex;margin-top: 20rpx;">
|
<view class="" style="display: flex;margin-top: 20rpx;">
|
||||||
|
@ -133,11 +133,19 @@
|
||||||
</view>
|
</view>
|
||||||
<view class="cont" @click="topage(5)">
|
<view class="cont" @click="topage(5)">
|
||||||
<view class="top">
|
<view class="top">
|
||||||
<image src="https://api.ccttiot.com/smartmeter/img/static/uXdBHA7pzOv2LYL7stJp" mode="">
|
<image src="https://api.ccttiot.com/smartmeter/img/static/uik9veDG6pMVG5M1Vxze" mode="">
|
||||||
</image>
|
</image>
|
||||||
</view>
|
</view>
|
||||||
<view class="bot">配网</view>
|
<view class="bot">配网</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<view class="cont" @click="btnkq">
|
||||||
|
<view class="top">
|
||||||
|
<u-switch v-model="checked" active-color="#8883F0"></u-switch>
|
||||||
|
</view>
|
||||||
|
<view class="bot">{{tdtxt}}</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="cont_box" style="padding-left: 30rpx;">
|
<view class="cont_box" style="padding-left: 30rpx;">
|
||||||
|
@ -180,6 +188,7 @@
|
||||||
deviceInfo: {},
|
deviceInfo: {},
|
||||||
loadings: false,
|
loadings: false,
|
||||||
info: '',
|
info: '',
|
||||||
|
checked:false,
|
||||||
tittxt: "设备详情",
|
tittxt: "设备详情",
|
||||||
titlist: [
|
titlist: [
|
||||||
"全部",
|
"全部",
|
||||||
|
@ -187,6 +196,7 @@
|
||||||
"水表",
|
"水表",
|
||||||
|
|
||||||
],
|
],
|
||||||
|
tdtxt:'开启',
|
||||||
curtitidx: 0,
|
curtitidx: 0,
|
||||||
id: '',
|
id: '',
|
||||||
focus:false,
|
focus:false,
|
||||||
|
@ -204,13 +214,14 @@
|
||||||
setMode:null,
|
setMode:null,
|
||||||
vipflag:false,
|
vipflag:false,
|
||||||
cztime:'',
|
cztime:'',
|
||||||
opflag:true
|
opflag:true,
|
||||||
|
timer: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(option) {
|
onLoad(option) {
|
||||||
let id = option.id
|
let id = option.id
|
||||||
this.id = id
|
this.id = id
|
||||||
this.getDevice(id)
|
// this.getDevice(id)
|
||||||
if(option.flag){
|
if(option.flag){
|
||||||
this.opflag = false
|
this.opflag = false
|
||||||
}else{
|
}else{
|
||||||
|
@ -255,10 +266,35 @@
|
||||||
path: '/pages/shouye/index'
|
path: '/pages/shouye/index'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
formattedTime() {
|
||||||
|
if (this.timeday.days > 0) {
|
||||||
|
// 只展示天和小时
|
||||||
|
return `${this.timeday.days}天${this.timeday.hours}小时`;
|
||||||
|
} else if (this.timeday.hours > 0) {
|
||||||
|
// 展示小时和分钟
|
||||||
|
return `${this.timeday.hours}小时${this.timeday.minutes}分钟`;
|
||||||
|
} else if (this.timeday.minutes > 0) {
|
||||||
|
// 展示分钟和秒
|
||||||
|
return `${this.timeday.minutes}分钟${this.timeday.seconds}秒`;
|
||||||
|
} else {
|
||||||
|
// 展示秒或0(如果秒也为0)
|
||||||
|
return this.timeday.seconds > 0 ? `${this.timeday.seconds}秒` : '0';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
beforeDestroy() {
|
||||||
|
// 组件销毁前清除定时器,防止内存泄漏
|
||||||
|
if (this.timer) {
|
||||||
|
clearInterval(this.timer);
|
||||||
|
this.timer = null;
|
||||||
|
console.log('已销毁');
|
||||||
|
}
|
||||||
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.getDevice(this.id)
|
this.getDevice(this.id)
|
||||||
}, 1000)
|
}, 100)
|
||||||
this.getQiniuToken()
|
this.getQiniuToken()
|
||||||
},
|
},
|
||||||
onUnload: function() {
|
onUnload: function() {
|
||||||
|
@ -289,6 +325,46 @@
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
// 开启和关闭
|
||||||
|
btnkq(){
|
||||||
|
if(this.tdtxt == '开启'){
|
||||||
|
this.$u.put(`/app/device/${this.id}/changePower?status=1`).then((res) => {
|
||||||
|
if (res.code == 200) {
|
||||||
|
this.tdtxt = '关闭'
|
||||||
|
this.checked = true
|
||||||
|
uni.showToast({
|
||||||
|
title: res.msg,
|
||||||
|
icon: 'success',
|
||||||
|
duration: 2000
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
uni.showToast({
|
||||||
|
title: res.msg,
|
||||||
|
icon: 'none',
|
||||||
|
duration: 2000
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
this.$u.put(`/app/device/${this.id}/changePower?status=0`).then((res) => {
|
||||||
|
if (res.code == 200) {
|
||||||
|
this.checked = false
|
||||||
|
this.tdtxt = '开启'
|
||||||
|
uni.showToast({
|
||||||
|
title: res.msg,
|
||||||
|
icon: 'success',
|
||||||
|
duration: 2000
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
uni.showToast({
|
||||||
|
title: res.msg,
|
||||||
|
icon: 'none',
|
||||||
|
duration: 2000
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
getQiniuToken() {
|
getQiniuToken() {
|
||||||
this.$u.get("/common/qiniu/uploadInfo").then((res) => {
|
this.$u.get("/common/qiniu/uploadInfo").then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
|
@ -366,13 +442,56 @@
|
||||||
if (differenceInMs <= 0) {
|
if (differenceInMs <= 0) {
|
||||||
this.timeday = 0
|
this.timeday = 0
|
||||||
} else {
|
} else {
|
||||||
this.timeday = Math.abs(Math.floor(differenceInMs / (1000 * 60)));
|
this.timeday = this.formatMilliseconds(differenceInMs)
|
||||||
|
this.startTimer()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.loadings = true
|
this.loadings = true
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
startTimer() {
|
||||||
|
this.timer = setInterval(() => {
|
||||||
|
if (this.timeday.seconds > 0) {
|
||||||
|
this.timeday.seconds--;
|
||||||
|
} else if (this.timeday.minutes > 0) {
|
||||||
|
this.timeday.seconds = 59; // 重置秒数为59
|
||||||
|
this.timeday.minutes--;
|
||||||
|
} else if (this.timeday.hours > 0) {
|
||||||
|
this.timeday.minutes = 59; // 重置分钟数为59
|
||||||
|
this.timeday.hours--;
|
||||||
|
this.timeday.seconds = 0; // 同时重置秒数为0
|
||||||
|
} else if (this.timeday.days > 0) {
|
||||||
|
this.timeday.hours = 23; // 重置小时数为23
|
||||||
|
this.timeday.minutes = 59; // 重置分钟数为59
|
||||||
|
this.timeday.seconds = 0; // 重置秒数为0
|
||||||
|
this.timeday.days--;
|
||||||
|
} else {
|
||||||
|
// 所有时间单位都已减为0,停止定时器
|
||||||
|
clearInterval(this.timer);
|
||||||
|
this.timer = null;
|
||||||
|
console.log('时间已到期');
|
||||||
|
}
|
||||||
|
}, 1000); // 每秒执行一次
|
||||||
|
},
|
||||||
|
// 计算天时分秒
|
||||||
|
formatMilliseconds(milliseconds) {
|
||||||
|
// 计算天数
|
||||||
|
let days = Math.floor(milliseconds / (1000 * 60 * 60 * 24))
|
||||||
|
// 计算剩余的小时数
|
||||||
|
let hours = Math.floor((milliseconds % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60))
|
||||||
|
// 计算剩余的分钟数
|
||||||
|
let minutes = Math.floor((milliseconds % (1000 * 60 * 60)) / (1000 * 60))
|
||||||
|
// 计算剩余的秒数
|
||||||
|
let seconds = Math.floor((milliseconds % (1000 * 60)) / 1000)
|
||||||
|
// 返回一个对象,包含天、小时、分钟和秒
|
||||||
|
return {
|
||||||
|
days: days,
|
||||||
|
hours: hours,
|
||||||
|
minutes: minutes,
|
||||||
|
seconds: seconds
|
||||||
|
}
|
||||||
|
},
|
||||||
opendevice() {
|
opendevice() {
|
||||||
let stause = 0
|
let stause = 0
|
||||||
if (this.deviceInfo.powerStatus == 1) {
|
if (this.deviceInfo.powerStatus == 1) {
|
||||||
|
@ -626,6 +745,10 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
trueje(){
|
trueje(){
|
||||||
|
if (this.timer) {
|
||||||
|
clearInterval(this.timer);
|
||||||
|
this.timer = null;
|
||||||
|
}
|
||||||
let id = this.deviceInfo.deviceId
|
let id = this.deviceInfo.deviceId
|
||||||
this.vipflag = false
|
this.vipflag = false
|
||||||
this.$u.put('/app/device/addTime/' + id + '?amount=' + this.cztime).then(res => {
|
this.$u.put('/app/device/addTime/' + id + '?amount=' + this.cztime).then(res => {
|
||||||
|
@ -737,11 +860,11 @@
|
||||||
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_START:
|
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_START:
|
||||||
if (!options.result) {
|
if (!options.result) {
|
||||||
console.log("蓝牙未开启", options);
|
console.log("蓝牙未开启", options);
|
||||||
uni.showToast({
|
// uni.showToast({
|
||||||
title: '蓝牙未开启',
|
// title: '蓝牙未开启',
|
||||||
icon: 'none',
|
// icon: 'none',
|
||||||
duration: 3000
|
// duration: 3000
|
||||||
});
|
// });
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
// this.searching = true
|
// this.searching = true
|
||||||
|
|
|
@ -449,6 +449,14 @@
|
||||||
"enablePullDownRefresh": false,
|
"enablePullDownRefresh": false,
|
||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
|
},{
|
||||||
|
"path": "miyao",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "",
|
||||||
|
"navigationBarBackgroundColor": "#4473f6",
|
||||||
|
"enablePullDownRefresh": false,
|
||||||
|
"navigationStyle": "custom"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "wifilist/index",
|
"path": "wifilist/index",
|
||||||
|
|
|
@ -320,9 +320,6 @@
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
tocz() {
|
tocz() {
|
||||||
this.showtip = false
|
this.showtip = false
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
|
@ -481,8 +478,6 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
changeGp(item, index) {
|
changeGp(item, index) {
|
||||||
// console.log(item);
|
// console.log(item);
|
||||||
this.pagenum = 1
|
this.pagenum = 1
|
||||||
|
@ -580,8 +575,6 @@
|
||||||
// scanType: ['qrCode'],
|
// scanType: ['qrCode'],
|
||||||
// success: res => {
|
// success: res => {
|
||||||
// console.log('扫描结果:', res);
|
// console.log('扫描结果:', res);
|
||||||
|
|
||||||
|
|
||||||
// this.qrResult = res.result;
|
// this.qrResult = res.result;
|
||||||
// // this.$u.get(`/app/device/${this.qrResult}/withSuitList`).then((res) =>{
|
// // this.$u.get(`/app/device/${this.qrResult}/withSuitList`).then((res) =>{
|
||||||
// // if(res.code == 200){
|
// // if(res.code == 200){
|
||||||
|
@ -727,10 +720,8 @@
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
const chart = await this.$refs.chart.init(echarts)
|
||||||
const chart = await this.$refs.chart.init(echarts);
|
|
||||||
chart.setOption(option)
|
chart.setOption(option)
|
||||||
|
|
||||||
return chart
|
return chart
|
||||||
},
|
},
|
||||||
// 获取设备详情
|
// 获取设备详情
|
||||||
|
@ -749,7 +740,7 @@
|
||||||
// this.$forceUpdate()
|
// this.$forceUpdate()
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
|
|
||||||
uni.setStorageSync('userType', res.data.userType)
|
// uni.setStorageSync('userType', res.data.userType)
|
||||||
this.userType = res.data.userType
|
this.userType = res.data.userType
|
||||||
if (this.userType == '01') {
|
if (this.userType == '01') {
|
||||||
this.getDeviceList()
|
this.getDeviceList()
|
||||||
|
@ -817,7 +808,7 @@
|
||||||
|
|
||||||
getdevice() {
|
getdevice() {
|
||||||
this.$u.get("/app/device/tenant").then((res) => {
|
this.$u.get("/app/device/tenant").then((res) => {
|
||||||
this.deviceInfo = res.rows.find(item => item.isDefault === true);
|
this.deviceInfo = res.rows.find(item => item.isDefault === true)
|
||||||
if (this.deviceInfo == undefined) {
|
if (this.deviceInfo == undefined) {
|
||||||
this.addflag = true
|
this.addflag = true
|
||||||
this.sbflag = false
|
this.sbflag = false
|
||||||
|
@ -825,7 +816,7 @@
|
||||||
this.addflag = false
|
this.addflag = false
|
||||||
this.sbflag = true
|
this.sbflag = true
|
||||||
}
|
}
|
||||||
uni.setStorageSync('deviceId', this.deviceInfo.deviceId);
|
uni.setStorageSync('deviceId', this.deviceInfo.deviceId)
|
||||||
// this.initChart()
|
// this.initChart()
|
||||||
this.order()
|
this.order()
|
||||||
});
|
});
|
||||||
|
|
11
pages/my.vue
11
pages/my.vue
|
@ -75,6 +75,10 @@
|
||||||
<image src="https://api.ccttiot.com/smartmeter/img/static/uGlrjkSOTDXMFuuRb03l" mode=""></image>
|
<image src="https://api.ccttiot.com/smartmeter/img/static/uGlrjkSOTDXMFuuRb03l" mode=""></image>
|
||||||
<view class="txt">意见反馈</view>
|
<view class="txt">意见反馈</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="botcard" @click="btnmy">
|
||||||
|
<image src="https://api.ccttiot.com/smartmeter/img/static/uCtxeWyTyH2DHQZaRv5Q" mode=""></image>
|
||||||
|
<view class="txt">秘钥管理</view>
|
||||||
|
</view>
|
||||||
<view class="botcard" @click="topage(5)">
|
<view class="botcard" @click="topage(5)">
|
||||||
<image src="https://api.ccttiot.com/smartmeter/img/static/uYWpW30vIQ6M4svb7Vnb"></image>
|
<image src="https://api.ccttiot.com/smartmeter/img/static/uYWpW30vIQ6M4svb7Vnb"></image>
|
||||||
<view class="txt">设置</view>
|
<view class="txt">设置</view>
|
||||||
|
@ -127,6 +131,11 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
btnmy(){
|
||||||
|
uni.navigateTo({
|
||||||
|
url:'/page_components/miyao'
|
||||||
|
})
|
||||||
|
},
|
||||||
btntc(){
|
btntc(){
|
||||||
uni.reLaunch({
|
uni.reLaunch({
|
||||||
url:'/pages/shouye/index'
|
url:'/pages/shouye/index'
|
||||||
|
@ -217,7 +226,7 @@
|
||||||
// this.$forceUpdate()
|
// this.$forceUpdate()
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
this.userinfo=res.data
|
this.userinfo=res.data
|
||||||
uni.setStorageSync('userType', res.data.userType)
|
// uni.setStorageSync('userType', res.data.userType)
|
||||||
this.userType = res.data.userType
|
this.userType = res.data.userType
|
||||||
if (this.userType == '01') {
|
if (this.userType == '01') {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user