|
@@ -1,5 +1,6 @@
|
1
|
1
|
import Taro, { Component } from '@tarojs/taro';
|
2
|
2
|
import Authorize from '@components/authorize'
|
|
3
|
+import ListView from '@components/ListView'
|
3
|
4
|
import './index.scss'
|
4
|
5
|
import { savePoint, updatePoint } from '@services/common'
|
5
|
6
|
import { connect } from '@tarojs/redux'
|
|
@@ -17,6 +18,9 @@ export default class transactionCustomer extends Taro.Component {
|
17
|
18
|
state = {
|
18
|
19
|
recordId: undefined, // 埋点ID
|
19
|
20
|
customerList: [],
|
|
21
|
+ hasMore: true,
|
|
22
|
+ isEmpty: false,
|
|
23
|
+ pageIndex: 1
|
20
|
24
|
}
|
21
|
25
|
|
22
|
26
|
componentWillUnmount() {
|
|
@@ -36,40 +40,70 @@ export default class transactionCustomer extends Taro.Component {
|
36
|
40
|
}
|
37
|
41
|
queryCustomerList(payload.type, payload).then(res => {
|
38
|
42
|
this.setState({
|
39
|
|
- customerList: res.records || []
|
|
43
|
+ customerList: res.records || [],
|
|
44
|
+ isEmpty: res.total == 0,
|
|
45
|
+ hasMore: res.current < res.page,
|
|
46
|
+ pageIndex: res.current >= res.pages ? res.pages : res.current
|
40
|
47
|
})
|
41
|
48
|
Taro.hideLoading()
|
42
|
49
|
})
|
43
|
50
|
}
|
|
51
|
+ onScrollToLower = async (fn) => {
|
|
52
|
+ const { pageIndex } = this.state;
|
|
53
|
+ this.loadList(pageIndex + 1)
|
|
54
|
+ fn && fn();
|
|
55
|
+ }
|
|
56
|
+ onPullDownRefresh = (rest) => {
|
|
57
|
+ // debugger
|
|
58
|
+ if (this.refreshing) return
|
|
59
|
+ this.refreshing = true
|
|
60
|
+ this.loadList(1)
|
|
61
|
+ rest && rest()
|
|
62
|
+ this.refreshing = false
|
|
63
|
+ }
|
44
|
64
|
|
45
|
65
|
render() {
|
46
|
|
- const { customerList } = this.state
|
|
66
|
+ const { customerList, isEmpty, hasMore } = this.state
|
47
|
67
|
|
48
|
68
|
return (
|
49
|
69
|
<View style="padding:10px">
|
50
|
|
- {
|
51
|
|
- !customerList.length &&
|
52
|
|
- <View style="margin:50px auto;text-align:center;font-size:14px;color:#888">暂无跟进客户~</View>
|
53
|
|
- }
|
54
|
|
- {
|
55
|
|
- customerList.length &&
|
56
|
|
- customerList.map(item => (
|
57
|
|
- <View class="item">
|
58
|
|
- <Image src={item.picture || require('@assets/default-avatar.png')} className='img'></Image>
|
59
|
|
- <View className="name">
|
60
|
|
- {item.name}
|
61
|
|
- {
|
62
|
|
- item.sex == '1' && <View style={`margin-left:10px;background-image: url(${iconImg});background-size: 100%;background-position: 0px -20px;width: 18px;height: 18px;`}></View>
|
63
|
|
- }
|
64
|
|
- {
|
65
|
|
- item.sex == '2' && <View style={`margin-left:10px;background-image: url(${iconImg});background-size: 100%;background-position: 0px 0px;width: 18px;height: 18px;`}></View>
|
66
|
|
- }
|
67
|
|
- </View>
|
68
|
|
- <View className="phone">{item.phone} </View>
|
69
|
|
- <View style={`background-image: url(${iconImg});background-size: 100%;background-position: 0px -44px;width: 22px;height: 22px;`}></View>
|
70
|
|
- </View>
|
71
|
|
- ))
|
72
|
|
- }
|
|
70
|
+ <ListView
|
|
71
|
+ className="wrap"
|
|
72
|
+ needInit
|
|
73
|
+ isEmpty={isEmpty}
|
|
74
|
+ emptyText="暂无成交客户~"
|
|
75
|
+ hasMore={hasMore}
|
|
76
|
+ onPullDownRefresh={fn => this.onPullDownRefresh(fn)}
|
|
77
|
+ onScrollToLower={fn => this.onScrollToLower(fn)}
|
|
78
|
+ >
|
|
79
|
+ <View className="list">
|
|
80
|
+ {
|
|
81
|
+ !customerList.length &&
|
|
82
|
+ <View></View>
|
|
83
|
+ // <View style="margin:50px auto;text-align:center;font-size:14px;color:#888">暂无成交客户~</View>
|
|
84
|
+ }
|
|
85
|
+ {
|
|
86
|
+ customerList.length &&
|
|
87
|
+ customerList.map(item => (
|
|
88
|
+ <View class="item">
|
|
89
|
+ <Image src={item.picture || require('@assets/default-avatar.png')} className='img'></Image>
|
|
90
|
+ <View className="name">
|
|
91
|
+ {item.name}
|
|
92
|
+ {
|
|
93
|
+ item.sex == '1' && <View style={`margin-left:10px;background-image: url(${iconImg});background-size: 100%;background-position: 0px -20px;width: 18px;height: 18px;`}></View>
|
|
94
|
+ }
|
|
95
|
+ {
|
|
96
|
+ item.sex == '2' && <View style={`margin-left:10px;background-image: url(${iconImg});background-size: 100%;background-position: 0px 0px;width: 18px;height: 18px;`}></View>
|
|
97
|
+ }
|
|
98
|
+ </View>
|
|
99
|
+ <View className="phone">{item.phone} </View>
|
|
100
|
+ <View style={`background-image: url(${iconImg});background-size: 100%;background-position: 0px -44px;width: 22px;height: 22px;`}></View>
|
|
101
|
+ </View>
|
|
102
|
+ ))
|
|
103
|
+ }
|
|
104
|
+ </View>
|
|
105
|
+ </ListView>
|
|
106
|
+
|
73
|
107
|
|
74
|
108
|
</View>
|
75
|
109
|
)
|