mirror of
https://gitee.com/elegant_wings/dbd-meeting-wx-small.git
synced 2025-06-22 01:59:36 +08:00
97 lines
2.1 KiB
JavaScript
97 lines
2.1 KiB
JavaScript
![]() |
let app = getApp()
|
||
|
Page({
|
||
|
/**
|
||
|
* 统一满分为5星
|
||
|
*/
|
||
|
data: {
|
||
|
num: '', //后端给的分数,显示相应的星星
|
||
|
one_1: '',
|
||
|
two_1: '',
|
||
|
one_2: 0,
|
||
|
two_2: 5,
|
||
|
one_3: 0,
|
||
|
two_3: 5
|
||
|
},
|
||
|
onLoad: function (e) {
|
||
|
console.log(e)
|
||
|
this.setData({
|
||
|
one_1: this.data.num,
|
||
|
two_1: 5 - this.data.num,
|
||
|
id: e.id
|
||
|
})
|
||
|
},
|
||
|
|
||
|
//工单评价
|
||
|
in_xin: function (e) {
|
||
|
var in_xin = e.currentTarget.dataset.in;
|
||
|
var one_2;
|
||
|
if (in_xin === 'use_sc2') {
|
||
|
one_2 = Number(e.currentTarget.id);
|
||
|
} else {
|
||
|
one_2 = Number(e.currentTarget.id) + this.data.one_2;
|
||
|
}
|
||
|
this.setData({
|
||
|
one_2: one_2,
|
||
|
two_2: 5 - one_2
|
||
|
})
|
||
|
},
|
||
|
//维修评价
|
||
|
in_xinp: function (e) {
|
||
|
var in_xin = e.currentTarget.dataset.in;
|
||
|
var one_3;
|
||
|
if (in_xin === 'use_sc3') {
|
||
|
one_3 = Number(e.currentTarget.id);
|
||
|
} else if (in_xin === 'use_sc1') {
|
||
|
one_3 = Number(e.currentTarget.id) + this.data.one_3;
|
||
|
}
|
||
|
this.setData({
|
||
|
one_3: one_3,
|
||
|
two_3: 5 - one_3
|
||
|
})
|
||
|
},
|
||
|
bindTextAreaBlur(e) {
|
||
|
console.log(e.detail.value)
|
||
|
this.setData({
|
||
|
remark: e.detail.value
|
||
|
})
|
||
|
},
|
||
|
apply() {
|
||
|
let that = this
|
||
|
if (that.data.one_2 == 0) {
|
||
|
wx.showToast({
|
||
|
icom: 'none',
|
||
|
title: '请先选择工单评价评分'
|
||
|
})
|
||
|
return false
|
||
|
}
|
||
|
if (that.data.one_3 == 0) {
|
||
|
wx.showToast({
|
||
|
icom: 'none',
|
||
|
title: '请先选择维修评价评分'
|
||
|
})
|
||
|
return false
|
||
|
}
|
||
|
app.AjaxRequest('POST', {
|
||
|
'content-type': 'application/json',
|
||
|
'Authorization': 'Bearer ' + app.Getopenid()
|
||
|
}, '/repair/review', {
|
||
|
id: that.data.id,
|
||
|
repairScore: that.data.one_2,
|
||
|
workerScore: that.data.one_3,
|
||
|
remark: that.data.remark,
|
||
|
}, function (res) {
|
||
|
if (res.code == 0) {
|
||
|
wx.showToast({
|
||
|
title: '评价提交成功',
|
||
|
success() {
|
||
|
setTimeout(function () {
|
||
|
wx.reLaunch({
|
||
|
url: '/pages/parkRepair/parkRepair',
|
||
|
})
|
||
|
}, 1000)
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
})
|