You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
192 lines
4.9 KiB
192 lines
4.9 KiB
import { satisfyEvaluation } from '../../utils/api'
|
|
|
|
Page({
|
|
data: {
|
|
notSatisify: '../../images/ic_bumanyihuise@2x.png',
|
|
notSatisifySelected: '../../images/ic_bumanyi@2x.png',
|
|
normalSatisify: '../../images/ic_jibenmanyihuise@2x.png',
|
|
normalSatisifySelected: '../../images/ic_jibenmanyi@2x.png',
|
|
verySatisify: '../../images/feichangmanyihuise@2x.png',
|
|
verySatisifySelected: '../../images/ic_feichangmanyi@2x.png',
|
|
textareaValue: '',
|
|
evaluationCallbackVisible: false,
|
|
satisifyType: 'verySatisify',
|
|
itemId: '',
|
|
isFirstNum: 0, //0:初始状态,1:提交一次审核违规不通过
|
|
isConReview: false, //true 强制发送
|
|
evaluationScore: '',
|
|
formPage: false, // 判断来自是不是来自 诉求页面
|
|
solveList:['解决','基本解决','未解决'],//是否解决
|
|
solutionInfo:''//01解决 02基本解决 03未解决
|
|
},
|
|
onLoad(options) {
|
|
if (options.itemId) {
|
|
this.setData({
|
|
itemId: options.itemId,
|
|
})
|
|
}
|
|
if (options.evaluationScore) {
|
|
this.setData({
|
|
satisifyType:
|
|
options.evaluationScore == '0'
|
|
? 'notSatisify'
|
|
: options.evaluationScore == '1'
|
|
? 'normalSatisify'
|
|
: options.evaluationScore == '2'
|
|
? 'verySatisify'
|
|
: '',
|
|
})
|
|
}
|
|
if (options.evaluationContent) {
|
|
this.setData({
|
|
textareaValue: options.evaluationContent,
|
|
})
|
|
}
|
|
|
|
if(options.pageName && options.pageName == 'appeal') {
|
|
this.setData({
|
|
formPage: true,
|
|
// satisifyType: 'verySatisify'
|
|
})
|
|
}
|
|
|
|
if(options.solutionInfo){
|
|
this.setData({
|
|
solutionInfo: options.solutionInfo,
|
|
})
|
|
}
|
|
},
|
|
onShow() {},
|
|
// textarea 双向绑定
|
|
bindTextareaValue(e) {
|
|
this.setData({
|
|
textareaValue: e.detail.value,
|
|
})
|
|
},
|
|
// 发表评价
|
|
publishEvaluation() {
|
|
if (!this.data.satisifyType) {
|
|
wx.showToast({
|
|
title: '请进行满意度评价',
|
|
icon: 'none',
|
|
duration: 1000,
|
|
})
|
|
return false
|
|
} else if (!this.data.textareaValue) {
|
|
wx.showToast({
|
|
title: '请填写评价内容',
|
|
icon: 'none',
|
|
duration: 1000,
|
|
})
|
|
return false
|
|
}else if(!this.data.solutionInfo){
|
|
wx.showToast({
|
|
title: '请选择处理结果',
|
|
icon: 'none',
|
|
duration: 1000,
|
|
})
|
|
return false
|
|
}
|
|
const para = {
|
|
itemId: this.data.itemId,
|
|
evaluationScore:
|
|
this.data.satisifyType === 'notSatisify'
|
|
? 0
|
|
: this.data.satisifyType === 'normalSatisify'
|
|
? 1
|
|
: this.data.satisifyType === 'verySatisify'
|
|
? 2
|
|
: '',
|
|
evaluationContent: this.data.textareaValue,
|
|
isConReview: this.data.isConReview,
|
|
solutionInfo:this.data.solutionInfo
|
|
}
|
|
wx.showLoading({
|
|
title: '加载中...',
|
|
mask: true,
|
|
})
|
|
satisfyEvaluation(para)
|
|
.then((res) => {
|
|
wx.hideLoading()
|
|
console.log('满意度评价', res)
|
|
this.setData({
|
|
evaluationCallbackVisible: !this.data.evaluationCallbackVisible,
|
|
isConReview: false,
|
|
})
|
|
})
|
|
.catch((err) => {
|
|
let { code } = err
|
|
if (code == 533) {
|
|
this.checkTitle()
|
|
} else {
|
|
wx.showToast({
|
|
title: err,
|
|
icon: 'none',
|
|
duration: 6000,
|
|
mask: true,
|
|
complete: () => {
|
|
setTimeout(() => {
|
|
wx.hideLoading()
|
|
}, 2000)
|
|
},
|
|
})
|
|
}
|
|
})
|
|
},
|
|
// 选择 满意度
|
|
chooseSatisifyType(e) {
|
|
this.setData({
|
|
satisifyType: e.currentTarget.dataset.type,
|
|
})
|
|
},
|
|
checkTitle() {
|
|
let that = this
|
|
if (this.data.isFirstNum == 0) {
|
|
this.setData({
|
|
isFirstNum: ++this.data.isFirstNum,
|
|
})
|
|
setTimeout(() => {
|
|
wx.hideLoading()
|
|
}, 3000)
|
|
// wx.showToast({
|
|
// title:'内容存在违规信息,请修改后重新提交!',
|
|
// icon:'none',
|
|
// duration: 3000,
|
|
// mask:true
|
|
// })
|
|
} else if (this.data.isFirstNum == 1) {
|
|
wx.hideLoading()
|
|
wx.showToast({
|
|
title: '',
|
|
icon: 'none',
|
|
duration: 100,
|
|
mask: true,
|
|
})
|
|
wx.showModal({
|
|
title: '提示',
|
|
content: '您提交的内容再次被判定为违规,您确定是否要提交?',
|
|
success(res) {
|
|
if (res.confirm) {
|
|
that.setData({
|
|
isConReview: true,
|
|
})
|
|
that.publishEvaluation()
|
|
} else if (res.cancel) {
|
|
}
|
|
},
|
|
})
|
|
}
|
|
},
|
|
handleChangeSolve(e){
|
|
this.setData({
|
|
solutionInfo:
|
|
e.detail.value == '0'
|
|
? '01'
|
|
: e.detail.value == '1'
|
|
? '02'
|
|
: e.detail.value == '2'
|
|
? '03'
|
|
: '',
|
|
})
|
|
}
|
|
})
|
|
|