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,30 +36,75 @@ ...@@ -33,30 +36,75 @@
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() {
uni.showLoading({ if (this.message === ''){
title: '保存中...' this.tipMsg = "请输入内容";
}) this.$refs.elm.showDialog();
const data = { } else {
targetId: this.userId, uni.showLoading({
content: this.message title: '保存中...'
} })
addMessage(data).then(res => { const userInfo = uni.getStorageSync('userInfo')
if (res.data.code == 200) { const data = {
this.isConfirm = true; targetId: this.userId,
this.tipMsg = "发送成功"; content: this.message,
this.$refs.elm.showDialog(); isPay:'0',//1花费 0不花费,
} else { wxOpenid: userInfo.wxOpenid
this.tipMsg = res.data.message;
this.$refs.elm.showDialog();
} }
}) addMessage(data).then(res => {
if (res.data.code == 200) {
this.isConfirm = true;
this.tipMsg = "发送成功";
this.$refs.elm.showDialog();
} else if (res.data.code === 1001){
//留言超出限制 是否采用金币进行留言
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();
}
})
} 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;
uni.navigateBack({ uni.navigateBack({
......
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