|
@@ -8,23 +8,27 @@ import Layout from '../../layout/index'
|
8
|
8
|
import request from '../../util/request'
|
9
|
9
|
import getQueryValue from '../../util/getQueryValue'
|
10
|
10
|
import NoData from '@/compents/NoData'
|
11
|
|
-
|
|
11
|
+import InifiniteList from '@/compents/InifiniteList'
|
12
|
12
|
|
13
|
13
|
const account = (props) => {
|
14
|
14
|
|
15
|
15
|
const { id } = getQueryValue()
|
16
|
16
|
const [list, setList] = useState([])
|
17
|
|
-
|
|
17
|
+ const [page, setPage] = useState({ total: 0, pageNum: 0 })
|
18
|
18
|
|
19
|
19
|
useDidShow(() => {
|
20
|
20
|
console.log('useDidShow')
|
21
|
21
|
getShopKepperList({ pageNum: 1, pageSize:10 })
|
22
|
22
|
})
|
23
|
23
|
|
24
|
|
- function getShopKepperList() {
|
25
|
|
- request({ url: '/taShopKeeper',params:{shopId:id}, method: 'get', }).then((res)=>{
|
|
24
|
+ function getShopKepperList(params) {
|
|
25
|
+ request({ url: '/taShopKeeper',params:{shopId:id,...params}, method: 'get', }).then((res)=>{
|
26
|
26
|
const { records, ...page} = res.data.data
|
27
|
|
- setList(records)
|
|
27
|
+ setList(list.concat(records || []))
|
|
28
|
+ setPage({
|
|
29
|
+ ...page,
|
|
30
|
+ pageNum: page.current
|
|
31
|
+ })
|
28
|
32
|
})
|
29
|
33
|
}
|
30
|
34
|
|
|
@@ -38,7 +42,7 @@ const account = (props) => {
|
38
|
42
|
if (res.confirm) {
|
39
|
43
|
console.log('用户点击确定')
|
40
|
44
|
request({ url: `/taShopKeeper/${keeperId}`, method: 'delete', }).then((res)=>{
|
41
|
|
- getShopKepperList({ pageNum: 1, pageSize:10 })
|
|
45
|
+ setList(list.filter((x)=>x.keeperId!=keeperId))
|
42
|
46
|
})
|
43
|
47
|
|
44
|
48
|
} else if (res.cancel) {
|
|
@@ -49,28 +53,40 @@ const account = (props) => {
|
49
|
53
|
}
|
50
|
54
|
|
51
|
55
|
|
|
56
|
+ const loadMore = () => {
|
|
57
|
+ getShopKepperList({ pageNum: page.pageNum + 1 })
|
|
58
|
+ }
|
52
|
59
|
|
|
60
|
+ const renderItem = (index, key) => (
|
|
61
|
+ <View className='account-view' key={key}>
|
|
62
|
+ {/* <Text className='account-view-title'>房源编号:<Text style={{fontSize:"1rem"}}>{item.keeperId}</Text></Text> */}
|
|
63
|
+ <ContainerLayout className='account-view-card'>
|
|
64
|
+ <View className='top' >
|
|
65
|
+ <View>姓名:{list[index].name}</View>
|
|
66
|
+ <View>电话:{list[index].phone}</View>
|
|
67
|
+ {/* <View>微信号:{x.user.name}</View>
|
|
68
|
+ <View>房源数:{x.user.name}</View> */}
|
|
69
|
+ </View>
|
|
70
|
+ <View className='bottom'>
|
|
71
|
+ <Text onClick={() => { Taro.navigateTo({ url: `/pages/account/edit/index?keeperId=${list[index].keeperId}` }) }}>编辑</Text>
|
|
72
|
+ <Text onClick={()=>onDelete(list[index].keeperId)}>删除</Text>
|
|
73
|
+ </View>
|
|
74
|
+ </ContainerLayout>
|
|
75
|
+ </View>
|
|
76
|
+ )
|
53
|
77
|
|
54
|
78
|
return <View className='account'>
|
55
|
79
|
<Layout>
|
56
|
80
|
<NoData nodata={!list.length} tips="暂无老板" style={{minHeight: '200px'}}>
|
57
|
|
- {list.map((item, index) => {
|
58
|
|
- return <View className='account-view' key={index}>
|
59
|
|
- {/* <Text className='account-view-title'>房源编号:<Text style={{fontSize:"1rem"}}>{item.keeperId}</Text></Text> */}
|
60
|
|
- <ContainerLayout className='account-view-card'>
|
61
|
|
- <View className='top' >
|
62
|
|
- <View>姓名:{item.name}</View>
|
63
|
|
- <View>电话:{item.phone}</View>
|
64
|
|
- {/* <View>微信号:{x.user.name}</View>
|
65
|
|
- <View>房源数:{x.user.name}</View> */}
|
66
|
|
- </View>
|
67
|
|
- <View className='bottom'>
|
68
|
|
- <Text onClick={() => { Taro.navigateTo({ url: `/pages/account/edit/index?keeperId=${item.keeperId}` }) }}>编辑</Text>
|
69
|
|
- <Text onClick={()=>onDelete(item.keeperId)}>删除</Text>
|
70
|
|
- </View>
|
71
|
|
- </ContainerLayout>
|
72
|
|
- </View>
|
73
|
|
- })}
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+ <InifiniteList
|
|
84
|
+ length={list.length}
|
|
85
|
+ total={page.total}
|
|
86
|
+ height={600}
|
|
87
|
+ itemRenderer={renderItem}
|
|
88
|
+ loadMore={loadMore}
|
|
89
|
+ />
|
74
|
90
|
</NoData>
|
75
|
91
|
</Layout>
|
76
|
92
|
{/* onClick={(e)=>(e) */}
|