parent
e20f33ddb8
commit
da1bd8069e
@ -0,0 +1,266 @@
|
||||
<template>
|
||||
<view
|
||||
class="house-popup-mask"
|
||||
v-if="visible"
|
||||
@click="close"
|
||||
>
|
||||
<view class="house-popup" @click.stop>
|
||||
<view class="popup-title">派单记录</view>
|
||||
<scroll-view scroll-y class="dispatch-list">
|
||||
<view
|
||||
class="dispatch-item"
|
||||
v-for="(item, index) in records"
|
||||
:key="index"
|
||||
>
|
||||
<view class="dispatch-header">
|
||||
<text class="dispatch-status" :class="dispatchStatusClass(item.status)">
|
||||
{{ getDispatchStatusText(item.status) }}
|
||||
</text>
|
||||
<text class="dispatch-time">{{ item.assignTime }}</text>
|
||||
</view>
|
||||
<view class="dispatch-body">
|
||||
<view class="row">
|
||||
<text class="label">派单人</text>
|
||||
<text class="value">{{ item.assignerName || '-' }}</text>
|
||||
</view>
|
||||
<view class="row">
|
||||
<text class="label">执行人</text>
|
||||
<text class="value">{{ item.executorName || '-' }}</text>
|
||||
</view>
|
||||
<view class="row">
|
||||
<text class="label">执行人部门</text>
|
||||
<text class="value">{{ item.executorDeptName || '-' }}</text>
|
||||
</view>
|
||||
<view class="row">
|
||||
<text class="label">联系方式</text>
|
||||
<text class="value">{{ item.phone || '-' }}</text>
|
||||
</view>
|
||||
<view class="row">
|
||||
<text class="label">预计完成时间</text>
|
||||
<text class="value">{{ item.expectedCompleteTime || '-' }}</text>
|
||||
</view>
|
||||
<view class="row">
|
||||
<text class="label">实际完成时间</text>
|
||||
<text class="value">{{ item.completeTime || '-' }}</text>
|
||||
</view>
|
||||
<view class="row" v-if="item.handleContent">
|
||||
<text class="label">处理内容</text>
|
||||
<text class="value">{{ item.handleContent }}</text>
|
||||
</view>
|
||||
<view class="row">
|
||||
<text class="label">业主确认</text>
|
||||
<text class="value">{{ item.ownerConfirm === '1' ? '是' : '否' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
class="empty"
|
||||
v-if="!loading && records.length === 0"
|
||||
>
|
||||
暂无派单记录
|
||||
</view>
|
||||
<view
|
||||
class="load-more"
|
||||
v-if="loading"
|
||||
>
|
||||
加载中...
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listMaintenanceDispatch } from '@/api/property.js';
|
||||
|
||||
export default {
|
||||
props: {
|
||||
visible: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
orderId: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
records: [],
|
||||
loading: false
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
visible: {
|
||||
handler(newVal) {
|
||||
console.log('DispatchRecord visible changed:', newVal);
|
||||
if (newVal && this.orderId) {
|
||||
this.fetchRecords();
|
||||
}
|
||||
},
|
||||
immediate: true
|
||||
},
|
||||
orderId: {
|
||||
handler(newVal) {
|
||||
console.log('DispatchRecord orderId changed:', newVal);
|
||||
if (newVal && this.visible) {
|
||||
this.fetchRecords();
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 获取派单记录数据
|
||||
async fetchRecords() {
|
||||
this.loading = true;
|
||||
try {
|
||||
const res = await listMaintenanceDispatch({
|
||||
page: 1,
|
||||
limit: 99,
|
||||
orderId: this.orderId
|
||||
});
|
||||
this.records = res?.data?.list || [];
|
||||
} catch (e) {
|
||||
console.error('获取派单记录失败:', e);
|
||||
uni.showToast({
|
||||
title: typeof e === 'string' ? e : '获取派单记录失败',
|
||||
icon: 'none'
|
||||
});
|
||||
} finally {
|
||||
this.loading = false;
|
||||
}
|
||||
},
|
||||
// 获取派单状态文本
|
||||
getDispatchStatusText(status) {
|
||||
const statusMap = {
|
||||
0: '待处理',
|
||||
1: '处理中',
|
||||
2: '已完成'
|
||||
};
|
||||
return statusMap[status] || '未知状态';
|
||||
},
|
||||
// 获取派单状态样式类
|
||||
dispatchStatusClass(status) {
|
||||
const classMap = {
|
||||
0: 'pending',
|
||||
1: 'doing',
|
||||
2: 'done'
|
||||
};
|
||||
return classMap[status] || '';
|
||||
},
|
||||
// 关闭弹窗
|
||||
close() {
|
||||
this.$emit('update:visible', false);
|
||||
this.records = [];
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.house-popup-mask {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
background-color: rgba(0, 0, 0, 0.4);
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
justify-content: center;
|
||||
z-index: 9999;
|
||||
overflow: hidden;
|
||||
|
||||
.house-popup {
|
||||
width: 100%;
|
||||
max-height: 70vh;
|
||||
background-color: #fff;
|
||||
border-radius: 20rpx 20rpx 0 0;
|
||||
padding: 24rpx 30rpx 40rpx;
|
||||
box-sizing: border-box;
|
||||
|
||||
.popup-title {
|
||||
text-align: center;
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.dispatch-list {
|
||||
max-height: 60vh;
|
||||
|
||||
.dispatch-item {
|
||||
padding: 20rpx 0;
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
|
||||
.dispatch-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 16rpx;
|
||||
|
||||
.dispatch-status {
|
||||
padding: 4rpx 12rpx;
|
||||
border-radius: 16rpx;
|
||||
font-size: 20rpx;
|
||||
}
|
||||
|
||||
.dispatch-status.pending {
|
||||
background-color: #E6F7FF;
|
||||
color: #409EFF;
|
||||
}
|
||||
|
||||
.dispatch-status.doing {
|
||||
background-color: #FFF7E6;
|
||||
color: #FA8C16;
|
||||
}
|
||||
|
||||
.dispatch-status.done {
|
||||
background-color: #F6FFED;
|
||||
color: #52C41A;
|
||||
}
|
||||
|
||||
.dispatch-time {
|
||||
font-size: 22rpx;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
|
||||
.dispatch-body {
|
||||
.row {
|
||||
display: flex;
|
||||
margin-bottom: 10rpx;
|
||||
|
||||
.label {
|
||||
width: 160rpx;
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.value {
|
||||
flex: 1;
|
||||
font-size: 24rpx;
|
||||
color: #333;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.empty {
|
||||
text-align: center;
|
||||
padding: 40rpx 0;
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.load-more {
|
||||
text-align: center;
|
||||
padding: 20rpx 0;
|
||||
font-size: 22rpx;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Loading…
Reference in new issue