index.js
12.2 KB
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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
import { commonApi } from '~/api/api'
import ActivityApi from '~/api/activityApi/index'
Page({
data: {
status: 1,
reporterInfo: [
{
label: '报案人',
value: '',
name: 'reporterName',
},
{
label: '报案人电话',
value: '',
name: 'reporterPhone'
},
{
label: '报案时间',
value: '',
name: 'reimbursementDate'
},
{
label: '出险时间',
value: '',
name: 'reporterDate'
},
{
label: '出险地点',
value: '',
name: 'reimbursementAddr'
},
],
imageInfo: {
idCard: [],//身份证
drivingLicense: '',//行驶证
accident: '',//事故责任认定书或相关凭证
vin: '',//车架号VIN照片
carAndPeople: '',//45°车头角度全车照片及人车合照
vehicleDamage: [],// 车辆受损细节照片 (可多张)
InsuranceLossStatement: '',//保险定损单
},
// 开票信息
invoiceInfo: [
{
label: '名称',
value: '国任财产保险股份有限公司深圳分公司'
},
{
label: '纳税识别号',
value: '914403005503071468'
},
{
label: '公司地址',
value: '深圳市罗湖区笋岗街道田心社区梨园路333-1号招商中环1栋2402-06A、415'
},
{
label: '联系电话',
value: '0755-88379089'
},
{
label: '开户行',
value: '中国建设银行股份有限公司深圳笋岗支行'
},
{
label: '银行账号',
value: '44201618500052507158'
},
],
mailInfo: [
{
label: '收件人',
value: '权益服务部'
}, {
label: '联系电话',
value: '18938907441'
}, {
label: '收件地址',
value: '广东省深圳市南山区留仙大道3370号南山智园崇文园1号楼14楼'
},
],
uploadInfo: {
repiare: [],
invoice: []
},
showInvoiceInfo: false,
reason: {
1: '拒赔',
2: '资料不清晰'
},
total:0
},
onLoad(options) {
},
onRoute(options) {
const { status } = options
this.setData({
status
})
this.equityAndClaimsDetail(options.id)
},
// 展开发票
showInvoice() {
this.setData({
showInvoiceInfo: !this.data.showInvoiceInfo
})
},
// 图片上传
toUploadImg(e) {
const { name, code } = e.currentTarget.dataset
let _this = this
wx.chooseImage({
count: 1
}).then(res => {
console.log(res)
let [tempFiles] = res.tempFilePaths
let imgType = tempFiles.split('.')[1]
let type = imgType == 'unknown' ? 'jpg' : imgType
wx.getFileSystemManager().readFile({
filePath: tempFiles, //选择图片返回的相对路径
encoding: 'base64', //编码格式
success(_res) {
wx.$api.showLoading('上传中...')
commonApi
.uploadImg({
file: `${type}@${_res.data}`
})
.then(img => {
wx.$api.hideLoading()
let { uploadInfo, status, imageInfo } = _this.data
if (status == 17) {
uploadInfo[name].push({
fileCode: code,
fileUrl: img,
fileType: 'image',
fileName: img.split('/').pop(),
mark:name
})
_this.setData({
uploadInfo
})
} else {
if (name === 'imageInfo.vehicleDamage') {
imageInfo.vehicleDamage.push(img)
_this.setData({
imageInfo
})
} else {
_this.setData({
[name]: img
})
}
}
})
}
})
})
},
// 图片预览
previewImage(e) {
let params = e.currentTarget.dataset
wx.$api.previewImage(params)
},
// 图片删除
delCurrentImg(e) {
const { name, index } = e.currentTarget.dataset
let { uploadInfo, imageInfo, status } = this.data
if (status == 17) {
uploadInfo[name].splice(index, 1)
this.setData({
uploadInfo
})
} else {
if (name === 'imageInfo.vehicleDamage') {
imageInfo.vehicleDamage.splice(index, 1)
this.setData({
imageInfo
})
} else {
this.setData({
[name]: ''
})
}
}
},
/* 上传发票 */
uploadInvoice() {
const { uploadInfo: { repiare,
invoice }, detail: { contractNo, id } } = this.data,
fileList = [...repiare, ...invoice]
ActivityApi.uploadInvoice({ id, fileList, contractNo, operation: 6 }).then(res => {
wx.$api.showToast('上传成功')
wx.navigateBack({
delta: 1
});
})
},
equityAndClaimsDetail(id) {
ActivityApi.equityAndClaimsDetail({ id, needDetail: true }).then(res => {
const file = res.files || [], imageInfo = { idCard: [], vehicleDamage: [] };
for (let i = 0; i < file.length; i++) {
if (file[i].mark == 'idCard') {
imageInfo[file[i].mark].push(file[i].fileUrl)
} else if (file[i].mark == 'vehicleDamage') {
imageInfo[file[i].mark].push(file[i].fileUrl)
} else {
imageInfo[file[i].mark] = file[i].fileUrl
}
}
if (res.supplementList) {
res.supplementList.forEach(el => {
el.createdDate = new Date(el.createdDate).format('yyyy.MM.dd hh:mm:ss')
})
}
let _total = 0
res.serviceItemsList.forEach(el=>{
_total = el.approveAmount+_total
})
this.setData({
detail: res,
imageInfo,
total:_total
})
})
},
intCaseDesc(e) {
this.caseDesc = e.detail.value
},
/* 再次提交核赔 */
againSumbit() {
const { detail,imageInfo } = this.data
const { equityOrderDetail } = detail
const { vehicle } = equityOrderDetail
let _applyAmounts = {}
let items = []
let _imgs = []
for (let k in imageInfo) {
if (k == 'idCard') {
imageInfo[k].forEach(el => {
let _tm = {
fileCode: 1,
fileUrl: el,
fileType: el.split('.').pop(),
fileName: '',
mark: k
}
_imgs.push(_tm)
})
} else if (k == 'vehicleDamage') {
imageInfo[k].forEach(el => {
let _tm = {
fileCode: 4,
fileUrl: el,
fileType: el.split('.').pop(),
fileName: '',
mark: k
}
_imgs.push(_tm)
})
} else {
let _tm = {
fileCode: 4,
fileUrl: imageInfo[k],
fileType: imageInfo[k].split('.').pop(),
fileName: '',
mark: k
}
_imgs.push(_tm)
}
}
detail.serviceItemsList.forEach(el => {
let _temp = {
serviceItemName: el.serviceItemName,
check: true,
serviceItemCode: el.serviceItemCode,
packageCode: equityOrderDetail.packageCode
}
items.push(_temp)
Object.assign(_applyAmounts, { [el.serviceItemCode]: el.applyAmount })
})
let supplementList = []
detail.supplementList.forEach(el=>{
let _temp = {
content:el.content,
suppType:1,
claimsId:detail.id,
id:el.id
}
supplementList.push(_temp)
})
if (this.caseDesc) {
supplementList.push({
content: this.caseDesc,
suppType: 1,
claimsId: detail.id
})
}
let params = {
operation: 3,
customerType: equityOrderDetail.customerType, // 客户类型
customerName: equityOrderDetail.customerName, // 客户名称
cardNo: equityOrderDetail.cardNo, // 证件号
customerPhone: equityOrderDetail.customerPhone, // 客户手机号
customerAddress: equityOrderDetail.customerAddress, // 客户联系地址
vehicle: {
vin: vehicle.vin,
engineNo: vehicle.engineNo,
licensePlate: vehicle.licensePlate,
billingDate: new Date(vehicle.billingDate).format('yyyy-MM-dd'),
invoicePrice: vehicle.invoicePrice,
vehicleBrandId: vehicle.vehicleBrandId,
vehicleBrandName: vehicle.vehicleBrandName,
vehicleSubBrandId: vehicle.vehicleSubBrandId,
vehicleSubBrandName: vehicle.vehicleSubBrandName,
vehicleSeriesId: vehicle.vehicleSeriesId,
vehicleSeriesName: vehicle.vehicleSeriesName,
vehicleShapeId: vehicle.vehicleShapeId,
vehicleShapeName: vehicle.vehicleShapeName,
},
attributes: equityOrderDetail.attributes,
isOss: 0,
cardType: equityOrderDetail.cardType, //证件类型(1身份证、2统一社会信息代码),
merchantPhone: equityOrderDetail.merchantPhone, //店面联系号码
merchantAddress: equityOrderDetail.merchantAddress, //店面联系地址
reporterName: detail.reporterName,
reporterPhone: detail.reporterPhone,
reportDate: detail.reporterDate,
reimbursementDate: detail.reimbursementDate,
reimbursementProvinceCode: detail.reimbursementProvinceCode,
reimbursementCityCode: detail.reimbursementCityCode,
reimbursementCountiesCode: detail.reimbursementCountiesCode,
reimbursementAddr: detail.reimbursementAddr,
handlerName: detail.handlerName,
handlerPhone: detail.handlerPhone,
fileList: _imgs,
itemsList: detail.serviceItemsList,
supplementList: supplementList,
applyAmounts: JSON.stringify(_applyAmounts),
id: detail.id,
contractNo: detail.contractNo
}
wx.$api.showLoading('提交中')
ActivityApi.saveOrSumbitClaimsAndEquity(params).then(res => {
wx.hideLoading();
wx.$api.showToast('提交成功')
wx.navigateBack({
delta: 1
});
})
}
})