dingxin 5 vuotta sitten
vanhempi
commit
9dcc5ff825

+ 2
- 2
config/routes.js Näytä tiedosto

93
               },
93
               },
94
               {
94
               {
95
                 path: '/customer/customerlist/customerDetail',
95
                 path: '/customer/customerlist/customerDetail',
96
-                name: '客户编辑',
96
+                name: '私客详情',
97
                 hideInMenu: true,
97
                 hideInMenu: true,
98
                 component: './customer/customerlist/customerDetail',
98
                 component: './customer/customerlist/customerDetail',
99
               },
99
               },
130
               },
130
               },
131
               {
131
               {
132
                 path: '/customer/customerlist/publicCustomerDetail',
132
                 path: '/customer/customerlist/publicCustomerDetail',
133
-                name: '客详情',
133
+                name: '客详情',
134
                 hideInMenu: true,
134
                 hideInMenu: true,
135
                 component: './customer/customerlist/publicCustomerDetail',
135
                 component: './customer/customerlist/publicCustomerDetail',
136
               },
136
               },

+ 50
- 29
src/pages/customer/customerlist/customerDetail.jsx Näytä tiedosto

15
    * @returns
15
    * @returns
16
    */
16
    */
17
   // eslint-disable-next-line react-hooks/rules-of-hooks
17
   // eslint-disable-next-line react-hooks/rules-of-hooks
18
-  const [data, setData] = useState([{ visitRecords: [] }])
18
+  const [data, setData] = useState([{ }])
19
+  const [tableData, setTableDataData] = useState([{ }])
19
   const [dataConsultant, setDataonsultant] = useState({})
20
   const [dataConsultant, setDataonsultant] = useState({})
20
   const [intentionData, setIntentionData] = useState([])
21
   const [intentionData, setIntentionData] = useState([])
21
 
22
 
22
   // eslint-disable-next-line react-hooks/rules-of-hooks
23
   // eslint-disable-next-line react-hooks/rules-of-hooks
23
   useEffect(() => {
24
   useEffect(() => {
24
     getById()
25
     getById()
26
+    toLoadIntention()
25
   }, [])
27
   }, [])
26
 
28
 
29
+  function toLoadIntention() {
30
+    const arr = []
31
+    // 意向值
32
+    for (let i = 0; i < intentionData.length; i++) {
33
+      const a = [].concat(
34
+        intentionData.concat([{
35
+          key: i,
36
+          name: `Edward King ${i}`,
37
+          age: 32,
38
+          address: `London, Park Lane no. ${i}`,
39
+        }]),
40
+      )
41
+      arr.push(a)
42
+   }
43
+   setIntentionData(arr)
44
+  }
45
+
27
   // 查询
46
   // 查询
47
+  const { id } = props.location.query;
28
   function getById(params) {
48
   function getById(params) {
29
-    const { id } = props.location.query;
30
     if (id === '' || id === undefined) {
49
     if (id === '' || id === undefined) {
31
       return
50
       return
32
     }
51
     }
33
-
34
-    request({ ...apis.customer.CustomerRecommendGet, urlData: { id }, params: { ...params } }).then(res => {
52
+    // eslint-disable-next-line max-len
53
+    request({ ...apis.customer.CustomerRecommendGet, urlData: { id }, params: { ...params, pageNumber: 1, pageSize: 10 } }).then(res => {
35
       setData(res)
54
       setData(res)
55
+      if (res.visitRecords) {
56
+        setTableDataData(res.visitRecords)
57
+      }
36
       setDataonsultant(res.geoInfo)
58
       setDataonsultant(res.geoInfo)
59
+      setIntentionData(res.intentions)
37
     })
60
     })
38
   }
61
   }
39
 // 分页
62
 // 分页
40
-  const changePageNum = pageNumber => {
41
-    // getList({ pageNum: pageNumber, pageSize: 10, ...props.form.getFieldsValue() })
63
+function onChange(number) {
64
+  if (id === '' || id === undefined) {
65
+    return
66
+  }
67
+    // eslint-disable-next-line max-len
68
+    request({ ...apis.customer.CustomerRecommendGet, urlData: { id }, params: { pageNumber: number, pageSize: 10 } }).then(res => {
69
+      setData(res)
70
+      setTableDataData(res.visitRecords)
71
+      setDataonsultant(res.geoInfo)
72
+    })
42
   }
73
   }
