Quellcode durchsuchen

Merge branch 'v3.5.1' of http://git.ycjcjy.com/zhiyuxing/estateagents-admin-manager into v3.5.1

# Conflicts:
#	src/pages/activity/helpActivity/edithelpActivity.jsx
魏超 vor 5 Jahren
Ursprung
Commit
7b329a0f6f

+ 9
- 1
config/config.js Datei anzeigen

@@ -138,5 +138,13 @@ export default {
138 138
   },
139 139
   chainWebpack: webpackPlugin,
140 140
 
141
-  proxy,
141
+  proxy: {
142
+    ...proxy,
143
+    '/gaode_amap': { // 高德地图
144
+      // target: 'http://192.168.0.11:8080/',
145
+      target: 'https://restapi.amap.com/v3/',
146
+      changeOrigin: true,
147
+      pathRewrite: { '^/gaode_amap': '' },
148
+    },
149
+  },
142 150
 };

+ 6
- 0
config/routes.js Datei anzeigen

@@ -128,6 +128,12 @@ export default [
128 128
                 name: '到访记录',
129 129
                 component: './customer/visiting/index',
130 130
               },
131
+              {
132
+                path: '/customer/customerlist/publicCustomerDetail',
133
+                name: '私客详情',
134
+                hideInMenu: true,
135
+                component: './customer/customerlist/publicCustomerDetail',
136
+              },
131 137
             ],
132 138
           },
133 139
           {

+ 5
- 19
src/pages/activity/helpActivity/edithelpActivity.jsx Datei anzeigen

@@ -22,8 +22,6 @@ const { TextArea } = Input;
22 22
 
23 23
 const header = props => {
24 24
   const [isEnlist, setIsEnlist] = useState(1)
25
-  const [activityStatus, setActivityStatus] = useState(1)  
26
-  const [disable, setDisable] = useState(false)
27 25
 
28 26
   const radioOnChange = e => {
29 27
     // console.log(e.target.value)
@@ -44,8 +42,6 @@ const header = props => {
44 42
           data.activityTime = [moment(data.startDate), moment(data.endDate)]
45 43
           const num = data.helpNum > 0 ? 1 : 0
46 44
           setIsEnlist(num)
47
-          setActivityStatus(data.activityStatus)
48
-          setDisable(data.activityStatus === 0 ? true : false)
49 45
           data.isEnlist = num
50 46
           props.form.setFieldsValue(data)
51 47
           setDynamicData(data)
@@ -144,7 +140,7 @@ const header = props => {
144 140
               message: '请选择所属项目',
145 141
             },
146 142
           ],
147
-        })(<BuildSelect disabled={disable} />)}
143
+        })(<BuildSelect />)}
148 144
         </Form.Item>
149 145
 
150 146
         <Form.Item label="活动标题">
@@ -199,7 +195,7 @@ const header = props => {
199 195
               message: '请选择活动时间',
200 196
             },
201 197
           ],
202
-        })(<RangePicker format="YYYY-MM-DD HH:mm:ss" showTime={{ format: 'HH:mm:ss' }} disabled={activityStatus===0 ? true : false}/>)}
198
+        })(<RangePicker format="YYYY-MM-DD HH:mm:ss" showTime={{ format: 'HH:mm:ss' }}/>)}
203 199
         </Form.Item>
204 200
 
205 201
         <Form.Item label="助力邀请人数" min={1} max={10}>
@@ -210,7 +206,7 @@ const header = props => {
210 206
               message: '请输入活动人数',
211 207
             },
212 208
           ],
213
-        })(<Input type="number" disabled={activityStatus===0 ? true : false}/>)}
209
+        })(<Input type="number" />)}
214 210
         </Form.Item>
215 211
 
216 212
         <Form.Item label="助力次数">
@@ -222,7 +218,7 @@ const header = props => {
222 218
             },
223 219
           ],
224 220
         })(
225
-          <Radio.Group disabled={activityStatus===0 ? true : false} onChange={(e) => radioOnChange(e)}>
221
+          <Radio.Group onChange={(e) => radioOnChange(e)}>
226 222
             <Radio value={0}>不限制</Radio>
227 223
             <Radio value={1}>限制</Radio>
228 224
           </Radio.Group>,
@@ -237,7 +233,7 @@ const header = props => {
237 233
                  message: '请输入助力人数',
238 234
                },
239 235
              ],
240
-           })(<Input type="number" placeholder="助力人数限制" disabled={activityStatus===0 ? true : false}/>)}
236
+           })(<Input type="number" placeholder="助力人数限制"/>)}
241 237
            </Form.Item>
242 238
          }
243 239
 
@@ -251,16 +247,6 @@ const header = props => {
251 247
           ],
252 248
         })(<ImageUploader />)}
253 249
         </Form.Item>
254
-        <Form.Item label="权重">
255
-        {getFieldDecorator('heavy', {
256
-          rules: [
257
-            {
258
-              required: true,
259
-              message: '请输入权重',
260
-            },
261
-          ],
262
-        })(<Input type="number" disabled={activityStatus===0 ? true : false} style={{ width: 80}}/>)}<span style={{ marginLeft: 30, color:'grey'}}>数字越大越靠前</span>
263
-        </Form.Item>
264 250
         <Form.Item wrapperCol={{ span: 12, offset: 8 }}>
265 251
           <Button type="primary" htmlType="submit">
266 252
             确认

+ 103
- 0
src/pages/building/list/add/components/amapAroundData.js Datei anzeigen

@@ -0,0 +1,103 @@
1
+import request from '../../../../../utils/request';
2
+import apis from '../../../../../services/apis';
3
+
4
+const KEY = '14f05ce59c26364fd0674014dc0d8b1b'
5
+
6
+const POI_TYPES_KETY = {
7
+    Transport: 'Transport',
8
+    Mall: 'Mall',
9
+    Edu: 'Edu',
10
+    Hospital: 'Hospital',
11
+    Bank: 'Bank',
12
+    Restaurant: 'Restaurant',
13
+}
14
+
15
+// key 值会被拿到 building 表中 组合为字段名
16
+const POI_TYPES = [
17
+    {
18
+      key: POI_TYPES_KETY.Transport,
19
+      label: '交通',
20
+      types: ['150100', '150200', '150300', '150400', '150500', '150600'],
21
+      data: [],
22
+    },
23
+    {
24
+      key: POI_TYPES_KETY.Mall,
25
+      label: '商业',
26
+      types: ['060100', '060200', '060300', '060400', '060500', '060600',
27
+              '060700', '060800', '060900', '061000', '061100', '061200',
28
+              '061300', '061400', '080100', '080200', '080300', '080400',
29
+              '080500', '080600'],
30
+      data: [],
31
+    },
32
+    {
33
+      key: POI_TYPES_KETY.Edu,
34
+      label: '学校',
35
+      types: ['141200'],
36
+      data: [],
37
+    },
38
+    {
39
+      key: POI_TYPES_KETY.Hospital,
40
+      label: '医院',
41
+      types: ['090100', '090200', '090300', '090400', '090500', '090600', '090700'],
42
+      data: [],
43
+    },
44
+    {
45
+      key: POI_TYPES_KETY.Bank,
46
+      label: '银行',
47
+      types: ['160100'],
48
+      data: [],
49
+    },
50
+    {
51
+      key: POI_TYPES_KETY.Restaurant,
52
+      label: '餐饮',
53
+      types: ['050100', '050200', '050300', '050400', '050500', '050600',
54
+              '050700', '050800', '050900'],
55
+      data: [],
56
+    },
57
+  ]
58
+
59
+/**
60
+ * 获取 POI 类型
61
+ * @param {*} keyType 
62
+ */
63
+const getPOIType = keyType => {
64
+    return POI_TYPES.filter(item => item.key === keyType)
65
+}
66
+
67
+/**
68
+ * 获取这个 keyType 类型的所有 types
69
+ * @param {类型的key值} keyType 
70
+ */
71
+const getTypes = keyType => {
72
+  const typesArr = getPOIType(keyType)
73
+  return typesArr[0].types.join('|')
74
+}
75
+
76
+/**
77
+ * 获取周边数据
78
+ * @param {查询参数} params 
79
+ */
80
+function getAroundData (params) {
81
+    return new Promise((resolve, reject) => {
82
+        const { types, location } = params
83
+        if (!types) {
84
+            // console.err('未传输类型types值')
85
+            reject(new Error('未传输类型types值'))
86
+            return
87
+        }
88
+        if (!location) {
89
+            // console.err('未传输传输中心坐标location值')
90
+            reject(new Error('未传输传输中心坐标location值'))
91
+            return
92
+        }
93
+
94
+        request({ ...apis.amap.webService, params: { ...params, key: KEY, types: getTypes(types), location } }).then(data => {
95
+            // console.log(data)
96
+            resolve(data)
97
+        }).catch(err => {
98
+            reject(err)
99
+        })
100
+    })
101
+}
102
+
103
+export { POI_TYPES_KETY, getAroundData, getPOIType, POI_TYPES }

