StoreApply.js
2.27 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
// packageMine/pages/serviceManage/components/StoreApply/StoreApply.js
import { IMG_URL } from '~/utils/constantData'
import mineServiceApi from '~/api/mineApi/mineService'
import { getNowMonth } from '~/utils/format'
Component({
/**
* 组件的属性列表
*/
properties: {
// 1-服务中心(园区店) 2-客户(4s店)
merchantType: {
type: Number,
value: 1
}
},
/**
* 组件的初始数据
*/
data: {
IMG_URL,
bgUrl: `${IMG_URL}/personal/empty_tran.png`,
serviceList: [],
total: -1,
pageCof: {
currentPage: 1,
pageSize: 10
},
isAsk: false,
reviewStatusObj: {
1: {
label: '审核中',
color: '#3666FE'
},
2: {
label: '已通过',
color: '#21AB60'
},
3: {
label: '已驳回',
color: '#F36261'
}
}
},
lifetimes: {
attached() {
this.handleSearch()
}
},
/**
* 组件的方法列表
*/
methods: {
handleSearch() {
this.setData({
['pageCof.currentPage']: 1,
total: -1
})
this.getList(true)
},
scrollonReachBottom() {
this.getList()
},
getList(isReset = false) {
let { serviceList, pageCof, total, isAsk, merchantType } = this.data
let _this = this
if (total == serviceList.length || isAsk) {
return true
}
let params = {
...pageCof,
merchantType: merchantType
}
this.setData({
isAsk: true
})
mineServiceApi.getReviewList(params).then(res => {
let { list, total } = res.data
const dateFormat = merchantType == 1 ? 'yyyy-MM-dd hh:mm:ss' : 'yyyy-MM-dd'
list.forEach(item => {
item.createdDate = item.createdDate ? new Date(item.createdDate).format(dateFormat).replace(/-/g, '.') : ''
})
this.setData({
serviceList: pageCof.currentPage == 1 ? (list || []) : serviceList.concat(list),
['pageCof.currentPage']: pageCof.currentPage + 1,
triggered: false,
total
})
if (isReset) {
this.setData({
scrollTop: 0
})
}
}).finally(function () {
_this.setData({
isAsk: false
})
})
},
}
})