43
   const columns = [
74
   const columns = [
44
     {
75
     {
67
     {
98
     {
68
       title: 'Name',
99
       title: 'Name',
69
       dataIndex: 'name',
100
       dataIndex: 'name',
70
-      width: 150,
71
-      render: (_, record) => <span>香颂半岛</span>,
101
+    render: (_, record) => <span width={500}>{record.buildingName}</span>,
72
     },
102
     },
73
     {
103
     {
74
       title: 'Address',
104
       title: 'Address',
75
       dataIndex: 'address',
105
       dataIndex: 'address',
76
-      render: (_, record) => <span style={{ marginLeft: '55%' }}>22</span>,
106
+      render: (_, record) => <span style={{ marginLeft: '-50%' }}>{record.intention}</span>,
77
     },
107
     },
78
   ];
108
   ];
79
-
80
-for (let i = 0; i < 100; i++) {
81
-  intentionData.push({
82
-    key: i,
83
-    name: `Edward King ${i}`,
84
-    age: 32,
85
-    address: `London, Park Lane no. ${i}`,
86
-  });
87
-}
88
   return (
109
   return (
89
     <>
110
     <>
90
       <div className={styles.cardBox}>
111
       <div className={styles.cardBox}>
91
-     {/* { console.log("data:",data),console.log("data:",dataConsultant)} */}
92
         <div className={styles.rightBox}>
112
         <div className={styles.rightBox}>
93
           <p className={styles.tit}>客户信息</p>
113
           <p className={styles.tit}>客户信息</p>
94
           <img className={styles.touxiang} src={ data.picture && data.picture } />
114
           <img className={styles.touxiang} src={ data.picture && data.picture } />
111
           </div>
131
           </div>
112
           {/* <p className={styles.rightItem}>预约到访时间:{data.appointmentTime && moment(data.appointmentTime).format('YYYY-MM-DD') }</p> */}
132
           {/* <p className={styles.rightItem}>预约到访时间:{data.appointmentTime && moment(data.appointmentTime).format('YYYY-MM-DD') }</p> */}
113
           <div className={styles.rightInfo}>
133
           <div className={styles.rightInfo}>
114
-            <p className={styles.rightItem}>国家:{ dataConsultant&&dataConsultant.country }</p>
115
-            <p className={styles.rightItem}>省份:{ dataConsultant&&dataConsultant.provience }</p>
116
-            <p className={styles.rightItem}>城市:{dataConsultant&&dataConsultant.city }</p>
134
+            <p className={styles.rightItem}>国家:{ dataConsultant && dataConsultant.country }</p>
135
+            <p className={styles.rightItem}>省份:{ dataConsultant && dataConsultant.provience }</p>
136
+            <p className={styles.rightItem}>城市:{dataConsultant && dataConsultant.city }</p>
117
             <p className={styles.rightItem}>来访渠道:活动分享</p>
137
             <p className={styles.rightItem}>来访渠道:活动分享</p>
118
             {/* <p className={styles.rightItem}>详细信息:</p> */}
138
             {/* <p className={styles.rightItem}>详细信息:</p> */}
119
             {/* <p className={styles.rightItem}>意向项目:{data.intention }</p> */} 
139
             {/* <p className={styles.rightItem}>意向项目:{data.intention }</p> */} 
126
       <div className={styles.cardBox}>
146
       <div className={styles.cardBox}>
127
         <div className={styles.rightBoxCentre}>
147
         <div className={styles.rightBoxCentre}>
128
         <p className={styles.tit}>置业顾问信息</p>
148
         <p className={styles.tit}>置业顾问信息</p>
129
-          <img className={styles.touxiang} src={ data.picture && data.picture } />
130
-          <p className={styles.infoItem}>曹玉文</p>
149
+          <img className={styles.touxiangphoto} src={ data.consultant && data.consultant.photo }/>
150
+          <p className={styles.infoItem}>{data.consultant && data.consultant.userName}</p>
131
           <div className={styles.right}>
151
           <div className={styles.right}>
132
           {/* <p className={styles.infoItem}>姓名:{ data.consultant && data.consultant.name }</p>
152
           {/* <p className={styles.infoItem}>姓名:{ data.consultant && data.consultant.name }</p>
133
           <p className={styles.infoItem}>部门:{ data.consultant && data.consultant.department }</p> */}
153
           <p className={styles.infoItem}>部门:{ data.consultant && data.consultant.department }</p> */}
134
           <p className={styles.infoItem}>号码:{ data.consultant && data.consultant.phone } </p>
154
           <p className={styles.infoItem}>号码:{ data.consultant && data.consultant.phone } </p>
135
-          <p className={styles.infoItem}>岗位:{ data.consultant && data.consultant.post }</p>
155
+          <p className={styles.infoItem}>岗位:{ data.consultant && data.consultant.position }</p>
136
           </div>
156
           </div>
137
           <div className={styles.left}>
157
           <div className={styles.left}>
138
-          <p className={styles.infoItem}>公司:{ data.consultant && data.consultant.company } </p>
158
+          <p className={styles.infoItem}>公司:{ data.consultant && data.consultant.orgName } </p>
139
           <p className={styles.infoItem}>
159
           <p className={styles.infoItem}>
140
             所属项目:
160
             所属项目:
141
             {
161
             {
148
         <div className={styles.leftBoxCentre}>
168
         <div className={styles.leftBoxCentre}>
149
           <div className={styles.tit}>
169
           <div className={styles.tit}>
150
                 <span>项目名称</span>
170
                 <span>项目名称</span>
151
-                <span style={{ marginLeft: '47%' }}>项目名称</span>
171
+                <span style={{ marginLeft: '47%' }}>意向值</span>
152
           </div>
172
           </div>
153
           {/* <img className={styles.touxiang} src={ data.picture && data.picture } /> */}
173
           {/* <img className={styles.touxiang} src={ data.picture && data.picture } /> */}
154
           <div className={styles.infoItem}>
174
           <div className={styles.infoItem}>
155
-          <Table columnWidth={10} showHeader={false} columns={intention} dataSource={intentionData} pagination={{ pageSize: 50 }} scroll={{ y: 240 }}/>,
175
+          <Table columnWidth={10} showHeader={false} columns={intention} dataSource={intentionData} pagination={false} scroll={intentionData && intentionData.length >= 3 ? { y: 240 } : false}/>
156
           </div>
176
           </div>
157
         </div>
177
         </div>
158
 
178
 
159
       </div>
179
       </div>
160
       <div className={styles.recordBox}>
180
       <div className={styles.recordBox}>
161
         <p className={styles.tableName}>访问记录</p>
181
         <p className={styles.tableName}>访问记录</p>
162
-        <Table showQuickJumper defaultCurrent={1} dataSource={data.visitRecords} columns={columns} current={50} />
182
+        <Table dataSource={tableData.records} columns={columns} pagination={{ pageSize: 10, total: tableData.total, onChange }} />
183
+        {/* <Pagination showQuickJumper defaultCurrent={1} total={data.records} onChange={e => changePageNum(e)} current={data.visitRecords.total}/> */}
163
       </div>
184
       </div>
164
 
185
 
165
     </>
186
     </>

+ 1
- 1
src/pages/customer/customerlist/index.jsx Näytä tiedosto

168
     router.push({
168
     router.push({
169
       pathname: '/customer/customerlist/publicCustomerDetail',
169
       pathname: '/customer/customerlist/publicCustomerDetail',
170
       query: {
170
       query: {
171
-        id: record.customerId,
171
+        id: record.personId,
172
       },
172
       },
173
     });
173
     });
174
   }
174
   }

+ 48
- 25
src/pages/customer/customerlist/publicCustomerDetail.jsx Näytä tiedosto

15
    * @returns
15
    * @returns
16
    */
16
    */
17
   // eslint-disable-next-line react-hooks/rules-of-hooks
17
   // eslint-disable-next-line react-hooks/rules-of-hooks
18
-  const [data, setData] = useState([{ visitRecords: [] }])
18
+  const [data, setData] = useState([{ }])
19
+  const [tableData, setTableDataData] = useState([{ }])
19
   const [dataConsultant, setDataonsultant] = useState({})
20
   const [dataConsultant, setDataonsultant] = useState({})
20
   const [intentionData, setIntentionData] = useState([])
21
   const [intentionData, setIntentionData] = useState([])
21
 
22
 
22
   // eslint-disable-next-line react-hooks/rules-of-hooks
23
   // eslint-disable-next-line react-hooks/rules-of-hooks
23
   useEffect(() => {
24
   useEffect(() => {
24
     getById()
25
     getById()
26
+    toLoadIntention()
25
   }, [])
27
   }, [])
26
 
28
 
29
+  function toLoadIntention() {
30
+    if (intentionData) {
31
+      return
32
+    }
33
+    const arr = []
34
+    // 意向值
35
+    for (let i = 0; i < intentionData.length; i++) {
36
+      const a = [].concat(
37
+        intentionData.concat([{
38
+          key: i,
39
+          name: `Edward King ${i}`,
40
+          age: 32,
41
+          address: `London, Park Lane no. ${i}`,
42
+        }]),
43
+      )
44
+      arr.push(a)
45
+   }
46
+   setIntentionData(arr)
47
+  }
48
+
27
   // 查询
49
   // 查询
50
+  const { id } = props.location.query;
28
   function getById(params) {
51
   function getById(params) {
29
-    const { id } = props.location.query;
30
     if (id === '' || id === undefined) {
52
     if (id === '' || id === undefined) {
31
       return
53
       return
32
     }
54
     }
33
 
55
 
34
-    request({ ...apis.customer.CustomerRecommendGet, urlData: { id }, params: { ...params } }).then(res => {
56
+    request({ ...apis.customer.cecommendPublic, urlData: { id }, params: { ...params } }).then(res => {
57
+      setTableDataData(res.visitRecords)
35
       setData(res)
58
       setData(res)
36
       setDataonsultant(res.geoInfo)
59
       setDataonsultant(res.geoInfo)
60
+      setIntentionData(res.intentions)
37
     })
61
     })
38
   }
62
   }
39
 // 分页
63
 // 分页
40
-  const changePageNum = pageNumber => {
41
-    // getList({ pageNum: pageNumber, pageSize: 10, ...props.form.getFieldsValue() })
64
+// 分页
65
+function onChange(number) {
66
+  if (id === '' || id === undefined) {
67
+    return
68
+  }
69
+    request({ ...apis.customer.cecommendPublic, urlData: { id }, params: { pageNumber: number, pageSize: 10 } }).then(res => {
70
+      setData(res)
71
+      setTableDataData(res.visitRecords)
72
+      setDataonsultant(res.geoInfo)
73
+    })
42
   }
74
   }
43
   const columns = [
75
   const columns = [
44
     {
76
     {
67
     {
99
     {
68
       title: 'Name',
100
       title: 'Name',
69
       dataIndex: 'name',
101
       dataIndex: 'name',
70
-      width: 150,
71
-      render: (_, record) => <span>香颂半岛</span>,
102
+    render: (_, record) => <span width={500}>{record.buildingName}</span>,
72
     },
103
     },
73
     {
104
     {
74
       title: 'Address',
105
       title: 'Address',
75
       dataIndex: 'address',
106
       dataIndex: 'address',
76
-      render: (_, record) => <span style={{ marginLeft: '55%' }}>22</span>,
107
+      render: (_, record) => <span style={{ marginLeft: '-50%' }}>{record.intention}</span>,
77
     },
108
     },
78
   ];
109
   ];
79
 
110
 
80
-for (let i = 0; i < 1; i++ ) {
81
-  intentionData.push({
82
-    key: i,
83
-    name: `Edward King ${i}`,
84
-    age: 32,
85
-    address: `London, Park Lane no. ${i}`,
86
-  });
87
-}
88
   return (
111
   return (
89
     <>
112
     <>
90
       <div className={publicStyle.cardBox}>
113
       <div className={publicStyle.cardBox}>
91
      {/* { console.log("data:",data),console.log("data:",dataConsultant)} */}
114
      {/* { console.log("data:",data),console.log("data:",dataConsultant)} */}
92
         <div className={publicStyle.rightBox}>
115
         <div className={publicStyle.rightBox}>
93
           <p className={publicStyle.tit}>客户信息</p>
116
           <p className={publicStyle.tit}>客户信息</p>
94
-          <img className={publicStyle.touxiang} src={ data.picture && data.picture } />
117
+          <img className={publicStyle.touxiang} src={ data.avatarurl && data.avatarurl } />
95
           <div className={publicStyle.right}>
118
           <div className={publicStyle.right}>
96
-            <p className={publicStyle.rightItem}>用户名称:{ data.name }</p>
119
+            <p className={publicStyle.rightItem}>用户名称:{ data.name === null ? data.nickname : data.name }</p>
97
             <p className={publicStyle.rightItem}>手机号码:{ data.phone }</p>
120
             <p className={publicStyle.rightItem}>手机号码:{ data.phone }</p>
98
             <p className={publicStyle.rightItem}>首次访问时间:{data.visitTime && moment(data.visitTime).format('YYYY-MM-DD')}</p>
121
             <p className={publicStyle.rightItem}>首次访问时间:{data.visitTime && moment(data.visitTime).format('YYYY-MM-DD')}</p>
99
           </div>
122
           </div>
105
           </div>
128
           </div>
106
           {/* <p className={styles.rightItem}>预约到访时间:{data.appointmentTime && moment(data.appointmentTime).format('YYYY-MM-DD') }</p> */}
129
           {/* <p className={styles.rightItem}>预约到访时间:{data.appointmentTime && moment(data.appointmentTime).format('YYYY-MM-DD') }</p> */}
107
           <div className={publicStyle.rightInfo}>
130
           <div className={publicStyle.rightInfo}>
108
-            <p className={publicStyle.rightItem}>国家:{ dataConsultant && dataConsultant.country }</p>
109
-            <p className={publicStyle.rightItem}>省份:{ dataConsultant && dataConsultant.provience }</p>
110
-            <p className={publicStyle.rightItem}>城市:{dataConsultant && dataConsultant.city }</p>
131
+            <p className={publicStyle.rightItem}>国家:{ data && data.country }</p>
132
+            <p className={publicStyle.rightItem}>省份:{ data && data.province }</p>
133
+            <p className={publicStyle.rightItem}>城市:{ data && data.city }</p>
111
             {/* <p className={styles.rightItem}>详细信息:</p> */}
134
             {/* <p className={styles.rightItem}>详细信息:</p> */}
112
-            {/* <p className={styles.rightItem}>意向项目:{data.intention }</p> */} 
135
+            {/* <p className={styles.rightItem}>意向项目:{data.intention }</p> */}
113
             {/* <p className={styles.rightItem}>客户说明:{ data.verifyRemark }</p> */}
136
             {/* <p className={styles.rightItem}>客户说明:{ data.verifyRemark }</p> */}
114
           </div>
137
           </div>
115
         </div>
138
         </div>
117
         <div className={publicStyle.leftBoxCentre}>
140
         <div className={publicStyle.leftBoxCentre}>
118
           <div className={publicStyle.tit}>
141
           <div className={publicStyle.tit}>
119
                 <span>项目名称</span>
142
                 <span>项目名称</span>
120
-                <span style={{ marginLeft: '47%' }}>项目名称</span>
143
+                <span style={{ marginLeft: '47%' }}>意向值</span>
121
           </div>
144
           </div>
122
           {/* <img className={styles.touxiang} src={ data.picture && data.picture } /> */}
145
           {/* <img className={styles.touxiang} src={ data.picture && data.picture } /> */}
123
           <div className={publicStyle.infoItem}>
146
           <div className={publicStyle.infoItem}>
124
-          <Table columnWidth={10} showHeader={false} columns={intention} dataSource={intentionData} pagination={{ pageSize: 50 }} scroll={{ y: 240 }}/>,
147
+          <Table columnWidth={10} showHeader={false} columns={intention} dataSource={intentionData} pagination={false} scroll={intentionData.length >= 3 ? { y: 240 } : false}/>
125
           </div>
148
           </div>
126
         </div>
149
         </div>
127
       </div>
150
       </div>
128
       <div className={publicStyle.recordBox}>
151
       <div className={publicStyle.recordBox}>
129
         <p className={publicStyle.tableName}>访问记录</p>
152
         <p className={publicStyle.tableName}>访问记录</p>
130
-        <Table dataSource={data.visitRecords} columns={columns} rowKey="customerDetail" onChange={changePageNum} showQuickJumper/>
153
+        <Table dataSource={tableData.records} columns={columns} pagination={{ pageSize: 10, total: tableData.total, onChange }} />
131
       </div>
154
       </div>
132
     </>
155
     </>
133
   )
156
   )

+ 6
- 0
src/pages/customer/customerlist/style.less Näytä tiedosto

147
     border-radius: 6px;
147
     border-radius: 6px;
148
     margin: 30px 0 20px 0;
148
     margin: 30px 0 20px 0;
149
   }
149
   }
150
+  .touxiangphoto{
151
+    width: 60px;
152
+    width: 60px;
153
+    border-radius: 6px;
154
+    margin: 30px 0 0px 0;
155
+  }
150
   .infoItem{
156
   .infoItem{
151
     color:#666;
157
     color:#666;
152
     font-size: 19px;
158
     font-size: 19px;

+ 5
- 0
src/services/apis.js Näytä tiedosto

268
       url: `${prefix}/customer/recommend/get/:id`,
268
       url: `${prefix}/customer/recommend/get/:id`,
269
       action: 'admin.customer.recommend.get.id.get',
269
       action: 'admin.customer.recommend.get.id.get',
270
     },
270
     },
271
+    cecommendPublic: {
272
+      method: 'GET',
273
+      url: `${prefix}/customer/recommend/public/get/:id`,
274
+      action: 'admin.customer.recommend.public.get.id.get',
275
+    },
271
     customerRecommendRecommenderExport: { // 导出数据(推荐客户)
276
     customerRecommendRecommenderExport: { // 导出数据(推荐客户)
272
       method: 'GET',
277
       method: 'GET',
273
       url: `${prefix}/customer/recommend/recommender/export`,
278
       url: `${prefix}/customer/recommend/recommender/export`,