Browse Source

Merge branch '815' into dev

dev
wangyx 1 week ago
parent
commit
00a17377d9
  1. 12
      pages/tabBar/work/index.vue
  2. 63
      pagesA/bsPage/bsHandle.vue
  3. 594
      pagesA/bsPage/bsRecord.vue

12
pages/tabBar/work/index.vue

@ -124,8 +124,8 @@ export default {
// { image: '/static/img/.png', text: '' }, // { image: '/static/img/.png', text: '' },
// ], // ],
bsList: [ bsList: [
{ image: '/static/img/上报.png', text: '问题上报' }, { image: "/static/img/上报.png", text: "问题上报" },
{ image: '/static/img/处理.png', text: '问题处理' }, { image: "/static/img/处理.png", text: "问题处理" },
], ],
}; };
}, },
@ -207,15 +207,13 @@ export default {
} }
}, },
handleBsClick(item) { handleBsClick(item) {
if (item.text === "处理") { if (item.text === "问题上报") {
//
uni.navigateTo({ uni.navigateTo({
url: "/pagesA/bsPage/bsRecord", url: "/pagesA/bsPage/bsReport",
}); });
} else { } else {
//
uni.navigateTo({ uni.navigateTo({
url: "/pagesA/bsPage/bsReport", url: "/pagesA/bsPage/bsRecord",
}); });
} }
}, },

63
pagesA/bsPage/bsHandle.vue

@ -11,7 +11,12 @@
feedbackTypeText(detail.feedbackType) feedbackTypeText(detail.feedbackType)
}}</text> }}</text>
</view> </view>
<view class="contBg"> <view class="contBg">
<view class="info-row">
<text class="info-label">位置</text>
<text class="info-value">{{ detail.position }}</text>
</view>
<view class="info-row"> <view class="info-row">
<view class="info-label">问题描述</view> <view class="info-label">问题描述</view>
<view class="info-value"> <view class="info-value">
@ -20,7 +25,7 @@
</view> </view>
<view class="info-row"> <view class="info-row">
<text class="info-label">图片/视频</text> <text class="info-label">图片</text>
<view <view
class="image-preview-item" class="image-preview-item"
v-for="(u, t) in detail.images" v-for="(u, t) in detail.images"
@ -32,13 +37,13 @@
</view> </view>
<view class="info-row"> <view class="info-row">
<text class="info-label"></text> <text class="info-label">报人</text>
<text class="info-value">{{ detail.graduateName }}</text> <text class="info-value">{{ detail.graduateName||'' }}</text>
</view> </view>
<view class="info-row"> <view class="info-row">
<text class="info-label">人电话</text> <text class="info-label">报人电话</text>
<text class="info-value">{{ detail.telephone }}</text> <text class="info-value">{{ detail.telephone || '' }}</text>
</view> </view>
<view class="info-row"> <view class="info-row">
@ -76,7 +81,7 @@
</view> </view>
<view class="form-section"> <view class="form-section">
<view class="form-label">上传图片/视频</view> <view class="form-label">上传图片</view>
<u-upload <u-upload
:max-count="10" :max-count="10"
:multiple="true" :multiple="true"
@ -128,10 +133,10 @@ export default {
return { return {
statusShow: false, statusShow: false,
statusList: [ statusList: [
{ dictValue: "1", name: "待处理" }, { dictValue: "0", name: "待处理" },
{ dictValue: "2", name: "处理中" }, { dictValue: "1", name: "处理中" },
{ dictValue: "3", name: "已处理" }, { dictValue: "2", name: "已处理" },
{ dictValue: "4", name: "不予处理" }, { dictValue: "3", name: "不予处理" },
], ],
form: { form: {
stateName: "", stateName: "",
@ -142,18 +147,40 @@ export default {
detail: {}, detail: {},
fileList: [], fileList: [],
feedbackTypeOptions: [ feedbackTypeOptions: [
{ value: 1, label: "安全问题", url: "/static/img/维修列表里.png" }, {
{ value: 2, label: "卫生问题", url: "/static/img/列表里图标.png" }, value: 1,
{ value: 3, label: "服务问题", url: "/static/img/问题投诉列表里.png" }, name: "报修",
{ value: 4, label: "噪音问题", url: "/static/img/列表里图标.png" }, icon: "/static/img/维修列表里.png",
{ value: 5, label: "体验问题", url: "/static/img/列表里图标.png" }, },
{ value: 6, label: "其他", url: "/static/img/问题投诉列表里.png" }, {
value: 2,
name: "报事",
icon: "/static/img/列表里图标.png",
},
{
value: 3,
name: "投诉",
icon: "/static/img/问题投诉列表里.png",
},
{
value: 4,
name: "建议",
icon: "/static/img/巡检记录列表里.png",
},
{
value: 5,
name: "其他",
icon: "/static/img/问题投诉列表里.png",
},
], ],
}; };
}, },
onLoad(options) { onLoad(options) {
console.log(options, "options"); console.log(options, "options");
if (options.id) {
this.getReportData(options.id); this.getReportData(options.id);
} else {
}
}, },
computed: { computed: {
feedbackTypeText() { feedbackTypeText() {
@ -161,7 +188,7 @@ export default {
const feedbackTypeObj = this.feedbackTypeOptions.find( const feedbackTypeObj = this.feedbackTypeOptions.find(
(item) => item.value === type (item) => item.value === type
); );
return feedbackTypeObj ? feedbackTypeObj.label : ""; return feedbackTypeObj ? feedbackTypeObj.name : "";
}; };
}, },
srcUrl() { srcUrl() {
@ -169,7 +196,7 @@ export default {
const feedbackTypeObj = this.feedbackTypeOptions.find( const feedbackTypeObj = this.feedbackTypeOptions.find(
(item) => item.value === type (item) => item.value === type
); );
return feedbackTypeObj ? feedbackTypeObj.url : ""; return feedbackTypeObj ? feedbackTypeObj.icon : "";
}; };
}, },
}, },

