dingxin пре 5 година
родитељ
комит
9dcc5ff825

+ 2
- 2
config/routes.js Прегледај датотеку

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

+ 50
- 29
src/pages/customer/customerlist/customerDetail.jsx Прегледај датотеку

@@ -15,30 +15,61 @@ function header(props) {
15 15
    * @returns
16 16
    */
17 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 20
   const [dataConsultant, setDataonsultant] = useState({})
20 21
   const [intentionData, setIntentionData] = useState([])
21 22
 
22 23
   // eslint-disable-next-line react-hooks/rules-of-hooks
23 24
   useEffect(() => {
24 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 48
   function getById(params) {
29
-    const { id } = props.location.query;
30 49
     if (id === '' || id === undefined) {
31 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 54
       setData(res)
55
+      if (res.visitRecords) {
56
+        setTableDataData(res.visitRecords)
57
+      }
36 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 74
   const columns = [
44 75
     {
@@ -67,28 +98,17 @@ function header(props) {
67 98
     {
68 99
       title: 'Name',
69 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 104
       title: 'Address',
75 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 109
   return (
89 110
     <>
90 111
       <div className={styles.cardBox}>
91
-     {/* { console.log("data:",data),console.log("data:",dataConsultant)} */}
92 112
         <div className={styles.rightBox}>
93 113
           <p className={styles.tit}>客户信息</p>
94 114
           <img className={styles.touxiang} src={ data.picture && data.picture } />
@@ -111,9 +131,9 @@ for (let i = 0; i < 100; i++) {
111 131
           </div>
112 132
           {/* <p className={styles.rightItem}>预约到访时间:{data.appointmentTime && moment(data.appointmentTime).format('YYYY-MM-DD') }</p> */}
113 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 137
             <p className={styles.rightItem}>来访渠道:活动分享</p>
118 138
             {/* <p className={styles.rightItem}>详细信息:</p> */}
119 139
             {/* <p className={styles.rightItem}>意向项目:{data.intention }</p> */} 
@@ -126,16 +146,16 @@ for (let i = 0; i < 100; i++) {
126 146
       <div className={styles.cardBox}>
127 147
         <div className={styles.rightBoxCentre}>
128 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 151
           <div className={styles.right}>
132 152
           {/* <p className={styles.infoItem}>姓名:{ data.consultant && data.consultant.name }</p>
133 153
           <p className={styles.infoItem}>部门:{ data.consultant && data.consultant.department }</p> */}
134 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 156
           </div>
137 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 159
           <p className={styles.infoItem}>
140 160
             所属项目:
141 161
             {
@@ -148,18 +168,19 @@ for (let i = 0; i < 100; i++) {
148 168
         <div className={styles.leftBoxCentre}>
149 169
           <div className={styles.tit}>
150 170
                 <span>项目名称</span>
151
-                <span style={{ marginLeft: '47%' }}>项目名称</span>
171
+                <span style={{ marginLeft: '47%' }}>意向值</span>
152 172
           </div>
153 173
           {/* <img className={styles.touxiang} src={ data.picture && data.picture } /> */}
154 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 176
           </div>
157 177
         </div>
158 178
 
159 179
       </div>
160 180
       <div className={styles.recordBox}>
161 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 184
       </div>
164 185
 
165 186
     </>

+ 1
- 1
src/pages/customer/customerlist/index.jsx Прегледај датотеку

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

+ 48
- 25
src/pages/customer/customerlist/publicCustomerDetail.jsx Прегледај датотеку

@@ -15,30 +15,62 @@ function header(props) {
15 15
    * @returns
16 16
    */
17 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 20
   const [dataConsultant, setDataonsultant] = useState({})
20 21
   const [intentionData, setIntentionData] = useState([])
21 22
 
22 23
   // eslint-disable-next-line react-hooks/rules-of-hooks
23 24
   useEffect(() => {
24 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 51
   function getById(params) {
29
-    const { id } = props.location.query;
30 52
     if (id === '' || id === undefined) {
31 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 58
       setData(res)
36 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 75
   const columns = [
44 76
     {
@@ -67,33 +99,24 @@ function header(props) {
67 99
     {
68 100
       title: 'Name',
69 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 105
       title: 'Address',
75 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 111
   return (
89 112
     <>
90 113
       <div className={publicStyle.cardBox}>
91 114
      {/* { console.log("data:",data),console.log("data:",dataConsultant)} */}
92 115
         <div className={publicStyle.rightBox}>
93 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 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 120
             <p className={publicStyle.rightItem}>手机号码:{ data.phone }</p>
98 121
             <p className={publicStyle.rightItem}>首次访问时间:{data.visitTime && moment(data.visitTime).format('YYYY-MM-DD')}</p>
99 122
           </div>
@@ -105,11 +128,11 @@ for (let i = 0; i < 1; i++ ) {
105 128
           </div>
106 129
           {/* <p className={styles.rightItem}>预约到访时间:{data.appointmentTime && moment(data.appointmentTime).format('YYYY-MM-DD') }</p> */}
107 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 134
             {/* <p className={styles.rightItem}>详细信息:</p> */}
112
-            {/* <p className={styles.rightItem}>意向项目:{data.intention }</p> */} 
135
+            {/* <p className={styles.rightItem}>意向项目:{data.intention }</p> */}
113 136
             {/* <p className={styles.rightItem}>客户说明:{ data.verifyRemark }</p> */}
114 137
           </div>
115 138
         </div>
@@ -117,17 +140,17 @@ for (let i = 0; i < 1; i++ ) {
117 140
         <div className={publicStyle.leftBoxCentre}>
118 141
           <div className={publicStyle.tit}>
119 142
                 <span>项目名称</span>
120
-                <span style={{ marginLeft: '47%' }}>项目名称</span>
143
+                <span style={{ marginLeft: '47%' }}>意向值</span>
121 144
           </div>
122 145
           {/* <img className={styles.touxiang} src={ data.picture && data.picture } /> */}
123 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 148
           </div>
126 149
         </div>
127 150
       </div>
128 151
       <div className={publicStyle.recordBox}>
129 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 154
       </div>
132 155
     </>
133 156
   )

+ 6
- 0
src/pages/customer/customerlist/style.less Прегледај датотеку

@@ -147,6 +147,12 @@
147 147
     border-radius: 6px;
148 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 156
   .infoItem{
151 157
     color:#666;
152 158
     font-size: 19px;

+ 5
- 0
src/services/apis.js Прегледај датотеку

@@ -268,6 +268,11 @@ export default {
268 268
       url: `${prefix}/customer/recommend/get/:id`,
269 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 276
     customerRecommendRecommenderExport: { // 导出数据(推荐客户)
272 277
       method: 'GET',
273 278
       url: `${prefix}/customer/recommend/recommender/export`,