// pages/progressQuery/progressQuery.js
|
const app = getApp();
|
Page({
|
|
/**
|
* 页面的初始数据
|
*/
|
data: {
|
src: app.globalData.imgUrl +'/image/bg.jpg',
|
itemIcon: app.globalData.imgUrl +'/image/ceshi.jpg',
|
icon: app.globalData.imgUrl +'/image/fzl.svg',
|
user: app.globalData.imgUrl +'/image/user.svg',
|
yes: app.globalData.imgUrl +'/image/yes.svg',
|
add: app.globalData.imgUrl +'/image/add.svg',
|
del: app.globalData.imgUrl +'/image/del.svg',
|
disabled: false,
|
imgdisabled:false,
|
id: '',
|
evalList: {},
|
caseQuery: {},
|
showTime:Date.now(),
|
status: 0,
|
auditOpinion: '',
|
userType: ['请选择身份关系', '诉讼代理人','辩护人','近亲属'],
|
},
|
|
|
selectChange: function (e) {
|
var name = e.currentTarget.dataset.name;
|
this.setData({
|
caseQuery: {
|
...this.data.caseQuery,
|
[name]: e.detail.value
|
}
|
})
|
|
},
|
|
inputChange: function(e) {
|
var name = e.currentTarget.dataset.name;
|
this.setData({
|
caseQuery: {
|
...this.data.caseQuery,
|
[name]: e.detail.value
|
}
|
})
|
},
|
|
onLoad: function(option) {
|
this.setData({
|
id: option.id,
|
})
|
var userinfo = wx.getStorageSync("user");
|
var that = this;
|
wx.request({
|
url: app.globalData.url + '/api/caseQuery/find?id=' + that.data.id + '&openId=' + userinfo.wxUnionId,
|
success: function(res) {
|
if (res.data.code == 0) {
|
var data = res.data.data.caseQuery;
|
var status = data.status;
|
if (status == 0) {
|
that.setData({ imgdisabled: false })
|
} else {
|
that.setData({ imgdisabled: true })
|
}
|
var disabled = app.judgeDisable(status);
|
data.userName = userinfo.userName;
|
data.createrId = userinfo.id;
|
if (!data.relation){
|
data.relation = 0;
|
}
|
var attList = data.attachments || [];
|
var evalList1001 = app.where(attList, {
|
associateTypeId: 1001
|
}) || [];
|
var evalList1002 = app.where(attList, {
|
associateTypeId: 1002
|
}) || [];
|
var evalList1003 = app.where(attList, {
|
associateTypeId: 1003
|
}) || [];
|
var evalList1004 = app.where(attList, {
|
associateTypeId: 1004
|
}) || [];
|
var evalList1014 = app.where(attList, {
|
associateTypeId: 1014
|
}) || [];
|
var evalList = {
|
evalList1001,
|
evalList1002,
|
evalList1003,
|
evalList1004,
|
evalList1014
|
};
|
for (var i in evalList) {
|
evalList[i] = evalList[i].map(({
|
path: pic,
|
id
|
}) => ({
|
pic,
|
id
|
}))
|
}
|
that.setData({
|
caseQuery: data,
|
disabled: disabled,
|
evalList,
|
id: data.id,
|
showTime: app.formatDate(data.createTime),
|
status,
|
auditOpinion: res.data.data.auditOpinion || ''
|
})
|
} else {
|
wx.showModal({
|
title: '提示',
|
content: "请求失败!"
|
})
|
}
|
}
|
})
|
},
|
|
submit: function(e) {
|
var caseQuery = this.data.caseQuery;
|
var status = e.currentTarget.dataset.type;
|
caseQuery.status = status;
|
var title = '';
|
if (status == "1") {
|
if (!caseQuery.caseTitle) {
|
return app.showModal("请填写案件名称!");
|
}
|
if (!caseQuery.unit) {
|
return app.showModal("请填写工作单位!");
|
}
|
if (!caseQuery.relation) {
|
return app.showModal("请填写身份关系!");
|
}
|
if (!caseQuery.content) {
|
return app.showModal("请填写查询内容!");
|
}
|
const {
|
evalList1001,
|
evalList1014
|
} = this.data.evalList;
|
if (evalList1001.length == 0) {
|
return app.showModal("请上传申请人身份证正反面!");
|
}
|
if (evalList1001.length < 2) {
|
return app.showModal("请至少上传两张身份证附件!")
|
}
|
if (evalList1014.length == 0) {
|
return app.showModal("请上传关系证明!");
|
}
|
}
|
var that = this;
|
wx.request({
|
url: app.globalData.url + '/api/caseQuery/save',
|
data: caseQuery,
|
method: 'POST',
|
header: {
|
"Content-Type": "application/json"
|
},
|
success: function(res) {
|
if (res.data.code == 0) {
|
if (status == 0) {
|
title = '保存草稿成功!';
|
} else {
|
title = '提交成功!';
|
}
|
wx.showToast({
|
title,
|
icon: 'success',
|
duration: 2000
|
})
|
setTimeout(function(){
|
wx.reLaunch({
|
url: '../index/index',
|
})
|
}, 2000)
|
} else {
|
wx.showModal({
|
title: '提示',
|
content: "提交失败!"
|
})
|
}
|
}
|
})
|
},
|
|
//添加图片
|
joinPicture: function(e) {
|
var that = this;
|
app.joinPicture(e, that)
|
},
|
|
// 删除图片
|
clearImg: function(e) {
|
var that = this;
|
app.clearImg(e, that)
|
},
|
|
//预览图片
|
previewImage: function(e) {
|
app.previewImage(e)
|
},
|
|
goback: function() {
|
wx.navigateBack({
|
changed: true
|
}); //返回上一页
|
}
|
})
|