594
pagesA/bsPage/bsRecord.vue

@ -1,63 +1,130 @@
<!-- 报事记录 -->
<template> <template>
<view class="content">
<!-- 顶部切换标签 -->
<view class="tab-container">
<view
class="tab-item"
:class="{ active: tabValue === 0 }"
@click="switchTab(0)"
>
<text class="tab-text">待处理</text>
</view>
<view
class="tab-item"
:class="{ active: tabValue === 1 }"
@click="switchTab(1)"
>
<text class="tab-text">处理中</text>
</view>
<view
class="tab-item"
:class="{ active: tabValue === 2 }"
@click="switchTab(2)"
>
<text class="tab-text">已处理</text>
</view>
<view
class="tab-item"
:class="{ active: tabValue === 3 }"
@click="switchTab(3)"
>
<text class="tab-text">不予处理</text>
</view>
</view>
<!-- 下拉刷新容器 -->
<scroll-view <scroll-view
class="content" class="scroll-container"
scroll-y="true" scroll-y="true"
refresher-enabled refresher-enabled="true"
:refresher-triggered="isRefreshing" :refresher-triggered="refreshing"
@refresherrefresh="refreshData" @refresherrefresh="onRefresh"
@scrolltolower="loadMore" @scrolltolower="onLoadMore"
:style="{ height: 'calc(100vh - 120rpx)' }"
>
<!-- 提醒列表 -->
<view class="reminder-list">
<!-- 空状态 -->
<view v-if="reminderList.length === 0 && !loading" class="empty-state">
<text class="empty-text">暂无数据</text>
</view>
<!-- 提醒项目列表 -->
<view
v-for="(item, index) in reminderList"
:key="index"
class="reminder-item"
@click="handleItemClick(item)"
> >
<view class="conItem" v-for="(item, index) in repairList" :key="index"> <!-- 卡片头部 -->
<view class="conItemTitle"> <view class="card-header">
<image :src="srcUrl(item.feedbackType)" class="titleImg"></image> <view class="header-left">
<text class="titleName">{{ feedbackTypeText(item.feedbackType) }}</text> <image
:src="getTypeIcon(item.feedbackType)"
class="type-icon"
></image>
<text class="type-name">{{
getTypeName(item.feedbackType)
}}</text>
</view> </view>
<view class="conItemCon"> </view>
<view class="repairInfo">
<view class="infoRow"> <!-- 卡片内容 -->
<view class="card-content">
<view class="info-row">
<text class="label">问题描述</text> <text class="label">问题描述</text>
<text class="value">{{ item.faultDescribe }}</text> <text class="value">{{ item.faultDescribe }}</text>
</view> </view>
<view class="infoRow"> <view class="info-row" v-if="item.images && item.images.length > 0">
<text class="label">图片/视频</text> <text class="label">图片</text>
<view <view class="image-container">
class="image-preview-item"
v-for="(u, t) in item.images"
:key="t"
@click="previewImage(item.images, t)"
>
<image <image
:src="u.url" v-for="(img, imgIndex) in item.images"
class="problemImage" :key="imgIndex"
:src="img.url"
class="problem-image"
mode="aspectFill" mode="aspectFill"
@click.stop="previewImage(item.images, imgIndex)"
></image> ></image>
</view> </view>
</view> </view>
<view class="infoRow"> <view class="info-row">
<text class="label">报事人</text> <text class="label">位置</text>
<text class="value">{{ item.graduateName }}</text> <text class="value">{{ item.position || "" }}</text>
</view>
<view class="info-row">
<text class="label">上报人</text>
<text class="value">{{ item.graduateName || "" }}</text>
</view> </view>
<view class="infoRow"> <view class="info-row">
<text class="label">报事人电话</text> <text class="label">报人电话</text>
<text class="value">{{ item.telephone }}</text> <text class="value">{{ item.telephone || "" }}</text>
</view> </view>
<view class="infoRow"> <view class="info-row">
<text class="label">上报时间</text> <text class="label">上报时间</text>
<text class="value">{{ item.createTime }}</text> <text class="value">{{ item.createTime }}</text>
</view> </view>
</view> </view>
<view class="actionButtons">
<button class="btn process" @click="handleProcess(item)">处理</button> <!-- 操作按钮 -->
<!-- <button class="btn dispatch" @click="handleDispatch(item)"> <view class="action-buttons" >
派单 <button class="btn process" @click.stop="handleProcess(item)">
</button> --> 处理
</button>
</view>
</view> </view>
</view> </view>
<!-- 加载更多提示 -->
<view v-if="loading" class="loading-more">
<text>加载中...</text>
</view>
<!-- 没有更多数据提示 -->
<view v-if="noMore && reminderList.length > 0" class="no-more">
<text>没有更多数据了</text>
</view> </view>
<view style="text-align: center" v-if="isLoading">加载中...</view>
<view v-else-if="repairList.length <= 0" class="no-data"> 暂无数据~ </view>
</scroll-view> </scroll-view>
</view>
</template> </template>
<script> <script>
@ -65,99 +132,96 @@ import { listReport } from "@/pages/api";
export default { export default {
data() { data() {
return { return {
isRefreshing: false, tabValue: 0, //
feedbackTypeOptions: [ refreshing: false,
{ value: 1, label: "安全问题", url: "/static/img/维修列表里.png" }, loading: false,
{ value: 2, label: "卫生问题", url: "/static/img/列表里图标.png" },
{ value: 3, label: "服务问题", url: "/static/img/问题投诉列表里.png" },
{ value: 4, label: "噪音问题", url: "/static/img/列表里图标.png" },
{ value: 5, label: "体验问题", url: "/static/img/列表里图标.png" },
{ value: 6, label: "其他", url: "/static/img/问题投诉列表里.png" },
],
noMore: false, noMore: false,
isLoading: false,
repairList: [],
form: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
unreadCount: 0,
reminderList: [],
//
typeConfig: [
{
value: 1,
name: "报修",
icon: "/static/img/维修列表里.png",
}, },
total: "", {
}; value: 2,
name: "报事",
icon: "/static/img/列表里图标.png",
}, },
onLoad() { {
this.getList(); value: 3,
name: "投诉",
icon: "/static/img/问题投诉列表里.png",
}, },
computed: { {
processStatusText() { value: 4,
return (state) => { name: "建议",
switch (state) { icon: "/static/img/巡检记录列表里.png",
case 0:
return "待处理";
case 1:
return "处理中";
case 2:
return "已处理";
case 3:
return "不予处理";
default:
return "";
}
};
}, },
feedbackTypeText() { {
return (type) => { value: 5,
const feedbackTypeObj = this.feedbackTypeOptions.find( name: "其他",
(item) => item.value === type icon: "/static/img/问题投诉列表里.png",
);
return feedbackTypeObj ? feedbackTypeObj.label : "";
};
}, },
srcUrl() { ],
return (type) => {
const feedbackTypeObj = this.feedbackTypeOptions.find(
(item) => item.value === type
);
return feedbackTypeObj ? feedbackTypeObj.url : "";
}; };
}, },
onLoad() {
this.loadReminderList();
},
onShow() {
//
this.refreshData();
},
computed: {
//
unreadCount() {
return this.reminderList.filter((item) => item.hasUnread).length;
},
}, },
methods: { methods: {
// onChange(name) {
async getList() { this.tabValue = name;
const res = await listReport(this.form); console.log(name);
if (res.code === 200) {
this.repairList = res.rows;
this.total = res.total;
if (res.total <= this.form.pageSize * this.form.pageNum) {
this.noMore = true;
}
this.isLoading = false;
this.isRefreshing = false;
if (this.form.pageNum == 1) {
this.repairList = res.rows;
} else {
this.repairList = [...this.repairList, ...res.rows];
}
}
}, },
//
refreshData() { refreshData() {
this.isRefreshing = true; this.pageNum = 1;
this.noMore = false; // this.noMore = false;
this.repairList = []; this.loadReminderList(true);
this.form.pageNum = 1; //
this.getList();
}, },
//
loadMore() { //
if (this.isLoading || this.noMore) return; // noMore switchTab(value) {
this.isLoading = true; this.tabValue = value;
this.form.pageNum++; this.pageNum = 1;
this.getList(); this.noMore = false;
this.reminderList = [];
this.loadReminderList(true);
},
//
getTypeName(type) {
const name = this.typeConfig.find((item) => item.value === type)?.name;
return name || "";
},
//
getTypeIcon(type) {
const icon = this.typeConfig.find((item) => item.value === type)?.icon;
return icon || "/static/img/巡检记录列表里.png";
}, },
previewImage(item, index) {
//
previewImage(images, index) {
uni.previewImage({ uni.previewImage({
current: index, current: index,
urls: item.map((item) => item.url), urls: images.map((img) => img.url),
success: (res) => { success: (res) => {
console.log("预览成功"); console.log("预览成功");
}, },
@ -166,14 +230,112 @@ export default {
}, },
}); });
}, },
//
handleProcess(item) { handleProcess(item) {
console.log("处理项目:", item);
uni.navigateTo({ uni.navigateTo({
url: `/pagesA/bsPage/bsHandle?id=${item.id}`, url: `/pagesA/bsPage/bsHandle?id=${item.id}`,
}); });
}, },
handleDispatch(item) {
console.log("派单", item); //
// async loadReminderList(isRefresh = false) {
if (this.loading) return;
this.loading = true;
try {
const res = await listReport({
pageNum: this.pageNum,
pageSize: this.pageSize,
state:
this.tabValue == 0
? 0
: this.tabValue == 1
? 1
: this.tabValue == 2
? 2
: 3, // 0: , 1: , 2:
});
if (res.code === 200) {
const data = res.rows || [];
if (isRefresh) {
this.reminderList = data;
this.pageNum = 1;
} else {
this.reminderList = [...this.reminderList, ...data];
}
//
if (data.length < this.pageSize) {
this.noMore = true;
}
}
} catch (error) {
console.error("加载提醒列表失败:", error);
} finally {
this.loading = false;
this.refreshing = false;
}
},
//
async onRefresh() {
this.pageNum = 1;
this.refreshing = true;
this.noMore = false;
await this.loadReminderList(true);
},
//
async onLoadMore() {
if (this.noMore || this.loading) return;
this.pageNum++;
await this.loadReminderList();
},
//
async handleItemClick(item) {
console.log("点击提醒项目:", item);
try {
// API
if (item.hasUnread) {
await markReminderRead(item.id);
item.hasUnread = false;
}
} catch (error) {
console.error("标记已读失败:", error);
// 使API
item.hasUnread = false;
}
},
//
formatTime(time) {
const now = new Date();
const targetTime = new Date(time);
const diff = now - targetTime;
const oneDay = 24 * 60 * 60 * 1000;
if (diff < oneDay && targetTime.toDateString() === now.toDateString()) {
return "今天";
} else {
return targetTime
.toLocaleString("zh-CN", {
year: "numeric",
month: "2-digit",
day: "2-digit",
hour: "2-digit",
minute: "2-digit",
second: "2-digit",
})
.replace(/\//g, "-");
}
}, },
}, },
}; };
@ -183,53 +345,148 @@ export default {
.content { .content {
width: 100%; width: 100%;
height: 100vh; height: 100vh;
background-color: rgba(248, 248, 248, 1); background-color: #f5f5f5;
padding: 20rpx; }
box-sizing: border-box;
.tab-container {
display: flex;
background-color: #fff;
padding: 20rpx 30rpx;
border-bottom: 1rpx solid #eee;
}
.tab-item {
flex: 1;
text-align: center;
position: relative;
transition: all 0.3s ease;
}
.tab-item.active {
color: #08b3b3;
}
// .tab-item.active::after {
// content: '';
// position: absolute;
// bottom: -20rpx;
// left: 50%;
// transform: translateX(-50%);
// width: 60rpx;
// height: 4rpx;
// background-color: #08B3B3;
// border-radius: 2rpx;
// }
.tab-text {
font-size: 32rpx;
font-weight: 500;
color: #666;
} }
.conItem { .tab-item.active .tab-text {
color: #08b3b3;
font-weight: 600;
}
.pageNum-header {
background-color: #fff;
padding: 20rpx 30rpx;
border-bottom: 1rpx solid #eee;
position: sticky;
top: 0;
z-index: 100;
position: relative;
}
.pageNum-title {
font-size: 32rpx;
font-weight: bold;
color: #333;
}
.unread-badge {
position: absolute;
top: 10rpx;
right: 30rpx;
background-color: #f44336;
color: #fff;
font-size: 20rpx;
padding: 4rpx 12rpx;
border-radius: 20rpx;
min-width: 32rpx;
text-align: center;
}
.scroll-container {
width: 100%; width: 100%;
border-radius: 10rpx; }
background-color: rgba(255, 255, 255, 1);
margin-bottom: 20rpx; .reminder-list {
padding: 20rpx; padding: 20rpx;
box-sizing: border-box; box-sizing: border-box;
background-color: #fff;
border-radius: 16rpx;
margin: 20rpx;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
}
.reminder-item {
background-color: #fff;
border-radius: 16rpx;
margin-bottom: 20rpx;
padding: 30rpx;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
transition: all 0.3s ease;
}
.reminder-item:active {
transform: scale(0.98);
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.1);
}
.reminder-item-line {
height: 1rpx;
background-color: #f0f0f0;
width: 80%;
}
.reminder-item:active {
transform: scale(0.98);
box-shadow: 0 1rpx 4rpx rgba(0, 0, 0, 0.1);
} }
.conItemTitle { .card-header {
display: flex; display: flex;
width: 100%; align-items: center;
margin-bottom: 20rpx; margin-bottom: 20rpx;
}
.header-left {
display: flex;
align-items: center; align-items: center;
} }
.titleImg { .type-icon {
width: 38rpx; width: 38rpx;
height: 38rpx; height: 38rpx;
margin-right: 10rpx;
} }
.titleName { .type-name {
color: rgba(0, 0, 0, 1);
font-size: 28rpx; font-size: 28rpx;
text-align: left;
margin-left: 10rpx;
font-weight: bold; font-weight: bold;
color: #333;
} }
.conItemCon { .card-content {
width: 100%; background-color: #f9f9f9;
}
.repairInfo {
width: 100%;
background-color: rgba(249, 249, 249, 1);
padding: 20rpx; padding: 20rpx;
box-sizing: border-box;
border-radius: 10rpx; border-radius: 10rpx;
margin-bottom: 20rpx;
} }
.infoRow { .info-row {
display: flex; display: flex;
align-items: flex-start; align-items: flex-start;
margin-bottom: 15rpx; margin-bottom: 15rpx;
@ -237,6 +494,10 @@ export default {
flex-wrap: wrap; flex-wrap: wrap;
} }
.info-row:last-child {
margin-bottom: 0;
}
.label { .label {
color: #a9afba; color: #a9afba;
font-size: 28rpx; font-size: 28rpx;
@ -246,28 +507,32 @@ export default {
} }
.value { .value {
color: rgba(0, 0, 0, 1); color: #333;
font-size: 26rpx; font-size: 26rpx;
flex: 1; flex: 1;
} }
.problemImage { .image-container {
display: flex;
flex-wrap: wrap;
gap: 10rpx;
margin-top: 5rpx;
}
.problem-image {
width: 120rpx; width: 120rpx;
height: 120rpx; height: 120rpx;
border-radius: 8rpx; border-radius: 8rpx;
margin-top: 5rpx;
margin-right: 10rpx;
margin-bottom: 10rpx; margin-bottom: 10rpx;
} }
.actionButtons { .action-buttons {
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
align-items: center; align-items: center;
margin-top: 20rpx;
margin-left: auto;
gap: 20rpx; gap: 20rpx;
width: fit-content; width: fit-content;
margin-left: auto;
} }
.btn { .btn {
@ -275,16 +540,43 @@ export default {
height: 52rpx; height: 52rpx;
line-height: 46rpx; line-height: 46rpx;
border-radius: 52rpx; border-radius: 52rpx;
background-color: rgba(255, 255, 255, 1); background-color: #fff;
color: rgba(8, 179, 179, 1); color: #08b3b3;
font-size: 28rpx; font-size: 28rpx;
text-align: center; text-align: center;
font-family: AlibabaPuHui-regular; font-family: AlibabaPuHui-regular;
border: 2rpx solid rgba(8, 179, 179, 1); border: 2rpx solid #08b3b3;
}
.btn.process {
border-color: #08b3b3;
color: #08b3b3;
}
.loading-more,
.no-more {
text-align: center;
padding: 30rpx;
color: #999;
font-size: 26rpx;
}
.empty-state {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 100rpx 30rpx;
color: #999;
} }
.dispatch { .empty-icon {
border-color: #ff8c00; font-size: 80rpx;
color: #ff8c00; margin-bottom: 20rpx;
}
.empty-text {
font-size: 28rpx;
color: #999;
} }
</style> </style>

Loading…
Cancel
Save