lisenzhou 2 år sedan
förälder
incheckning
bc794a289a

+ 4
- 4
project.config.json Visa fil

@@ -95,28 +95,28 @@
95 95
 				{
96 96
 					"id": 5,
97 97
 					"name": "经纪人",
98
-					"pathName": "subpackages/pages/borker/agentRule/index",
98
+					"pathName": "subpackages/pages/broker/agentRule/index",
99 99
 					"query": "",
100 100
 					"scene": null
101 101
 				},
102 102
 				{
103 103
 					"id": 6,
104 104
 					"name": "佣金规则",
105
-					"pathName": "subpackages/pages/borker/agreement/index",
105
+					"pathName": "subpackages/pages/broker/agreement/index",
106 106
 					"query": "",
107 107
 					"scene": null
108 108
 				},
109 109
 				{
110 110
 					"id": 7,
111 111
 					"name": "我的邀请",
112
-					"pathName": "subpackages/pages/borker/invitation/index",
112
+					"pathName": "subpackages/pages/broker/invitation/index",
113 113
 					"query": "",
114 114
 					"scene": null
115 115
 				},
116 116
 				{
117 117
 					"id": 8,
118 118
 					"name": "邀请列表",
119
-					"pathName": "subpackages/pages/borker/invitationlist/index",
119
+					"pathName": "subpackages/pages/broker/invitationlist/index",
120 120
 					"query": "",
121 121
 					"scene": null
122 122
 				}

+ 143
- 97
src/components/BuildingSelect/index.jsx Visa fil

@@ -1,132 +1,178 @@
1
+import Taro from "@tarojs/taro";
2
+import { View, Button, RadioGroup, Label, Radio } from "@tarojs/components";
3
+import { API_GET_AGENT_BUILDINGS, API_ITEMS_LIST } from "@/constants/api";
4
+import { ROLE_CODE } from "@/constants/user";
5
+import { useSelector } from "react-redux";
6
+import { fetch } from "@/utils/request";
1 7
 
2
-import Taro from '@tarojs/taro'
3
-import { View, Button, RadioGroup, Label, Radio } from '@tarojs/components'
4
-import { API_GET_AGENT_BUILDINGS, API_ITEMS_LIST } from '@/constants/api'
5
-import { ROLE_CODE } from '@/constants/user'
6
-import { useSelector } from 'react-redux'
7
-import { fetch } from '@/utils/request'
8
+import { useState, useEffect, useMemo } from "react";
9
+import "./style.css";
8 10
 
9
-import { useState, useEffect, useMemo } from 'react'
10
-import './style.css'
11
-
12
-const wrapAnimate = 'wrap wrapAnimate'
13
-const frameAnimate = 'frame-wrapper'
11
+const wrapAnimate = "wrap wrapAnimate";
12
+const frameAnimate = "frame-wrapper";
14 13
 
15 14
 export default (props) => {
16
-  const { value, onChange, role } = props
15
+  const { value, onChange, role } = props;
17 16
 
18
-  const city = useSelector(state => state.city)
17
+  const city = useSelector((state) => state.city);
19 18
 
20
-  const [dicts, setDicts] = useState([])
21
-  const [visible, setVisible] = useState(false)
22
-  const [loading, setLoading] = useState(false)
19
+  const [dicts, setDicts] = useState([]);
20
+  const [visible, setVisible] = useState(false);
21
+  const [loading, setLoading] = useState(false);
23 22
   // const [val, setVal] = useState({ buildingName: '意向楼盘' })
24 23
   // const [buildingTitle, setBuildingTitle] = useState({ buildingName: '意向楼盘' })
25
-  const [current, setCurrent] = useState({ buildingName: '意向楼盘' })
24
+  const [current, setCurrent] = useState({ buildingName: "意向楼盘" });
26 25
 
27 26
   const buildingProp = useMemo(
28
-    () => (dicts || []).filter(x => x.buildingId === value)[0] || { buildingName: '请选择' },
27
+    () =>
28
+      (dicts || []).filter((x) => x.buildingId === value)[0] || {
29
+        buildingName: "请选择",
30
+      },
29 31
     [value, dicts]
30
-  )
32
+  );
31 33
 
32 34
   useEffect(() => {
33
-    setCurrent(buildingProp)
34
-  }, [buildingProp])
35
+    setCurrent(buildingProp);
36
+  }, [buildingProp]);
35 37
 
36 38
   useEffect(() => {
37
-    setLoading(true)
38
-    if (role !== ROLE_CODE.CUSTOMER && role !== ROLE_CODE.DRIFT && role !== ROLE_CODE.CONSULTANT) {
39
-      fetch({ url: API_GET_AGENT_BUILDINGS }).then((res) => {
40
-        setDicts(res || [])
41
-        setLoading(false)
42
-      }).catch(() => setLoading(false))
39
+    setLoading(true);
40
+
41
+    if (
42
+      role !== ROLE_CODE.CUSTOMER &&
43
+      role !== ROLE_CODE.DRIFT &&
44
+      role !== ROLE_CODE.CONSULTANT &&
45
+      role !== ROLE_CODE.BROKER
46
+    ) {
47
+      fetch({ url: API_GET_AGENT_BUILDINGS })
48
+        .then((res) => {
49
+          setDicts(res || []);
50
+          setLoading(false);
51
+        })
52
+        .catch(() => setLoading(false));
43 53
     } else {
44
-      fetch({ url: API_ITEMS_LIST, payload: { pageNumber: 1, pageSize: 1000, cityId: city.curCity.id } }).then((res) => {
45
-        setDicts(res.records)
46
-        setLoading(false)
47
-      }).catch(() => setLoading(false))
54
+      fetch({
55
+        url: API_ITEMS_LIST,
56
+        payload: {
57
+          pageNumber: 1,
58
+          pageSize: 1000,
59
+          cityId: city.curCity.id,
60
+          isBroker: role === ROLE_CODE.BROKER,
61
+        },
62
+      })
63
+        .then((res) => {
64
+          setDicts(res.records);
65
+          setLoading(false);
66
+        })
67
+        .catch(() => setLoading(false));
48 68
     }
49
-  }, [city.curCity.id, role])
69
+  }, [city.curCity.id, role]);
50 70
 
