EquityClaims.js
9.8 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
357
358
359
360
// packageStoreAssistant/components/EquityClaims/EquityClaims.js
import { claimsApi } from '~/api/api'
import NP from 'number-precision'
import Util from '~/utils/util'
Component({
/**
* 组件的属性列表
*/
properties: {
fresh:{
type:Boolean,
observer: function (val) {
if (val) {
this.getTotal()
this.getList(true)
}
}
}
},
/**
* 组件的初始数据
*/
data: {
timeList: [{
type: 1,
name: '近一周',
}, {
type: 2,
name: '近一月',
}, {
type: 3,
name: '近一年',
}],
isSelected: false,
tabList: [
{
name: '全部',
count: 0,
key: 'total',
status: ''
},
{
name: '待处理',
count: 0,
key: 'processed',
status: 0
},
{
name: '待审核',
count: 0,
key: 'reviewed',
status: 1
},
{
name: '已支付',
count: 0,
key: 'paySuccess',
status: 2
},
],
orderList: [],
statusMap:{
32: '待受理',
33: '待定损',
35: '定损不通过',
34: '定损通过',
23: '待核赔',
25: '核赔不通过',
1: '待支付',
3: '已支付',
40: '已失效'
},
statusList: [
{
name: '全部',
val: ''
},
{
name: '待受理',
val: 32
},
{
name: '待定损',
val: 33
},
{
name: '定损通过',
val: 34
},
{
name: '定损不通过',
val: 35
},
{
name: '待核赔',
val: 23
},
{
name: '核赔不通过',
val: 25
},
{
name: '待支付',
val: 1
},
{
name: '已支付',
val: 3
},
{
name: '已失效',
val: 40
}
],
pageParam: {
pageNum: 1,
pageSize: 10,
searchContent: '',
polymericStatus: '',
status: '',
createdStartDate: '',
createdEndDate: '',
type: ''
},
filterObj: {
status: '',
createdStartDate: '',
createdEndDate: '',
type: ''
},
total: 0
},
lifetimes: {
attached() {
}
},
/**
* 组件的方法列表
*/
methods: {
getTotal() {
const {createdStartDate, createdEndDate, status, searchContent } = this.getParams()
claimsApi.getListTotalApi({createdStartDate, createdEndDate, status, searchContent}).then(res => {
if(res) {
let { tabList } = this.data
tabList.forEach(item => {
item.count = res[item.key]
})
this.setData({
tabList
})
}
})
},
selectStatus(e) {
const {row} = e.currentTarget.dataset
this.setData({
'filterObj.status' : row.val
})
},
// 选择上周,上月,上年
selectTimeOptions(e) {
const {type} = e.currentTarget.dataset
this.setData({
'filterObj.type' : type,
'filterObj.createdStartDate' : '',
'filterObj.createdEndDate' : ''
})
},
// 确定筛选弹窗
comfirmOptions() {
let {filterObj, pageParam} = this.data
const { status } = filterObj
if(status == 32 || status==35 || status == 34 || status == 25) {
pageParam.polymericStatus = 0
}else if(status==3){
pageParam.polymericStatus = 2
}else if(status=='' || status == 40){
pageParam.polymericStatus = ''
}else{
pageParam.polymericStatus = 1
}
this.setData({
pageParam: {...pageParam, ...filterObj}
},()=>{
console.log(pageParam, 'pageParam')
this.getTotal()
this.getList(true)
this.cancel()
})
},
getParams(isInit) {
if(isInit) this.data.pageParam.pageNum = 1
let params = Util.deepClone(this.data.pageParam)
if(params.type) {
params.createdStartDate = this.getStartDate(params.type)
params.createdEndDate = new Date().format("yyyy-MM-dd")
}
if(params.createdStartDate) params.createdStartDate = params.createdStartDate + ' 00:00:00'
if(params.createdEndDate) params.createdEndDate = params.createdEndDate + ' 23:59:59'
delete params.type
return params
},
// 获取上周,上月,上年的日期
getStartDate(type) {
const today = new Date();
let dateAgo = new Date(today);
if(type==1) {
dateAgo.setDate(today.getDate() - 7)
}else if(type==2){
dateAgo.setMonth(today.getMonth() - 1);
}else{
dateAgo.setFullYear(today.getFullYear() - 1);
}
return new Date(dateAgo).format("yyyy-MM-dd")
},
getList(isInit) {
// wx.$api.showLoading()
const {
pageParam,
total
} = this.data
let params = this.getParams(isInit)
if(!isInit && total && total<=this.data.orderList.length) return;
return new Promise(resolve => {
claimsApi.getClaimsListApi(params).then(response => {
if(response.code == 21) {
wx.navigateTo({
url: "/pages/Login/Login",
});
return
}
const res = response.data
if(res){
let list = res.list || []
//32待受理 33待定损 35定损不通过 34定损通过 23待核赔 25核赔不通过 1待支付 3已支付
const _statusList1 = [32, 33, 35, 34, 23, 25, 1, 3]
list.forEach(item => {
item.status = this.getStatus(item.status)
item.commitTime = item.commitTime ? new Date(item.commitTime).format("yyyy-MM-dd hh:mm:ss") : '--'
item.paySuccessDate = item.paySuccessDate ? new Date(item.paySuccessDate).format("yyyy-MM-dd hh:mm:ss") : '--'
const _idx = _statusList1.findIndex(ele => ele == item.status)
item.showApvItem = _idx >= 3
item.showResonItem = item.status == 35 || item.status == 25
item.showPayItem = item.status == 3
item.btnName = item.status == 35 || item.status == 25 ? '重新提交' : item.status == 32 || item.status == 34 ? '上传资料' : '查看'
})
let orderList = pageParam.pageNum > 1 ? [...this.data.orderList, ...list] : list
this.setData({
orderList,
total: res.total
})
}
resolve(1)
})
}).finally(end => {
this.setData({
pageParam,
activeTrigger: false
})
wx.$api.hideLoading()
})
},
getStatus(status) {
if(status == 2 || status==21){ //2校验不通过 21待运营经理审核 都算是待核赔
return 23
}else if(status == 22) { //22运营经理审核不通过 都算是核赔不通过
return 25
}else if(status == 4) { //4支付失败 都算是待支付
return 1
}else{
return status
}
},
// 点击搜素
toSearch(e) {
this.getList(true)
this.getTotal()
},
// 搜索框
inputSeachText(e) {
this.setData({
'pageParam.searchContent' : e.detail.value
})
},
// 切换聚合状态tab
changeTab(e){
const { idx, row } = e.currentTarget.dataset
this.setData({
'pageParam.polymericStatus': row.status
},()=>{
this.getList(true)
})
},
// 打开筛选弹窗
toShowFilter() {
let {filterObj, pageParam} = this.data
for(let key in filterObj){
filterObj[key] = pageParam[key]
}
this.setData({
filterObj,
filterVisible: true
})
},
// 关闭筛选弹窗
cancel() {
const {status, createdStartDate, createdEndDate, type} = this.data.pageParam
this.setData({
filterVisible: false,
isSelected: status || createdStartDate || createdEndDate || type
})
},
//时间选择
filtterFn(e) {
console.log(e)
const {type} = e.currentTarget.dataset
const { value } = e.detail
this.setData({
[`filterObj.${type}`]: value,
'filterObj.type': ''
})
},
//重置
resetFilter() {
this.setData({
'filterObj.status' : '',
'filterObj.createdStartDate' : '',
'filterObj.createdEndDate' : '',
'filterObj.type' : '',
})
},
//下拉刷新
activityRefresh(e) {
this.comfirmOptions()
},
//上拉加载
scrollonReachBottom(e) {
const { pageNum } = this.data.pageParam
this.setData({
'pageParam.pageNum' : pageNum+1,
},()=>{
this.getList()
})
},
// 跳转编辑或新增
toClaimsPage(e) {
const { row } = e.currentTarget.dataset
let params = 'status=32'
if(row && row.id){
params = `status=${row.status}&id=${row.id}`
}
wx.navigateTo({
url: `/packageStoreAssistant/packageEquityClaims/pages/addClaims/addClaims?${params}`,
});
},
}
})