<template> <view class="page"> <u-navbar title="设备信息" :border-bottom="false" :background="bgc" back-icon-color="#262B37" title-color='#262B37' title-size='36' height='48' id="navbar"> </u-navbar> <view class="box" v-if="xxobj.placementStatus == 0"> <view class="ulbox" @click="editnameflag = true"> <view class="one"> 设备名称 </view> <view class="two"> {{xxobj.deviceName == null ? '--' : xxobj.deviceName}} <image src="https://api.ccttiot.com/smartmeter/img/static/uS5JydUQDmvbMyg4nsdo" mode=""></image> </view> </view> <view class="ulbox"> <view class="one"> 设备型号 </view> <view class="two"> {{xxobj.model == null ? '--' : xxobj.model}} </view> </view> <view class="ulbox"> <view class="one"> 设备编号 </view> <view class="two"> {{xxobj.sn == null ? '--' : xxobj.sn}} </view> </view> <view class="ulbox"> <view class="one"> 设备状态 </view> <view class="two" v-if="xxobj.placementStatus == 1"> 已投放 </view> <view class="two" v-if="xxobj.placementStatus == 0"> 未投放 </view> </view> <view class="ulbox"> <view class="one"> 版本号 </view> <view class="two"> {{xxobj.version == null ? '--' : xxobj.version}} </view> </view> <view class="ulbox" style="border-bottom: none;"> <view class="one"> 联网状态 </view> <view class="two"> {{xxobj.onlineStatus == 1 ? '在线' : '离线'}} <image src="https://api.ccttiot.com/smartmeter/img/static/uS5JydUQDmvbMyg4nsdo" mode=""></image> </view> </view> <view class="anniu"> <view class="jiebang" @click="btndel"> 删除 </view> <view class="tougang" @click="btnshop"> 投放 </view> </view> </view> <!-- 已投放 已投放 已投放 --> <view class="" v-if="xxobj.placementStatus == 1"> <view class="toufangbox"> <view class="shebeibj"> <view class="lt"> <view class="name" @click="editnameflag = true"> {{xxobj.deviceName}} <u-icon name="edit-pen-fill" color="#3f3f3f" size="38"></u-icon> </view> <view class="zt"> 设备状态:<text v-if="xxobj.placementStatus == 1">已投放</text><text v-if="xxobj.placementStatus == 0">未投放</text> </view> <view class="zt"> SN:{{xxobj.sn}} </view> <view class="zt"> 更新时间:{{xxobj.updateTime == null ? '--' : xxobj.updateTime}} </view> </view> <view class="rt"> <image :src="xxobj.picture" mode=""></image> </view> </view> </view> <view class="jichuxx"> <view class="top"> 基础信息 </view> <view class="one"> <view class="two"> 设备名称 </view> <view class="thr"> {{xxobj.deviceName}} </view> </view> <view class="one"> <view class="two"> 店铺名称 </view> <view class="thr"> {{mdianobj.name == null ? '--' : mdianobj.name}} </view> </view> <view class="one"> <view class="two"> 详细地址 </view> <view class="thr" v-if="mdianobj.address"> {{mdianobj.address.length > 15 ? mdianobj.address.slice(0,15) + '...' : mdianobj.address}} </view> <view class="thr" v-else> -- </view> </view> <view class="one"> <view class="two"> 绑定时间 </view> <view class="thr"> {{xxobj.activationTime == null ? '--' : xxobj.activationTime}} </view> </view> </view> <view class="lianwang"> <view class="two"> 联网状态 </view> <view class="thr"> {{xxobj.onlineStatus == 0 ? '离线' : '在线'}} <image src="https://api.ccttiot.com/smartmeter/img/static/uS5JydUQDmvbMyg4nsdo" mode=""></image> </view> </view> <view class="kongzhi"> <view class="jiebang" @click="btngb"> 关闭 </view> <view class="tougang" @click="btnkq"> 开启 </view> </view> <view class="anniu"> <view class="jiebang" @click="btndel"> 删除 </view> <view class="tougang" @click="btnjiebang"> 解绑 </view> </view> </view> <view class="mask" v-if="editnameflag"></view> <view class="editname" v-if="editnameflag"> <view class="top"> 修改设备名称 </view> <input type="text" v-model="name" placeholder="请输入设备名称"/> <view class="btnanniu"> <view class="quxiao" @click="editnameflag = false"> 取消 </view> <view class="queren" @click="btneditname"> 确认 </view> </view> </view> <!-- <view class="mask" v-if="xuanzeflag"></view> <view class="xuanze" v-if="xuanzeflag"> <view class="top"> <view>选择使用场景</view> <view @click="xuanzeflag = false"><image src="https://api.ccttiot.com/smartmeter/img/static/uAd1csWlbqF423arI5b6" mode=""></image></view> </view> <view class="changj"> <view class="changj_item" @click="btnshop(1)"> 自助棋牌 </view> <view class="changj_item" @click="btnshop(2)"> 共享棋牌 </view> <view class="changj_item" @click="btnshop(3)"> 自助台球 </view> </view> </view> --> </view> </template> <script> export default { data() { return { bgc: { backgroundColor: "#fff", }, deviceId:'', xxobj:{}, xuanzeflag:false, editnameflag:false, name:'', mdianobj:{}, sn:'' } }, onLoad(option) { this.deviceId = option.deviceId this.sn = option.sn this.getxx() }, methods: { // 开启设备 btnkq(){ this.$u.put(`/app/device/admin/${this.deviceId}/switch?open=true`).then(res =>{ if(res.code == 200){ uni.showToast({ title: res.msg, icon: 'success', duration: 2000 }) }else{ uni.showToast({ title: res.msg, icon: 'none', duration: 2000 }) } }) }, // 关闭设备 btngb(){ this.$u.put(`/app/device/admin/${this.deviceId}/switch?open=false`).then(res =>{ if(res.code == 200){ uni.showToast({ title: res.msg, icon: 'success', duration: 2000 }) }else{ uni.showToast({ title: res.msg, icon: 'none', duration: 2000 }) } }) }, // 点击删除设备 btndel(){ let that = this uni.showModal({ title: '温馨提示', content: '您确定要删除该设备吗?', success: function (res) { if (res.confirm) { that.$u.delete(`/app/device/mch/unbind/${that.deviceId}`).then(res => { if (res.code == 200) { uni.showToast({ title: '删除成功', icon: 'success', duration: 2000 }) setTimeout(()=>{ uni.navigateBack() },1000) }else{ uni.showToast({ title: res.msg, icon: 'none', duration: 2000 }) } }) } else if (res.cancel) { } } }) }, // 点击确定修改设备名称 btneditname(){ let data = { deviceName:this.name } this.$u.post(`/app/device/editName/${this.deviceId}?deviceName=${this.name}`,data).then(res =>{ if(res.code == 200){ this.getxx() this.name = '' this.editnameflag = false uni.showToast({ title: '修改成功', icon: 'success', duration: 2000 }) }else{ uni.showToast({ title: res.msg, icon: 'none', duration: 2000 }) } }) }, // 查询设备的门店 getmendian(){ this.$u.get(`app/store/mch/${this.xxobj.storeId}`).then(res => { if (res.code == 200) { this.mdianobj = res.data } }) }, // 点击选择门店 btnshop(){ uni.navigateTo({ url:'/page_shanghu/xuanzeshop?deviceId=' + this.deviceId }) }, // 获取设备信息 getxx(){ this.$u.get(`/app/device/${this.deviceId}`).then(res => { if (res.code == 200) { this.xxobj = res.data if(this.xxobj.storeId != null){ this.getmendian() } this.name = this.xxobj.deviceName } }) }, // 点击解绑设备 btnjiebang(){ let that = this uni.showModal({ title: '温馨提示', content: '您确定要解绑该设备吗?', success: function (res) { if (res.confirm) { that.$u.post(`app/device/offline/${that.deviceId}`).then(res => { if (res.code == 200) { uni.showToast({ title: '解绑成功', icon: 'success', duration: 2000 }) setTimeout(()=>{ uni.navigateBack() },1000) }else{ uni.showToast({ title: res.msg, icon: 'none', duration: 2000 }) } }) } else if (res.cancel) { } } }) } } } </script> <style lang="scss"> /deep/ .u-iconfont, /deep/ .u-title{ padding-bottom: 20rpx; box-sizing: border-box; } .editname{ width: 580rpx; max-height: 400rpx; background-color: #fff; border-radius: 24rpx; position: fixed; top: 414rpx; left: 50%; transform: translateX(-50%); .btnanniu{ display: flex; margin-top: 60rpx; border-top: 1px solid #D8D8D8; .quxiao{ border-right: 1px solid #D8D8D8; } view{ width: 50%; height: 120rpx; line-height: 120rpx; text-align: center; font-size: 32rpx; font-weight: 600; } } input{ width: 480rpx; height: 80rpx; line-height: 80rpx; margin: auto; background-color: #D8D8D8; margin-top: 50rpx; padding-left: 30rpx; box-sizing: border-box; border-radius: 10rpx; } .top{ font-size: 32rpx; font-weight: 600; text-align: center; width: 100%; margin-top: 30rpx; } } .jieb{ width: 750rpx; height: 152rpx; background: #FFFFFF; box-shadow: 0rpx 8rpx 20rpx 0rpx rgba(0,0,0,0.3); border-radius: 0rpx 0rpx 0rpx 0rpx; position: fixed; bottom: 0; left: 0; .bt{ width: 680rpx; height: 104rpx; background: #48893B; margin: auto; margin-top: 24rpx; border-radius: 24rpx; font-weight: 600; font-size: 36rpx; color: #FFFFFF; text-align: center; line-height: 104rpx; } } .lianwang{ width: 680rpx; height: 112rpx; background: #FFFFFF; display: flex; align-items: center; justify-content: space-between; margin: auto; margin-top: 22rpx; border-radius: 24rpx; padding: 36rpx 32rpx; box-sizing: border-box; .two{ font-size: 32rpx; color: #7C7C7C; } .thr{ font-size: 32rpx; color: #3D3D3D; display: flex; align-items: center; image{ width: 12rpx; height: 34rpx; margin-left: 10rpx; } } } .jichuxx{ width: 680rpx; max-height: 458rpx; background: #FFFFFF; box-sizing: border-box; padding: 44rpx 34rpx; box-sizing: border-box; margin: auto; margin-top: 22rpx; border-radius: 20rpx; .top{ border-left: 14rpx solid #48893B; font-weight: 600; font-size: 36rpx; color: #3D3D3D; padding-left: 24rpx; box-sizing: border-box; } .one{ display: flex; justify-content: space-between; align-items: center; margin-top: 28rpx; .two{ font-size: 32rpx; color: #7C7C7C; } .thr{ font-size: 32rpx; color: #3D3D3D; } } } .toufangbox{ width: 680rpx; height: 284rpx; background: #FFFFFF; border-radius: 24rpx 24rpx 24rpx 24rpx; margin: auto; margin-top: 22rpx; padding: 44rpx 34rpx; box-sizing: border-box; .shebeibj{ display: flex; justify-content: space-between; .lt{ .name{ font-weight: 600; font-size: 40rpx; color: #262B37; } .zt{ font-size: 28rpx; color: #5B5B5B; margin-top: 12rpx; text{ color: #00BA88; } } } .rt{ image{ width: 196rpx; height: 196rpx; } } } } .xuanze{ width: 750rpx; height: 494rpx; background: #FFFFFF; border-radius: 40rpx 40rpx 0 0; position: fixed; left: 0; bottom: 0; z-index: 1; padding: 42rpx 62rpx; box-sizing: border-box; .changj{ display: flex; justify-content: space-between; flex-wrap: wrap; .changj_item{ width: 302rpx; height: 110rpx; background: #F0F0F0; border-radius: 6rpx 6rpx 6rpx 6rpx; font-weight: 600; text-align: center; line-height: 110rpx; font-size: 36rpx; margin-top: 40rpx; color: #3D3D3D; } } .top{ display: flex; justify-content: space-between; view{ font-weight: 600; font-size: 36rpx; color: #3D3D3D; image{ width: 50rpx; height: 50rpx; } } } } .mask{ width: 100%; height: 100vh; background-color: #000; opacity: .3; position: fixed; top: 0; left: 0; } .kongzhi{ width: 100%; height: 152rpx; justify-content: space-between; display: flex; padding: 24rpx 36rpx; .jiebang{ text-align: center; width: 330rpx; height: 104rpx; line-height: 104rpx; border: 2rpx solid #48893B; font-size: 36rpx; color: #48893B; border-radius: 20rpx; } .tougang{ text-align: center; width: 330rpx; height: 104rpx; background: #48893B; font-size: 36rpx; color: #FFFFFF; line-height: 104rpx; border-radius: 20rpx; } } .anniu{ width: 100%; height: 152rpx; background: #FFFFFF; box-shadow: 0rpx 8rpx 20rpx 0rpx rgba(0,0,0,0.3); border-radius: 0rpx 0rpx 0rpx 0rpx; display: flex; padding: 24rpx 36rpx; box-sizing: border-box; justify-content: space-between; text-align: center; position: fixed; left: 0; bottom: 0; .jiebang{ width: 330rpx; height: 104rpx; line-height: 104rpx; border: 2rpx solid #48893B; font-size: 36rpx; color: #48893B; border-radius: 20rpx; } .tougang{ width: 330rpx; height: 104rpx; background: #48893B; font-size: 36rpx; color: #FFFFFF; line-height: 104rpx; border-radius: 20rpx; } } .box{ width: 680rpx; height: 708rpx; background: #FFFFFF; border-radius: 20rpx; margin: auto; margin-top: 28rpx; padding: 0 30rpx; box-sizing: border-box; .ulbox{ width: 100%; height: 118rpx; line-height: 118rpx; display: flex; justify-content: space-between; border-bottom: 1px solid #D8D8D8; .one{ font-size: 32rpx; color: #3D3D3D; } .two{ font-size: 32rpx; color: #7C7C7C; display: flex; align-items: center; image{ width: 14rpx; height: 42rpx; margin-left: 20rpx; } } } } page { background: #F6F6F6; } </style>