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
// pages/assistMediate/index.js
const $$ = require('../../utils/util');
 
function searchCaseApi(submitData) {
    return $$.request({ url: 'paCaseInfo/pageAssistCase', type: 'get', service: 'mediate', submitData });
}
 
Page({
    /**
     * 页面的初始数据
     */
    caseId: '',
    data: {
        img: `${$$.url.img}assist-bg.png`,
        searchValue: '',
        isSeach: false, // 是否搜索
        caseData: {}, // 案件数据
    },
 
    // 搜索邀请码
    handleSearch(e) {
        this.setData({ searchValue: e.detail || '' });
        if (!!e.detail) {
            this.searchCase(e.detail);
        } else {
            this.setData({ isSeach: false });
        }
    },
 
    // 扫描二维码
    handleScan() {
        let that = this;
        wx.scanCode({
            success(res) {
                let caseId = $$.getQueryString(res.result, 'applyId');
                that.caseId = caseId;
                that.searchCase(caseId);
            },
        });
    },
 
    // 查询案件
    async searchCase(submitData, type) {
        $$.showLoading();
        const res = await searchCaseApi({ id: submitData, page: 1, size: 10 });
        $$.hideLoading();
        if (res.type) {
            this.setData({ isSeach: true, caseData: res.data.content[0] || {} });
        }
        if (type === 'onPullDownRefresh') {
            $$.showToast({ title: '已是最新记录', duration: 1000 });
            wx.stopPullDownRefresh();
        }
    },
 
    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh() {
        if (this.data.isSeach) {
            this.searchCase(this.caseId, 'onPullDownRefresh');
        }
    },
});