对接 投诉详情 投诉列表 选择处理人员 api

This commit is contained in:
Zy
2026-05-15 18:11:54 +08:00
parent 8324d096c0
commit 84a7a24288
13 changed files with 604 additions and 240 deletions

View File

@@ -9,21 +9,28 @@
></TabsComponents>
<view class="detail_list flex flex-1 overflow-auto">
<scroll-view scroll-y="true">
<view class="item" v-for="(item, index) in list" :key="index" @tap="handleComplaint">
<scroll-view scroll-y="true" lower-threshold="160" @scrolltolower="scrolltolower">
<view
class="item"
v-for="(item, index) in list"
:key="index"
@tap="handleComplaint(item.id)"
>
<view class="title flex items-center">
<text>{{ item.title }}</text>
<view class="status padding" v-if="item.status === 0"> <text>待处理</text> </view>
<text>{{ item.typeName }}</text>
<view class="status padding" v-if="item.status === '待处理'">
<text>待处理</text>
</view>
<view class="status compluted" v-else>
<text>已完成</text>
</view>
</view>
<view class="descrtion">
<text>{{ item.desction }}</text>
<text>{{ item.problemDes }}</text>
</view>
<view class="detailsMan">
<text>投诉人:</text>
<text>{{ item.user }}</text>
<text>{{ item.complaintName }}</text>
</view>
<view class="detailsMan">
<text>手机号:</text>
@@ -32,9 +39,9 @@
<view class="detailsMan flex justify-between">
<view class="">
<text>投诉时间:</text>
<text>{{ item.time }}</text>
<text>{{ item.createTime }}</text>
</view>
<view class="actions" v-if="item.status === 0">
<view class="actions" v-if="item.status === '待处理'">
<text>处理</text>
</view>
</view>
@@ -45,18 +52,22 @@
</view>
</template>
<script setup>
<script setup lang="ts">
import { ref } from 'vue'
import { onShow } from '@dcloudio/uni-app'
import TabsComponents from '@/components/tabs/tabs.vue'
const activeStatus = ref(0)
import { getComplainList } from '@/api/complain.js'
const scrollTop = ref(0)
const activeStatus = ref(-1)
const statusTabs = [
{
name: '全部',
value: 0
value: -1
},
{
name: '待处理',
value: 1
value: 0
},
{
name: '已完成',
@@ -64,57 +75,74 @@ const statusTabs = [
}
]
// 切换状态(全部/待分配/待解决/已完成)筛选
const switchStatus = value => {
const switchStatus = (value: number) => {
activeStatus.value = value
if (value === -1) {
querySearch.value.status = undefined
} else {
querySearch.value.status = value
}
querySearch.value.pageNum = 1
querySearch.value.pageSize = 10
hasMore.value = true
isLoading.value = false
scrollTop.value = 0
list.value = []
init()
}
//
const list = [
{
title: '小区环境',
status: 0, // 0 待处理 1 已完成
desction: '1栋楼下道路路灯不亮,并且有的亮度不够,请物业公司及时更换,防止发生意外事故。',
user: '胡小小',
phone: '19113212388',
time: '2023-08-01 10:05:46'
},
{
title: '小区环境',
status: 1, // 0 待处理 1 已完成
desction: '1栋楼下道路路灯不亮,并且有的亮度不够,请物业公司及时更换,防止发生意外事故。',
user: '胡小小',
phone: '19113212388',
time: '2023-08-01 10:05:46'
},
{
title: '小区环境',
status: 1, // 0 待处理 1 已完成
desction: '1栋楼下道路路灯不亮,并且有的亮度不够,请物业公司及时更换,防止发生意外事故。',
user: '胡小小',
phone: '19113212388',
time: '2023-08-01 10:05:46'
},
{
title: '小区环境',
status: 0, // 0 待处理 1 已完成
desction: '1栋楼下道路路灯不亮,并且有的亮度不够,请物业公司及时更换,防止发生意外事故。',
user: '胡小小',
phone: '19113212388',
time: '2023-08-01 10:05:46'
},
{
title: '小区环境',
status: 1, // 0 待处理 1 已完成
desction: '1栋楼下道路路灯不亮,并且有的亮度不够,请物业公司及时更换,防止发生意外事故。',
user: '胡小小',
phone: '19113212388',
time: '2023-08-01 10:05:46'
}
]
function handleComplaint() {
uni.navigateTo({
url: '/pageSubPack/complaint/Details_handle'
const total = ref(0) //
const isLoading = ref(false) // 加载锁
const hasMore = ref(true) // 是否还有更多数据
const list = ref([])
const querySearch = ref({
pageSize: 10,
pageNum: 1,
status: undefined // 0 待处理 1 已完成
})
function init() {
// 1. 如果正在加载或没有更多数据,直接返回
if (isLoading.value || !hasMore.value) return
// 2. 开启锁
isLoading.value = true
uni.showLoading({
title: '加载中',
mask: true
})
getComplainList(querySearch.value)
.then(res => {
list.value = [...list.value, ...res.rows]
total.value = res.total
// 判断是否还有更多
hasMore.value = list.value.length < total.value
})
.finally(() => {
isLoading.value = false
uni.hideLoading()
})
}
onShow(() => {
hasMore.value = true
init()
})
// actions
function handleComplaint(id: string) {
uni.navigateTo({
url: '/pageSubPack/complaint/Details_handle?id=' + id
})
}
function scrolltolower() {
// 必须加这两个判断!
if (isLoading.value || !hasMore.value) {
return
}
querySearch.value.pageNum += 1
init()
}
</script>
@@ -128,12 +156,11 @@ function handleComplaint() {
padding: 20rpx 40rpx;
.detail_list {
.item {
height: 390rpx;
background: #ffffff;
border-radius: 16rpx;
margin-bottom: 20rpx;
box-sizing: border-box;
padding: 30rpx 36rpx 55rpx 54rpx;
padding: 30rpx 36rpx 30rpx 54rpx;
.title {
font-weight: 400;
font-size: 32rpx;

View File

@@ -6,13 +6,14 @@
<view class="line"></view>
<text>投诉状态</text>
</view>
<view class="status" v-if="info.status === 0"> <text>待处理</text> </view>
<view class="status alwary" v-if="info.status === 1">
<view class="status" v-if="complainInfo.status === '0'"> <text>待处理</text> </view>
<view class="status alwary" v-if="complainInfo.status === '2'">
<text>已完成</text>
</view>
</view>
<view class="subDescrition" v-if="info.status === 1">
<text>已完成处理,已联系工作人员粘贴标语提醒,并派人定时巡视。</text>
<view class="subDescrition" v-if="complainInfo.status === '2'">
<!-- <text>已完成处理,已联系工作人员粘贴标语提醒,并派人定时巡视。</text> -->
<text>{{ complainInfo.handleContent }}</text>
</view>
<view class="items flex items-center justify-between">
<view class="title flex items-center">
@@ -24,28 +25,30 @@
<view class="item">
<view class="label"> 投诉类型 </view>
<view class="value flex items-center justify-between">
<view class=""> 社区服务 </view>
<view class="">
<text>{{ complainInfo.typeName }}</text>
</view>
<uni-icons type="right" size="14" color="#000000"></uni-icons>
</view>
</view>
<view class="item">
<view class="label"> 问题描述 </view>
<view class="value">
<text
>投诉内容投诉内容投诉内容投诉内容投诉内容投诉内容投诉内容投诉内容投诉内容投诉内容
</text>
<text>{{ complainInfo.problemDes }} </text>
</view>
</view>
<view class="item">
<view class="label"> 投诉人姓名 </view>
<view class="value">
<text>匿名 </text>
<text>
{{ complainInfo.complaintName }}
</text>
</view>
</view>
<view class="item">
<view class="label"> 手机号码 </view>
<view class="value">
<text>无 </text>
<text> {{ complainInfo.phone }}</text>
</view>
</view>
<view class="photobox">
@@ -54,7 +57,7 @@
</view>
<view class="imgbox">
<image
v-for="(item, index) in info.imgs"
v-for="(item, index) in showImages"
:key="index"
:src="item"
class="img"
@@ -65,7 +68,7 @@
</view>
<!-- submit -->
<view v-if="info.status === 0" class="action_btn" @tap="handleSelecthouse">
<view v-if="complainInfo.status === '0'" class="action_btn" @tap="handleSelecthouse">
<text>处理</text>
</view>
</view>
@@ -73,7 +76,10 @@
</template>
<script setup>
import { ref } from 'vue'
import { onMounted, ref } from 'vue'
import { onLoad, onShow } from '@dcloudio/uni-app'
import { getComplainMain } from '@/api/complain.js'
const info = ref({
status: 0, //0待解决 1已完成
imgs: [
@@ -84,10 +90,55 @@ const info = ref({
'https://picsum.photos/61'
]
})
/** 投诉详情id */
const complainId = ref('')
/** 投诉详情内容 */
const complainInfo = ref({
id: '',
typeId: null,
typeName: '',
problemDes: '',
complaintName: '',
phone: '',
villageId: null,
problemImageUrl: '',
status: '0',
createTime: null,
handleId: '',
handleName: '',
handleContent: ''
})
const showImages = ref([])
// 接受列表传递过来的id
onLoad(options => {
if (options && options.id && options.id.trim()) {
complainId.value = options.id
}
})
// 查询 投诉详情
function init() {
if (complainId.value) {
getComplainMain(complainId.value).then(res => {
complainInfo.value = res.data
showImages.value = res.data.problemImageUrl
.split(',')
.filter(item => item.includes('http'))
.map(item => item.split('?')[0])
})
}
}
onShow(() => {
init()
})
function handleSelecthouse() {
uni.navigateTo({
url: '/pageSubPack/complaint/handle'
})
if (complainId.value) {
uni.navigateTo({
url: '/pageSubPack/complaint/handle?handleId=' + complainId.value
})
}
}
</script>
@@ -176,6 +227,7 @@ function handleSelecthouse() {
.img {
width: 132rpx;
height: 132rpx;
border: 1rpx solid #efefef;
}
}
}

View File

@@ -3,12 +3,22 @@
<view class="handlebox flex-1">
<view class="items checkout flex items-center" @tap="handleClick">
<view class="label">处理人员</view>
<view class="value"> {{ checkoutinfo.username ? checkoutinfo.username : '请选择' }} </view>
<view class="value ellipsis">
<text>{{ checkoutinfo.userName ? checkoutinfo.userName : '请选择' }}</text>
</view>
</view>
<view class="items">
<view class="label">处理描述</view>
<view class="areabox">
<textarea value="" placeholder="请输入" placeholder-style="font-size:28rpx;" />
<textarea
style="width: 100%; height: 100%; overflow: hidden"
:value="form.handleContent"
:maxlength="-1"
auto-height
placeholder="请输入"
@blur="handleBlur"
placeholder-style="font-size:28rpx;"
/>
</view>
</view>
<view class="action_btn" @tap="handleSelecthouse">
@@ -18,26 +28,50 @@
</view>
</template>
<script setup>
<script setup lang="ts" key="handle">
import { ref } from 'vue'
import { onLoad, onUnload } from '@dcloudio/uni-app'
import { putComplainProcess } from '@/api/complain'
const checkoutinfo = ref({
username: '',
userid: ''
userName: '',
userId: ''
})
const form = ref({
complaintId: '',
handleContent: ''
})
onLoad(options => {
if (options && options.handleId && options.handleId.trim()) {
form.value.complaintId = options.handleId
}
})
// 选择处理人员
function handleClick() {
uni.navigateTo({
url: '/pageSubPack/complaint/handleUser',
events: {
backData: data => {
checkoutinfo.value.username = data.username
checkoutinfo.value.userid = data.userid
backData: (data: { userName: string; userId: string }) => {
checkoutinfo.value.userName = decodeURIComponent(data.userName)
checkoutinfo.value.userId = data.userId
}
}
})
}
function handleBlur(e) {
form.value.handleContent = e.detail.value
}
// 处理投诉 提交
function handleSelecthouse() {
uni.navigateBack()
putComplainProcess({
id: form.value.complaintId,
handleContent: form.value.handleContent
}).then(() => {
uni.navigateBack()
})
}
</script>
@@ -48,6 +82,7 @@ function handleSelecthouse() {
.items {
margin-bottom: 30rpx;
overflow: hidden;
&.checkout {
height: 100rpx;
line-height: 100rpx;
@@ -55,6 +90,7 @@ function handleSelecthouse() {
}
.label {
width: 128rpx;
min-width: 128rpx;
height: 40rpx;
font-weight: 550;
font-size: 32rpx;
@@ -76,6 +112,9 @@ function handleSelecthouse() {
border: 2rpx solid #e7e7e7;
padding: 10rpx;
box-sizing: border-box;
min-height: 162rpx;
max-height: 450rpx;
overflow: auto;
}
}
.action_btn {

View File

@@ -38,7 +38,7 @@
<view class="">
<view class="info">
<text>姓名:</text>
<text>{{ item.name }}</text>
<text>{{ item.nickName }}</text>
</view>
<view class="info">
<text>角色:</text>
@@ -46,10 +46,10 @@
</view>
<view class="info">
<text>手机号码:</text>
<text>{{ item.phone }}</text>
<text>{{ item.phonenumber }}</text>
</view>
</view>
<radio color="#4d5dfa" :value="item.id" />
<radio color="#4d5dfa" :value="item.userId" />
</view>
</label>
</radio-group>
@@ -63,10 +63,17 @@
</view>
</template>
<script setup>
<script setup key="Details">
import { ref, onMounted, getCurrentInstance } from 'vue'
import { getSystemUsers_employee } from '@/api/common.js'
import navBar from '@/components/navbar/navbar.vue'
let eventChannel = null
onMounted(() => {
const instance = getCurrentInstance().proxy
eventChannel = instance.getOpenerEventChannel()
})
const Searching = ref(true)
/** 点击时切换到input,并聚焦 */
function handleClick() {
@@ -100,70 +107,52 @@ function scrolltolower() {
getlist()
}
function getlist() {
// 1. 如果正在加载或没有更多数据,直接返回
if (isLoading.value || !hasMore.value) return
// 2. 开启锁
if (isLoading.value) {
return
}
isLoading.value = true
uni.showLoading({
title: '加载中',
mask: true
})
const { pageNum, pageSize } = queryParmas.value
const startId = (pageNum - 1) * pageSize + 1
const arr = Array.from({ length: pageSize }).map((_, index) => {
const realId = startId + index
const randomStatus = Math.floor(Math.random() * 3)
return {
name: '张三' + realId,
roleName: '维修人员',
phone: '19578012123',
id: realId
}
})
// 追加数据(正确方式)
searchlist.value = [...searchlist.value, ...arr]
// 判断是否还有更多
hasMore.value = searchlist.value.length < total.value
isLoading.value = false
uni.hideLoading()
getSystemUsers_employee('complainUser', queryParmas.value.value)
.then(res => {
console.log(res)
searchlist.value = res.data
})
.finally(() => {
isLoading.value = false
uni.hideLoading()
})
}
getlist()
function resetList() {
reportRecords.value = []
queryParmas.value.pageNum = 1
hasMore.value = true
getlist()
}
//=======================
// 选中的人员id
const checkoutUserid = ref(null)
// 选中的人员信息
const checkoutUserInfo = ref(null)
function radioChange(val) {
checkoutUserid.value = Number(val.detail.value)
const find = searchlist.value.find(item => item.id === Number(val.detail.value))
checkoutUserid.value = val.detail.value
const find = searchlist.value.find(item => item.userId === val.detail.value)
if (find) {
checkoutUserInfo.value = find
}
}
let eventChannel = null
// 必须在 onMounted 里获取
onMounted(() => {
const instance = getCurrentInstance().proxy
if (instance && instance.getOpenerEventChannel) {
eventChannel = instance.getOpenerEventChannel()
}
})
function handleSelecthouse() {
if (eventChannel) {
eventChannel.emit('backData', {
userid: checkoutUserid.value,
username: checkoutUserInfo.value.name
})
// 3. 返回上一页
uni.navigateBack()
// 携带你要传递的参数
const params = {
userId: checkoutUserid.value,
userName: checkoutUserInfo.value.nickName
}
eventChannel.emit('backData', {
userId: params.userId,
userName: encodeURIComponent(params.userName)
})
uni.navigateBack()
}
</script>

View File

@@ -67,6 +67,7 @@ function handleClick() {
backData: data => {
houseName.value = data.HouseName
formData.value.houseId = data.Houseid
console.log(data)
}
}
})

View File

@@ -4,7 +4,7 @@
<view
@click="handleClick"
class="search_view flex-center"
v-if="!queryParmas.value.trim() && Searching"
v-if="!queryParmas.keyword.trim() && Searching"
>
<uni-icons type="search" size="34rpx" color="rgba(0,0,0,0.26)"></uni-icons>
<text>请输入关键字进行搜索</text>
@@ -14,7 +14,7 @@
@change="handleSearch"
:focus="true"
ref="inputRef"
v-model="queryParmas.value"
v-model="queryParmas.keyword"
v-else
/>
</view>
@@ -25,17 +25,17 @@
<view
class="search_item flex flex-between"
:class="{
active: checkoutHouseid === item.id
active: checkoutHouseid === item.houseId
}"
>
<view class="flex items-center flex-1">
<!-- checkout -->
<radio color="#4d5dfa" :value="item.id" />
<radio color="#4d5dfa" :value="item.houseId" />
<!-- housename -->
<text class="address">{{ item.address }}</text>
<text class="address">{{ item.addressCn ?? item.addressHyphen }}</text>
</view>
<!-- username -->
<view class="username">{{ item.username }}</view>
<view class="username">{{ item.residentName }}</view>
</view>
</label>
</radio-group>
@@ -50,9 +50,11 @@
</template>
<script setup>
import { ref, getCurrentInstance, onMounted } from 'vue'
import { getVillageHouseList_keyword } from '@/api/common.js'
const Searching = ref(true)
const queryParmas = ref({
value: '',
keyword: '',
pageNum: 1,
pageSize: 10
})
@@ -62,18 +64,17 @@ function handleClick() {
}
/** 判断 失去焦点时 切换回 view */
function handleInput() {
if (queryParmas.value.value.trim()) {
if (queryParmas.value.keyword.trim()) {
Searching.value = true
}
}
function handleSearch() {}
const checkoutHouseid = ref(null)
const checkoutHouseInfo = ref(null)
/** 选择房屋,返回id*/
function radioChange(res) {
checkoutHouseid.value = Number(res.detail.value)
const find = searchlist.value.find(item => item.id === Number(res.detail.value))
checkoutHouseid.value = res.detail.value
const find = searchlist.value.find(item => item.houseId === res.detail.value)
if (find) {
checkoutHouseInfo.value = find
}
@@ -83,7 +84,7 @@ function radioChange(res) {
const searchlist = ref([])
const isLoading = ref(false) // 加载锁
const hasMore = ref(true) // 是否还有更多数据
const total = ref(21)
const total = ref(0)
function scrolltolower() {
// 必须加这两个判断!
if (isLoading.value || !hasMore.value) {
@@ -101,26 +102,21 @@ function getlist() {
title: '加载中',
mask: true
})
const { pageNum, pageSize } = queryParmas.value
const startId = (pageNum - 1) * pageSize + 1
const arr = Array.from({ length: pageSize }).map((_, index) => {
const realId = startId + index // ✅ 修复 ID 错误
return {
id: realId,
username: '李赫',
address: 'A栋3单元3' + realId
}
})
// 追加数据(正确方式)
searchlist.value = [...searchlist.value, ...arr]
// 判断是否还有更多
hasMore.value = searchlist.value.length < total.value
isLoading.value = false
uni.hideLoading()
getVillageHouseList_keyword(queryParmas.value, queryParmas.value.keyword)
.then(res => {
// 追加数据(正确方式)
searchlist.value = [...searchlist.value, ...res.rows]
// 判断是否还有更多
hasMore.value = searchlist.value.length < total.value
})
.finally(() => {
isLoading.value = false
uni.hideLoading()
})
}
getlist()
// 重置list
function resetList() {
searchlist.value = []
queryParmas.value.pageNum = 1
@@ -128,7 +124,15 @@ function resetList() {
getlist()
}
// -0---------------------------------------
// Search
function handleSearch() {
queryParmas.value.pageNum = 1
queryParmas.value.pageSize = 10
searchlist.value = []
getlist()
}
// ----------------------------------------
let eventChannel = null
// 必须在 onMounted 里获取
onMounted(() => {
@@ -139,11 +143,10 @@ onMounted(() => {
})
function handleSelecthouse() {
console.log(checkoutHouseInfo.value)
if (!eventChannel) return
eventChannel.emit('backData', {
Houseid: checkoutHouseid.value,
HouseName: checkoutHouseInfo.value.address
HouseName: checkoutHouseInfo.value.addressCn ?? checkoutHouseInfo.value.addressHyphen
})
// 3. 返回上一页
uni.navigateBack()