feat: 洗美报告对接ReportImage多图接口,前端提交/展示适配新格式
This commit is contained in:
parent
ee3b868c6f
commit
a1b3780ab9
@ -22,8 +22,8 @@
|
|||||||
>
|
>
|
||||||
<div class="gallery-cover">
|
<div class="gallery-cover">
|
||||||
<img
|
<img
|
||||||
v-if="r.beforePhoto"
|
v-if="r.beforePhotos && r.beforePhotos.length > 0"
|
||||||
:src="imgUrl(r.beforePhoto)"
|
:src="imgUrl(r.beforePhotos[0])"
|
||||||
class="cover-img"
|
class="cover-img"
|
||||||
/>
|
/>
|
||||||
<div v-else class="cover-placeholder">
|
<div v-else class="cover-placeholder">
|
||||||
|
|||||||
@ -234,12 +234,12 @@ const routeToken = ref('')
|
|||||||
const isStaff = computed(() => isLoggedIn())
|
const isStaff = computed(() => isLoggedIn())
|
||||||
|
|
||||||
const beforePhotos = computed(() => {
|
const beforePhotos = computed(() => {
|
||||||
if (!reportData.value?.beforePhoto) return []
|
if (!reportData.value?.beforePhotos) return []
|
||||||
return reportData.value.beforePhoto.split(',').filter(Boolean)
|
return reportData.value.beforePhotos
|
||||||
})
|
})
|
||||||
const afterPhotos = computed(() => {
|
const afterPhotos = computed(() => {
|
||||||
if (!reportData.value?.afterPhoto) return []
|
if (!reportData.value?.afterPhotos) return []
|
||||||
return reportData.value.afterPhoto.split(',').filter(Boolean)
|
return reportData.value.afterPhotos
|
||||||
})
|
})
|
||||||
const beforePhotoUrls = computed(() => beforePhotos.value.map((item) => imgUrl(item)))
|
const beforePhotoUrls = computed(() => beforePhotos.value.map((item) => imgUrl(item)))
|
||||||
const afterPhotoUrls = computed(() => afterPhotos.value.map((item) => imgUrl(item)))
|
const afterPhotoUrls = computed(() => afterPhotos.value.map((item) => imgUrl(item)))
|
||||||
|
|||||||
@ -238,15 +238,22 @@ const submitReport = async () => {
|
|||||||
if (!report.value.serviceType) return uni.showToast({ title: '请选择服务类型', icon: 'none' })
|
if (!report.value.serviceType) return uni.showToast({ title: '请选择服务类型', icon: 'none' })
|
||||||
if (!report.value.appointmentTime) return uni.showToast({ title: '请选择服务时间', icon: 'none' })
|
if (!report.value.appointmentTime) return uni.showToast({ title: '请选择服务时间', icon: 'none' })
|
||||||
submitting.value = true
|
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 = {
|
const payload = {
|
||||||
appointmentId: currentAppointmentId.value || null,
|
appointmentId: currentAppointmentId.value || null,
|
||||||
userId: userInfo.id,
|
userId: userInfo.id,
|
||||||
petName: report.value.petName,
|
petName: report.value.petName,
|
||||||
serviceType: report.value.serviceType,
|
serviceType: report.value.serviceType,
|
||||||
appointmentTime: report.value.appointmentTime || null,
|
appointmentTime: report.value.appointmentTime || null,
|
||||||
beforePhoto: report.value.before.join(','),
|
remark: report.value.remark,
|
||||||
afterPhoto: report.value.after.join(','),
|
images
|
||||||
remark: report.value.remark
|
|
||||||
}
|
}
|
||||||
const res = await createReport(payload)
|
const res = await createReport(payload)
|
||||||
submitting.value = false
|
submitting.value = false
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user