群众留言完成

This commit is contained in:
aixianling
2022-03-22 15:24:33 +08:00
parent 25fddf63db
commit 30ecf5b154
3 changed files with 61 additions and 14 deletions

View File

@@ -1,10 +1,10 @@
<template>
<section class="mmDetail">
<ai-detail>
<ai-title slot="title" title="留言详情" isShowBottomBorder isShowBack @onBackClick="$router.push({query:{}})">
<template #rightBtn>
<el-button type="primary">回复留言</el-button>
<el-button>关闭留言</el-button>
<ai-title slot="title" title="留言详情" isShowBottomBorder isShowBack @onBackClick="back">
<template #rightBtn v-if="!isClosed">
<el-button type="primary" @click="dialog=true">回复留言</el-button>
<el-button @click="handleCloseMass(detail.id)">关闭留言</el-button>
</template>
</ai-title>
<template #content>
@@ -38,6 +38,13 @@
</el-form>
</template>
</ai-detail>
<ai-dialog :visible.sync="dialog" title="回复留言" width="500px" @onConfirm="submit">
<el-form size="small" :model="form" :rules="rules" label-width="80px" ref="ReplyForm">
<el-form-item label="回复内容" prop="content">
<el-input type="textarea" v-model="form.content" rows="4" clearable placeholder="请输入回复内容"/>
</el-form-item>
</el-form>
</ai-dialog>
</section>
</template>
@@ -62,11 +69,19 @@ export default {
0: "留言",
1: "回复"
}
},
isClosed() {
return this.detail.status == 2
}
},
data() {
return {
detail: {},
dialog: false,
form: {},
rules: {
content: [{required: true, message: "请输入回复内容"}]
}
}
},
methods: {
@@ -80,6 +95,34 @@ export default {
}
})
},
back() {
this.$router.push({})
},
handleCloseMass(id) {
this.$confirm("是否要关闭留言?").then(() => {
this.instance.post("/appleavemessage/close", null, {
params: {id}
}).then(res => {
if (res?.code == 0) {
this.$message.success("关闭成功")
this.back()
}
})
}).catch(() => 0)
},
submit() {
this.$refs.ReplyForm.validate(v => {
if (v) {
let {id: messageId} = this.detail
this.instance.post("/appleavemessagereply/addOrUpdate", {...this.form, messageId, userType: 1}).then(res => {
if (res?.code == 0) {
this.$message.success("提交成功!")
this.back()
}
})
}
})
}
},
created() {
this.getDetail()