51 71
   const handleSelect = (e) => {
52
-
53
-    const buildingId = e.detail.value
54
-    const building = dicts.filter(x => x.buildingId === buildingId)[0] || { buildingName: '意向楼盘' }
72
+    const buildingId = e.detail.value;
73
+    const building = dicts.filter((x) => x.buildingId === buildingId)[0] || {
74
+      buildingName: "意向楼盘",
75
+    };
55 76
 
56 77
     // setBuildingTitle(building)
57
-    setCurrent(building)
58
-  }
78
+    setCurrent(building);
79
+  };
59 80
   const handleSubmit = (e) => {
60
-    e.stopPropagation()
61
-    setVisible(false)
81
+    e.stopPropagation();
82
+    setVisible(false);
62 83
 
63
-    onChange(current.buildingId, current)
64
-  }
84
+    onChange(current.buildingId, current);
85
+  };
65 86
 
66 87
   const handleCancel = () => {
67
-    setVisible(false)
68
-    setCurrent(buildingProp)
69
-  }
88
+    setVisible(false);
89
+    setCurrent(buildingProp);
90
+  };
70 91
 
71 92
   return (
72 93
     <view>
73
-      {
74
-        visible ? (
75
-          < >
76
-            <view onClick={handleCancel} className={wrapAnimate}></view>
77
-            <view className={frameAnimate} catchMove>
78
-              <view className='frame'>
79
-                {/* 标题  */}
80
-                <view className='title-wrapper'>
81
-                  <view>{current.buildingName}</view>
82
-                </view>
83
-                {/* 内容 */}
84
-                <view style='overflow-x: hidden;'>
85
-                  <View className='page-section'>
86
-                    <View className='radio-list' >
87
-                      <scroll-view
88
-                        scrollY
89
-                        style={{ height: '40vh', overflow: 'hidden' }}
90
-                        catchMove
91
-                      >
92
-                        {loading && '加载中...'}
93
-                        {
94
-                          !loading && (
95
-                            <RadioGroup className='radio-list__RadioGroup' onChange={handleSelect} onClick={e => e.stopPropagation()}>
96
-                              {dicts.map((item, i) => {
97
-                                return (
98
-                                  <Label catchMove className='radio-list__label' for={`rdo-${i}`} key={i}>
99
-                                    <view className='radio-list__text'>{item.buildingName}</view>
100
-
101
-                                    <Radio id={`rdo-${i}`} catchMove className='radio-list__radio' value={item.buildingId} checked={item.buildingId === current.buildingId}></Radio>
102
-
103
-                                  </Label>
104
-                                )
105
-                              })}
106
-                            </RadioGroup>
107
-                          )
108
-                        }
109
-                      </scroll-view>
110
-                    </View>
94
+      {visible ? (
95
+        <>
96
+          <view onClick={handleCancel} className={wrapAnimate}></view>
97
+          <view className={frameAnimate} catchMove>
98
+            <view className="frame">
99
+              {/* 标题  */}
100
+              <view className="title-wrapper">
101
+                <view>{current.buildingName}</view>
102
+              </view>
103
+              {/* 内容 */}
104
+              <view style="overflow-x: hidden;">
105
+                <View className="page-section">
106
+                  <View className="radio-list">
107
+                    <scroll-view
108
+                      scrollY
109
+                      style={{ height: "40vh", overflow: "hidden" }}
110
+                      catchMove
111
+                    >
112
+                      {loading && "加载中..."}
113
+                      {!loading && (
114
+                        <RadioGroup
115
+                          className="radio-list__RadioGroup"
116
+                          onChange={handleSelect}
117
+                          onClick={(e) => e.stopPropagation()}
118
+                        >
119
+                          {dicts.map((item, i) => {
120
+                            return (
121
+                              <Label
122
+                                catchMove
123
+                                className="radio-list__label"
124
+                                for={`rdo-${i}`}
125
+                                key={i}
126
+                              >
127
+                                <view className="radio-list__text">
128
+                                  {item.buildingName}
129
+                                </view>
130
+
131
+                                <Radio
132
+                                  id={`rdo-${i}`}
133
+                                  catchMove
134
+                                  className="radio-list__radio"
135
+                                  value={item.buildingId}
136
+                                  checked={
137
+                                    item.buildingId === current.buildingId
138
+                                  }
139
+                                ></Radio>
140
+                              </Label>
141
+                            );
142
+                          })}
143
+                        </RadioGroup>
144
+                      )}
145
+                    </scroll-view>
111 146
                   </View>
112
-
113
-                  {/* <view className='bottom-text' onClick={handleTextNext}> */}
114
-                  <view style={{ display: 'flex', margin: '2em auto' }}>
115
-                    <Button className='checkBtn' onClick={handleCancel}  >取消</Button>
116
-                    <Button className='okBtn' disabled={!current.buildingId} onClick={handleSubmit}> 确定</Button>
117
-                  </view>
118
-                  {/* <view className='Btn'>
147
+                </View>
148
+
149
+                {/* <view className='bottom-text' onClick={handleTextNext}> */}
150
+                <view style={{ display: "flex", margin: "2em auto" }}>
151
+                  <Button className="checkBtn" onClick={handleCancel}>
152
+                    取消
153
+                  </Button>
154
+                  <Button
155
+                    className="okBtn"
156
+                    disabled={!current.buildingId}
157
+                    onClick={handleSubmit}
158
+                  >
159
+                    {" "}
160
+                    确定
161
+                  </Button>
162
+                </view>
163
+                {/* <view className='Btn'>
119 164
                     <Button onClick={handleCancel} >取消</Button>
120 165
                     <Button disabled={!val.buildingId} onClick={handleSubmit}>确定</Button>
121 166
                   </view> */}
122
-                </view>
123 167
               </view>
124 168
             </view>
125
-          </>
126
-        ) :
127
-          <View onClick={() => setVisible(true)}>{buildingProp.buildingName}</View>
128
-      }
169
+          </view>
170
+        </>
171
+      ) : (
172
+        <View onClick={() => setVisible(true)}>
173
+          {buildingProp.buildingName}
174
+        </View>
175
+      )}
129 176
     </view>
130
-
131
-  )
132
-}
177
+  );
178
+};

+ 3
- 0
src/constants/broker.js Visa fil

@@ -13,3 +13,6 @@ export const API_BK_BANk_CARD = resolvePath('bkBankCard')
13 13
 
14 14
 //我邀请的经纪人列表
15 15
 export const API_BROKER_LIST = resolvePath('broker')
