xusd
7 days ago 998218675eb243d43912c203174a6b72b299c0f8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
// 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);
    },
});