tearoom/page_shanghu/weishebei.vue
2024-12-20 18:09:41 +08:00

294 lines
6.4 KiB
Vue

<template>
<view class="page">
<u-navbar title="未投放设备列表" :border-bottom="false" :background="bgc" back-icon-color="#262B37" title-color='#262B37'
title-size='36' height='50' id="navbar">
</u-navbar>
<view class="list"
@touchstart="onTouchStart"
@touchend="onTouchEnd">
<view class="list_item" v-for="(item,index) in list" :key="index" @click="btnedit(item.sn)">
<view class="top">
<view class="sn">SN:{{item.sn}}</view>
<view class="zt" style="color: #48893B;" v-if="item.onlineStatus == 1">
<text></text>在线
</view>
<view class="zt" style="color: #808080;" v-else>
<text style="background-color: #808080;"></text>离线
</view>
</view>
<view class="cen">
<image :src="item.picture" mode=""></image>
<view class="sbxx">
<view class="">
门店名称:{{item.storeName == null ? '--' : item.storeName}}
</view>
<view class="">
投放位置:--
</view>
<view class="">
设备状态:<text style="color: #48893B;" v-if="item.placementStatus == 1">已投放</text>
<text style="color: #F39B18;" v-if="item.placementStatus == 2">待投放</text>
</view>
</view>
</view>
<view class="sbm">
<text></text>
<view class="">
设备码
</view>
</view>
</view>
<view class="" style="width: 100%;text-align: center;margin-top: 100rpx;font-size: 34rpx;color: #ccc;">
没有更多设备啦...
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
bgc: {
backgroundColor: "#fff",
},
list:[],
tfshow: false,
ztshow:false,
status:'',
keyword:'',
pagesum:1,
pagesize:10,
touchStartX: 0, // 触屏起始点x
touchStartY: 0, // 触屏起始点y
xiaflag:true,
total:'',
qingqiuflag:true,
storeId:''
}
},
onLoad(option) {
this.storeId = option.storeId
},
onShow() {
this.status ='',
this.keyword ='',
this.pagesum = 1
this.list = []
this.getsb()
},
methods: {
// 点击跳转到设备信息页
btnedit(sn){
uni.navigateTo({
url:'/page_shanghu/toufsb?storeId=' + this.storeId + '&sn=' + sn
})
},
// 请求所有设备列表
getsb(){
this.$u.get(`/app/device/list?status=${this.status}&pageNum=${this.pagesum}&pageSize=${this.pagesize}&keyword=${this.keyword}&placementStatus=2`).then(res => {
if (res.code == 200) {
this.xiaflag = true
this.total = res.total
if (this.pagesum > 1) {
this.pagesum++
this.list = this.list.concat(res.rows)
this.qingqiuflag = true
} else {
this.pagesum++
this.list = res.rows
this.qingqiuflag = true
}
}
})
},
// 按下滑动
onTouchStart(e) {
this.imgflag = false
this.touchStartX = e.touches[0].clientX;
this.touchStartY = e.touches[0].clientY;
},
// 松开滑动
onTouchEnd(e) {
this.imgflag = true
let deltaX = e.changedTouches[0].clientX - this.touchStartX;
let deltaY = e.changedTouches[0].clientY - this.touchStartY;
if (Math.abs(deltaX) > 50 && Math.abs(deltaX) > Math.abs(deltaY)) {
if (deltaX >= 0) {
// console.log("左滑")
} else {
// console.log("右滑")
}
} else if (Math.abs(deltaY) > 50 && Math.abs(deltaX) < Math.abs(deltaY)) {
if (deltaY < 100) {
if(this.qingqiuflag == true){
let sum = (this.pagesum - 1) * this.pagesize
console.log(sum,this.total);
if (this.total > sum) {
this.qingqiuflag = false
this.getsb()
}
}
} else {
console.log("下滑")
}
}
},
}
}
</script>
<style lang="scss">
/deep/ .u-iconfont,
/deep/ .u-title{
padding-bottom: 20rpx;
}
page {
background: #F6F6F6;
}
.list{
width: 100%;
height: 1230rpx;
overflow: scroll;
padding-bottom: 50rpx;
box-sizing: border-box;
.list_item{
width: 750rpx;
height: 422rpx;
background: #FFFFFF;
margin-top: 20rpx;
.sbm{
margin-top: 18rpx;
display: flex;
justify-content: space-between;
padding-right: 38rpx;
box-sizing: border-box;
view{
width: 152rpx;
height: 64rpx;
border-radius: 14rpx 14rpx 14rpx 14rpx;
border: 2rpx solid #48893B;
text-align: center;
line-height: 62rpx;
font-size: 32rpx;
color: #48893B;
}
}
.cen{
display: flex;
padding-left: 30rpx;
box-sizing: border-box;
margin-top: 28rpx;
.sbxx{
view{
margin-top: 30rpx;
}
}
image{
width: 196rpx;
height: 196rpx;
margin-right: 40rpx;
}
}
.top{
display: flex;
justify-content: space-between;
border-bottom: 1px solid #D8D8D8;
padding: 0 32rpx;
height: 94rpx;
line-height: 94rpx;
.zt{
display: flex;
align-items: center;
text{
width: 14rpx;
height: 14rpx;
background: #48893B;
margin-right: 12rpx;
border-radius: 50%;
}
}
.sn{
font-weight: 600;
font-size: 30rpx;
color: #3D3D3D;
}
}
}
}
.shaixuan{
width: 100%;
padding: 0 112rpx;
box-sizing: border-box;
display: flex;
justify-content: space-between;
align-items: center;
background-color: #fff;
padding-top: 32rpx;
padding-bottom: 24rpx;
box-sizing: border-box;
.lt{
display: flex;
align-items: center;
font-size: 32rpx;
color: #3D3D3D;
}
.rt{
display: flex;
align-items: center;
font-size: 32rpx;
color: #3D3D3D;
}
image{
width: 32rpx;
height: 32rpx;
margin-left: 10rpx;
}
}
.serch{
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 40rpx;
box-sizing: border-box;
padding-top: 40rpx;
background-color: #fff;
.rt{
width: 56rpx;
height: 56rpx;
margin-top: 4rpx;
}
.lt{
display: flex;
align-items: center;
width: 596rpx;
height: 68rpx;
border: 2rpx solid #48893B;
border-radius: 24rpx;
padding-left: 30rpx;
box-sizing: border-box;
.sousuo{
width: 140rpx;
height: 66rpx;
text-align: center;
line-height: 66rpx;
font-size: 32rpx;
color: #FFFFFF;
background: #48893B;
border: 2rpx solid #48893B;
border-radius: 0 20rpx 20rpx 0;
}
image{
width: 46rpx;
height: 46rpx;
}
input{
width: 380rpx;
margin-left: 30rpx;
height: 68rpx;
line-height: 68rpx;
}
}
}
</style>