InspectionCleaning/pages/index/cleanDetails.vue

185 lines
4.4 KiB
Vue
Raw Normal View History

2025-04-07 09:30:11 +08:00
<template>
<view class="content">
<u-navbar title="保洁详情"></u-navbar>
<view class="area-info">
2025-04-11 17:24:07 +08:00
<view class="name">{{ dataInfo.name }}</view>
<view class="position">所属计划{{ dataInfo.planName }}</view>
2025-04-07 09:30:11 +08:00
</view>
<view class="area-details">
<view class="title">区域详情</view>
<view class="details">
<view class="block">
2025-04-11 17:24:07 +08:00
<view class="value"> {{ dataInfo.areaType }}</view>
2025-04-07 09:30:11 +08:00
<view class="label">区域类型</view>
</view>
<view class="block">
2025-04-11 17:24:07 +08:00
<view class="value">{{ dataInfo.userName }}</view>
2025-04-07 09:30:11 +08:00
<view class="label">保洁人员</view>
</view>
<view class="block">
2025-04-14 15:10:19 +08:00
<view class="value">{{ dataInfo.completedTime }}</view>
2025-04-07 09:30:11 +08:00
<view class="label">清扫时间</view>
</view>
<view class="block">
2025-04-11 17:24:07 +08:00
<view class="value">{{ dataInfo.note }}</view>
2025-04-07 09:30:11 +08:00
<view class="label">备注</view>
</view>
</view>
<view class="title">保洁区域图片</view>
<view class="images">
2025-04-11 17:24:07 +08:00
<image
2025-04-07 09:30:11 +08:00
class="image"
2025-04-11 17:24:07 +08:00
v-for="(v, i) in dataInfo.pictures"
2025-04-07 09:30:11 +08:00
:key="i"
2025-04-11 17:24:07 +08:00
:src="BASE_URL + '/uploads/' + v.path"
2025-04-14 15:10:19 +08:00
@click="previewImage(i)"
2025-04-11 17:24:07 +08:00
></image>
2025-04-07 09:30:11 +08:00
</view>
</view>
</view>
</template>
<script>
2025-04-11 17:24:07 +08:00
import BASE_URL from "@/api/env.js"; //引入接口共用地址
2025-04-10 14:21:16 +08:00
import { GetPlanInfoAre } from "@/api/apiList";
2025-04-14 15:10:19 +08:00
import { dateFormat } from "@/utils/utils.js";
2025-04-07 09:30:11 +08:00
export default {
data() {
2025-04-10 14:21:16 +08:00
return {
id: "",
2025-04-11 17:24:07 +08:00
params: {},
dataInfo: {},
BASE_URL,
2025-04-10 14:21:16 +08:00
};
},
onLoad(options) {
2025-04-11 17:24:07 +08:00
console.log("options", JSON.parse(decodeURIComponent(options.params)));
this.params = JSON.parse(decodeURIComponent(options.params));
},
onShow() {
2025-04-10 14:21:16 +08:00
this.getAreaInfo();
},
methods: {
2025-04-14 15:10:19 +08:00
dateFormat,
// 预览图片
previewImage(index) {
uni.previewImage({
2025-04-14 16:51:36 +08:00
urls: this.dataInfo.pictures.map(
(v) => BASE_URL + "/uploads/" + v.path
),
2025-04-14 15:10:19 +08:00
current: index,
});
},
2025-04-10 14:21:16 +08:00
async getAreaInfo() {
const res = await GetPlanInfoAre({
2025-04-11 17:24:07 +08:00
id: this.params.id,
2025-04-10 14:21:16 +08:00
});
2025-04-11 17:24:07 +08:00
if (res.succeed) {
this.dataInfo = res.data;
2025-04-14 15:10:19 +08:00
this.dataInfo.completedTime = dateFormat(
new Date(this.dataInfo.completedTime),
"YYYY/MM/DD HH:mm:ss"
);
2025-04-11 17:24:07 +08:00
}
2025-04-10 14:21:16 +08:00
},
2025-04-07 09:30:11 +08:00
},
};
</script>
<style lang="scss" scoped>
.content {
height: 100vh;
background: linear-gradient(#fff 0%, #e0ebf9 20%);
.title {
line-height: 1;
border-left: 10rpx solid #5a7ee9;
padding-left: 16rpx;
font-weight: bold;
font-size: 36rpx;
color: #000000;
}
.area-info {
padding: 44rpx;
margin-top: 30rpx;
height: 290rpx;
background: url("@/static/images/area-bg.png") no-repeat 100% 100%;
background-size: 100% 100%;
display: flex;
flex-direction: column;
.name {
font-weight: bold;
font-size: 56rpx;
color: #211d2f;
}
.position {
margin-top: 44rpx;
font-weight: 500;
font-size: 32rpx;
color: #717b94;
}
}
.area-details {
padding: 50rpx 32rpx;
background: #ffffff;
border-radius: 36rpx 36rpx 0 0;
min-height: calc(100vh - 400rpx);
.details {
margin-top: 42rpx;
margin-bottom: 70rpx;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
.block {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
2025-04-14 15:10:19 +08:00
gap: 10rpx;
2025-04-07 09:30:11 +08:00
width: 48.5%;
height: 160rpx;
background: #f1f7fe;
border-radius: 18rpx;
}
.block:nth-child(n + 3) {
margin-top: 14rpx;
}
2025-04-14 15:10:19 +08:00
.label {
color: #5a6c88;
}
2025-04-07 09:30:11 +08:00
}
.images {
2025-04-14 15:10:19 +08:00
display: flex;
flex-wrap: wrap; /* 允许换行 */
justify-content: flex-start; /* 从左开始排列 */
margin-top: 32rpx;
}
.image {
/* 设置宽度,留出间隙 */
width: calc((100% - 40rpx) / 3); /* 假设间隙为 20rpx */
height: 210rpx; /* 或根据需要调整高度 */
border-radius: 18rpx;
background-color: #eee;
overflow: hidden;
margin-right: 20rpx; /* 右边间隙 */
margin-bottom: 20rpx; /* 下边间隙 */
}
/* 清除每行最后一个元素的右边距 */
.image:nth-child(3n) {
margin-right: 0;
2025-04-11 17:24:07 +08:00
}
2025-04-07 09:30:11 +08:00
}
}
</style>