xujing před 5 roky
rodič
revize
5844cef521

+ 2
- 0
src/app.js Zobrazit soubor

@@ -315,6 +315,8 @@ class App extends Component {
315 315
           Taro.removeStorageSync('activityPageIndex')
316 316
           Taro.removeStorageSync('newsPageIndex')
317 317
           Taro.removeStorageSync('buildingPageIndex')
318
+          Taro.removeStorageSync('followPageIndex')
319
+          Taro.removeStorageSync('clinchPageIndex')
318 320
 
319 321
           // 获取未读消息
320 322
           const { person: { personId } } = res

+ 25
- 10
src/useless/pages/person/customerAnalysis/followUpCustomer/index.js Zobrazit soubor

@@ -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
     })

+ 17
- 8
src/useless/pages/person/customerAnalysis/transactionCustomer/index.js Zobrazit soubor

@@ -29,24 +29,33 @@ export default class transactionCustomer extends Taro.Component {
29 29
 
30 30
   componentDidShow() {
31 31
     Taro.showLoading()
32
-    this.loadList(1)
33
-
32
+    const pageSize = (Taro.getStorageSync('clinchPageIndex') || 1) * 10
33
+    this.loadList(1, pageSize)
34 34
   }
35
-  loadList(pageNumber) {
35
+  componentDidHide() {
36
+    const { pageIndex } = this.state;
37
+    Taro.setStorageSync('clinchPageIndex', pageIndex)
38
+  }
39
+
40
+  loadList(page = 0, pageSize = 10) {
41
+    const currentPage = page || this.state.pageIndex
36 42
     const payload = {
37 43
       type: 'clinch',
38
-      pageNumber,
39
-      pageSize: 9999
44
+      pageSize,
45
+      pageNumber: currentPage,
40 46
     }
41 47
     queryCustomerList(payload.type, payload).then(res => {
42
-      const { records, list, total, current, pages } = res || {}
48
+      const { records, list, total, current, pages, size } = res || {}
43 49
       const _list = records || list || []
44 50
       const newList = current <= 1 ? _list : this.state.customerList.concat(_list)
51
+      const pageNum = Math.max(Taro.getStorageSync('clinchPageIndex'), current)
45 52
       this.setState({
46 53
         customerList: newList,
47 54
         isEmpty: total == 0,
48
-        hasMore: current < pages,
49
-        pageIndex: current >= pages ? pages : current
55
+        hasMore: current * size < total,
56
+        pageIndex: pageNum,
57
+        // hasMore: current < pages,
58
+        // pageIndex: current >= pages ? pages : current
50 59
       })
51 60
       Taro.hideLoading()
52 61
     })