+ 79
- 5
src/pages/building/list/add/components/base.jsx Datei anzeigen

@@ -1,10 +1,10 @@
1 1
 import React, { useState, useEffect } from 'react';
2 2
 import { Form, Icon, Input, Button, DatePicker, Select, Card, Row, Col, Pagination, Alert, Radio, Tag, Tooltip, Tabs, InputNumber, notification } from 'antd';
3 3
 import moment from 'moment';
4
+import { router } from 'umi';
4 5
 import request from '../../../../../utils/request';
5 6
 import apis from '../../../../../services/apis';
6 7
 import Styles from '../style.less';
7
-import { router } from 'umi';
8 8
 import ImageUpload from '../../../../../components/XForm/ImageUpload'
9 9
 import ImageListUpload from '../../../../../components/XForm/ImageListUpload'
10 10
 import Wangedit from '../../../../../components/Wangedit/Wangedit'
@@ -13,6 +13,8 @@ import Amap from './amap'
13 13
 import BudildingProjectType from './buildingProjectType'
14 14
 import SelectCity from '../../../../../components/SelectButton/CitySelect'
15 15
 import FileUpload from '@/components/XForm/FileUpload';
16
+import { POI_TYPES_KETY, getAroundData, getPOIType, POI_TYPES } from './amapAroundData'
17
+import { ifError } from 'assert';
16 18
 
17 19
 const { Option } = Select
18 20
 const { TabPane } = Tabs;
