Commit 059d8162 authored by 罗林杰's avatar 罗林杰

修改留言

parent 2463041b
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
<script> <script>
import ELM from '@/components/elm-toast/index.vue'; import ELM from '@/components/elm-toast/index.vue';
import {addMessage} from "../api/user"; import {addMessage} from "../api/user";
import {getDict} from "../api/system/dict/data";
export default { export default {
data() { data() {
...@@ -21,7 +22,9 @@ ...@@ -21,7 +22,9 @@
message:'', message:'',
type: 0, type: 0,
tipMsg: '', tipMsg: '',
isConfirm: false isConfirm: false,
//金币支付金额
payCount: 0
} }
}, },
components: { components: {
...@@ -33,29 +36,74 @@ ...@@ -33,29 +36,74 @@
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
title: "留言" title: "留言"
}) })
this.getLeaveMessageDict()
}, },
onPageScroll(e) { onPageScroll(e) {
if (e.scrollTop > 50) {} else {} if (e.scrollTop > 50) {} else {}
}, },
methods: { methods: {
async saveAbout() { async saveAbout() {
if (this.message === ''){
this.tipMsg = "请输入内容";
this.$refs.elm.showDialog();
} else {
uni.showLoading({ uni.showLoading({
title: '保存中...' title: '保存中...'
}) })
const userInfo = uni.getStorageSync('userInfo')
const data = { const data = {
targetId: this.userId, targetId: this.userId,
content: this.message content: this.message,
isPay:'0',//1花费 0不花费,
wxOpenid: userInfo.wxOpenid
} }
addMessage(data).then(res => { addMessage(data).then(res => {
if (res.data.code == 200) { if (res.data.code == 200) {
this.isConfirm = true; this.isConfirm = true;
this.tipMsg = "发送成功"; this.tipMsg = "发送成功";
this.$refs.elm.showDialog(); this.$refs.elm.showDialog();
} else { } else if (res.data.code === 1001){
this.tipMsg = res.data.message; //留言超出限制 是否采用金币进行留言
uni.showModal({
title: '提示',
content: '已超出留言次数,是否花费'+ this.payCount +'金币再进行留言',
success: (res) => {
if (res.confirm) {
const form = {
targetId: this.targetId,//目标id
content: this.message,//输入的内容
isPay:'1',//1花费 0不花费
wxOpenid: userInfo.wxOpenid
}
addMessage(form).then(res=>{
if (res.data.code == 200){
this.isConfirm = true;
this.tipMsg = "发送成功";
this.$refs.elm.showDialog(); this.$refs.elm.showDialog();
} }
}) })
} else if (res.cancel) {
}
}
});
this.inputTemp = ''
} else if(res.data.code === 1002){
uni.showToast({
title: res.data.message,
icon: 'none'
})
}
})
}
},
//获取留言字典配置
getLeaveMessageDict(){
getDict('leave_message_config').then(res=> {
this.leaveMessageOptions = res.data.data
//过滤出dictLabel等于pay_count的dictValue
this.payCount = this.leaveMessageOptions.find(item => item.dictLabel === 'pay_count').dictValue;
})
}, },
confirm() { confirm() {
this.isConfirm = false; this.isConfirm = false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment