|
@@ -44,25 +44,35 @@ export default class followUpCustomer extends Taro.Component {
|
44
|
44
|
}
|
45
|
45
|
componentDidShow() {
|
46
|
46
|
Taro.showLoading()
|
47
|
|
- this.loadList(1)
|
|
47
|
+ const pageSize = (Taro.getStorageSync('followPageIndex') || 1) * 10
|
|
48
|
+ this.loadList(1, pageSize)
|
48
|
49
|
|
49
|
50
|
}
|
|
51
|
+ componentDidHide() {
|
|
52
|
+ const { pageIndex } = this.state;
|
|
53
|
+ Taro.setStorageSync('followPageIndex', pageIndex)
|
|
54
|
+ }
|
50
|
55
|
|
51
|
|
- loadList(pageNumber) {
|
|
56
|
+ loadList(page = 0, pageSize = 10) {
|
|
57
|
+ const currentPage = page || this.state.pageIndex
|
52
|
58
|
const payload = {
|
53
|
59
|
type: 'follow',
|
54
|
|
- pageNumber,
|
55
|
|
- pageSize: 10
|
|
60
|
+ pageSize,
|
|
61
|
+ pageNumber: currentPage,
|
56
|
62
|
}
|
|
63
|
+
|
57
|
64
|
queryCustomerList(payload.type, payload).then(res => {
|
58
|
|
- const { records, list, total, current, pages } = res || {}
|
|
65
|
+ const { records, list, total, current, pages, size } = res || {}
|
59
|
66
|
const _list = records || list || []
|
60
|
67
|
const newList = current <= 1 ? _list : this.state.customerList.concat(_list)
|
|
68
|
+ const pageNum = Math.max(Taro.getStorageSync('followPageIndex'), current)
|
61
|
69
|
this.setState({
|
62
|
70
|
customerList: newList,
|
63
|
71
|
isEmpty: total == 0,
|
64
|
|
- hasMore: current < pages,
|
65
|
|
- pageIndex: current >= pages ? pages : current
|
|
72
|
+ hasMore: current * size < total,
|
|
73
|
+ pageIndex: pageNum,
|
|
74
|
+ // hasMore: current < pages,
|
|
75
|
+ // pageIndex: current >= pages ? pages : current
|
66
|
76
|
})
|
67
|
77
|
Taro.hideLoading()
|
68
|
78
|
})
|
|
@@ -97,9 +107,10 @@ export default class followUpCustomer extends Taro.Component {
|
97
|
107
|
// 筛查跟进客户
|
98
|
108
|
filterCustomerList() {
|
99
|
109
|
|
|
110
|
+
|
100
|
111
|
const payload = {
|
101
|
112
|
type: 'follow',
|
102
|
|
- pageNumber: 0,
|
|
113
|
+ pageNumber: 1,
|
103
|
114
|
pageSize: 9999,
|
104
|
115
|
name: this.state.inputValue,
|
105
|
116
|
status: (this.state.statusIndex == 0 || this.state.statusIndex == -1) ? '' : this.state.statusIndex,
|
|
@@ -109,9 +120,13 @@ export default class followUpCustomer extends Taro.Component {
|
109
|
120
|
endReportDate: this.state.endReportDate,
|
110
|
121
|
}
|
111
|
122
|
queryCustomerList(payload.type, payload).then(res => {
|
112
|
|
-
|
|
123
|
+ const { records, total, current, pages, size } = res || {}
|
113
|
124
|
this.setState({
|
114
|
|
- customerList: res.records || []
|
|
125
|
+
|
|
126
|
+ customerList: records || [],
|
|
127
|
+ isEmpty: total == 0,
|
|
128
|
+ hasMore: current * size < total,
|
|
129
|
+ pageIndex: pageNum,
|
115
|
130
|
})
|
116
|
131
|
Taro.hideLoading()
|
117
|
132
|
})
|