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,
|
icon2: false,
|
excess: '',
|
disabled: false,
|
imgdisabled:false,
|
evalList: {},
|
countryPay: {},
|
showTime: Date.now(),
|
status: 0,
|
auditOpinion: ''
|
},
|
|
// 页面跳转
|
requestInfo: function() {
|
wx.navigateTo({
|
url: '../requestInfo/requestInfo?excess=' + this.data.excess + '&disabled=' + this.data.disabled + '&id=' + this.data.id + '&status=' + this.data.status + '&imgdisabled=' + this.data.imgdisabled
|
})
|
},
|
agentInfo: function() {
|
wx.navigateTo({
|
url: '../countryAgentInfo/countryAgentInfo?excess=' + this.data.excess + '&disabled=' + this.data.disabled + '&id=' + this.data.id + '&status=' + this.data.status + '&imgdisabled=' + this.data.imgdisabled
|
})
|
},
|
|
onLoad: function(option) {
|
this.setData({
|
id: option.id,
|
excess: option.name || ''
|
})
|
var that = this;
|
wx.request({
|
url: app.globalData.url + '/api/countryPay/find?id=' + that.data.id,
|
success: function(res) {
|
if (res.data.code == 0) {
|
var attList = res.data.data.countryPay.attList || [];
|
var evalList1009 = app.where(attList, {
|
associateTypeId: 1009
|
}) || [];
|
var evalList1010 = app.where(attList, {
|
associateTypeId: 1010
|
}) || [];
|
var evalList1011 = app.where(attList, {
|
associateTypeId: 1011
|
}) || [];
|
var evalList1012 = app.where(attList, {
|
associateTypeId: 1012
|
}) || [];
|
var evalList = {
|
evalList1009,
|
evalList1010,
|
evalList1011,
|
evalList1012
|
};
|
for (var i in evalList) {
|
evalList[i] = evalList[i].map(({
|
imgPath: pic,
|
attId: id
|
}) => ({
|
pic,
|
id
|
}))
|
}
|
var status = res.data.data.countryPay.status;
|
if (status == 0) {
|
that.setData({ imgdisabled: false })
|
} else {
|
that.setData({ imgdisabled: true })
|
}
|
var disabled = app.judgeDisable(status);
|
that.setData({
|
countryPay: res.data.data.countryPay,
|
icon1: res.data.data.icon1,
|
icon2: res.data.data.icon2,
|
id: res.data.data.countryPay.id,
|
evalList,
|
showTime: app.formatDate(res.data.data.countryPay.createTime),
|
disabled,
|
status,
|
auditOpinion: res.data.data.auditOpinion || ''
|
})
|
} else {
|
wx.showModal({
|
title: '提示',
|
content: "请求失败!"
|
})
|
}
|
}
|
})
|
},
|
|
inputChange: function(e) {
|
var name = e.currentTarget.dataset.name;
|
this.setData({
|
countryPay: {
|
...this.data.countryPay,
|
[name]: e.detail.value
|
}
|
})
|
},
|
|
submit: function(e) {
|
var openId = wx.getStorageSync("openId");
|
var status = e.currentTarget.dataset.type;
|
var userinfo = wx.getStorageSync("user");
|
var countryPay = this.data.countryPay;
|
countryPay.createId = userinfo.id;
|
countryPay.status = status;
|
var title = '';
|
if (status == 1) {
|
if (!this.data.icon1) {
|
return app.showModal("请填写赔偿请求人信息!");
|
}
|
if (!countryPay.content) {
|
return app.showModal("请填写国家赔偿内容!");
|
}
|
const {
|
evalList1009,
|
evalList1010,
|
evalList1011
|
} = this.data.evalList;
|
if (evalList1009.length == 0) {
|
return app.showModal("请上传刑事赔偿申请书!");
|
}
|
if (evalList1010.length == 0) {
|
return app.showModal("请上传原案强制措施的法律文书!");
|
}
|
if (evalList1011.length == 0) {
|
return app.showModal("请上传原案处理情况的法律文书!");
|
}
|
}
|
var that = this;
|
wx.request({
|
url: app.globalData.url + '/api/countryPay/save',
|
data: countryPay,
|
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: 3000
|
})
|
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)
|
},
|
|
|
})
|