var 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',
|
id: '',
|
icon1: false,
|
disabled: false,
|
imgdisabled: false,
|
evalList: {},
|
judicialAid: {},
|
status: 0,
|
auditOpinion: ''
|
},
|
|
// 页面跳转
|
requestInfo: function() {
|
wx.navigateTo({
|
url: '../judicialUserInfo/judicialUserInfo?disabled=' + this.data.disabled + '&id=' + this.data.id + '&status=' + this.data.status + '&imgdisabled=' + this.data.imgdisabled
|
|
})
|
},
|
|
inputChange: function(e) {
|
var name = e.currentTarget.dataset.name;
|
this.setData({
|
judicialAid: {
|
...this.data.judicialAid,
|
[name]: e.detail.value
|
}
|
})
|
},
|
|
onLoad: function(option) {
|
this.setData({
|
id: option.id,
|
})
|
var that = this;
|
wx.request({
|
url: app.globalData.url + '/api/judicialAid/find?id=' + that.data.id,
|
success: function(res) {
|
if (res.data.code == 0) {
|
var judicialAid = res.data.data.judicialAid;
|
var attList = judicialAid.attList || [];
|
var evalList1004 = app.where(attList, {
|
associateType: 1004
|
}) || [];
|
var evalList1007 = app.where(attList, {
|
associateType: 1007
|
}) || [];
|
var evalList1008 = app.where(attList, {
|
associateType: 1008
|
}) || [];
|
var evalList = {
|
evalList1004,
|
evalList1007,
|
evalList1008,
|
};
|
for (var i in evalList) {
|
evalList[i] = evalList[i].map(({
|
imgPath: pic,
|
attachmentId: id
|
}) => ({
|
pic,
|
id
|
}))
|
}
|
var status = judicialAid.status;
|
if (status == 0) {
|
that.setData({
|
imgdisabled: false
|
})
|
} else {
|
that.setData({
|
imgdisabled: true
|
})
|
}
|
var disabled = app.judgeDisable(status);
|
that.setData({
|
judicialAid,
|
id: judicialAid.id,
|
icon1: res.data.data.icon1,
|
evalList,
|
showTime: app.formatDate(res.data.data.judicialAid.createTime),
|
disabled,
|
status,
|
auditOpinion: res.data.data.auditOpinion || ''
|
})
|
} else {
|
wx.showModal({
|
title: '提示',
|
content: "请求失败!"
|
})
|
}
|
}
|
})
|
},
|
|
submit: function(e) {
|
var status = e.currentTarget.dataset.type;
|
var userinfo = wx.getStorageSync("user");
|
var judicialAid = this.data.judicialAid;
|
judicialAid.createId = userinfo.id;
|
judicialAid.status = status;
|
var title = '';
|
if (status == 1) {
|
if (!this.data.icon1) {
|
return app.showModal("请填写个人信息!");
|
}
|
if (!judicialAid.content) {
|
return app.showModal("请填写救助申请理由!");
|
}
|
|
const {
|
evalList1004,
|
evalList1007,
|
evalList1008,
|
} = this.data.evalList;
|
|
if (judicialAid.agentName && evalList1004.length == 0) {
|
return app.showModal("请上传授权委托书!");
|
}
|
|
if (evalList1007.length == 0) {
|
return app.showModal("请上传国家司法救助申请书!");
|
}
|
if (evalList1008.length == 0) {
|
return app.showModal("请上传救助申请人及其家庭成员生活困难情况的证明!");
|
}
|
}
|
var that = this;
|
wx.request({
|
url: app.globalData.url + '/api/judicialAid/save',
|
data: judicialAid,
|
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
|
}); //返回上一页
|
}
|
})
|