修复预约详情删除图片回显

This commit is contained in:
2026-07-23 11:09:19 +08:00
parent 2e9ffc3cf2
commit a8112d95a8
4 changed files with 69 additions and 7 deletions
@@ -344,8 +344,9 @@ Page({
},
async persistAppointmentImages(fileIds, previewImageUrls) {
const imageFileIds = fileIds.join(',')
const result = await planningApi.updateAppointmentImages(this.data.id, {
imageFileIds: fileIds.join(',')
imageFileIds
})
markPlanningRefresh()
if (isAppointmentResponse(result)) {
@@ -353,8 +354,11 @@ Page({
} else {
await this.loadDetail()
}
if (Array.isArray(previewImageUrls) && previewImageUrls.length > 0) {
this.setData({ productImageUrls: previewImageUrls })
if (Array.isArray(previewImageUrls)) {
this.setData({
productImageUrls: previewImageUrls,
productImageFileIds: imageFileIds
})
}
},
@@ -418,9 +422,9 @@ Page({
const nextImageUrls = currentImageUrls.filter((item, itemIndex) => itemIndex !== index)
this.setData({ imageUploading: true })
await this.persistAppointmentImages(nextFileIds, nextImageUrls)
wx.showToast({ title: '图片已保存' })
wx.showToast({ title: '图片已删除' })
} catch (error) {
wx.showToast({ title: error.message || '图片保存失败', icon: 'none' })
wx.showToast({ title: error.message || '图片删除失败', icon: 'none' })
} finally {
this.setData({ imageUploading: false })
}