diff --git a/src/views/rental/Detail.vue b/src/views/rental/Detail.vue index cad8be0..086cd96 100644 --- a/src/views/rental/Detail.vue +++ b/src/views/rental/Detail.vue @@ -247,6 +247,7 @@ export default { status: [{ required: true, message: '请选择状态', trigger: 'change' }] }, rentalDialogVisible: false, + renewingRentalId: null, rentalForm: { id: '', roomId: '', @@ -638,6 +639,7 @@ export default { startDate: rental.startDate ? new Date(rental.startDate) : '', endDate: rental.endDate ? new Date(rental.endDate) : '' } + this.renewingRentalId = null this.rentalDialogVisible = true }, handleRenewRental(rental) { @@ -661,6 +663,7 @@ export default { status: 'active', remark: '续租' } + this.renewingRentalId = rental.id this.rentalDialogVisible = true }, async handleSaveRental() { @@ -671,6 +674,12 @@ export default { } else { await rentalApi.create(this.rentalForm) this.$message.success('租赁记录添加成功') + + if (this.renewingRentalId) { + await rentalApi.update(this.renewingRentalId, { status: 'expired' }) + this.$message.success('原租赁记录状态已更新为已到期') + this.renewingRentalId = null + } } this.rentalDialogVisible = false this.loadData()