@@ -41,6 +43,8 @@ function openNotificationWithIcon(type, message) {
41 43
 function AddBuilding(props) {
42 44
   const { getFieldDecorator } = props.form;
43 45
 
46
+  const [poi, setPoi] = useState([])
47
+
44 48
   console.log('props.building: ', props.building)
45 49
   if (props.building.buildingId !== undefined) {
46 50
     const { buildingId } = props.building
@@ -48,13 +52,13 @@ function AddBuilding(props) {
48 52
      useEffect(() => {
49 53
       if (buildingId !== '') {
50 54
         getById(buildingId)
55
+        setPoi(POI_TYPES)
51 56
       }
52 57
     }, [])
53 58
   }
54 59
 
55 60
    // 获取详情信息
56 61
    function getById(currentId) {
57
-
58 62
     request({ ...apis.building.buildingGetById, urlData: { id: currentId } }).then(res => {
59 63
       if (res.openingDate !== null) {
60 64
         res.openingDate = moment(res.openingDate)
@@ -87,6 +91,8 @@ function AddBuilding(props) {
87 91
   }
88 92
 
89 93
   function addBuilding(data) {
94
+    console.log('poi: ', poi)
95
+    data.mapJson = poi
90 96
     data.openingDate = moment(data.openingDate, 'yyyy-MM-dd HH:mm:ss')
91 97
     data.receivedDate = moment(data.receivedDate, 'yyyy-MM-dd HH:mm:ss')
92 98
     // 项目主图
@@ -121,6 +127,74 @@ function AddBuilding(props) {
121 127
     })
122 128
   }
123 129
 
130
+  // 周边设施 回调
131
+  function getMapScope(e) {
132
+    const coordinate = props.form.getFieldValue('coordinate').split(',')
133
+    const poiData = [].concat(POI_TYPES)
134
+    poiData.map(item => {
135
+      getAroundData({ types: item.key, location: `${coordinate[1]},${coordinate[0]}`, radius: e }).then(res => {
136
+        const { pois } = res
137
+        setFormMapScopeValue(item.key, pois)
138
+      }).catch(err => {
139
+        console.log(err.message)
140
+        openNotificationWithIcon('error', '周边数据获取失败')
141
+      })
142
+    })
143
+  }
144
+
145
+  function setFormMapScopeValue(key, pois) {
146
+    const poiArray = pois.map(p => {
147
+      return {
148
+        address: p.address,
149
+        adname: p.adname,
150
+        cityname: p.cityname,
151
+        distance: p.distance,
152
+        id: p.id,
153
+        location: p.location,
154
+        name: p.name,
155
+        pname: p.pname,
156
+        shopinfo: p.shopinfo,
157
+        type: p.type,
158
+        typecode: p.typecode,
159
+      }
160
+    })
161
+    
162
+    // 设置表单值
163
+    getFormMapScopeName(key, { data: poiArray })
164
+
165
+    const newPoi = poi.map(m => {
166
+      if (m.key === key) {
167
+        m.data = poiArray
168
+      }
169
+      return m
170
+    })
171
+    setPoi(newPoi)
172
+  }
173
+
174
+  function getFormMapScopeName(keyType, item) {
175
+    switch (keyType) {
176
+      case POI_TYPES_KETY.Transport:
177
+        props.form.setFieldsValue({ buildingTransport: item.data.map(t => t.name).join(',') })
178
+        return 'buildingTransport';
179
+      case POI_TYPES_KETY.Bank:
180
+        props.form.setFieldsValue({ buildingBank: item.data.map(t => t.name).join(',') })
181
+        return 'buildingBank';
182
+      case POI_TYPES_KETY.Edu:
183
+        props.form.setFieldsValue({ buildingEdu: item.data.map(t => t.name).join(',') })
184
+        return 'buildingEdu';
185
+      case POI_TYPES_KETY.Hospital:
186
+        props.form.setFieldsValue({ buildingHospital: item.data.map(t => t.name).join(',') })
187
+        return 'buildingHospital';
188
+      case POI_TYPES_KETY.Restaurant:
189
+        props.form.setFieldsValue({ buildingRestaurant: item.data.map(t => t.name).join(',') })
190
+        return 'buildingRestaurant';
191
+      case POI_TYPES_KETY.Mall:
192
+        props.form.setFieldsValue({ buildingMall: item.data.map(t => t.name).join(',') })
193
+        return 'buildingMall';
194
+      default:
195
+    }
196
+  }
197
+
124 198
   return (
125 199
         <Form {...formItemLayout} onSubmit={handleSubmit}>
126 200
           <Form.Item label="项目Id" style={{ display: 'none' }}>
@@ -186,7 +260,7 @@ function AddBuilding(props) {
186 260
           <Form.Item label="项目标签" >
187 261
             {getFieldDecorator('tag')(
188 262
               <Select mode="tags" placeholder="输入后选中" style={{ width: '1016px' }}>
189
-                
263
+
190 264
               </Select>,
191 265
             )}
192 266
           </Form.Item>
@@ -226,7 +300,7 @@ function AddBuilding(props) {
226 300
             {getFieldDecorator('discount')(<Input />)}
227 301
           </Form.Item>
228 302
           <Form.Item label="首页推荐" >
229
-            {getFieldDecorator('isMain',{
303
+            {getFieldDecorator('isMain', {
230 304
               initialValue: 1,
231 305
             })(
232 306
             <Radio.Group>
@@ -264,7 +338,7 @@ function AddBuilding(props) {
264 338
             {getFieldDecorator('mapScope', {
265 339
               rules: [{ required: true, message: '请选择周边设施搜索范围' }],
266 340
             })(
267
-              <Select placeholder="请选择周边设施搜索范围" style={{ width: '970px' }}>
341
+              <Select placeholder="请选择周边设施搜索范围" style={{ width: '970px' }} onChange={e => getMapScope(e)}>
268 342
                 <Option value={1000}>1公里</Option>
269 343
                 <Option value={3000}>3公里</Option>
270 344
                 <Option value={5000}>5公里</Option>

+ 180
- 19
src/pages/building/list/add/components/buildingImage.jsx Datei anzeigen

@@ -1,15 +1,37 @@
1 1
 import React, { useState, useEffect } from 'react';
2 2
 import { Form, Icon, Input, Button, DatePicker, Select, Card, Row, Col, Pagination, Alert, Radio, Tag, Tooltip, Tabs, Table, notification, Modal, Layout } from 'antd';
3 3
 import ImageListUpload from '../../../../../components/XForm/ImageListUpload';
4
+import moment from 'moment';
5
+import request from '../../../../../utils/request';
6
+import apis from '../../../../../services/apis';
4 7
 
5 8
 const { Header, Footer, Sider, Content } = Layout;
6 9
 
10
+const modalEdiFormItemLayout = {
11
+  labelCol: {
12
+    xs: { span: 24 },
13
+    sm: { span: 8 },
14
+  },
15
+  wrapperCol: {
16
+    xs: { span: 24 },
17
+    sm: { span: 16 },
18
+  },
19
+};
20
+
21
+const openNotificationWithIcon = (type, message) => {
22
+  notification[type]({
23
+    message,
24
+    description:
25
+      '',
26
+  });
27
+};
28
+
7 29
 /**
8 30
  * 弹框
9 31
  */
10 32
 function ModalEdi(props) {
11
-
12
-  const [visibleData, setVisibleData] = useState({ visible: false })
33
+  const { apartment, buildingId, apartmentId } = props.visibleData
34
+  const [visibleData, setVisibleData] = useState({ visible: false, buildingId: '', apartmentId: '', apartment: '' })
13 35
 
14 36
   if (!props.visibleData) {
15 37
     console.error('缺少visibleData参数!')
@@ -17,6 +39,7 @@ function ModalEdi(props) {
17 39
 
18 40
   useEffect(() => {
19 41
     setVisibleData(props.visibleData)
42
+    props.form.setFieldsValue({ apartmentId, apartmentName: apartment !== '' ? apartment.apartmentName : '' })
20 43
   }, [props.visibleData.visible])
21 44
 
22 45
   function handleOk(e) {
@@ -29,54 +52,171 @@ function ModalEdi(props) {
29 52
     props.onCancel();
30 53
   }
31 54
 
55
+  function handleSubmit(e) {
56
+    e.preventDefault();
57
+    props.form.validateFieldsAndScroll((err, values) => {
58
+      if (!err) {
59
+        console.log('Received values of form: ', values);
60
+        submitData(values)
61
+      }
62
+    });
63
+  }
64
+
65
+  function submitData(data) {
66
+    if (buildingId === '' || buildingId === undefined) {
67
+      return
68
+    }
69
+    if (data.img) {
70
+        // 如果是 名称 和 图片一起编辑,就穿最新的图片
71
+      data.img = data.img.map((item, index) => ({ imgType: 'aparment', url: item, orderNo: index }))
72
+    } else {
73
+        // 如果是 名称 和 图片一起编辑,就穿最新的图片
74
+      data.img = visibleData.apartment.buildingImgList
75
+    }
76
+    data.buildingId = buildingId;
77
+    data.apartmentType = 'photo'
78
+    const api = (data.apartmentId !== undefined && data.apartmentId !== '') ? apis.building.buildingApartmentUpdate : apis.building.buildingApartmentAdd;
79
+
80
+    // 网路请求
81
+    request({ ...api, data: { ...data } }).then(() => {
82
+      // eslint-disable-next-line no-unused-expressions
83
+      openNotificationWithIcon('success', '操作成功')
84
+      handleCancel()
85
+      props.onSuccess()
86
+      // this.setState({ visibleData: { visible: false, apartmentId: '', buildingId: '' } }, () => console.log('回调:', this.state.visibleData))
87
+    }).catch(err => {
88
+      // eslint-disable-next-line no-unused-expressions
89
+      openNotificationWithIcon('error', err)
90
+    })
91
+  }
92
+
93
+  const { getFieldDecorator } = props.form;
32 94
   return (
33 95
     <>
34 96
       <Modal
35
-          title="Basic Modal"
97
+          title="编辑"
36 98
           visible={visibleData.visible}
37 99
           onOk={handleOk}
38 100
           onCancel={handleCancel}
101
+          width={700}
102
+          footer={null}
39 103
         >
40
-          <p>Some contents...</p>
41
-          <p>Some contents...</p>
42
-          <p>Some contents...</p>
104
+         <Form {...modalEdiFormItemLayout} onSubmit={handleSubmit}>
105
+          <Form.Item label="编号" style={{ display: 'none' }}>
106
+              {getFieldDecorator('apartmentId')(<Input />)}
107
+          </Form.Item>
108
+          <Form.Item label="相册名称">
109
+            {getFieldDecorator('apartmentName', {
110
+              rules: [
111
+                {
112
+                  required: true,
113
+                  message: '请输入相册名称',
114
+                },
115
+                {
116
+                  max: 10,
117
+                  message: '不超过10个字符',
118
+                },
119
+              ],
120
+            })(<Input />)}
121
+          </Form.Item>
122
+          {
123
+            !props.noImage && <Form.Item label="选择图片">
124
+            {getFieldDecorator('img', {
125
+              rules: [
126
+                {
127
+                  required: true,
128
+                  message: '请选择图片',
129
+                },
130
+              ],
131
+            })(<ImageListUpload />)}
132
+          </Form.Item>
133
+          }
134
+          <Form.Item style={{ display: 'flex', justifyContent: 'flex-end' }}>
135
+            <Button type="primary" htmlType="submit">
136
+              保存
137
+            </Button>
138
+            &nbsp;&nbsp;&nbsp;&nbsp;
139
+            <Button onClick={() => handleCancel()}>
140
+              取消
141
+            </Button>
142
+          </Form.Item>
143
+         </Form>
43 144
         </Modal>
44 145
     </>
45 146
   )
46 147
 }
47 148
 
149
+const WrappedModalEdiForm = Form.create({ name: 'ModalEdi' })(ModalEdi);
150
+
48 151
 /**
49 152
  * 模块
50 153
  */
51 154
 function BuildingImageModel(props) {
52 155
   const [imageList, setImageList] = useState([])
53
-  const [visibleData, setVisibleData] = useState({ visible: false })
156
+  const [visibleData, setVisibleData] = useState({ visible: false, buildingId: '', apartmentId: '', apartment: '' })
157
+
158
+  useEffect(() => {
159
+    setImageList(getImgUrl())
160
+  }, [props.apartment.apartmentId])
161
+
162
+  function getImgUrl() {
163
+    return ((props.apartment.buildingImgList || [])).map(item => item.url)
164
+  }
165
+
166
+  function submitData(data) {
167
+    const { apartmentId } = props.apartment
168
+    if (apartmentId === '' || apartmentId === undefined) {
169
+      return
170
+    }
171
+
172
+    data.buildingId = props.apartment.buildingId;
173
+    data.apartmentType = 'photo'
174
+    const api = data.apartmentId !== undefined ? apis.building.buildingApartmentUpdate : apis.building.buildingApartmentAdd;
175
+
176
+    // 网路请求
177
+    request({ ...api, data: { ...data } }).then(() => {
178
+      // eslint-disable-next-line no-unused-expressions
179
+      openNotificationWithIcon('success', '操作成功')
180
+    }).catch(err => {
181
+      // eslint-disable-next-line no-unused-expressions
182
+      // openNotificationWithIcon('error', err)
183
+    })
184
+  }
54 185
 
55 186
   function onImageChange(e) {
56 187
     setImageList(e)
188
+       
189
+    // 新增加图片后,更新后端数据
190
+    const img = e.map((item, index) => ({ imgType: 'aparment', url: item, orderNo: index }))
191
+    submitData({ ...props.apartment, img })
57 192
   }
58 193
 
59 194
   function edi() {
60
-    setVisibleData({ visible: true })
195
+    setVisibleData({ visible: true, buildingId: props.apartment.buildingId, apartmentId: props.apartment.apartmentId, apartment: props.apartment })
61 196
   }
62 197
 
63 198
   function onCancel(e) {
64
-    setVisibleData({ visible: false })
199
+    setVisibleData({ visible: false, buildingId: '', apartmentId: '', apartment: '' })
65 200
   }
66 201
 
67 202
   function deletePhoto() {
203
+    request({ ...apis.building.buildingApartmentDelete, urlData: { id: props.apartment.apartmentId } }).then(() => {
204
+      openNotificationWithIcon('success', '操作成功')
205
+      props.onSuccess()
206
+    }).catch(err => {
68 207
 
208
+    })
69 209
   }
70 210
 
71 211
   return (
72 212
     <>
73
-<span style={{ marginTop: '10px', marginBottom: '10px' }}>效果图({imageList.length})</span>
213
+      <span style={{ marginTop: '10px', marginBottom: '10px' }}>{props.apartment.apartmentName}({imageList.length})</span>
74 214
       <Button type="link" style={{ color: 'blue' }} onClick={() => edi()}>重命名</Button>
75 215
       <Button type="link" style={{ color: 'blue' }} onClick={() => deletePhoto()}>删除相册</Button>
76 216
       <ImageListUpload value={imageList} onChange={onImageChange} unlimited/>
77 217
 
78 218
        {/* 编辑页 */}
79
-       <ModalEdi visibleData={visibleData} onCancel={e => onCancel(e)}/>
219
+       <WrappedModalEdiForm visibleData={visibleData} onCancel={e => onCancel(e)} onSuccess={() => props.onSuccess()} noImage/>
80 220
        <hr />
81 221
     </>
82 222
   )
@@ -85,28 +225,49 @@ function BuildingImageModel(props) {
85 225
 /**
86 226
  * 主体
87 227
  */
88
-function buildingImage() {
89
-  const [visibleData, setVisibleData] = useState({ visible: false })
228
+function buildingImage(props) {
229
+  // eslint-disable-next-line react-hooks/rules-of-hooks
230
+  const [visibleData, setVisibleData] = useState({ visible: false, buildingId: '', apartmentId: '', apartment: '' })
231
+  const [imageList, setImageList] = useState([])
232
+
233
+  // eslint-disable-next-line react-hooks/rules-of-hooks
234
+  useEffect(() => {
235
+    getList()
236
+  }, [props.building.buildingId])
237
+ 
90 238
 
91 239
   function edi() {
92
-    setVisibleData({ visible: true })
240
+    setVisibleData({ visible: true, buildingId: props.building.buildingId, apartmentId: '', apartment: '' })
93 241
   }
94 242
 
95 243
   function onCancel(e) {
96
-    setVisibleData({ visible: false })
244
+    setVisibleData({ visible: false, buildingId: '', apartmentId: '', apartment: '' })
245
+  }
246
+
247
+  function onSuccess(e) {
248
+    getList()
249
+  }
250
+
251
+  function getList(params) {
252
+    // 网路请求
253
+    request({ ...apis.building.buildingApartment, urlData: { id: props.building.buildingId }, params: { ...params, apartmentType: 'photo' } }).then(res => {
254
+      setImageList(res)
255
+    }).catch(err => {
256
+      openNotificationWithIcon('error', err.message)
257
+    })
97 258
   }
98 259
 
99 260
   return (
100 261
     <>
101 262
       <Button type="primary" onClick={() => edi()}>新增</Button>
102 263
       <Layout style={{ background: '#fff' }}>
103
-        <Content><BuildingImageModel /></Content>
104
-        <Content><BuildingImageModel /></Content>
105
-        <Content><BuildingImageModel /></Content>
264
+        {
265
+          imageList.map(item => <Content><BuildingImageModel apartment={item} key={item.apartmentId} onSuccess={e => onSuccess(e)}/></Content>)
266
+        }
106 267
       </Layout>
107 268
 
108 269
       {/* 编辑页 */}
109
-      <ModalEdi visibleData={visibleData} onCancel={e => onCancel(e)}/>
270
+      <WrappedModalEdiForm visibleData={visibleData} onCancel={e => onCancel(e)} onSuccess={e => onSuccess(e)}/>
110 271
     </>
111 272
   )
112 273
 }

+ 1
- 1
src/pages/building/list/add/components/imageSet.jsx Datei anzeigen

@@ -53,7 +53,7 @@ function imageSet(props) {
53 53
 
54 54
   function getList(params) {
55 55
     // 网路请求
56
-    request({ ...apis.building.buildingApartment, urlData: { id: props.building.buildingId }, params: { ...params } }).then(res => {
56
+    request({ ...apis.building.buildingApartment, urlData: { id: props.building.buildingId }, params: { ...params, apartmentType: 'apart' } }).then(res => {
57 57
       setData(res)
58 58
     }).catch(err => {
59 59
       openNotificationWithIcon('error', err.message)

+ 145
- 0
src/pages/customer/customerlist/components/recommend.jsx Datei anzeigen

@@ -0,0 +1,145 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Icon, Input, Button, DatePicker, Select, Card, Row, Col, Pagination, Alert, Table, Avatar, Radio, Modal, Descriptions, notification } from 'antd';
3
+import moment from 'moment';
4
+import request from '../../../../utils/request';
5
+import apis from '../../../../services/apis';
6
+import Styles from '../style.less';
7
+
8
+
9
+const { Option } = Select;
10
+// eslint-disable-next-line @typescript-eslint/no-unused-vars
11
+const { Meta } = Card;
12
+
13
+/**
14
+ * 推荐客户
15
+ *
16
+ * @param {*} props
17
+ * @returns
18
+ */
19
+class ModalRecommendRecord extends React.Component {
20
+  constructor(props) {
21
+    super(props);
22
+    this.state = {
23
+       dataSource: [],
24
+       visibleData: { visible: false, customerId: '' },
25
+    }
26
+  }
27
+
28
+  // 挂载之后
29
+  componentDidMount() {
30
+    this.getList({ pageNumber: 1, pageSize: 5 })
31
+  }
32
+
33
+  componentDidUpdate(preProps, preState) {
34
+    // console.log('this.props.visibleData', this.props.visibleData)
35
+    if (this.props.visibleData.customerId !== preState.visibleData.customerId) {
36
+      this.getList({ pageNumber: 1, pageSize: 5 })
37
+      this.setState({ visibleData: this.props.visibleData });
38
+    }
39
+  }
40
+
41
+  // 弹框确定按钮
42
+  // eslint-disable-next-line react/sort-comp
43
+  handleOk() {
44
+    this.setState({ visibleData: { visible: false, customerId: '' } })
45
+  }
46
+
47
+  // 弹框取消按钮
48
+  handleCancel() {
49
+    this.setState({ visibleData: { visible: false, customerId: '' } })
50
+  }
51
+
52
+  openNotificationWithIcon = (type, message) => {
53
+    notification[type]({
54
+      message,
55
+      description:
56
+        '',
57
+    });
58
+  }
59
+
60
+  getList(params) {
61
+    const { customerId } = this.state.visibleData
62
+    if (customerId === '' || customerId === undefined) {
63
+      return
64
+    }
65
+    console.log('customerId', customerId)
66
+    // 网路请求
67
+    // 网路请求
68
+    request({ ...apis.customer.recommendClient, urlData: { id: customerId }, params: { ...params } }).then(res => {
69
+      this.setState({ dataSource: res })
70
+    }).catch(err => {
71
+      this.openNotificationWithIcon('error', err)
72
+    })
73
+  }
74
+
75
+   // 分页
76
+  onChange(pageNum) {
77
+    this.getList({ pageNumber: pageNum, pageSize: 5 })
78
+  }
79
+
80
+  render() {
81
+    const columns = [
82
+      {
83
+        title: '头像',
84
+        // eslint-disable-next-line jsx-a11y/alt-text
85
+        render: (text, records) => <img src={records.picture} width={50} height={50} />,
86
+      },
87
+      {
88
+        title: '用户名',
89
+        dataIndex: 'name',
90
+        key: 'name',
91
+      },
92
+      {
93
+        title: '电话',
94
+        dataIndex: 'phone',
95
+        key: 'phone',
96
+      },
97
+      {
98
+        title: '性别',
99
+        dataIndex: 'sex',
100
+        key: 'sex',
101
+        render: (text, records) => <span>{records.sex === 1 ? '男' : '女'}</span>,
102
+      },
103
+      {
104
+        title: '意向项目',
105
+        dataIndex: 'intention',
106
+        key: 'intention',
107
+      },
108
+      {
109
+        title: '推荐时间',
110
+        dataIndex: 'createDate',
111
+        key: 'createDate',
112
+        render: (_, record) => <><span>{ record.createDate && moment(record.createDate).format('YYYY-MM-DD') }</span></>,
113
+      },
114
+      {
115
+        title: '状态',
116
+        // eslint-disable-next-line consistent-return
117
+        render: (text, records) => {
118
+          if (records.status === 1) { return '报备' }
119
+          if (records.status === 2) { return '到访' }
120
+          if (records.status === 3) { return '认筹' }
121
+          if (records.status === 4) { return '签约' }
122
+          // reportRecommendStatus
123
+        },
124
+      },
125
+    ]
126
+    return (
127
+      <>
128
+        <Modal
129
+            title="推荐客户"
130
+            width={800}
131
+            destroyOnClose="true"
132
+            footer={null}
133
+            visible={this.state.visibleData.visible}
134
+            // onOk={() => this.handleOk()}
135
+            onCancel={(e) => this.handleCancel(e)}
136
+          >
137
+            {console.log('this.state.dataSource', this.state.dataSource)}
138
+            <Table dataSource={this.state.dataSource.records} rowKey="integralrecord" columns={columns} pagination={{ total: this.state.dataSource.total, onChange: e => this.onChange(e) }} />
139
+          </Modal>
140
+      </>
141
+    );
142
+  }
143
+}
144
+
145
+export default ModalRecommendRecord

+ 84
- 31
src/pages/customer/customerlist/customerDetail.jsx Datei anzeigen

@@ -1,5 +1,5 @@
1 1
 import React, { useState, useEffect } from 'react';
2
-import { Form, Table } from 'antd';
2
+import { Form, Table, Pagination } from 'antd';
3 3
 import { FormattedMessage } from 'umi-plugin-react/locale';
4 4
 import styles from './style.less';
5 5
 import apis from '../../../services/apis';
@@ -17,6 +17,7 @@ function header(props) {
17 17
   // eslint-disable-next-line react-hooks/rules-of-hooks
18 18
   const [data, setData] = useState([{ visitRecords: [] }])
19 19
   const [dataConsultant, setDataonsultant] = useState({})
20
+  const [intentionData, setIntentionData] = useState([])
20 21
 
21 22
   // eslint-disable-next-line react-hooks/rules-of-hooks
22 23
   useEffect(() => {
@@ -35,7 +36,10 @@ function header(props) {
35 36
       setDataonsultant(res.geoInfo)
36 37
     })
37 38
   }
38
-
39
+// 分页
40
+  const changePageNum = pageNumber => {
41
+    // getList({ pageNum: pageNumber, pageSize: 10, ...props.form.getFieldsValue() })
42
+  }
39 43
   const columns = [
40 44
     {
41 45
       title: '访问事件',
@@ -58,55 +62,104 @@ function header(props) {
58 62
       render: (_, record) => <span>{record.visitDuration === null ? 0 : record.visitDuration }秒</span>,
59 63
     },
60 64
   ]
65
+  // 意向
66
+  const intention = [
67
+    {
68
+      title: 'Name',
69
+      dataIndex: 'name',
70
+      width: 150,
71
+      render: (_, record) => <span>香颂半岛</span>,
72
+    },
73
+    {
74
+      title: 'Address',
75
+      dataIndex: 'address',
76
+      render: (_, record) => <span style={{ marginLeft: '55%' }}>22</span>,
77
+    },
78
+  ];
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
+}
61 88
   return (
62 89
     <>
63 90
       <div className={styles.cardBox}>
64 91
      {/* { console.log("data:",data),console.log("data:",dataConsultant)} */}
65
-        <div className={styles.leftBox}>
66
-          <p className={styles.tit}>置业顾问信息</p>
67
-          <img className={styles.touxiang} src={ data.consultant && data.consultant.picture } />
68
-          <p className={styles.infoItem}>姓名:{ data.consultant && data.consultant.name }</p>
69
-          <p className={styles.infoItem}>部门:{ data.consultant && data.consultant.department }</p>
70
-          <p className={styles.infoItem}>岗位:{ data.consultant && data.consultant.post }</p>
71
-          <p className={styles.infoItem}>号码:{ data.consultant && data.consultant.phone } </p>
72
-          <p className={styles.infoItem}>公司:{ data.consultant && data.consultant.company } </p>
73
-          <p className={styles.infoItem}>
74
-            所属项目:
75
-            {
76
-              data.consultant && data.consultant.projects.map((item, _) => <span>{item}</span>)
77
-            }
78
-          </p>
79
-        </div>
80 92
         <div className={styles.rightBox}>
81 93
           <p className={styles.tit}>客户信息</p>
82 94
           <img className={styles.touxiang} src={ data.picture && data.picture } />
83 95
           <div className={styles.right}>
84 96
             <p className={styles.rightItem}>用户名称:{ data.name }</p>
85 97
             <p className={styles.rightItem}>手机号码:{ data.phone }</p>
86
-            <p className={styles.rightItem}>来访渠道:活动分享</p>
98
+            <p className={styles.rightItem}>首次访问时间:{data.visitTime && moment(data.visitTime).format('YYYY-MM-DD')}</p>
99
+          </div>
100
+          <div className={styles.Centered}>
101
+          <p>访问时长:{ data.duration }秒</p>
102
+          <p>访问次数:{ data.visitTimes }</p>
103
+          <p className={styles.rightItem}>客户描述:{ data.describe }</p>
104
+          {/* <p>预约人数:{ data.visiteNum }</p> */}
105
+          </div>
106
+          <div className={styles.rightCentered}>
107
+          <p >需求类型:{ data.demandType }</p>
108
+          <p >价格区间:{data.priceRange }</p>
109
+          <p >物业类型:{ data.realtyManageType }</p>
110
+          {/* <p>预约人数:{ data.visiteNum }</p> */}
87 111
           </div>
88
-          <p className={styles.rightItem}>访问时长:{ data.duration }秒</p>
89
-          <p className={styles.rightItem}>访问次数:{ data.visitTimes }</p>
90
-          <p className={styles.rightItem}>预约人数:{ data.visiteNum }</p>
91
-          <p className={styles.rightItem}>首次访问时间:{data.visitTime && moment(data.visitTime).format('YYYY-MM-DD')}</p>
92
-          <p className={styles.rightItem}>预约到访时间:{data.appointmentTime && moment(data.appointmentTime).format('YYYY-MM-DD') }</p>
112
+          {/* <p className={styles.rightItem}>预约到访时间:{data.appointmentTime && moment(data.appointmentTime).format('YYYY-MM-DD') }</p> */}
93 113
           <div className={styles.rightInfo}>
94 114
             <p className={styles.rightItem}>国家:{ dataConsultant&&dataConsultant.country }</p>
95 115
             <p className={styles.rightItem}>省份:{ dataConsultant&&dataConsultant.provience }</p>
96 116
             <p className={styles.rightItem}>城市:{dataConsultant&&dataConsultant.city }</p>
97
-            <p className={styles.rightItem}>详细信息:</p>
98
-            <p className={styles.rightItem}>意向项目:{data.intention }</p>
99
-            <p className={styles.rightItem}>价格区间:{data.priceRange }</p>
100
-            <p className={styles.rightItem}>客户说明:{ data.verifyRemark }</p>
101
-            <p className={styles.rightItem}>客户描述:{ data.describe }</p>
102
-            <p className={styles.rightItem}>需求类型:{ data.demandType }</p>
103
-            <p className={styles.rightItem}>物业类型:{ data.realtyManageType }</p>
117
+            <p className={styles.rightItem}>来访渠道:活动分享</p>
118
+            {/* <p className={styles.rightItem}>详细信息:</p> */}
119
+            {/* <p className={styles.rightItem}>意向项目:{data.intention }</p> */} 
120
+            {/* <p className={styles.rightItem}>客户说明:{ data.verifyRemark }</p> */}
104 121
           </div>
105 122
         </div>
123
+        
124
+      </div>
125
+      <br></br>
126
+      <div className={styles.cardBox}>
127
+        <div className={styles.rightBoxCentre}>
128
+        <p className={styles.tit}>置业顾问信息</p>
129
+          <img className={styles.touxiang} src={ data.picture && data.picture } />
130
+          <p className={styles.infoItem}>曹玉文</p>
131
+          <div className={styles.right}>
132
+          {/* <p className={styles.infoItem}>姓名:{ data.consultant && data.consultant.name }</p>
133
+          <p className={styles.infoItem}>部门:{ data.consultant && data.consultant.department }</p> */}
134
+          <p className={styles.infoItem}>号码:{ data.consultant && data.consultant.phone } </p>
135
+          <p className={styles.infoItem}>岗位:{ data.consultant && data.consultant.post }</p>
136
+          </div>
137
+          <div className={styles.left}>
138
+          <p className={styles.infoItem}>公司:{ data.consultant && data.consultant.company } </p>
139
+          <p className={styles.infoItem}>
140
+            所属项目:
141
+            {
142
+              data.consultant && data.consultant.projects.map((item, _) => <span>{item}</span>)
143
+            }
144
+          </p>
145
+          </div>
146
+        </div>
147
+        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
148
+        <div className={styles.leftBoxCentre}>
149
+          <div className={styles.tit}>
150
+                <span>项目名称</span>
151
+                <span style={{ marginLeft: '47%' }}>项目名称</span>
152
+          </div>
153
+          {/* <img className={styles.touxiang} src={ data.picture && data.picture } /> */}
154
+          <div className={styles.infoItem}>
155
+          <Table columnWidth={10} showHeader={false} columns={intention} dataSource={intentionData} pagination={{ pageSize: 50 }} scroll={{ y: 240 }}/>,
156
+          </div>
157
+        </div>
158
+
106 159
       </div>
107 160
       <div className={styles.recordBox}>
108 161
         <p className={styles.tableName}>访问记录</p>
109
-        <Table dataSource={data.visitRecords} columns={columns} pagination={false} rowKey="customerDetail" />
162
+        <Table showQuickJumper defaultCurrent={1} dataSource={data.visitRecords} columns={columns} current={50} />
110 163
       </div>
111 164
 
112 165
     </>

+ 73
- 3
src/pages/customer/customerlist/index.jsx Datei anzeigen

@@ -8,6 +8,7 @@ import router from 'umi/router';
8 8
 
9 9
 import Attribution from './components/attribution'
10 10
 import IntegralRecord from './components/integralRecord'
11
+import ModalRecommendRecord from './components/recommend'
11 12
 import ChangeStatus from './components/changeStatus'
12 13
 import BuildSelect from '../../../components/SelectButton/BuildSelect'
13 14
 import AuthButton from '@/components/AuthButton';
@@ -50,6 +51,9 @@ function body(props) {
50 51
   const [statusVisibleData, setStatusVisibleData] = useState({ visible: false, customerId: '', status: '' })
51 52
   // 变更状态 ============= end
52 53
 
54
+  // 推荐客户
55
+  const [recommendVisibleData, setRecommendVisibleData] = useState({ visible: false, customerId: '' })
56
+
53 57
   // eslint-disable-next-line react-hooks/rules-of-hooks
54 58
   useEffect(() => {
55 59
     getList({ pageNumber: 1, pageSize: 10, customerType })
@@ -76,6 +80,7 @@ function body(props) {
76 80
     setRecordVisibleData({ visible: false, customerId: '' })
77 81
     setGVisibleData({ visible: false, customerId: '', realtyConsultant: '' })
78 82
     setStatusVisibleData({ visible: false, customerId: '', status: '' })
83
+    setRecommendVisibleData({ visible: false, customerId: '' })
79 84
   }
80 85
 
81 86
   // 提交事件
@@ -126,19 +131,30 @@ function body(props) {
126 131
     setGVisibleData({ visible: true, customerId: record.customerId, realtyConsultant: record.realtyConsultant, buildingId: record.buildingId })
127 132
     setRecordVisibleData({ visible: false, customerId: '' })
128 133
     setStatusVisibleData({ visible: false, customerId: '' })
134
+    setRecommendVisibleData({ visible: false, customerId: '' })
129 135
   }
130 136
 
131 137
   function showRecord(record) {
132 138
     setRecordVisibleData({ visible: true, customerId: record.customerId })
133 139
     setGVisibleData({ visible: false, customerId: '', realtyConsultant: '', buildingId: '' })
134 140
     setStatusVisibleData({ visible: false, customerId: '' })
141
+    setRecommendVisibleData({ visible: false, customerId: '' })
135 142
   }
136 143
 
137 144
   function showStatus(record) {
138 145
     setRecordVisibleData({ visible: false, customerId: '' })
139 146
     setGVisibleData({ visible: false, customerId: '', realtyConsultant: '', buildingId: '' })
147
+    setRecommendVisibleData({ visible: false, customerId: '' })
140 148
     setStatusVisibleData({ visible: true, customerId: record.customerId, status: record.status })
141 149
   }
150
+
151
+  // 推荐客户
152
+  function showRecommend(personId) {
153
+    setRecordVisibleData({ visible: false, customerId: '' })
154
+    setGVisibleData({ visible: false, customerId: '', realtyConsultant: '', buildingId: '' })
155
+    setStatusVisibleData({ visible: false, customerId: '', status: '' })
156
+    setRecommendVisibleData({ visible: true, customerId: personId })
157
+  }
142 158
   function toCustomerDateil(record) {
143 159
     router.push({
144 160
       pathname: '/customer/customerlist/customerDetail',
@@ -147,6 +163,15 @@ function body(props) {
147 163
       },
148 164
     });
149 165
   }
166
+  // 私客详情
167
+  function publicCustomerDetail(record) {
168
+    router.push({
169
+      pathname: '/customer/customerlist/publicCustomerDetail',
170
+      query: {
171
+        id: record.customerId,
172
+      },
173
+    });
174
+  }
150 175
 
151 176
   function exportCustomer () {
152 177
     const fieldsValue = getFieldsValue()
@@ -173,9 +198,18 @@ function body(props) {
173 198
 
174 199
   // 关闭调整归属的窗口
175 200
   function closeAttribution() {
201
+    alert(1)
176 202
     setGVisibleData({ visible: false, customerId: '', realtyConsultant: '', buildingId: '' })
177 203
     getList({ pageNum: 1, pageSize: 10, customerType, ...props.form.getFieldsValue() })
178 204
   }
205
+  // 回调关闭所有弹框
206
+  function closeAll() {
207
+    alert(1)
208
+    setRecordVisibleData({ visible: false, customerId: '' })
209
+    setGVisibleData({ visible: false, customerId: '', realtyConsultant: '', buildingId: '' })
210
+    setStatusVisibleData({ visible: false, customerId: '', status: '' })
211
+    setRecommendVisibleData({ visible: false, customerId: '' })
212
+  }
179 213
 
180 214
   const publicColumns = [
181 215
     {
@@ -209,6 +243,34 @@ function body(props) {
209 243
       align: 'center',
210 244
       width: '15%',
211 245
     },
246
+    {
247
+      title: '性别',
248
+      dataIndex: 'sex',
249
+      key: 'sex',
250
+      align: 'center',
251
+      width: '10%',
252
+      // eslint-disable-next-line no-nested-ternary
253
+      render: (_, record) => <><span>{record.sex === 1 ? '男' : record.sex === 2 ? '女' : '未知'}</span></>,
254
+    },
255
+    {
256
+      title: '操作',
257
+      dataIndex: 'customerId',
258
+      key: 'customerId',
259
+      align: 'center',
260
+      width: '25%',
261
+      // eslint-disable-next-line no-nested-ternary
262
+      render: (_, record) => (
263
+        <>
264
+          <AuthButton>
265
+            <Button className={customerType === 'private' ? Styles.displayS : Styles.text } type="link" onClick={() => publicCustomerDetail(record)}>查看详情</Button>
266
+          </AuthButton>
267
+          &nbsp;&nbsp;
268
+          <AuthButton>
269
+            <Button className={customerType === 'private' ? Styles.displayS : Styles.text } type="link" onClick={() => showRecommend(record.personId)}>推荐客户</Button>
270
+          </AuthButton>
271
+        </>
272
+      ),
273
+    },
212 274
   ]
213 275
 
214 276
   const privateColumns = [
@@ -290,12 +352,13 @@ function body(props) {
290 352
       // eslint-disable-next-line no-nested-ternary
291 353
       render: (_, record) => (
292 354
         <>
355
+            &nbsp;
293 356
           <AuthButton name="admin.customer.recommend.edit.id.put" noRight={null}>
294 357
             <Button className={customerType === 'private' ? Styles.text : Styles.displayS} type="link" onClick={() => showStatus(record)}>变更状态</Button>
295 358
             &nbsp;&nbsp;
296 359
             <Button className={customerType === 'private' ? Styles.text : Styles.displayS} type="link" onClick={() => showGM(record)}>调整归属</Button>
297 360
           </AuthButton>
298
-            <br />
361
+            &nbsp;&nbsp;
299 362
           <AuthButton name="admin.customer.recommend.get" noRight={null}>
300 363
             <Button className={customerType === 'private' ? Styles.text : Styles.displayS} type="link" onClick={() => toCustomerDateil(record)}>查看详情</Button>
301 364
           </AuthButton>
@@ -303,6 +366,10 @@ function body(props) {
303 366
           <AuthButton name="admin.mine.taPointsRecords.id.get" noRight={null}>
304 367
             <Button className={customerType === 'private' ? Styles.text : Styles.displayS} type="link" onClick={() => showRecord(record)}>积分记录</Button>
305 368
           </AuthButton>
369
+            &nbsp;
370
+          <AuthButton name="admin.mine.taPointsRecords.id.get" noRight={null}>
371
+            <Button className={customerType === 'private' ? Styles.text : Styles.displayS} type="link" onClick={() => showRecommend(record.customerId)}>推荐客户</Button>
372
+          </AuthButton>
306 373
         </>
307 374
       ),
308 375
     },
@@ -383,10 +450,13 @@ function body(props) {
383 450
       <Attribution visibleData={gVisibleData} onCancel={() => closeAttribution()}/>
384 451
 
385 452
       {/* 积分记录 */}
386
-      <IntegralRecord visibleData={recordVisibleData} />
453
+      <IntegralRecord visibleData={recordVisibleData} onCancel={() => closeAll()} />
387 454
 
388 455
       {/* 变更状态 */}
389
-      <ChangeStatus visibleData={statusVisibleData} />
456
+      <ChangeStatus visibleData={statusVisibleData} onCancel={() => closeAll()}/>
457
+
458
+      {/* 推荐客户 */}
459
+      <ModalRecommendRecord visibleData={recommendVisibleData} onCancel={() => closeAll()}/>
390 460
     </>
391 461
   );
392 462
 }

+ 137
- 0
src/pages/customer/customerlist/publicCustomerDetail.jsx Datei anzeigen

@@ -0,0 +1,137 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Table, Pagination } from 'antd';
3
+import { FormattedMessage } from 'umi-plugin-react/locale';
4
+import publicStyle from './publicStyle.less';
5
+import apis from '../../../services/apis';
6
+import request from '../../../utils/request';
7
+import moment from 'moment';
8
+
9
+import router from 'umi/router';
10
+
11
+
12
+function header(props) {
13
+  /**
14
+   * @param {*} props
15
+   * @returns
16
+   */
17
+  // eslint-disable-next-line react-hooks/rules-of-hooks
18
+  const [data, setData] = useState([{ visitRecords: [] }])
19
+  const [dataConsultant, setDataonsultant] = useState({})
20
+  const [intentionData, setIntentionData] = useState([])
21
+
22
+  // eslint-disable-next-line react-hooks/rules-of-hooks
23
+  useEffect(() => {
24
+    getById()
25
+  }, [])
26
+
27
+  // 查询
28
+  function getById(params) {
29
+    const { id } = props.location.query;
30
+    if (id === '' || id === undefined) {
31
+      return
32
+    }
33
+
34
+    request({ ...apis.customer.CustomerRecommendGet, urlData: { id }, params: { ...params } }).then(res => {
35
+      setData(res)
36
+      setDataonsultant(res.geoInfo)
37
+    })
38
+  }
39
+// 分页
40
+  const changePageNum = pageNumber => {
41
+    // getList({ pageNum: pageNumber, pageSize: 10, ...props.form.getFieldsValue() })
42
+  }
43
+  const columns = [
44
+    {
45
+      title: '访问事件',
46
+      dataIndex: 'activity',
47
+      key: 'activity',
48
+      align: 'center',
49
+    },
50
+    {
51
+      title: '访问时间',
52
+      dataIndex: 'visitTime',
53
+      key: 'visitTime',
54
+      align: 'center',
55
+
56
+    },
57
+    {
58
+      title: '停留时间',
59
+      dataIndex: 'visitDuration',
60
+      key: 'visitDuration',
61
+      align: 'center',
62
+      render: (_, record) => <span>{record.visitDuration === null ? 0 : record.visitDuration }秒</span>,
63
+    },
64
+  ]
65
+  // 意向
66
+  const intention = [
67
+    {
68
+      title: 'Name',
69
+      dataIndex: 'name',
70
+      width: 150,
71
+      render: (_, record) => <span>香颂半岛</span>,
72
+    },
73
+    {
74
+      title: 'Address',
75
+      dataIndex: 'address',
76
+      render: (_, record) => <span style={{ marginLeft: '55%' }}>22</span>,
77
+    },
78
+  ];
79
+
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 (
89
+    <>
90
+      <div className={publicStyle.cardBox}>
91
+     {/* { console.log("data:",data),console.log("data:",dataConsultant)} */}
92
+        <div className={publicStyle.rightBox}>
93
+          <p className={publicStyle.tit}>客户信息</p>
94
+          <img className={publicStyle.touxiang} src={ data.picture && data.picture } />
95
+          <div className={publicStyle.right}>
96
+            <p className={publicStyle.rightItem}>用户名称:{ data.name }</p>
97
+            <p className={publicStyle.rightItem}>手机号码:{ data.phone }</p>
98
+            <p className={publicStyle.rightItem}>首次访问时间:{data.visitTime && moment(data.visitTime).format('YYYY-MM-DD')}</p>
99
+          </div>
100
+          <div className={publicStyle.Centered}>
101
+          <p>访问时长:{ data.duration }秒</p>
102
+          <p>访问次数:{ data.visitTimes }</p>
103
+          <p className={publicStyle.rightItem}>来访渠道:活动分享</p>
104
+          {/* <p>预约人数:{ data.visiteNum }</p> */}
105
+          </div>
106
+          {/* <p className={styles.rightItem}>预约到访时间:{data.appointmentTime && moment(data.appointmentTime).format('YYYY-MM-DD') }</p> */}
107
+          <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>
111
+            {/* <p className={styles.rightItem}>详细信息:</p> */}
112
+            {/* <p className={styles.rightItem}>意向项目:{data.intention }</p> */} 
113
+            {/* <p className={styles.rightItem}>客户说明:{ data.verifyRemark }</p> */}
114
+          </div>
115
+        </div>
116
+        {/* { console.log("data:",data),console.log("data:",dataConsultant)} */}
117
+        <div className={publicStyle.leftBoxCentre}>
118
+          <div className={publicStyle.tit}>
119
+                <span>项目名称</span>
120
+                <span style={{ marginLeft: '47%' }}>项目名称</span>
121
+          </div>
122
+          {/* <img className={styles.touxiang} src={ data.picture && data.picture } /> */}
123
+          <div className={publicStyle.infoItem}>
124
+          <Table columnWidth={10} showHeader={false} columns={intention} dataSource={intentionData} pagination={{ pageSize: 50 }} scroll={{ y: 240 }}/>,
125
+          </div>
126
+        </div>
127
+      </div>
128
+      <div className={publicStyle.recordBox}>
129
+        <p className={publicStyle.tableName}>访问记录</p>
130
+        <Table dataSource={data.visitRecords} columns={columns} rowKey="customerDetail" onChange={changePageNum} showQuickJumper/>
131
+      </div>
132
+    </>
133
+  )
134
+}
135
+const WrappedHeader = Form.create({ name: 'header' })(header);
136
+
137
+export default WrappedHeader

+ 209
- 0
src/pages/customer/customerlist/publicStyle.less Datei anzeigen

@@ -0,0 +1,209 @@
1
+.SubmitButton {
2
+  background: rgba(239,39,58,1);
3
+  border-radius: 7px;
4
+  border: 0px;
5
+}
6
+.text {
7
+  color: rgba(239,39,58,1);
8
+}
9
+.SelectFrom {
10
+  width: 180px;
11
+  background: #ffffff;
12
+  border-radius: 7px;
13
+  border: 1px solid #dbdbdb;
14
+}
15
+.addButton {
16
+  background: #50be00;
17
+  border-radius: 4px;
18
+  border: 0px;
19
+  margin: 10px 0px;
20
+}
21
+.cardText {
22
+  color: #333;
23
+  display: flex;
24
+  align-items: center;
25
+  position: relative;
26
+  line-height: 1.5;
27
+  font-size: 0.106rem;
28
+  margin-bottom: 0.08rem;
29
+
30
+}
31
+.cardItem{
32
+  color: #666;
33
+  display: flex;
34
+  align-items: center; 
35
+  line-height: 1.5;
36
+  font-size: 0.106rem;
37
+  margin-bottom: 0.08rem; 
38
+}
39
+.ediText {
40
+  font-size: 0.106rem;
41
+  color: #ff925c;
42
+  line-height: 24px;
43
+  position: absolute;
44
+  right: 0;
45
+}
46
+.title{
47
+  display: inline-block;
48
+  width:  0.54rem;
49
+  justify-content: space-between;
50
+  text-align: justify;
51
+  text-align-last:justify
52
+}
53
+
54
+.address { 
55
+  width: 400px;
56
+  height: 24px; 
57
+  text-overflow: ellipsis; 
58
+  white-space: nowrap;
59
+  overflow: hidden;
60
+}
61
+
62
+.pitchButton { 
63
+  border-color: rgba(255,126,72,1);
64
+  background-color: rgba(255,126,72,1);
65
+  color: rgba(255,255,255,1); 
66
+}
67
+.noButton {
68
+  border-color: rgba(255,126,72,1);
69
+  color: rgba(255,126,72,1);
70
+}
71
+.displayS {
72
+  display: none;
73
+}
74
+
75
+
76
+// 客户详情样式
77
+.cardBox{
78
+  display: flex;
79
+  .leftBox{
80
+    width:90%;
81
+    min-width:28.5%;
82
+    height:315px;
83
+    background:rgba(255,255,255,1);
84
+    box-shadow:0px 0px 16px 2px rgba(0,0,0,0.12);
85
+    border-radius:8px;
86
+    display: inline-block;
87
+    margin-right: 30px;
88
+    padding: 30px;
89
+    overflow: hidden;
90
+  }
91
+  .rightBox{
92
+    width:865px;
93
+    min-width:342px;
94
+    height:290px;
95
+    background:rgba(255,255,255,1);
96
+    box-shadow:0px 0px 16px 2px rgba(0,0,0,0.12);
97
+    border-radius:8px;
98
+    display: inline-block;
99
+    margin-right: 30px;
100
+    padding: 30px;
101
+    overflow: hidden;
102
+  }
103
+  .rightBox{
104
+    width:-webkit-fill-available;
105
+    height:315px;
106
+    min-width: 70%;
107
+    background:rgba(255,255,255,1);
108
+    box-shadow:0px 0px 16px 2px rgba(0,0,0,0.12);
109
+    border-radius:8px;
110
+    display: inline-block;
111
+    padding: 30px;
112
+    overflow: hidden;
113
+    position: relative;
114
+  }
115
+  .rightBoxCentre{
116
+    width:865px;
117
+    height:315px;
118
+    min-width: 60%;
119
+    background:rgba(255,255,255,1);
120
+    box-shadow:0px 0px 16px 2px rgba(0,0,0,0.12);
121
+    border-radius:8px;
122
+    display: inline-block;
123
+    padding: 30px;
124
+    overflow: hidden;
125
+    position: relative;
126
+  }
127
+  .leftBoxCentre{
128
+    width:100%;
129
+    height:315px;
130
+    background:rgba(255,255,255,1);
131
+    box-shadow:0px 0px 16px 2px rgba(0,0,0,0.12);
132
+    border-radius:8px;
133
+    display: inline-block;
134
+    padding: 30px;
135
+    overflow: hidden;
136
+    position: relative;
137
+  }
138
+  .tit{
139
+    font-size:24px;
140
+    font-weight:600;
141
+    color:#222;
142
+    margin: 10px 0 0 0;
143
+  }
144
+  .touxiang{
145
+    width: 120px;
146
+    width: 120px;
147
+    border-radius: 6px;
148
+    margin: 30px 0 20px 0;
149
+  }
150
+  .infoItem{
151
+    color:#666;
152
+    font-size: 19px;
153
+    margin: 0 0 10px 0;
154
+    
155
+  }
156
+  .rightItem{
157
+    color:#666;
158
+    font-size: 19px;
159
+    margin: 0 0 15px 0;
160
+  }
161
+  .right{
162
+    position: absolute;
163
+    top:108px;
164
+    left:170px;
165
+  }
166
+  .left{
167
+    position: absolute;
168
+    top:108px;
169
+    left:60%;
170
+  }
171
+  .rightInfo{
172
+    position: absolute;
173
+    top:108px;
174
+    left:80%;
175
+  }
176
+
177
+  .Centered{
178
+    position: absolute;
179
+    top:108px;
180
+    left:40%;
181
+    margin: 0 0 15px 0;
182
+    color:#666;
183
+    font-size: 19px;
184
+  }
185
+
186
+  .rightCentered{
187
+    position: absolute;
188
+    top:108px;
189
+    left:55%;
190
+    margin: 0 0 15px 0;
191
+    color:#666;
192
+    font-size: 19px;
193
+  }
194
+  
195
+}
196
+.recordBox{
197
+  width:100%;
198
+  background:rgba(255,255,255,1);
199
+  box-shadow:0px 0px 16px 2px rgba(0,0,0,0.12);
200
+  border-radius:8px;
201
+  margin-top: 30px;
202
+  padding: 30px;
203
+  .tableName{
204
+    font-size:24px;
205
+    font-weight:600;
206
+    color:#222;
207
+  }
208
+}
209
+

+ 64
- 6
src/pages/customer/customerlist/style.less Datei anzeigen

@@ -77,9 +77,21 @@
77 77
 .cardBox{
78 78
   display: flex;
79 79
   .leftBox{
80
-    width:342px;
80
+    width:1000px;
81 81
     min-width:342px;
82
-    height:511px;
82
+    height:1000px;
83
+    background:rgba(255,255,255,1);
84
+    box-shadow:0px 0px 16px 2px rgba(0,0,0,0.12);
85
+    border-radius:8px;
86
+    display: inline-block;
87
+    margin-right: 30px;
88
+    padding: 30px;
89
+    overflow: hidden;
90
+  }
91
+  .rightBox{
92
+    width:865px;
93
+    min-width:342px;
94
+    height:290px;
83 95
     background:rgba(255,255,255,1);
84 96
     box-shadow:0px 0px 16px 2px rgba(0,0,0,0.12);
85 97
     border-radius:8px;
@@ -90,8 +102,31 @@
90 102
   }
91 103
   .rightBox{
92 104
     width:-webkit-fill-available;
93
-    height:511px;
94
-    min-width: 800px;
105
+    height:315px;
106
+    min-width: 100%;
107
+    background:rgba(255,255,255,1);
108
+    box-shadow:0px 0px 16px 2px rgba(0,0,0,0.12);
109
+    border-radius:8px;
110
+    display: inline-block;
111
+    padding: 30px;
112
+    overflow: hidden;
113
+    position: relative;
114
+  }
115
+  .rightBoxCentre{
116
+    width:865px;
117
+    height:315px;
118
+    min-width: 60%;
119
+    background:rgba(255,255,255,1);
120
+    box-shadow:0px 0px 16px 2px rgba(0,0,0,0.12);
121
+    border-radius:8px;
122
+    display: inline-block;
123
+    padding: 30px;
124
+    overflow: hidden;
125
+    position: relative;
126
+  }
127
+  .leftBoxCentre{
128
+    width:100%;
129
+    height:315px;
95 130
     background:rgba(255,255,255,1);
96 131
     box-shadow:0px 0px 16px 2px rgba(0,0,0,0.12);
97 132
     border-radius:8px;
@@ -128,10 +163,33 @@
128 163
     top:108px;
129 164
     left:170px;
130 165
   }
166
+  .left{
167
+    position: absolute;
168
+    top:108px;
169
+    left:60%;
170
+  }
131 171
   .rightInfo{
132 172
     position: absolute;
133
-    top:50px;
134
-    left:50%;
173
+    top:108px;
174
+    left:80%;
175
+  }
176
+
177
+  .Centered{
178
+    position: absolute;
179
+    top:108px;
180
+    left:30%;
181
+    margin: 0 0 15px 0;
182
+    color:#666;
183
+    font-size: 19px;
184
+  }
185
+
186
+  .rightCentered{
187
+    position: absolute;
188
+    top:108px;
189
+    left:55%;
190
+    margin: 0 0 15px 0;
191
+    color:#666;
192
+    font-size: 19px;
135 193
   }
136 194
   
137 195
 }

+ 13
- 0
src/services/apis.js Datei anzeigen

@@ -1,4 +1,6 @@
1 1
 const prefix = '/api/admin'
2
+// 高德地图
3
+const amapPrefix = '/gaode_amap'
2 4
 
3 5
 export default {
4 6
   image: {
@@ -286,6 +288,11 @@ export default {
286 288
       url: `${prefix}/customer/recommend/export`,
287 289
       action: 'admin.customer.recommend.export.get',
288 290
     },
291
+    recommendClient: {
292
+      method: 'GET',
293
+      url: `${prefix}/customer/recommend/:id`,
294
+      action: 'admin.customer.recommend.get',
295
+    },
289 296
   },
290 297
   indexEcharts: {
291 298
     list:{
@@ -916,5 +923,11 @@ export default {
916 923
     method: 'GET',
917 924
     action: 'admin.posterTemplate.get',
918 925
   },
926
+ },
927
+ amap: { // 高德地图
928
+   webService: { // Web服务Api ---- 周边搜索
929
+     url: `${amapPrefix}/place/around`,
930
+     method: 'GET',
931
+   },
919 932
  }
920 933
 }

+ 7
- 3
src/utils/request.js Datei anzeigen

@@ -65,7 +65,6 @@ request.interceptors.request.use((url, options) => {
65 65
 });
66 66
 
67 67
 request.interceptors.response.use(async (response, options) => {
68
-
69 68
   if (response && response.status) {
70 69
     if (response.status != 200) {
71 70
       const errorText = codeMessage[response.status] || response.statusText;
@@ -76,12 +75,17 @@ request.interceptors.response.use(async (response, options) => {
76 75
       });
77 76
       throw new Error(response.statusText);
78 77
     } else {
79
-      console.log('response.headers: ', response.headers)
80
-      console.log('response.headers.Content-Type: ', response.headers.get('Content-Type'))
78
+      // console.log('response.headers: ', response.headers)
79
+      // console.log('response.headers.Content-Type: ', response.headers.get('Content-Type'))
81 80
       if (response.headers.get('Content-Type') === 'application/octet-stream;charset=utf-8') {
82 81
         return await response.clone().blob();
83 82
       }
84 83
 
84
+      // 高德地图的数据,直接返回
85
+      if (response.url.indexOf('gaode_amap') !== -1) {
86
+        return await response.clone().json();
87
+      }
88
+
85 89
       const { code, data, message } = await response.clone().json();
86 90
       if (code != 1000) {
87 91
         if (code === 1001) {