16
+
17
+//经纪人榜单
18
+export const API_BROKER_RANK = resolvePath('broker/rank')

+ 2
- 2
src/pages/mine/addCustomer/index.jsx Visa fil

@@ -90,7 +90,7 @@ export default withLayout((props) => {
90 90
 
91 91
     setLoading(true)
92 92
     let url = null
93
-    if (personType === ROLE_CODE.CONSULTANT || personType === ROLE_CODE.CUSTOMER) {
93
+    if (personType === ROLE_CODE.CONSULTANT || personType === ROLE_CODE.CUSTOMER || personType === ROLE_CODE.BROKER) {
94 94
       // url = API_REPORT_CUETOMER
95 95
       url = API_USER_ADD_CUSTOMER
96 96
     } else if (personType === ROLE_CODE.CHANNEL_AGENT) {
@@ -122,7 +122,7 @@ export default withLayout((props) => {
122 122
     setBuildingId(bid)
123 123
     // setBuildingId(building.buildingId)
124 124
   }
125
-
125
+console.log(personType === ROLE_CODE.CONSULTANT || ROLE_CODE.CUSTOMER,'===')
126 126
   return (
127 127
     <view className='Page addCustomer'>
128 128
 

+ 3
- 2
src/pages/mine/components/MyCustomerListItem/index.jsx Visa fil

@@ -2,6 +2,7 @@
2 2
 import { Image } from '@tarojs/components'
3 3
 import Taro from '@tarojs/taro'
4 4
 import { BIZ_STATUS } from '@/constants/user'
5
+import { useSelector } from "react-redux";
5 6
 import './index.scss'
6 7
 
7 8
 const addDays = (dt, days) => {
@@ -14,10 +15,10 @@ const addDays = (dt, days) => {
14 15
 
15 16
 export default function MyCustomerListItem(props) {
16 17
   const { data = {} } = props
17
-
18
+  // const person = useSelector((state) => state.user.person);
18 19
   const { expirationDate, customerStatus, createDate } = data
19 20
   const expStr = expirationDate && customerStatus === '1' ? `${addDays(createDate, expirationDate)} 回收` : ''
20
-
21
+// console.log()
21 22
   const gotoDetail = () => {
22 23
     if (data.status - 0 !== 3) {
23 24
       if (!data.customerId) {

+ 1
- 1
src/pages/mine/tabData.js Visa fil

@@ -29,7 +29,7 @@ const MineMenuList = {
29 29
       { name: '我的客户', icon: require('@/assets/mine-icon1.png'), router: '/pages/mine/myCustomer/index' },
30 30
       { name: '我的资料', icon: require('@/assets/mine-icon1.png'), router: '/subpackages/pages/broker/toBeBroker/index' },
31 31
       { name: '我的消息', icon: require('@/assets/mine-icon1.png'), router: '/subpackages/pages/broker/myMessage/index' },
32
-      { name: '我邀请的全民经纪人', icon: require('@/assets/mine-icon1.png'), router: '/pages/mine/addCustomer/index?type=estateAgent' },
32
+      { name: '我邀请的全民经纪人', icon: require('@/assets/mine-icon1.png'), router: '/subpackages/pages/broker/invitationlist/index' },
33 33
     ],
34 34
     [
35 35
 

+ 1
- 1
src/routes.js Visa fil

@@ -447,7 +447,7 @@ const routes = [
447 447
   },
448 448
 
449 449
   {
450
-    name: "经纪人",
450
+    name: "邀请奖励",
451 451
     page: "pages/broker/agentRule/index",
452 452
     pkg: "subpackages",
453 453
     type: "other",

+ 16
- 1
src/services/broker.js Visa fil

@@ -3,7 +3,9 @@ import { fetch } from '@/utils/request'
3 3
 import {
4 4
   API_BK_AGREEMENT,
5 5
   API_BK_BANk_CARD,
6
-  API_BROKER_LIST
6
+  API_BROKER_LIST,
7
+  API_BROKER_RANK,
8
+  API_BK_AGENT_RULE
7 9
 } from '@/constants/broker'
8 10
 
9 11
 
@@ -26,3 +28,16 @@ export const queryBkAgreement = (payload) => fetch({ url: `${API_BK_AGREEMENT}`,
26 28
  * @param {*} 
27 29
  */
28 30
  export const querybrokerList = (payload) => fetch({ url: `${API_BROKER_LIST}`, payload })
31
+
32
+ /**
33
+ * 经纪人排行榜
34
+ * @param {*} 
35
+ */
36
+  export const queryBrokerRank = (payload) => fetch({ url: `${API_BROKER_RANK}`, payload })
37
+
38
+
39
+   /**
40
+ * 经纪人规则
41
+ * @param {*} 
42
+ */
43
+    export const getbkAgentRule = (payload) => fetch({ url: `${API_BK_AGENT_RULE}`, payload })

+ 23
- 10
src/subpackages/pages/broker/agentRule/index.jsx Visa fil

@@ -1,14 +1,27 @@
1
-import withLayout from '@/layout'
2
-import { ScrollView, View, Image, Text, RichText } from '@tarojs/components'
3
-import './index.scss'
1
+import withLayout from "@/layout";
2
+import { ScrollView, View, Image, Text, RichText } from "@tarojs/components";
3
+import { useState, useEffect } from "react";
4
+import { getbkAgentRule } from "@/services/broker";
5
+import "./index.scss";
4 6
 
5
-const defaultRuleImage = 'https://xlk-assets.oss-cn-shanghai.aliyuncs.com/miniapp/broker/%E5%85%A8%E6%B0%91%E7%BB%8F%E7%BA%AA%E4%BA%BA.png'
7
+const defaultRuleImage =
8
+  "https://xlk-assets.oss-cn-shanghai.aliyuncs.com/miniapp/broker/%E5%85%A8%E6%B0%91%E7%BB%8F%E7%BA%AA%E4%BA%BA.png";
6 9
 export default withLayout(() => {
7
-  const value = '<p>一、给钱</p ><p>二、还是给钱</p ><p>三、就问你要不要?<br/></p>';
10
+  const [value, setValue] = useState("");
11
+  useEffect(() => {
12
+    getbkAgentRule().then((res) => {
13
+      setValue(res.content);
14
+    });
15
+  }, []);
16
+
8 17
   return (
9
-    <ScrollView className='Page broker-page' style={{ height: '100vh' }} scrollY>
10
-      <Image mode='heightFix' className='img-set' src={defaultRuleImage} />
11
-      <View className='broker-padding'>
18
+    <ScrollView
19
+      className="Page broker-page"
20
+      style={{ height: "100vh" }}
21
+      scrollY
22
+    >
23
+      <Image mode="heightFix" className="img-set" src={defaultRuleImage} />
24
+      <View className="broker-padding">
12 25
         <View>
13 26
           <Text>邀请奖励说明</Text>
14 27
           <View>
@@ -17,5 +30,5 @@ export default withLayout(() => {
17 30
         </View>
18 31
       </View>
19 32
     </ScrollView>
20
-  )
21
-})
33
+  );
34
+});

+ 24
- 10
src/subpackages/pages/broker/invitationlist/index.jsx Visa fil

@@ -5,7 +5,7 @@ import { View, Image, Text } from "@tarojs/components";
5 5
 import "./index.scss";
6 6
 import { useState, useEffect } from "react";
7 7
 import { querybrokerList } from "@/services/broker";
8
-
8
+import { formatDate } from "@/utils/chatDate";
9 9
 export default withLayout(() => {
10 10
   const [list, setList] = useState([]);
11 11
   const [total, setTotal] = useState(0);
@@ -15,7 +15,7 @@ export default withLayout(() => {
15 15
 
16 16
   const getList = () => {
17 17
     querybrokerList().then((res) => {
18
-      setList([...res.records,...res.records]);
18
+      setList([...res.records, ...res.records]);
19 19
       setTotal(res.total);
20 20
     });
21 21
   };
@@ -30,21 +30,31 @@ export default withLayout(() => {
30 30
     <View className="invitationlist-background">
31 31
       <View>
32 32
         <View className="invitationlist-font">总邀请人数</View>
33
-        <View className="invitationlist-font-right">
33
+        <View
34
+          className="invitationlist-font-right"
35
+          onClick={() => {
36
+            Taro.navigateTo({
37
+              url: "/subpackages/pages/broker/agentRule/index",
38
+            });
39
+          }}
40
+        >
34 41
           <Image className="invitationlist-img" mode="widthFix" src={img1} />
35 42
           邀请奖励
36 43
         </View>
37 44
         <View className="invitationlist-background-2">
38 45
           <View className="invitationlist-font-tl">{total}</View>
39
-          <View className="invitationlist-font-right-t">
46
+          <View
47
+            className="invitationlist-font-right-t"
48
+            onClick={() => {
49
+              Taro.navigateTo({
50
+                url: "/subpackages/pages/broker/rankingList/index",
51
+              });
52
+            }}
53
+          >
40 54
             <Image className="invitationlist-img" mode="widthFix" src={img2} />
41 55
             邀请注册榜
42 56
           </View>
43 57
         </View>
44
-        <View className="invitationlist-view-1">
45
-          更新时间:&nbsp;<View className="invitationlist-view">2022-07-22</View>
46
-          &nbsp;<View className="invitationlist-view">12:00:00</View>
47
-        </View>
48 58
       </View>
49 59
       <View className="invitationlist-view-list">
50 60
         {list.map((item) => {
@@ -58,8 +68,12 @@ export default withLayout(() => {
58 68
               </View>
59 69
               <View className="invitationlist-view-list-ifr">
60 70
                 <Text className="invitationlist-text-1">{item.name}</Text>
61
-                <Text className="invitationlist-text">{item.customerNum||0}</Text>
62
-                <Text className="invitationlist-text">{item.brokerNum||0}</Text>
71
+                <Text className="invitationlist-text">
72
+                  {item.customerNum || 0}
73
+                </Text>
74
+                <Text className="invitationlist-text">
75
+                  {item.brokerNum || 0}
76
+                </Text>
63 77
                 <Text className="invitationlist-time">2022/07/26</Text>
64 78
               </View>
65 79
               <View className="invitationlist-view-list-ifr-t">

+ 146
- 18
src/subpackages/pages/broker/rankingList/components/list/index.jsx Visa fil

@@ -8,12 +8,53 @@ import { fetch, uploadFiles } from "@/utils/request";
8 8
 import { UPDATE_USER_INFO, ROLE_CODE } from "@/constants/user";
9 9
 import { API_EDIT_AGENT, API_UPDATE_PHOTO } from "@/constants/api";
10 10
 import store from "@/store";
11
-
11
+import { isEmpty } from "@/utils/tools";
12 12
 import "@/assets/css/iconfont.css";
13 13
 import "./index.scss";
14 14
 
15 15
 export default withLayout((props) => {
16
-  const { columns, dataSource } = props;
16
+  const { columns, params, getList = () => {} } = props;
17
+
18
+  const [list, setList] = useState([]);
19
+  const [IsPull, setPull] = useState(false);
20
+
21
+  const [pageNumber, setPageNumber] = useState(1);
22
+  const [HasNextPage, setHasNextPage] = useState(true);
23
+
24
+  useEffect(() => {
25
+    if (pageNumber) {
26
+      GetPageList();
27
+    }
28
+  }, [pageNumber]);
29
+
30
+  const GetPageList = () => {
31
+    setHasNextPage(false);
32
+    getList({ ...params, pageNumber, pageSize: 10 }).then((res) => {
33
+      setList(
34
+        pageNumber === 1 ? res.records || [] : list.concat(res.records || [])
35
+      );
36
+      setHasNextPage(res.current < res.pages);
37
+      setPull(false);
38
+    });
39
+  };
40
+
41
+  const PageLoadMore = () => {
42
+    // 页面上拉加载更多
43
+    if (HasNextPage) {
44
+      setPageNumber(pageNumber + 1);
45
+    }
46
+  };
47
+
48
+  useEffect(() => {
49
+    // 下拉刷新触发
50
+    if (IsPull) {
51
+      if (pageNumber === 1) {
52
+        GetPageList();
53
+      } else {
54
+        setPageNumber(1);
55
+      }
56
+    }
57
+  }, [IsPull]);
17 58
 
18 59
   return (
19 60
     <view className="component rankingListList">
@@ -24,22 +65,109 @@ export default withLayout((props) => {
24 65
           </view>
25 66
         ))}
26 67
       </view>
27
-      <view className="list-tbody">
28
-        {dataSource?.map((item, index) => {
29
-          return (
30
-            <view className="list-tbody-row" key={index}>
31
-              {columns?.map((x) => (
32
-                <view
33
-                  key={x.key}
34
-                  style={{ width: x.width, textAlign: "center" }}
35
-                >
36
-                  {(x?.render && x?.render(item)) || item[x.dataIndex] || ""}
37
-                </view>
38
-              ))}
39
-            </view>
40
-          );
41
-        })}
42
-      </view>
68
+      <ScrollView
69
+        scroll-y
70
+        refresher-triggered={IsPull}
71
+        onscrolltolower={PageLoadMore}
72
+        refresher-background="#fff"
73
+      >
74
+        <view className="list-tbody">
75
+          {list?.map((item, index) => {
76
+            return (
77
+              <view className="list-tbody-row" key={index}>
78
+                {columns?.map((x, index) => (
79
+                  <view
80
+                    key={x.key}
81
+                    style={{ width: x.width, textAlign: "center" }}
82
+                  >
83
+                    
84
+                    {(x?.render && x?.render(item,index)) ||
85
+                      (!isEmpty(item[x.dataIndex]) ? item[x.dataIndex] : 0)}
86
+                  </view>
87
+                ))}
88
+              </view>
89
+            );
90
+          })}
91
+        </view>
92
+
93
+        {/* <view className="PageBottom">
94
+          <text>已经到底了~</text>
95
+        </view> */}
96
+      </ScrollView>
43 97
     </view>
44 98
   );
45 99
 });
100
+
101
+// import { useState, useEffect } from 'react'
102
+// import { useSelector } from 'react-redux'
103
+// import { useRouter } from '@tarojs/taro'
104
+// import { ScrollView } from '@tarojs/components'
105
+
106
+// import Item from './Item'
107
+
108
+// import './index.scss'
109
+
110
+// export default function MyCollectForActivity () {
111
+
112
+//  const router=useRouter()
113
+//    const { type,buildingId } = router.params;
114
+
115
+//   const [PageList, setPageList] = useState([{},{},{},{},{},{},{},{},{},{}])
116
+//   const [IsPull, setPull] = useState(false)
117
+
118
+//   const [pageNumber, setPageNumber] = useState(1)
119
+//   const [HasNextPage, setHasNextPage] = useState(true)
120
+
121
+//   useEffect(() => {
122
+//     if(pageNumber) {
123
+//     //   GetPageList()
124
+//     }
125
+//   }, [pageNumber])
126
+
127
+//   const PageRefresh = () => { // 页面下拉刷新回调
128
+//     // setPull(true)
129
+//   }
130
+
131
+//   const GetPageList = () => {
132
+//     setHasNextPage(false)
133
+
134
+//   }
135
+
136
+//   const PageLoadMore = () => { // 页面上拉加载更多
137
+//     if(HasNextPage) {
138
+//       setPageNumber(pageNumber + 1)
139
+//     }
140
+//   }
141
+
142
+//   useEffect(() => { // 下拉刷新触发
143
+//     // if (IsPull) {
144
+//     //   if(pageNumber === 1) {
145
+//     //     GetPageList()
146
+//     //   } else {
147
+//     //     setPageNumber(1)
148
+//     //   }
149
+//     // }
150
+//   }, [IsPull])
151
+
152
+//   return (
153
+//     <view className='components myWalletList'>
154
+//       <ScrollView scroll-y  refresher-triggered={IsPull}  onscrolltolower={PageLoadMore} refresher-background='#fff'>
155
+//         <view className='PageContent'>
156
+//           <view className='List'>
157
+//             {
158
+//               PageList.map((item, index) => (
159
+//                 <Item data={item} key={`myWalletList-${index}`}></Item>
160
+//               ))
161
+//             }
162
+//           </view>
163
+
164
+//           {/* bottom */}
165
+//           <view className='PageBottom'>
166
+//             <text>已经到底了~</text>
167
+//           </view>
168
+//         </view>
169
+
170
+//       </ScrollView>
171
+//     </view>
172
+//   )
173
+// }

+ 0
- 14
src/subpackages/pages/broker/rankingList/index.jsx Visa fil

@@ -24,20 +24,6 @@ export default withLayout(() => {
24 24
           alt=""
25 25
           srcset=""
26 26
         />
27
-        {/* <view className="tabs">
28
-          <view
29
-            className={`tab ${activeKey === 1 ? "active" : ""}`}
30
-            onClick={() => setActiveKey(1)}
31
-          >
32
-            我的佣金
33
-          </view>
34
-          <view
35
-            className={`tab ${activeKey === 2 ? "active" : ""}`}
36
-            onClick={() => setActiveKey(2)}
37
-          >
38
-            我的奖励
39
-          </view>
40
-        </view> */}
41 27
       </view>
42 28
       <view className="content">
43 29
         <view className="tabs">

+ 44
- 33
src/subpackages/pages/broker/rankingList/invitationList/index.jsx Visa fil

@@ -2,11 +2,7 @@ import { useState, useEffect } from "react";
2 2
 import Taro from "@tarojs/taro";
3 3
 import { useSelector } from "react-redux";
4 4
 import withLayout from "@/layout";
5
-import { ScrollView, Input, Image, Block, Textarea } from "@tarojs/components";
6
-import { getImgURL } from "@/utils/image";
7
-import { fetch, uploadFiles } from "@/utils/request";
8
-import { UPDATE_USER_INFO, ROLE_CODE } from "@/constants/user";
9
-import { API_EDIT_AGENT, API_UPDATE_PHOTO } from "@/constants/api";
5
+import { queryBrokerRank } from "@/services/broker";
10 6
 import MyAchievement from "../components/myAchievement";
11 7
 import AchievementList from "../components/list";
12 8
 import store from "@/store";
@@ -15,11 +11,27 @@ import "@/assets/css/iconfont.css";
15 11
 import "./index.scss";
16 12
 
17 13
 export default withLayout(() => {
14
+
15
+
18 16
   const columns = [
19 17
     {
20 18
       title: "排名",
21 19
       width: "30%",
22 20
       dataIndex: "a",
21
+      render: (x, index) => {
22
+        if (index >= 3) {
23
+          return index + 1;
24
+        } else {
25
+          return (
26
+            <image
27
+              className="rank-image"
28
+              src={`${OSS_FAST_PATH}/miniapp/broker/${index + 1}.png`}
29
+              alt=""
30
+              srcset=""
31
+            />
32
+          );
33
+        }
34
+      },
23 35
     },
24 36
     {
25 37
       title: "经纪人",
@@ -27,12 +39,7 @@ export default withLayout(() => {
27 39
       dataIndex: "name",
28 40
       render: (x) => (
29 41
         <view>
30
-          <image
31
-            className="list-image"
32
-            src={`${OSS_FAST_PATH}/miniapp/broker/消息.png`}
33
-            alt=""
34
-            srcset=""
35
-          />
42
+          <image className="list-image" src={x.avatarurl} alt="" srcset="" />
36 43
           {x.name}
37 44
         </view>
38 45
       ),
@@ -40,30 +47,30 @@ export default withLayout(() => {
40 47
     {
41 48
       title: "邀请人(个)",
42 49
       width: "40%",
43
-      dataIndex: "number",
50
+      dataIndex: "brokerNum",
44 51
     },
45 52
   ];
46 53
 
47
-  const list = [
48
-    {
49
-      a: 1,
50
-      name: "张三",
51
-      number: 4433,
52
-      key: 1,
53
-    },
54
-    {
55
-      a: 2,
56
-      name: "李四",
57
-      number: 4433,
58
-      key: 2,
59
-    },
60
-    {
61
-      a: 3,
62
-      name: "张三",
63
-      number: 4433,
64
-      key: 3,
65
-    },
66
-  ];
54
+  // const list = [
55
+  //   {
56
+  //     a: 1,
57
+  //     name: "张三",
58
+  //     number: 4433,
59
+  //     key: 1,
60
+  //   },
61
+  //   {
62
+  //     a: 2,
63
+  //     name: "李四",
64
+  //     number: 4433,
65
+  //     key: 2,
66
+  //   },
67
+  //   {
68
+  //     a: 3,
69
+  //     name: "张三",
70
+  //     number: 4433,
71
+  //     key: 3,
72
+  //   },
73
+  // ];
67 74
 
68 75
   return (
69 76
     <view className="invitationList">
@@ -76,7 +83,11 @@ export default withLayout(() => {
76 83
           key: 3,
77 84
         }}
78 85
       />
79
-      <AchievementList columns={columns} dataSource={list} />
86
+      <AchievementList
87
+        columns={columns}
88
+        params={{ rankType: "person" }}
89
+        getList={queryBrokerRank}
90
+      />
80 91
     </view>
81 92
   );
82 93
 });

+ 7
- 0
src/subpackages/pages/broker/rankingList/invitationList/index.scss Visa fil

@@ -12,4 +12,11 @@
12 12
     vertical-align: middle;
13 13
     margin-right: 14px;
14 14
   }
15
+  .rank-image {
16
+    width: 60px;
17
+    height:60px;
18
+
19
+    vertical-align: middle;
20
+    margin-right: 14px;
21
+  }
15 22
 }

+ 44
- 28
src/subpackages/pages/broker/rankingList/transactionList/index.jsx Visa fil

@@ -4,9 +4,7 @@ import { useSelector } from "react-redux";
4 4
 import withLayout from "@/layout";
5 5
 import { ScrollView, Input, Image, Block, Textarea } from "@tarojs/components";
6 6
 import { getImgURL } from "@/utils/image";
7
-import { fetch, uploadFiles } from "@/utils/request";
8
-import { UPDATE_USER_INFO, ROLE_CODE } from "@/constants/user";
9
-import { API_EDIT_AGENT, API_UPDATE_PHOTO } from "@/constants/api";
7
+import { queryBrokerRank } from "@/services/broker";
10 8
 import MyAchievement from "../components/myAchievement";
11 9
 import AchievementList from "../components/list";
12 10
 import store from "@/store";
@@ -20,10 +18,24 @@ export default withLayout(() => {
20 18
       title: "排名",
21 19
       width: "15%",
22 20
       dataIndex: "a",
21
+      render: (x, index) => {
22
+        if (index >= 3) {
23
+          return index + 1;
24
+        } else {
25
+          return (
26
+            <image
27
+              className="rank-image"
28
+              src={`${OSS_FAST_PATH}/miniapp/broker/${index + 1}.png`}
29
+              alt=""
30
+              srcset=""
31
+            />
32
+          );
33
+        }
34
+      },
23 35
     },
24 36
     {
25 37
       title: "姓名",
26
-      width: "20%",
38
+      width: "30%",
27 39
       dataIndex: "name",
28 40
       render: (x) => (
29 41
         <view>
@@ -39,36 +51,36 @@ export default withLayout(() => {
39 51
     },
40 52
     {
41 53
       title: "数量(组)",
42
-      width: "35%",
43
-      dataIndex: "number",
54
+      width: "25%",
55
+      dataIndex: "customerNum",
44 56
     },
45 57
     {
46 58
       title: "佣金(元)",
47 59
       width: "30%",
48
-      dataIndex: "money",
60
+      dataIndex: "totalCommission",
49 61
     },
50 62
   ];
51 63
 
52
-  const list = [
53
-    {
54
-      a: 1,
55
-      name: "张三",
56
-      number: 4433,
57
-      key: 1,
58
-    },
59
-    {
60
-      a: 2,
61
-      name: "李四",
62
-      number: 4433,
63
-      key: 2,
64
-    },
65
-    {
66
-      a: 3,
67
-      name: "张三",
68
-      number: 4433,
69
-      key: 3,
70
-    },
71
-  ];
64
+  // const list = [
65
+  //   {
66
+  //     a: 1,
67
+  //     name: "张三",
68
+  //     number: 4433,
69
+  //     key: 1,
70
+  //   },
71
+  //   {
72
+  //     a: 2,
73
+  //     name: "李四",
74
+  //     number: 4433,
75
+  //     key: 2,
76
+  //   },
77
+  //   {
78
+  //     a: 3,
79
+  //     name: "张三",
80
+  //     number: 4433,
81
+  //     key: 3,
82
+  //   },
83
+  // ];
72 84
 
73 85
   return (
74 86
     <view className="invitationList">
@@ -81,7 +93,11 @@ export default withLayout(() => {
81 93
           key: 3,
82 94
         }}
83 95
       />
84
-      <AchievementList columns={columns} dataSource={list} />
96
+      <AchievementList
97
+        columns={columns}
98
+        params={{ rankType: "money" }}
99
+        getList={queryBrokerRank}
100
+      />
85 101
     </view>
86 102
   );
87 103
 });

+ 129
- 98
src/subpackages/pages/marketing/sureVisit/index.jsx Visa fil

@@ -1,55 +1,59 @@
1
-import React, { useState, useEffect } from 'react'
2
-import Taro from '@tarojs/taro'
3
-import withLayout from '@/layout'
4
-import { ScrollView, Input, Image } from '@tarojs/components'
5
-import Picker from '@/components/Picker'
6
-import { getChannelCustomerDetail } from '@/services/person'
7
-import { getCardList } from '@/services/card'
8
-import { uploadFiles, fetch } from '@/utils/request'
9
-import { API_MARKETING_VISIT } from '@/constants/api'
10
-import { formatDate } from '@/utils/chatDate'
11
-import '@/assets/css/iconfont.css'
12
-import './index.scss'
1
+import React, { useState, useEffect } from "react";
2
+import Taro from "@tarojs/taro";
3
+import withLayout from "@/layout";
4
+import { ScrollView, Input, Image } from "@tarojs/components";
5
+import Picker from "@/components/Picker";
6
+import { getChannelCustomerDetail } from "@/services/person";
7
+import { getCardList } from "@/services/card";
8
+import { uploadFiles, fetch } from "@/utils/request";
9
+import { API_MARKETING_VISIT } from "@/constants/api";
10
+import { formatDate } from "@/utils/chatDate";
11
+import "@/assets/css/iconfont.css";
12
+import "./index.scss";
13
+import { ROLE_CODE } from "@/constants/user";
13 14
 
14 15
 export default withLayout((props) => {
15
-  const { router } = props
16
-  const { id } = router.params
17
-
18
-  const [loading, setLoading] = useState(false)
19
-  const [channelCustomer, setChannelCustomer] = useState({})
20
-  const [consultantList, setConsultantList] = useState([])
21
-  const [consultant, setConsultant] = useState()
22
-  const [visitDate, setVisitDate] = useState(formatDate(Date.now(), 'yyyy-MM-dd'))
23
-  const [imageUrl, setImageUrl] = useState()
24
-  const [remark, setRemark] = useState()
25
-  const [channelCustomerId, setChannelCustomerId] = useState(null)
16
+  const { router, person } = props;
17
+  const { id } = router.params;
18
+  console.log(props, "==");
19
+  const [loading, setLoading] = useState(false);
20
+  const [channelCustomer, setChannelCustomer] = useState({});
21
+  const [consultantList, setConsultantList] = useState([]);
22
+  const [consultant, setConsultant] = useState();
23
+  const [visitDate, setVisitDate] = useState(
24
+    formatDate(Date.now(), "yyyy-MM-dd")
25
+  );
26
+  const [imageUrl, setImageUrl] = useState();
27
+  const [remark, setRemark] = useState();
28
+  const [channelCustomerId, setChannelCustomerId] = useState(null);
26 29
 
27 30
   const openAlbum = (e) => {
28
-    e.stopPropagation()
31
+    e.stopPropagation();
29 32
 
30 33
     Taro.chooseImage({
31 34
       count: 1,
32
-      sizeType: ['original', 'compressed'],  //可选择原图或压缩后的图片
33
-      sourceType: ['album', 'camera'], //可选择性开放访问相册、相机
34
-      success: res => {
35
+      sizeType: ["original", "compressed"], //可选择原图或压缩后的图片
36
+      sourceType: ["album", "camera"], //可选择性开放访问相册、相机
37
+      success: (res) => {
35 38
         Taro.showLoading({
36
-          title: '加载中',
37
-        })
38
-        uploadFiles(res.tempFilePaths).then(data => {
39
-          setImageUrl(data[0])
40
-          Taro.hideLoading()
41
-        }).catch(() => {
42
-          Taro.hideLoading()
43
-        })
44
-      }
45
-    })
46
-  }
39
+          title: "加载中",
40
+        });
41
+        uploadFiles(res.tempFilePaths)
42
+          .then((data) => {
43
+            setImageUrl(data[0]);
44
+            Taro.hideLoading();
45
+          })
46
+          .catch(() => {
47
+            Taro.hideLoading();
48
+          });
49
+      },
50
+    });
51
+  };
47 52
 
48 53
   const handleSubmit = (e) => {
49
-
50 54
     const payload = {
51 55
       id,
52
-      type: 'report',
56
+      type: "report",
53 57
       realtyConsultant: consultant,
54 58
       customerVisit: {
55 59
         buildingId: channelCustomer.buildingId,
@@ -58,37 +62,38 @@ export default withLayout((props) => {
58 62
         realtyConsultant: consultant,
59 63
         imageUrl,
60 64
 
61
-        visitDate: `${visitDate}T12:00:00.000Z`,  // 随便造了一个时刻
65
+        visitDate: `${visitDate}T12:00:00.000Z`, // 随便造了一个时刻
62 66
         remark,
63 67
         channelId: channelCustomer.channelId,
64 68
         channelCustomerId,
65 69
       },
66
-
67
-    }
68
-
69
-    setLoading(true)
70
-    fetch({ url: API_MARKETING_VISIT, payload, method: 'PUT' }).then((res) => {
71
-      setLoading(false)
72
-      Taro.showToast({
73
-        title: '操作成功',
74
-        icon: 'none'
70
+    };
71
+
72
+    setLoading(true);
73
+    fetch({ url: API_MARKETING_VISIT, payload, method: "PUT" })
74
+      .then((res) => {
75
+        setLoading(false);
76
+        Taro.showToast({
77
+          title: "操作成功",
78
+          icon: "none",
79
+        });
80
+        const t = setTimeout(() => {
81
+          Taro.navigateBack({ delta: 1 });
82
+          clearTimeout(t);
83
+        }, 1500);
75 84
       })
76
-      const t = setTimeout(() => {
77
-        Taro.navigateBack({ delta: 1 })
78
-        clearTimeout(t)
79
-      }, 1500)
80
-    }).catch((e) => {
81
-      setLoading(false)
82
-    })
83
-  }
85
+      .catch((e) => {
86
+        setLoading(false);
87
+      });
88
+  };
84 89
 
85 90
   useEffect(() => {
86 91
     if (id) {
87 92
       getChannelCustomerDetail(id).then((res) => {
88
-        setChannelCustomer(res || {})
93
+        setChannelCustomer(res || {});
89 94
 
90
-        setConsultant(res?.realtyConsultant)
91
-        setChannelCustomerId(res?.channelCustomerId)
95
+        setConsultant(res?.realtyConsultant);
96
+        setChannelCustomerId(res?.channelCustomerId);
92 97
 
93 98
         if (res?.buildingId) {
94 99
           getCardList({
@@ -96,79 +101,105 @@ export default withLayout((props) => {
96 101
             pageSize: 50,
97 102
             buildingId: res.buildingId,
98 103
           }).then((x) => {
99
-            const { records } = x || {}
100
-            setConsultantList(records || [])
101
-          })
104
+            const { records } = x || {};
105
+            setConsultantList(records || []);
106
+          });
102 107
         }
103
-      })
108
+      });
104 109
     }
105
-  }, [id])
110
+  }, [id]);
106 111
 
107 112
   // const [PageProps] = useState(props)
108 113
 
109 114
   return (
110
-    <view className='Page sureVisit'>
111
-
115
+    <view className="Page sureVisit">
112 116
       <ScrollView scrollY>
113
-        <view className='PageContent'>
114
-
117
+        <view className="PageContent">
115 118
           <text>客户姓名</text>
116
-          <view className='FormLine flex-h'>
117
-            <view className='flex-item'>
119
+          <view className="FormLine flex-h">
120
+            <view className="flex-item">
118 121
               <text>{channelCustomer.name}</text>
119 122
               {/* <Input placeholder='请输入姓名' value={channelCustomer.name}></Input> */}
120 123
             </view>
121 124
           </view>
122
-
123
-          <text>归属渠道</text>
124
-          <view className='FormLine flex-h'>
125
-            <view className='flex-item'>
126
-              <text>{channelCustomer.channelName}</text>
127
-              {/* <Input placeholder='请输入渠道' value={channelCustomer.channelName}></Input> */}
128
-            </view>
129
-          </view>
125
+          {channelCustomer.recommendPersonType === ROLE_CODE.BROKER ? (
126
+            <>
127
+              <text>报备经纪人</text>
128
+              <view className="FormLine flex-h">
129
+                <view className="flex-item">
130
+                  <text>{channelCustomer.recommendPersonName}</text>
131
+                  {/* <Input placeholder='请输入渠道' value={channelCustomer.channelName}></Input> */}
132
+                </view>
133
+              </view>
134
+            </>
135
+          ) : (
136
+            <>
137
+              <text>归属渠道</text>
138
+              <view className="FormLine flex-h">
139
+                <view className="flex-item">
140
+                  <text>{channelCustomer.channelName}</text>
141
+                  {/* <Input placeholder='请输入渠道' value={channelCustomer.channelName}></Input> */}
142
+                </view>
143
+              </view>
144
+            </>
145
+          )}
130 146
 
131 147
           <text>内场接待(选填)</text>
132
-          <view className='FormLine flex-h'>
133
-            <view className='flex-item'>
148
+          <view className="FormLine flex-h">
149
+            <view className="flex-item">
134 150
               {/* <Input placeholder='请输入内场接待'></Input> */}
135
-              <Picker kv={['name', 'id']} value={consultant} placeholder='请输入内场接待' dicts={consultantList} onChange={setConsultant} />
151
+              <Picker
152
+                kv={["name", "id"]}
153
+                value={consultant}
154
+                placeholder="请输入内场接待"
155
+                dicts={consultantList}
156
+                onChange={setConsultant}
157
+              />
136 158
             </view>
137 159
           </view>
138 160
 
139 161
           <text>到访时间</text>
140
-          <view className='FormLine flex-h'>
141
-            <view className='flex-item'>
162
+          <view className="FormLine flex-h">
163
+            <view className="flex-item">
142 164
               {/* <text>请选择</text> */}
143
-              <Picker mode='date' value={visitDate} onChange={setVisitDate} />
165
+              <Picker mode="date" value={visitDate} onChange={setVisitDate} />
144 166
             </view>
145 167
             {/* <text className='iconfont icon-jiantoudown'></text> */}
146 168
           </view>
147 169
 
148 170
           <text>到访照片(选填)</text>
149
-          <view className='FormLine flex-h'>
150
-            <view className='flex-item'>
171
+          <view className="FormLine flex-h">
172
+            <view className="flex-item">
151 173
               {/* <view className='UploadImg'>
152 174
                 <text className='iconfont icon-xiangji centerLabel'></text>
153 175
               </view> */}
154
-              <Image src={imageUrl} className='UploadImg' onClick={openAlbum} mode="aspectFill"></Image>
176
+              <Image
177
+                src={imageUrl}
178
+                className="UploadImg"
179
+                onClick={openAlbum}
180
+                mode="aspectFill"
181
+              ></Image>
155 182
             </view>
156 183
           </view>
157 184
 
158 185
           <text>备注</text>
159
-          <view className='FormLine flex-h'>
160
-            <view className='flex-item'>
161
-              <textarea placeholder='补充说明(选填)' value={remark} onInput={(e) => setRemark(e.detail.value)} ></textarea>
186
+          <view className="FormLine flex-h">
187
+            <view className="flex-item">
188
+              <textarea
189
+                placeholder="补充说明(选填)"
190
+                value={remark}
191
+                onInput={(e) => setRemark(e.detail.value)}
192
+              ></textarea>
162 193
             </view>
163 194
           </view>
164 195
 
165
-          <view className='Btn'>
166
-            <button loading={loading} onClick={handleSubmit}>提交</button>
196
+          <view className="Btn">
197
+            <button loading={loading} onClick={handleSubmit}>
198
+              提交
199
+            </button>
167 200
           </view>
168
-
169 201
         </view>
170 202
       </ScrollView>
171
-
172 203
     </view>
173
-  )
174
-})
204
+  );
205
+});

+ 5
- 3
src/utils/tools.js Visa fil

@@ -15,6 +15,10 @@ export function isEmpty(o) {
15 15
     }
16 16
   }
17 17
 
18
+  if (o === null || o === undefined) {
19
+    return true;
20
+  }
21
+
18 22
   if (typeof o === "object") {
19 23
     return !Object.keys(o).length;
20 24
   }
@@ -23,9 +27,7 @@ export function isEmpty(o) {
23 27
     return !o.length;
24 28
   }
25 29
 
26
-  if (o === null || o === undefined) {
27
-    return true;
28
-  }
30
+  
29 31
 
30 32
   return false;
31 33
 }