odc.xiaohui
2023-04-07 f693c859cdaf607c2a146ef89a7a2ce0d9476d1a
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
// index.ts
// 获取应用实例
const managerReportDetail = getApp()
 
Page({
    data: {
        valuereject: '',
        showreject: false,
        arraySex: [
            { sex: '男', id: 1 },
            { sex: '女', id: 0 }
        ],
        sex: '男',
        sexId: 0,
        datae: null,
        idCardMaterials: [], //  身份证
        contractMaterials: [],//  合同
        transactionMaterials: [],//  交易
        elseMaterials: [],//  其他
        reportDetail: {},
        isShow: false,
        causeList: [],
        causeIndex: null,
        images: [],
        array: ["2022/08/19/5040f71639fd44b48228ce0e5c242727.jpeg", "2022/08/19/47bbd7c1d7bd4c07a0b17d671fe47010.jpeg"]
    },
    onChangereject(e) {
        console.log(e);
        this.setData({
            valuereject: e.detail
        })
    },
    deny() {
        this.setData({ showreject: true });
    },
    subreject() {
        console.log('6666666666');
        let parms = {
            id: this.data.reportDetail.id,
            reason: this.data.valuereject
        }
        wx.request(
            {
                url: managerReportDetail.globalData.url + "/report/reject",
                method: "POST",
                data: parms,
                header: { 'token': wx.getStorageSync('token') },
                success: (res) => {
                    console.log(res);
                    wx.reLaunch({
                        url: '../../../manager/index'
                    })
                }
            })
    },
 
    onClose() {
        this.setData({ showreject: false });
    },
 
    // 事件处理函数
    bindViewTap() {
        wx.navigateTo({
            url: '../logs/logs',
        })
    },
    bindPickerChangeSex(e) {
        console.log(e);
 
        this.setData({
            sexId: e.detail.value
        })
        this.setData({
            sex: this.data.arraySex[e.detail.value].sex
        })
    },
    //查看图片
    face() {
        wx.previewMedia({
            sources: [{ url: managerReportDetail.globalData.imageUrl + "/img/" + this.data.reportDetail.pic }]
        })
    },
    //选择案件
    pickCause(e: { detail: { value: string | number; }; }) {
        console.log(e);
        this.setData({
            causeIndex: e.detail.value
        })
        this.data.reportDetail.causeId = this.data.causeList[e.detail.value].id
    },
    cancel() {
        console.log("cancel")
        wx.navigateBack({
        })
    },
    //通过
    pass() {
        if (this.data.reportDetail.causeId == null) {
            wx.showToast({
                title: "请选择关联案件",
                icon: "error"
            })
        } else {
            wx.request(
                {
                    url: managerReportDetail.globalData.url + "/report/audit",
                    method: "POST",
                    data: this.data.reportDetail,
                    header: {
                        'token': wx.getStorageSync('token'),
                        'content-type': 'application/json'
                    }, success: (res) => {
                        console.log(res)
                        wx.reLaunch({
                            url: '../../cause/index'
                        })
                    }
                })
        }
    },
    onChangeTabs(e) {
        console.log(e);
 
    },
    onLoad(e) {
        wx.request(
            {
                url: managerReportDetail.globalData.url + "/cause/getCauseList",
                method: "GET",
                header: { 'token': wx.getStorageSync('token') },
                success: (res) => {
                    this.data.causeList = res.data.data.records
                    this.setData({
                        causeList: res.data.data.records
                    })
                    this.getDataList(e)
                }
            })
    },
    getDataList(e) {
        wx.request(
            {
                url: managerReportDetail.globalData.url + "/report/" + e.id,
                method: "GET",
                header: { 'token': wx.getStorageSync('token') },
                success: (res) => {
                    let detail = res.data.data
                    console.log(this.data.causeList);
                    this.setData({
                        causeIndex: this.data.causeList.findIndex(val => { return val.id == detail.causeId }),
                        reportDetail: detail,
                        sex: detail.sex,
                        contractMaterials: this.materialStringToArray(detail.contractMaterials),
                        idCardMaterials: this.materialStringToArray(detail.idCardMaterials),
                        transactionMaterials: this.materialStringToArray(detail.transactionMaterials),
                        elseMaterials: this.materialStringToArray(detail.elseMaterials)
                    })
                    console.log(this.data.idCardMaterials);
                }
            })
    },
    materialStringToArray(s: string): string[] {
        if (s == '' || s == null) {
            return []
        } else {
            return s.split(',').map(i => managerReportDetail.globalData.imageUrl + "/img/" + i)
        }
    }
})