ownerExitRoom.vue
1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<template>
<el-dialog
:title="$t('ownerExitRoom.confirmOperation')"
:visible.sync="visible"
width="500px"
center
@close="close"
>
<div class="modal-body">
<div class="text-center">
<p>{{ $t('ownerExitRoom.confirmExit') }}</p>
<p>{{ $t('ownerExitRoom.confirmExitTip') }}</p>
</div>
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="close">{{ $t('ownerExitRoom.cancel') }}</el-button>
<el-button type="primary" @click="doOwnerExitRoom">{{ $t('ownerExitRoom.confirmExitBtn') }}</el-button>
</div>
</el-dialog>
</template>
<script>
import { exitRoom } from '@/api/owner/showOwnerRoomApi'
import { getCommunityId } from '@/api/community/communityApi'
export default {
name: 'OwnerExitRoom',
data() {
return {
visible: false,
roomInfo: {}
}
},
methods: {
open(roomInfo) {
this.roomInfo = roomInfo
this.visible = true
},
close() {
this.visible = false
this.roomInfo = {}
},
async doOwnerExitRoom() {
try {
const params = {
...this.roomInfo,
communityId: getCommunityId()
}
const res = await exitRoom(params)
if (res.code === 0) {
this.$emit('exit-success')
this.close()
this.$message.success('退房成功')
} else {
this.$message.error(res.msg || '退房失败')
}
} catch (error) {
this.$message.error('请求失败')
}
}
}
}
</script>
<style scoped>
.modal-body {
padding: 20px;
text-align: center;
}
.text-center {
text-align: center;
}
.dialog-footer {
text-align: center;
}
</style>