|
|
|
@ -97,9 +97,13 @@ |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import {getRoomCheckRecDetail,submitCheckout} from "../../../common/api" |
|
|
|
export default { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
roomId: '', // 房间ID |
|
|
|
userInfo: {}, // 用户信息 |
|
|
|
roomDetail: {}, // 房间详情 |
|
|
|
btnStyle: |
|
|
|
"background:linear-gradient(90deg,#0DC6C6 0%,#13C2C2 100%);font-size:36rpx;border-radius:48rpx;width:60vw;height:80rpx;", |
|
|
|
deviceList: [ |
|
|
|
@ -115,12 +119,81 @@ export default { |
|
|
|
waterMeter: 3245.1, |
|
|
|
electricMeter: 2672.6, |
|
|
|
remark: "", |
|
|
|
value: "", // 其他说明的文本内容 |
|
|
|
fileList: [], |
|
|
|
roomClean: "已打扫", |
|
|
|
cleanOptions: ["已打扫", "未打扫"], |
|
|
|
}; |
|
|
|
}, |
|
|
|
onLoad(options) { |
|
|
|
// 获取路由参数 |
|
|
|
if (options.roomId) { |
|
|
|
this.roomId = options.roomId; |
|
|
|
} |
|
|
|
if (options.userInfo) { |
|
|
|
try { |
|
|
|
this.userInfo = JSON.parse(decodeURIComponent(options.userInfo)); |
|
|
|
} catch (e) { |
|
|
|
console.error('解析userInfo失败:', e); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 如果有roomId,则获取房间详情 |
|
|
|
if (this.roomId) { |
|
|
|
this.getRoomDetail(); |
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
// 获取房间详情 |
|
|
|
async getRoomDetail() { |
|
|
|
try { |
|
|
|
uni.showLoading({ |
|
|
|
title: '加载中...' |
|
|
|
}); |
|
|
|
|
|
|
|
const res = await getRoomCheckRecDetail({ |
|
|
|
roomId: this.roomId |
|
|
|
}); |
|
|
|
|
|
|
|
if (res && res.code === 200) { |
|
|
|
this.roomDetail = res.data || {}; |
|
|
|
// 根据返回的数据更新页面显示 |
|
|
|
this.updatePageData(); |
|
|
|
} else { |
|
|
|
uni.showToast({ |
|
|
|
title: res?.msg || '获取房间详情失败', |
|
|
|
icon: 'none' |
|
|
|
}); |
|
|
|
} |
|
|
|
} catch (error) { |
|
|
|
console.error('获取房间详情失败:', error); |
|
|
|
uni.showToast({ |
|
|
|
title: '获取房间详情失败', |
|
|
|
icon: 'none' |
|
|
|
}); |
|
|
|
} finally { |
|
|
|
uni.hideLoading(); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
// 更新页面数据 |
|
|
|
updatePageData() { |
|
|
|
// 根据roomDetail更新页面显示的数据 |
|
|
|
if (this.roomDetail.roomName) { |
|
|
|
// 更新房间名称等基本信息 |
|
|
|
} |
|
|
|
if (this.roomDetail.deviceList && this.roomDetail.deviceList.length > 0) { |
|
|
|
// 更新设备列表 |
|
|
|
this.deviceList = this.roomDetail.deviceList; |
|
|
|
} |
|
|
|
if (this.roomDetail.roomClean) { |
|
|
|
this.roomClean = this.roomDetail.roomClean; |
|
|
|
} |
|
|
|
if (this.roomDetail.remark) { |
|
|
|
this.value = this.roomDetail.remark; |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
onDeviceChange(idx, val) { |
|
|
|
this.deviceList[idx].status = val; |
|
|
|
}, |
|
|
|
@ -128,12 +201,16 @@ export default { |
|
|
|
let files = Array.isArray(event) ? event : [event]; |
|
|
|
this.fileList = this.fileList.concat(files); |
|
|
|
}, |
|
|
|
onDelete(event) { |
|
|
|
deletePic(event) { |
|
|
|
this.fileList.splice(event.index, 1); |
|
|
|
}, |
|
|
|
onSubmit() { |
|
|
|
uni.showToast({ title: "提交成功", icon: "success" }); |
|
|
|
}, |
|
|
|
// 文本格式化器 |
|
|
|
formatter(value) { |
|
|
|
return value; |
|
|
|
}, |
|
|
|
}, |
|
|
|
}; |
|
|
|
</script> |
|
|
|
|