feat: 洗美报告对接ReportImage多图接口,前端提交/展示适配新格式

This commit is contained in:
MaDaLei 2026-04-16 21:20:28 +08:00
parent ee3b868c6f
commit a1b3780ab9
3 changed files with 16 additions and 9 deletions

View File

@ -22,8 +22,8 @@
>
<div class="gallery-cover">
<img
v-if="r.beforePhoto"
:src="imgUrl(r.beforePhoto)"
v-if="r.beforePhotos && r.beforePhotos.length > 0"
:src="imgUrl(r.beforePhotos[0])"
class="cover-img"
/>
<div v-else class="cover-placeholder">

View File

@ -234,12 +234,12 @@ const routeToken = ref('')
const isStaff = computed(() => isLoggedIn())
const beforePhotos = computed(() => {
if (!reportData.value?.beforePhoto) return []
return reportData.value.beforePhoto.split(',').filter(Boolean)
if (!reportData.value?.beforePhotos) return []
return reportData.value.beforePhotos
})
const afterPhotos = computed(() => {
if (!reportData.value?.afterPhoto) return []
return reportData.value.afterPhoto.split(',').filter(Boolean)
if (!reportData.value?.afterPhotos) return []
return reportData.value.afterPhotos
})
const beforePhotoUrls = computed(() => beforePhotos.value.map((item) => imgUrl(item)))
const afterPhotoUrls = computed(() => afterPhotos.value.map((item) => imgUrl(item)))

View File

@ -238,15 +238,22 @@ const submitReport = async () => {
if (!report.value.serviceType) return uni.showToast({ title: '请选择服务类型', icon: 'none' })
if (!report.value.appointmentTime) return uni.showToast({ title: '请选择服务时间', icon: 'none' })
submitting.value = true
//
const images = []
report.value.before.forEach((url, i) => {
images.push({ photoUrl: url, photoType: 'before', sortOrder: i })
})
report.value.after.forEach((url, i) => {
images.push({ photoUrl: url, photoType: 'after', sortOrder: i })
})
const payload = {
appointmentId: currentAppointmentId.value || null,
userId: userInfo.id,
petName: report.value.petName,
serviceType: report.value.serviceType,
appointmentTime: report.value.appointmentTime || null,
beforePhoto: report.value.before.join(','),
afterPhoto: report.value.after.join(','),
remark: report.value.remark
remark: report.value.remark,
images
}
const res = await createReport(payload)
submitting.value = false