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

修改留言

parent 2463041b
......@@ -13,6 +13,7 @@
<script>
import ELM from '@/components/elm-toast/index.vue';
import {addMessage} from "../api/user";
import {getDict} from "../api/system/dict/data";
export default {
data() {
......@@ -21,7 +22,9 @@
message:'',
type: 0,
tipMsg: '',
isConfirm: false
isConfirm: false,
//金币支付金额
payCount: 0
}
},
components: {
......@@ -33,30 +36,75 @@
uni.setNavigationBarTitle({
title: "留言"
})
this.getLeaveMessageDict()
},
onPageScroll(e) {
if (e.scrollTop > 50) {} else {}
},
methods: {
async saveAbout() {
uni.showLoading({
title: '保存中...'
})
const data = {
targetId: this.userId,
content: this.message
}
addMessage(data).then(res => {
if (res.data.code == 200) {
this.isConfirm = true;
this.tipMsg = "发送成功";
this.$refs.elm.showDialog();
} else {
this.tipMsg = res.data.message;
this.$refs.elm.showDialog();
if (this.message === ''){
this.tipMsg = "请输入内容";
this.$refs.elm.showDialog();
} else {
uni.showLoading({
title: '保存中...'
})
const userInfo = uni.getStorageSync('userInfo')
const data = {
targetId: this.userId,
content: this.message,
isPay:'0',//1花费 0不花费,
wxOpenid: userInfo.wxOpenid
}
})
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() {
this.isConfirm = false;
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