baodeng_xcx/page_shanghu/device/devicexq.vue
2025-05-14 15:14:12 +08:00

808 lines
17 KiB
Vue

<template>
<view class="page">
<u-navbar title="设备信息" :border-bottom="false" :background="bgc" back-icon-color="#fff" title-color='#fff'
title-size='36' height='48' id="navbar">
</u-navbar>
<view class="box">
<view class="ulbox" @click="roommaflag = true">
<view class="one">
设备名称
</view>
<view class="two">
{{deviceobj.deviceName == null ? '--' : deviceobj.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">
{{deviceobj.modelName == null ? '--' : deviceobj.modelName}}
</view>
</view>
<view class="ulbox">
<view class="one">
设备SN
</view>
<view class="two">
{{deviceobj.deviceNo == null ? '--' : deviceobj.deviceNo}}
</view>
</view>
<view class="ulbox">
<view class="one">
设备状态
</view>
<view class="two" v-if="deviceobj.boothId == null">
未投放
</view>
<view class="two" v-if="deviceobj.boothId != null">
已投放
</view>
</view>
<view class="ulbox">
<view class="one">
联网状态
</view>
<view class="two" v-if="deviceobj.onlineStatus == 1">
在线
</view>
<view class="two" v-if="deviceobj.onlineStatus == 0">
离线
</view>
</view>
<view class="ulbox" @click="dengflag = true">
<view class="one">
持续爆灯时长
</view>
<view class="two">
{{deviceobj.duration == null ? 0 : deviceobj.duration}}s <image src="https://api.ccttiot.com/smartmeter/img/static/uS5JydUQDmvbMyg4nsdo" mode=""></image>
</view>
</view>
<view class="ulbox" @click="showone = true">
<view class="one">
投放店铺
</view>
<view class="two">
{{deviceobj.storeName == null ? '--' : deviceobj.storeName}} <image src="https://api.ccttiot.com/smartmeter/img/static/uS5JydUQDmvbMyg4nsdo" mode=""></image>
</view>
</view>
<view class="ulbox" style="border: none;" @click="addmenflagss">
<view class="one">
投放位置
</view>
<view class="two">
{{deviceobj.position == null ? '--' : deviceobj.position}} <image src="https://api.ccttiot.com/smartmeter/img/static/uS5JydUQDmvbMyg4nsdo" mode=""></image>
</view>
</view>
<u-select v-model="showone" :list="listone" @confirm="btnone"></u-select>
<view class="anniu">
<view class="tougang" style="margin-right: 30rpx;">
解绑
</view>
<view class="tougang" style="background-color: #FF8998;color: #010000;">
投放
</view>
</view>
</view>
<!-- 修改名称 -->
<view class="roomma" v-if="roommaflag">
<view class="name">
修改名称
</view>
<input type="number" v-model="roomma" placeholder="请输入名称"/>
<view class="annius">
<view class="qx" @click="roommaflag = false">
取消
</view>
<view class="qd" @click="btneditname">
确定
</view>
</view>
</view>
<view class="mask" v-if="roommaflag"></view>
<!-- 修改爆灯时长 -->
<view class="roomma" v-if="dengflag">
<view class="name">
修改爆灯时长(秒)
</view>
<input type="number" v-model="duration" placeholder="请输入爆灯时长"/>
<view class="annius">
<view class="qx" @click="dengflag = false">
取消
</view>
<view class="qd" @click="btndeng">
确定
</view>
</view>
</view>
<view class="mask" v-if="dengflag"></view>
<!-- 投放位置选择弹窗 -->
<view class="seat-selector" :class="{ 'show': addmenflag }" v-show="addmenflag">
<view class="selector-header">
<view class="title">投放卡座位置</view>
<view class="floor-tabs">
<view
v-for="floor in floors"
:key="floor.id"
:class="['floor-tab', currentFloor === floor.id ? 'active' : '']"
@click="selectFloor(floor.id)">
{{floor.name}}
</view>
</view>
</view>
<view class="selector-content">
<view class="area-list">
<view
v-for="area in areas"
:key="area.id"
:class="['area-item', currentArea === area.id ? 'active' : '']"
@click="selectArea(area.id)">
{{area.name}}
</view>
</view>
<view class="seat-grid">
<view
v-for="seat in seats"
:key="seat.id"
:class="['seat-item', currentSeat === seat.id ? 'active' : '']"
@click="selectSeat(seat)">
{{seat.name}}
</view>
</view>
</view>
<view class="selector-footer">
<view class="btn cancel" @click="addmenflag = false">取消</view>
<view class="btn confirm" @click="confirmSeatSelection">确认</view>
</view>
</view>
<view class="mask" v-if="addmenflag"></view>
</view>
</template>
<script>
export default {
data() {
return {
roomma:'',
roommaflag:false,
showone:false,
bgc: {
backgroundColor: "#0B0B0B",
},
addmenflag:false,
listone:[{
value: '',
label: ''
}],
kstj: '',
currentFloor: '1',
currentArea: '',
currentSeat: '',
selectedPosition: '',
floors: [
{ id: '1', name: '1F' },
{ id: '2', name: '2F' }
],
areas: [
{ id: 'A', name: 'A区' },
{ id: 'B', name: 'B区' },
{ id: 'C', name: 'C区' },
{ id: 'D', name: 'D区' }
],
seats: [
{ id: 'C1', name: 'C1' },
{ id: 'C2', name: 'C2' },
{ id: 'C3', name: 'C3' },
{ id: 'C4', name: 'C4' },
{ id: 'C5', name: 'C5' },
{ id: 'C6', name: 'C6' },
{ id: 'C7', name: 'C7' },
{ id: 'C8', name: 'C8' },
{ id: 'C9', name: 'C9' },
{ id: 'C10', name: 'C10' },
{ id: 'C11', name: 'C11' },
{ id: 'C12', name: 'C12' },
{ id: 'C13', name: 'C13' },
{ id: 'C14', name: 'C14' },
{ id: 'C15', name: 'C15' },
{ id: 'C16', name: 'C16' },
{ id: 'C17', name: 'C17' },
{ id: 'C18', name: 'C18' },
{ id: 'C19', name: 'C19' },
{ id: 'C20', name: 'C20' },
{ id: 'C21', name: 'C21' },
{ id: 'C22', name: 'C22' },
{ id: 'C23', name: 'C23' },
{ id: 'C24', name: 'C24' }
],
maskShow: false,
deviceid:'',
deviceobj:{},
dengflag:false,
duration:0
}
},
onLoad(option) {
this.deviceid = option.deviceId
this.getxq()
this.getshop()
},
onShow() {
},
methods: {
// 点击修改爆灯时长
btndeng(){
let data = {
deviceId:this.deviceid,
duration:this.duration
}
this.$u.put(`/bst/device`,data).then(res => {
if(res.code == 200){
this.deviceobj.duration = this.duration
this.dengflag = false
uni.showToast({
title: '修改成功',
icon: 'success',
duration:2000
})
}else{
uni.showToast({
title: res.msg,
icon: 'none',
duration:2000
})
}
})
},
// 点击修改名称
btneditname(){
let data = {
deviceId:this.deviceid,
deviceName:this.roomma
}
this.$u.put(`/bst/device`,data).then(res => {
if(res.code == 200){
this.deviceobj.deviceName = this.roomma
this.roommaflag = false
uni.showToast({
title: '修改成功',
icon: 'success',
duration:2000
})
}else{
uni.showToast({
title: res.msg,
icon: 'none',
duration:2000
})
}
})
},
// 获取所有店铺
getshop(){
this.$u.get(`/bst/store/list?pageNum=1&pageSize=999`).then(res => {
if(res.code == 200){
res.rows.forEach((item) =>{
this.listone.push({
label:item.storeName,
value:item.storeId
})
})
}
})
},
// 请求设备详情
getxq(){
this.$u.get(`/bst/device/${this.deviceid}`).then(res => {
if(res.code == 200){
this.deviceobj = res.data
this.roomma = res.data.deviceName
this.duration = res.data.duration
}
})
},
// 点击位置投放
addmenflagss(){
console.log('111')
this.addmenflag = true
setTimeout(() => {
this.maskShow = true
}, 50)
},
// 修改投放店铺
btnone(e){
console.log(e);
let data = {
deviceId:this.deviceid,
storeId:e[0].value
}
this.$u.put(`/bst/device?`,data).then(res => {
if(res.code == 200){
uni.showToast({
title: '修改成功',
icon: 'success',
duration:2000
})
this.getxq()
}else{
uni.showToast({
title: res.msg,
icon: 'none',
duration:2000
})
}
})
},
selectFloor(floorId) {
this.currentFloor = floorId
},
selectArea(areaId) {
this.currentArea = areaId
},
selectSeat(seat) {
this.currentSeat = seat.id
},
confirmSeatSelection() {
const floor = this.floors.find(f => f.id === this.currentFloor)
const area = this.areas.find(a => a.id === this.currentArea)
const seat = this.seats.find(s => s.id === this.currentSeat)
if (floor && area && seat) {
this.selectedPosition = `${floor.name}-${area.name}-${seat.name}`
this.addmenflag = false
} else {
uni.showToast({
title: '请选择完整的位置信息',
icon: 'none'
})
}
}
}
}
</script>
<style lang="scss">
/deep/ .u-iconfont,
/deep/ .u-title{
padding-bottom: 20rpx;
box-sizing: border-box;
}
.roomma{
position: fixed;
top: 40%;
left: 50%;
transform: translateX(-50%);
width: 500rpx;
height: 300rpx;
background-color: #fff;
border-radius: 30rpx;
z-index: 999;
padding: 20rpx;
box-sizing: border-box;
.name{
width: 100%;
text-align: center;
font-size: 32rpx;
font-weight: 600;
margin-top: 20rpx;
}
input{
width: 100%;
height: 60rpx;
background-color: #D8D8D8;
border-radius: 10rpx;
padding-left: 20rpx;
box-sizing: border-box;
margin-top: 20rpx;
}
.annius{
display: flex;
justify-content: space-between;
padding: 0 40rpx;
box-sizing: border-box;
margin-top: 10rpx;
.qx,
.qd{
margin-top: 20rpx;
width: 180rpx;
height: 80rpx;
line-height: 80rpx;
text-align: center;
border-radius: 10rpx;
border: 1px solid #FF8998;
font-size: 32rpx;
color: #FF8998;
}
.qd{
background-color: #FF8998;
color: #fff;
}
}
}
.mask {
width: 100%;
height: 100vh;
background-color: #000;
opacity: .3;
position: fixed;
top: 0;
left: 0;
}
.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;
}
.anniu{
width: 100%;
height: 152rpx;
background: #0B0B0B;
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: 50rpx;
.tougang{
width: 680rpx;
margin: auto;
height: 104rpx;
background: #0B0B0B;
font-size: 36rpx;
color: #FFFFFF;
line-height: 104rpx;
border-radius: 20rpx;
border: 2rpx solid #FF8998;
color: #FF8998;
font-weight: 600;
}
}
.box{
width: 680rpx;
max-height: 708rpx;
background: #0B0B0B;
border-radius: 20rpx;
margin: auto;
margin-top: 28rpx;
.ulbox{
width: 100%;
height: 118rpx;
line-height: 118rpx;
display: flex;
justify-content: space-between;
border-bottom: 1px solid #313131;
.one{
font-size: 32rpx;
color: #fff;
}
.two{
font-size: 32rpx;
color: #A1A1A1;
display: flex;
align-items: center;
image{
width: 14rpx;
height: 42rpx;
margin-left: 20rpx;
}
}
}
}
page {
background: #0B0B0B;
}
.seat-selector {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
height: 58vh;
background-color: #0B0B0B;
border-radius: 40rpx 40rpx 0 0;
z-index: 999;
padding-bottom: 100rpx;
box-sizing: border-box;
transform: translateY(100%);
transition: transform 0.3s ease-out;
&.show {
transform: translateY(0);
}
.selector-header {
padding: 40rpx 30rpx;
.title {
font-size: 32rpx;
color: #fff;
margin-bottom: 30rpx;
}
.floor-tabs {
display: flex;
gap: 20rpx;
.floor-tab {
padding: 10rpx 40rpx;
background: #1A1A1A;
color: #fff;
border-radius: 10rpx;
font-size: 28rpx;
&.active {
background: #FF8998;
}
}
}
}
.selector-content {
display: flex;
height: calc(100% - 300rpx);
.area-list {
width: 200rpx;
background: #1A1A1A;
padding: 20rpx 0;
.area-item {
height: 80rpx;
line-height: 80rpx;
text-align: center;
color: #fff;
font-size: 28rpx;
&.active {
background: #FF8998;
}
}
}
.seat-grid {
flex: 1;
padding: 20rpx;
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 20rpx;
overflow-y: auto;
.seat-item {
height: 80rpx;
line-height: 80rpx;
text-align: center;
background: #1A1A1A;
color: #fff;
border-radius: 10rpx;
font-size: 28rpx;
&.active {
background: #FF8998;
}
}
}
}
.selector-footer {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 120rpx;
display: flex;
justify-content: space-between;
padding: 20rpx 30rpx;
box-sizing: border-box;
background: #0B0B0B;
.btn {
width: 45%;
height: 80rpx;
line-height: 80rpx;
text-align: center;
border-radius: 10rpx;
font-size: 28rpx;
&.cancel {
background: #1A1A1A;
color: #fff;
}
&.confirm {
background: #FF8998;
color: #fff;
}
}
}
}
.mask {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100vh;
background-color: rgba(0, 0, 0, 0.3);
z-index: 998;
opacity: 0;
transition: opacity 0.3s ease-out;
&.show {
opacity: 1;
}
}
</style>