InspectionCleaning/pages/adminNfc/index.vue

266 lines
6.1 KiB
Vue
Raw Normal View History

2025-04-15 10:07:11 +08:00
<template>
<view class="content">
2025-04-15 11:04:10 +08:00
<!-- 头部两个卡片 -->
<view class="card">
<view class="card-item card-left">
<view class="card-title">已绑定子区域数</view>
2025-04-24 15:03:07 +08:00
<view class="card-totel">{{ form.bindnfc }}</view>
2025-04-15 11:04:10 +08:00
</view>
<view class="card-item card-right">
<view class="card-title">未绑定子区域数</view>
2025-04-24 15:03:07 +08:00
<view class="card-totel">{{ form.noBindnfc }}</view>
2025-04-15 11:04:10 +08:00
</view>
</view>
2025-04-15 11:22:20 +08:00
<!-- 搜索 -->
2025-04-15 14:37:47 +08:00
<view class="search-box">
2025-04-24 15:03:07 +08:00
<u-input class="search-input" v-model="keyword" border placeholder="搜索名称"></u-input>
2025-04-15 14:37:47 +08:00
<view class="select-box" @click="selectFn">
<view>
{{ selectVal }}
</view>
2025-04-24 15:03:07 +08:00
<image src="/static/svg/down.svg" style="width: 30rpx; height: 30rpx; margin-left: 10rpx"></image>
2025-04-15 14:37:47 +08:00
</view>
</view>
<!-- tabs -->
2025-04-24 15:03:07 +08:00
<u-tabs class="tabs-box" bg-color="#F6F8FC" :list="tabsList" :is-scroll="true" :current="tabCurrent"
@change="tabChangeFn"></u-tabs>
2025-04-15 14:37:47 +08:00
<!-- tip -->
<view class="tip-box">共10个子区域其中5个未绑定</view>
<!-- 列表 -->
<view class="list-box">
<scroll-view :scroll-y="true" class="scroll-Y">
<view v-for="i in 80" class="item-box">
<view class="item-title">子区域{{ i }}</view>
<view v-if="i % 2 === 0" class="btn-have btn">已绑定</view>
2025-04-24 15:03:07 +08:00
<view v-if="i % 2 !== 0" class="btn-none btn" @click="showDialog = true">去绑定</view>
2025-04-15 14:37:47 +08:00
</view>
</scroll-view>
2025-04-15 11:22:20 +08:00
</view>
2025-04-15 14:37:47 +08:00
<!-- 筛选的下拉 -->
2025-04-24 15:03:07 +08:00
<u-action-sheet :list="options" title="请选择" @click="changeFn" v-model:value="selectShow"></u-action-sheet>
<bind-dialog :visible="showDialog" @close="showDialog = false" @changeBinding="onChangeBinding"
@confirm="onConfirm"></bind-dialog>
2025-04-15 10:07:11 +08:00
<u-tabbar :list="vuex_tabbar"></u-tabbar>
</view>
</template>
<script>
2025-04-24 15:03:07 +08:00
import { GetRegionDataListApi, GetHomeDataApi } from "@/api/apiAdmin.js";
2025-04-16 09:07:43 +08:00
import BindDialog from "@/pages/adminNfc/components/bindDialog.vue"; // 确保路径正确
2025-04-15 10:07:11 +08:00
export default {
2025-04-16 09:07:43 +08:00
components: {
BindDialog,
},
2025-04-15 10:07:11 +08:00
data() {
return {
2025-04-24 15:03:07 +08:00
form: {
"regionCount": 0,
"areaCount": 0,
"bindnfc": 0,
"noBindnfc": 0
},
2025-04-15 14:37:47 +08:00
keyword: "",
selectShow: false,
2025-04-16 09:07:43 +08:00
showDialog: false,
2025-04-15 14:37:47 +08:00
selectVal: "全部",
options: [
{
text: "全部",
},
{
text: "已绑定",
},
{
text: "未绑定",
},
],
tabCurrent: 0,
tabsList: [
{
name: "区域1",
},
{
name: "区域2",
},
{
name: "区域3",
},
{
name: "区域4",
},
{
name: "区域5",
},
{
name: "区域6",
},
{
name: "区域7",
},
{
name: "区域8",
},
],
2025-04-15 10:07:11 +08:00
};
},
mounted() {
uni.hideLoading(); // 关闭 Loading
},
2025-04-24 15:03:07 +08:00
onLoad() {
this.getAreaFn();
},
onShow() {
this.getDataFn();
},
2025-04-15 14:37:47 +08:00
methods: {
2025-04-24 15:03:07 +08:00
async getDataFn() {
const res = await GetHomeDataApi();
console.log(res, "首页数据");
Object.assign(this.form, res.data);
},
async getAreaFn() {
const res = await GetRegionDataListApi()
console.log(res, "区域数据");
this.tabsList = res.data.areaList
},
2025-04-15 14:37:47 +08:00
selectFn() {
this.selectShow = true;
},
changeFn(val) {
console.log(val, "val--");
this.selectVal = this.options[val].text;
},
tabChangeFn(val) {
console.log(val, "val--");
this.tabCurrent = val;
},
2025-04-16 09:07:43 +08:00
onChangeBinding() {
console.log("点击了更换绑定");
// 处理更换绑定的逻辑
},
onConfirm() {
console.log("点击了知道了");
// 处理确认逻辑
},
2025-04-15 14:37:47 +08:00
},
2025-04-15 10:07:11 +08:00
};
</script>
<style lang="scss" scoped>
.content {
2025-04-15 14:37:47 +08:00
min-height: calc(100vh - 180rpx); // 确保容器有明确高度
// overflow: hidden;
background-color: #f6f8fc;
2025-04-15 10:07:11 +08:00
padding-bottom: 100rpx;
2025-04-24 15:03:07 +08:00
2025-04-15 11:04:10 +08:00
.card {
display: flex;
2025-04-15 14:37:47 +08:00
// margin-top: 30rpx;
2025-04-15 11:04:10 +08:00
padding-left: 30rpx;
padding-right: 30rpx;
2025-04-24 15:03:07 +08:00
2025-04-15 11:04:10 +08:00
.card-item {
position: relative;
flex: 1;
2025-04-15 14:37:47 +08:00
height: 150rpx;
2025-04-15 11:04:10 +08:00
border-radius: 30rpx;
color: white;
padding: 20rpx;
font-size: 30rpx;
2025-04-24 15:03:07 +08:00
2025-04-15 11:04:10 +08:00
.card-title {
font-size: 30rpx;
}
2025-04-24 15:03:07 +08:00
2025-04-15 11:04:10 +08:00
.card-totel {
padding-left: 20rpx;
font-size: 40rpx;
}
}
2025-04-24 15:03:07 +08:00
2025-04-15 11:04:10 +08:00
.card-left {
2025-04-24 15:03:07 +08:00
background: url("/static/adminImg/icon-bg1.png") no-repeat right 32rpx bottom 20rpx / 60rpx 60rpx;
2025-04-15 11:04:10 +08:00
background-color: #4974f3;
}
2025-04-24 15:03:07 +08:00
2025-04-15 11:04:10 +08:00
.card-right {
margin-left: 20rpx;
2025-04-24 15:03:07 +08:00
background: url("/static/adminImg/icon-bg2.png") no-repeat right 32rpx bottom 20rpx / 60rpx 60rpx;
2025-04-15 11:04:10 +08:00
background-color: #53d5a9;
}
}
2025-04-24 15:03:07 +08:00
2025-04-15 14:37:47 +08:00
.search-box {
display: flex;
align-items: center;
// border: 1px solid red;
margin-top: 20rpx;
padding: 20rpx;
2025-04-24 15:03:07 +08:00
2025-04-15 14:37:47 +08:00
.search-input {
background-color: white;
border-radius: 50rpx;
}
2025-04-24 15:03:07 +08:00
2025-04-15 14:37:47 +08:00
.select-box {
display: flex;
justify-content: center;
align-items: center;
// border: 1px solid red;
margin-left: 20rpx;
background-color: white;
width: 150rpx;
border-radius: 20rpx;
text-align: center;
padding-top: 10rpx;
padding-bottom: 10rpx;
}
}
2025-04-24 15:03:07 +08:00
2025-04-15 14:37:47 +08:00
.tip-box {
color: grey;
padding-left: 30rpx;
}
2025-04-24 15:03:07 +08:00
2025-04-15 14:37:47 +08:00
.list-box {
padding-left: 30rpx;
padding-right: 30rpx;
2025-04-24 15:03:07 +08:00
2025-04-15 14:37:47 +08:00
.item-box {
background-color: white;
margin-top: 20rpx;
padding-left: 30rpx;
padding-right: 30rpx;
height: 100rpx;
border-radius: 20rpx;
display: flex;
justify-content: space-between;
align-items: center;
2025-04-24 15:03:07 +08:00
2025-04-15 14:37:47 +08:00
.item-title {
font-size: 30rpx;
color: #333;
// font-weight: bold;
}
2025-04-24 15:03:07 +08:00
2025-04-15 14:37:47 +08:00
.btn {
padding-left: 20rpx;
padding-right: 20rpx;
border-radius: 20rpx;
padding-top: 5rpx;
padding-bottom: 5rpx;
}
2025-04-24 15:03:07 +08:00
2025-04-15 14:37:47 +08:00
.btn-have {
background-color: #f5f5f5;
color: black;
}
2025-04-24 15:03:07 +08:00
2025-04-15 14:37:47 +08:00
.btn-none {
background-color: #4274dc;
color: white;
}
}
}
2025-04-15 10:07:11 +08:00
}
</style>