You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

130 lines
2.6 KiB

11 months ago
<template>
<!-- 设备 -->
<view class="work-container">
<Search @search='search' @screen='screen' :isShowScreen='false' />
11 months ago
<view class="list">
<view class="item" v-for="(item,index) in list" :key='index'>
<u-image :src="item.images" width='160'
height="160">
11 months ago
<template v-slot:error>
<view class="image-error">
<u-icon name="photo" color="#c7c7c7" size="38"></u-icon>
<view style="font-size: 24rpx;">暂无图片</view>
</view>
</template>
</u-image>
<view class="text">
<view class="title">
{{item.name}}
11 months ago
</view>
<view class="dec1">
{{item.number}}
11 months ago
</view>
<view class="dec2">
{{item.factoryAreaName}}
11 months ago
</view>
</view>
</view>
</view>
<view style="height: 94rpx;padding-top: 30rpx;">
<u-loadmore :status="status" v-if="status != 'loadmore'" />
</view>
11 months ago
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
</template>
<script>
import * as deviceApi from "@/api/device.js"
11 months ago
export default {
data() {
return {
params: {
pageNo: 1,
pageSize: 10,
type: '',
name:''
},
status: 'loadmore', //是否显示没有更多了
list: [],
11 months ago
}
},
methods: {
// 搜索
search(keyWord) {
this.params.name = keyWord
this.params.pageNo = 1
this.list = []
this.status = 'loadmore'
this.getList()
11 months ago
},
// 筛选
screen() {
this.$tab.navigateTo(`/pages/device/screen`)
},
// 获取设备保修列表
getList() {
if (this.status == 'nomore') return;
this.status = 'loading';
this.$modal.loading('加载中')
deviceApi.devicePage(this.params).then((res) => {
this.$modal.closeLoading()
if (res.data.list.length > 0) {
this.list = this.list.concat(res.data.list);
this.params.pageNo++;
this.status = 'loadmore'
} else {
this.status = 'nomore'
}
})
},
},
onShow() {
this.params.pageNo = 1
this.list = []
this.status = 'loadmore'
this.getList()
},
onReachBottom() {
this.getList()
11 months ago
}
}
</script>
<style lang="scss" scoped>
.list {
padding-bottom: 20rpx;
.item {
margin-top: 20rpx;
background: white;
padding: 30rpx;
display: flex;
align-items: center;
.text {
11 months ago
margin-left: 20rpx;
11 months ago
.title {
font-size: 32rpx;
font-weight: bold;
}
.dec1 {
font-size: 28rpx;
margin-top: 16rpx;
color: #acacac;
}
.dec2 {
font-size: 28rpx;
margin-top: 6rpx;
color: #acacac;
}
11 months ago
}
}
}
.image-error {
11 months ago
text-align: center;
}
</style>