smartmeter-app/pages/shebei/setting.vue

532 lines
11 KiB
Vue
Raw Normal View History

2024-01-27 16:37:52 +08:00
<template>
<view class="page">
<u-navbar title="设置" :border-bottom="false" :background="bgc" title-color='#2E4975' title-size='36'
height='36'></u-navbar>
<view class="card">
2024-04-27 17:20:50 +08:00
<view class="li" @click.stop="sremake()">
2024-01-27 16:37:52 +08:00
<view class="tit">
备注
</view>
<view class="info">
<view class="txt">
2024-04-27 17:20:50 +08:00
{{deviceInfo.remark}}
2024-01-27 16:37:52 +08:00
</view>
<view class="iconfont icon-xiangyou1"></view>
</view>
</view>
2024-04-27 17:20:50 +08:00
<view class="li" @click="showfz=true">
2024-01-27 16:37:52 +08:00
<view class="tit">
分组
</view>
<view class="info">
<view class="txt">
2024-04-27 17:20:50 +08:00
{{deviceInfo.groupName}}
2024-01-27 16:37:52 +08:00
</view>
<view class="iconfont icon-xiangyou1"></view>
</view>
</view>
2024-04-27 17:20:50 +08:00
<view class="li" @click="sprice()">
2024-01-27 16:37:52 +08:00
<view class="tit">
电价设置
</view>
<view class="info">
<view class="txt">
2024-04-27 17:20:50 +08:00
{{deviceInfo.price}}/
2024-01-27 16:37:52 +08:00
</view>
<view class="iconfont icon-xiangyou1"></view>
</view>
</view>
2024-04-27 17:20:50 +08:00
<view class="li" @click="show=true">
2024-01-27 16:37:52 +08:00
<view class="tit">
欠费断电
</view>
<view class="info">
2024-04-27 17:20:50 +08:00
<view class="txt" v-if="deviceInfo.outageWay==1">
欠费断电
</view>
<view class="txt" v-if="deviceInfo.outageWay==0">
欠费不断电
2024-01-27 16:37:52 +08:00
</view>
<view class="iconfont icon-xiangyou1"></view>
</view>
</view>
<view class="li">
<view class="tit">
S/N
</view>
<view class="info">
<view class="txt">
2024-04-27 17:20:50 +08:00
{{deviceInfo.mac}}
2024-01-27 16:37:52 +08:00
</view>
<!-- <view class="iconfont icon-xiangyou1"></view> -->
</view>
</view>
<view class="li">
<view class="tit">
类型
</view>
<view class="info">
<view class="txt">
2024-04-27 17:20:50 +08:00
{{deviceInfo.model}}
2024-01-27 16:37:52 +08:00
</view>
<!-- <view class="iconfont icon-xiangyou1"></view> -->
</view>
</view>
<view class="li">
<view class="tit">
Wifi配网
</view>
<view class="info">
<view class="txt">
2024-04-27 17:20:50 +08:00
{{deviceInfo.wifi}}
2024-01-27 16:37:52 +08:00
</view>
<!-- <view class="iconfont icon-xiangyou1"></view> -->
</view>
</view>
</view>
<u-mask :show="showloading"></u-mask>
2024-04-27 17:20:50 +08:00
<u-mask :show="showfz"></u-mask>
<view class="fz" v-show="showfz" >
2024-01-27 16:37:52 +08:00
<view class="fz_top">
2024-04-27 17:20:50 +08:00
<view class="iconfont icon-shanchu" @click="showfz=false">
2024-01-27 16:37:52 +08:00
</view>
<view class="tit">
设备分组
</view>
2024-04-27 17:20:50 +08:00
<view class="txt" @click="tosetpage()">
2024-01-27 16:37:52 +08:00
管理
</view>
</view>
<view class="card_cont">
2024-04-27 17:20:50 +08:00
<view class="cards" v-for="(item,index) in groupList" :key="index" @click="changeGp(item)">
2024-01-27 16:37:52 +08:00
<view class="txt">
2024-04-27 17:20:50 +08:00
{{item.groupName}}
2024-01-27 16:37:52 +08:00
</view>
<view class="num">
2024-04-27 17:20:50 +08:00
{{item.deviceCount}}
2024-01-27 16:37:52 +08:00
</view>
</view>
<view class="zhanwei" style="width: 100%;height: 100rpx;">
</view>
</view>
</view>
<view class="dd">
2024-04-27 17:20:50 +08:00
<u-select v-model="show" :list="list" title='欠费断电' @confirm="confirm" ></u-select>
2024-01-27 16:37:52 +08:00
</view>
2024-04-27 17:20:50 +08:00
<u-popup v-model="showpopup" mode="center" border-radius='20'>
<view class="popcard" v-if="showremake">
<view class="tit">
修改备注
</view>
<view class="ipt">
<u-input v-model="remake" placeholder=" " border='surround' placeholder-style='font-size: 24rpx;' />
</view>
<view class="btnbox">
<view class="btn2" @click="close()">
取消
</view>
<view class="btn1" @click="sub(1)">
确定
</view>
</view>
</view>
<view class="popcard" v-if="showpeice" >
<view class="tit">
修改备注
</view>
<view class="ipt">
<u-input v-model="price" placeholder=" " border='surround' placeholder-style='font-size: 24rpx;'/>
</view>
<view class="btnbox">
<view class="btn2" @click="close()">
取消
</view>
<view class="btn1" @click="sub(2)">
确定
</view>
</view>
</view>
</u-popup>
<view class="btn" @click="deldevice()">
2024-01-27 16:37:52 +08:00
解除绑定
</view>
</view>
</template>
<script>
export default {
data() {
return {
bgc: {
backgroundColor: "#F7FAFE",
},
2024-03-25 19:46:07 +08:00
showloading: false,
2024-01-27 16:37:52 +08:00
showfz: false,
2024-04-27 17:20:50 +08:00
show: false,
2024-01-27 16:37:52 +08:00
list: [{
value: '1',
label: '欠费立即断电'
},
{
2024-04-27 17:20:50 +08:00
value: '0',
label: '欠费不断电'
2024-01-27 16:37:52 +08:00
}
],
2024-04-27 17:20:50 +08:00
id:'',
deviceInfo:{},
groupList:{},
showpopup:false,
remake:'',
price:'',
showpeice:false,
showremake:false,
2024-01-27 16:37:52 +08:00
}
},
2024-04-27 17:20:50 +08:00
onLoad(option) {
let id = option.id
this.id=id
this.getDevice(id)
},
onShow() {
this.getgroup()
},
2024-01-27 16:37:52 +08:00
methods: {
2024-04-27 17:20:50 +08:00
changeGp(item){
console.log(item,'changeGp');
let data ={
deviceId:this.id,
groupId: item.groupId
}
this.putdevice(data)
this.showfz=false
setTimeout(()=>{
this.getgroup()
},1000)
},
tosetpage(){
this.showfz=false
uni.navigateTo({
url:'/pages/shebei/fenzu'
})
},
sub(num){
if(num==1){
let data ={
deviceId:this.id,
remark:this.remake
}
this.showpopup=false
this.showremake=false
this.putdevice(data)
}else if(num==2){
let data ={
deviceId:this.id,
price:this.price
}
this.showpopup=false
this.showpeice=false
this.putdevice(data)
}
},
deldevice(){
this.$u.delete('/app/device/landlord/unbind/'+this.id).then((res) => {
if (res.code == 200) {
uni.showToast({
title: '解除成功',
icon: 'none',
duration: 2000
});
uni.navigateBack({
delta: 1 // 返回上级页面
});
}
})
},
confirm(e){
let data ={
deviceId:this.id,
outageWay: e[0].value
}
this.putdevice(data)
},
putdevice(data){
this.$u.put('/app/device',data).then((res) => {
if (res.code == 200) {
this.getDevice()
uni.showToast({
title: '修改成功',
icon: 'none',
duration: 2000
});
}
})
},
sremake(){
this.showpopup=true
this.showremake=true
},
sprice(){
this.showpopup=true
this.showpeice=true
},
close() {
this.showpeice=false
this.showremake=false
this.showpopup=false
},
getDevice(id){
this.$u.get("/app/device/"+this.id).then((res) => {
// this.$forceUpdate()
if (res.code == 200) {
this.deviceInfo=res.data
console.log(this.deviceInfo,'resres');
this.price=this.deviceInfo.price
this.remake=this.deviceInfo.remark
// this.loadings=true
// this.initChart()
}
});
},
getgroup(){
this.$u.get("/app/group/list").then((res) => {
// this.$forceUpdate()
if (res.code == 200) {
this.groupList=res.rows
// this.loadings=true
// this.initChart()
}
});
}
2024-01-27 16:37:52 +08:00
}
}
</script>
<style lang="scss">
page {
background-color: #F7FAFE;
}
.page {
width: 750rpx;
2024-04-27 17:20:50 +08:00
.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;
}
}
}
2024-01-27 16:37:52 +08:00
.card {
padding: 16rpx 38rpx;
margin: 60rpx auto 0;
width: 654rpx;
// height: 734rpx;
background: #FFFFFF;
border-radius: 30rpx;
box-shadow: 0rpx 16rpx 40rpx 0rpx rgba(42, 130, 228, 0.1);
opacity: 1;
.li {
display: flex;
flex-wrap: nowrap;
align-items: center;
justify-content: space-between;
height: 94rpx;
border-bottom: #E5E5E5 solid 2rpx;
.tit {
font-size: 32rpx;
font-family: HarmonyOS Sans SC, HarmonyOS Sans SC;
font-weight: 400;
color: #000000;
}
.info {
display: flex;
flex-wrap: nowrap;
align-items: center;
.txt {
font-size: 32rpx;
font-family: HarmonyOS Sans SC, HarmonyOS Sans SC;
font-weight: 400;
color: #95989D;
}
.icon-xiangyou1 {
margin-left: 6rpx;
color: #95989D;
}
}
}
}
.btn {
display: flex;
align-items: center;
justify-content: center;
margin: 52rpx auto 0;
width: 654rpx;
height: 100rpx;
background: #FF4F4F;
box-shadow: 0rpx 16rpx 40rpx 0rpx rgba(42, 130, 228, 0.1);
opacity: 1;
border-radius: 30rpx;
font-size: 32rpx;
font-family: HarmonyOS Sans SC, HarmonyOS Sans SC;
font-weight: 400;
color: #FFFFFF;
}
.fz {
position: fixed;
bottom: 0;
width: 750rpx;
height: 1152rpx;
background: #F7FAFE;
border-radius: 30rpx 30rpx 0 0;
z-index: 10071;
.fz_top {
margin: 18rpx 0 auto;
display: flex;
flex-wrap: nowrap;
justify-content: space-between;
.icon-shanchu {
margin-left: 40rpx;
font-size: 50rpx;
}
.tit {
font-size: 36rpx;
font-family: Source Han Sans, Source Han Sans;
font-weight: 400;
color: #000000;
}
.txt {
margin-right: 40rpx;
font-size: 36rpx;
font-family: Source Han Sans, Source Han Sans;
font-weight: 400;
color: #2A82E4;
}
}
.card_cont {
width: 750rpx;
display: flex;
flex-wrap: wrap;
align-items: baseline;
justify-content: center;
height: 1030rpx;
overflow-y: auto;
overflow-x: hidden;
.cards {
margin-top: 32rpx;
display: flex;
flex-wrap: nowrap;
align-items: center;
justify-content: space-between;
padding: 0 40rpx;
width: 682rpx;
border-radius: 30rpx;
height: 114rpx;
background: #FFFFFF;
box-shadow: 0rpx 16rpx 40rpx 0rpx rgba(42, 130, 228, 0.1);
.txt {
font-size: 36rpx;
font-family: Source Han Sans, Source Han Sans;
font-weight: 400;
color: #000000;
}
.num {
font-size: 36rpx;
font-family: Source Han Sans, Source Han Sans;
font-weight: 400;
color: #000000;
}
}
}
}
}
</style>