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.
299 lines
7.9 KiB
299 lines
7.9 KiB
// pages/issueDetail/issueDetail.js
|
|
var api = require('../../api/issueDetail.js')
|
|
import {
|
|
$wuxToast
|
|
} from '../../dist/index'
|
|
const app = getApp()
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
issueId: "",
|
|
issueState: "",
|
|
detailData: {},
|
|
processList: [],
|
|
handleSubmitData: {},
|
|
optionsCascader: [], // 分类列表
|
|
visible: false
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad(options) {
|
|
this.setData({
|
|
issueId: options.issueId,
|
|
issueState: options.issueState
|
|
})
|
|
if (this.data.issueState == "0") { // 待回应
|
|
this.getEventDetail() // 获取事件详情
|
|
this.getCategoryList() // 获取分类列表
|
|
} else if (this.data.issueState == "1") { // 待处理
|
|
this.getIssueDetail() // 获取议题详情
|
|
this.getIssueProcessList() // 获取议题处理进度
|
|
} else if (this.data.issueState == "2") { // 已驳回
|
|
this.getEventDetail() // 获取事件详情
|
|
} else if (this.data.issueState == "3") { // 已关闭
|
|
this.getIssueDetail() // 获取议题详情
|
|
this.getIssueProcessList() // 获取议题处理进度
|
|
}
|
|
},
|
|
// 获取事件详情
|
|
getEventDetail() {
|
|
api.getEventDetail(this.data.issueId).then((res) => {
|
|
console.log(res.data.userId)
|
|
this.setData({
|
|
detailData: {
|
|
id: res.data.id,
|
|
avatar: res.data.userFace,
|
|
nickname: res.data.nickName,
|
|
distributeTime: res.data.createdTime,
|
|
partyFlag: res.data.partyFlag,
|
|
images: res.data.imageArray,
|
|
content: res.data.eventContent,
|
|
mobile: res.data.mobile,
|
|
address: res.data.address,
|
|
advice: res.data.advice,
|
|
handleResidentImages: res.data.handleResidentImages,
|
|
userId: res.data.userId,
|
|
}
|
|
})
|
|
})
|
|
},
|
|
// 获取议题详情
|
|
getIssueDetail() {
|
|
api.getIssueDetail(this.data.issueId).then((res) => {
|
|
console.log(res.data.userId)
|
|
this.setData({
|
|
detailData: {
|
|
id: res.data.id,
|
|
eventId: res.data.eventId,
|
|
avatar: res.data.avatar,
|
|
nickname: res.data.nickname,
|
|
distributeTime: res.data.distributeTime,
|
|
images: res.data.images,
|
|
content: res.data.content,
|
|
mobile: res.data.mobile,
|
|
address: res.data.address,
|
|
categoryName: res.data.categoryName,
|
|
statementNum: res.data.statementNum,
|
|
approveNum: res.data.approveNum,
|
|
opposeNum: res.data.opposeNum,
|
|
commentNum: res.data.commentNum,
|
|
browseNum: res.data.browseNum,
|
|
userId: res.data.userId,
|
|
}
|
|
})
|
|
})
|
|
},
|
|
// 获取处理进度
|
|
getIssueProcessList() {
|
|
api.getIssueProcessList(this.data.issueId).then((res) => {
|
|
console.log(res.data)
|
|
if (res.data.length > 1) {
|
|
res.data[res.data.length - 1].lastProcess = true
|
|
}
|
|
res.data[0].firstProcess = true
|
|
this.setData({
|
|
processList: res.data
|
|
})
|
|
})
|
|
},
|
|
|
|
// 获取分类列表
|
|
getCategoryList() {
|
|
api.getCategoryList().then((res) => {
|
|
console.log(res.data)
|
|
this.setData({
|
|
optionsCascader: res.data
|
|
})
|
|
})
|
|
},
|
|
|
|
|
|
|
|
// 处理操作
|
|
onShowActionSheet(e) {
|
|
this.setData({
|
|
handleSubmitData: e.detail
|
|
})
|
|
},
|
|
|
|
// 提交
|
|
onBindFormSubmit(e) {
|
|
this.setData({
|
|
handleSubmitData: e.detail
|
|
})
|
|
if (this.data.issueState == "0") { // 待回应
|
|
if (this.data.handleSubmitData.eventState){
|
|
if (this.data.handleSubmitData.eventState == '4') {//审核通过
|
|
if (!this.data.handleSubmitData.categoryId) {
|
|
$wuxToast().show({
|
|
type: 'text',
|
|
duration: 3000,
|
|
color: '#fff',
|
|
text: '请选择分类',
|
|
success: () => console.log('')
|
|
})
|
|
return false
|
|
}
|
|
}
|
|
}else{
|
|
$wuxToast().show({
|
|
type: 'text',
|
|
duration: 3000,
|
|
color: '#fff',
|
|
text: '请选择审核操作',
|
|
success: () => console.log('')
|
|
})
|
|
return false
|
|
}
|
|
|
|
if (!this.data.handleSubmitData.advice) {
|
|
$wuxToast().show({
|
|
type: 'text',
|
|
duration: 3000,
|
|
color: '#fff',
|
|
text: '请填写处理意见',
|
|
success: () => console.log('')
|
|
})
|
|
return false
|
|
};
|
|
|
|
|
|
|
|
let params = {
|
|
id: this.data.detailData.id,
|
|
categoryId: this.data.handleSubmitData.categoryId,
|
|
eventState: this.data.handleSubmitData.eventState,
|
|
advice: this.data.handleSubmitData.advice,
|
|
images: this.data.handleSubmitData.images,
|
|
userId: this.data.detailData.userId,
|
|
}
|
|
wx.showLoading({
|
|
title: '正在提交,请稍后',
|
|
})
|
|
if (this.data.handleSubmitData.eventState == 2) { //事件状态(2-驳回,4-审核通过)
|
|
api.reviewNopass(params).then((res) => {
|
|
console.log(res)
|
|
wx.hideLoading()
|
|
if (res.code === 0) {
|
|
// 显示提醒
|
|
this.setData({
|
|
visible: true
|
|
})
|
|
}
|
|
})
|
|
} else if (this.data.handleSubmitData.eventState == 4) {
|
|
api.reviewPass(params).then((res) => {
|
|
console.log(res)
|
|
wx.hideLoading()
|
|
if (res.code === 0) {
|
|
// 显示提醒
|
|
this.setData({
|
|
visible: true
|
|
})
|
|
}
|
|
})
|
|
}
|
|
// api.postEventHandleSubmit(params).then((res) => {
|
|
// console.log(res)
|
|
// if (res.code === 0) {
|
|
// // 显示提醒
|
|
// this.setData({
|
|
// visible: true
|
|
// })
|
|
// }
|
|
// })
|
|
} else if (this.data.issueState == "1") { // 待处理
|
|
|
|
|
|
if (!this.data.handleSubmitData.state) {
|
|
$wuxToast().show({
|
|
type: 'text',
|
|
duration: 3000,
|
|
color: '#fff',
|
|
text: '请选择处理操作',
|
|
success: () => console.log('')
|
|
})
|
|
return false
|
|
};
|
|
|
|
if (!this.data.handleSubmitData.advice) {
|
|
$wuxToast().show({
|
|
type: 'text',
|
|
duration: 3000,
|
|
color: '#fff',
|
|
text: '请填写回复居民意见',
|
|
success: () => console.log('')
|
|
})
|
|
return false
|
|
};
|
|
let params = {
|
|
id: this.data.detailData.id,
|
|
advice: this.data.handleSubmitData.advice,
|
|
state: this.data.handleSubmitData.state,
|
|
images: this.data.handleSubmitData.images,
|
|
userId: this.data.detailData.userId,
|
|
}
|
|
wx.showLoading({
|
|
title: '正在提交,请稍后',
|
|
})
|
|
if (this.data.handleSubmitData.state == 1) { //状态 1 回应,2 关闭,4 转项目
|
|
api.response(params).then((res) => {
|
|
console.log(res)
|
|
wx.hideLoading()
|
|
if (res.code === 0) {
|
|
// 显示提醒
|
|
this.setData({
|
|
visible: true
|
|
})
|
|
}
|
|
})
|
|
} else if (this.data.handleSubmitData.state == 2) {
|
|
api.close(params).then((res) => {
|
|
console.log(res)
|
|
wx.hideLoading()
|
|
if (res.code === 0) {
|
|
// 显示提醒
|
|
this.setData({
|
|
visible: true
|
|
})
|
|
}
|
|
})
|
|
} else if (this.data.handleSubmitData.state == 4) {
|
|
api.toItem(params).then((res) => {
|
|
console.log(res)
|
|
wx.hideLoading()
|
|
if (res.code === 0) {
|
|
// 显示提醒
|
|
this.setData({
|
|
visible: true
|
|
})
|
|
}
|
|
})
|
|
}
|
|
// api.postIssueHandleSubmit(params).then((res) => {
|
|
// console.log(res)
|
|
// if (res.code === 0) {
|
|
// // 显示提醒
|
|
// this.setData({
|
|
// visible: true
|
|
// })
|
|
// }
|
|
// })
|
|
}
|
|
},
|
|
|
|
// 关闭提醒
|
|
onClose() {
|
|
this.setData({
|
|
visible: false,
|
|
})
|
|
wx.navigateBack()
|
|
},
|
|
|
|
|
|
})
|