// pages/mediateDetail/index.js
|
const $$ = require('../../utils/util');
|
|
// 获取案件详情
|
function getCaseDetailApi(submitData, pageType) {
|
if (pageType === '1') {
|
// 调解
|
return $$.request({ url: 'paCaseInfo/getCaseInfo?id=' + submitData, type: 'get', service: 'mediate' });
|
} else {
|
// 司法确认
|
return $$.request({ url: 'paJudicInfo/getJudicInfo?judicId=' + submitData, type: 'get', service: 'mediate' });
|
}
|
}
|
|
Page({
|
/**
|
* 页面的初始数据
|
*/
|
data: {
|
pageType: '1', // '1':我的调解; '2':我的司法确认
|
type: '1', // '1':待受理;'2':待调解(待开始);'3':调解中(进行中);'4':调解结束(已结束);'5':调解-退回;'6':不予受理;'7':异常终止
|
steps: [],
|
stepsActive: 0,
|
caseData: {}, // 案件详情数据
|
},
|
|
// 数据处理
|
setMediateData(caseData, pageType) {
|
let type = '1';
|
if (caseData.process) {
|
if (caseData.process === '5') {
|
type = '5';
|
} else if (caseData.process === '6') {
|
type = '6';
|
} else {
|
type = caseData.process || '1';
|
}
|
}
|
if (pageType === '1') {
|
this.formatTime(caseData);
|
}
|
if (pageType === '2') {
|
this.formatTime(caseData.caseInfo);
|
this.formatTime(caseData.judicInfo);
|
}
|
this.setData({ caseData: caseData, type, stepsActive: ['5', '6', '7'].includes(type) ? 0 : parseInt(type) - 1 });
|
},
|
|
// 格式化时间
|
formatTime(data, pageType) {
|
if (pageType === '1') {
|
let arr = ['applyTime', 'mediStartTime', 'mediEndTime'],
|
arr2 = ['orderStartTime', 'orderEndTime'];
|
data.meetInfo = data.meetInfo || {};
|
arr.forEach((x) => {
|
if (data[x]) {
|
data[x] = $$.timeFormat(data[x]);
|
}
|
});
|
arr2.forEach((x) => {
|
if (data.meetInfo[x]) {
|
data.meetInfo[x] = $$.timeFormat(data.meetInfo[x]);
|
}
|
});
|
} else {
|
let arr = ['orderEndTime', 'orderStartTime'];
|
arr.forEach((x) => {
|
if (data[x]) {
|
data[x] = $$.timeFormat(data[x]);
|
}
|
});
|
}
|
},
|
|
// 获取案件信息
|
getTypeData(data) {
|
wx.setNavigationBarTitle({
|
title: data.pageType === '1' ? '调解详情' : '司法确认详情',
|
});
|
let arr = data.pageType === '1' ? ['待受理', '待调解', '调解中', '调解结束'] : ['待受理', '待开始', '进行中', '已结束'];
|
this.setData({
|
pageType: data.pageType,
|
steps: [
|
{ title: arr[0], icon: '', activeIcon: 'steps-detail-1-active.png' },
|
{ title: arr[1], icon: 'steps-detail-2.png', activeIcon: 'steps-detail-2-active.png' },
|
{ title: arr[2], icon: 'steps-detail-3.png', activeIcon: 'steps-detail-3-active.png' },
|
{ title: arr[3], icon: 'steps-detail-4.png', activeIcon: 'steps-detail-4-active.png' },
|
],
|
stepsActive: parseInt(data.type || 1) - 1,
|
});
|
this.getCaseDetail(data.id, data.pageType);
|
},
|
|
// 获取纠纷案件详情
|
async getCaseDetail(id, pageType) {
|
$$.showLoading();
|
const res = await getCaseDetailApi(id, pageType);
|
$$.hideLoading();
|
if (res.type) {
|
let data = res.data || {};
|
this.setMediateData(data, pageType);
|
}
|
},
|
/**
|
* 生命周期函数--监听页面加载
|
*/
|
onLoad(options) {
|
this.getTypeData(options);
|
},
|
});
|