Procházet zdrojové kódy

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

傅行帆 před 5 roky
rodič
revize
e0bf9d7465

+ 6
- 5
src/pages/house/edit/components/shareRecord.jsx Zobrazit soubor

@@ -14,10 +14,11 @@ const { TextArea } = Input;
14 14
 
15 15
 const header = (props) => {
16 16
   const [ data, setData ] = useState({})
17
-//   const [page, changePage] = useState({})
17
+  const [page, changePage] = useState({})
18
+  const {salesBatchId} = props.salesBatchId
18 19
 
19 20
   useEffect(() => {
20
-    getList({ pageNum: 1, pageSize: 10, salesBatchId : 1});
21
+    getList({ pageNum: 1, pageSize: 10, salesBatchId : props.salesBatchId});
21 22
   },[])
22 23
 
23 24
   // 查询列表
@@ -71,7 +72,7 @@ const header = (props) => {
71 72
       dataIndex: 'shareType',
72 73
       key: 'shareType',
73 74
       align: 'center',
74
-      render: (x, row) => <span></span>
75
+      render: (x, row) => <span>{ row.shareType === 'housePoster' ? '海报分享' : '小程序分享' }</span>
75 76
     },
76 77
     {
77 78
       title: '分享内容',
@@ -83,7 +84,7 @@ const header = (props) => {
83 84
   ];
84 85
   
85 86
   const changePageNum = (pageNumber) => {
86
-      getList({ pageNum: pageNumber, pageSize: 10, ...props.form.getFieldsValue() })
87
+      getList({ pageNum: pageNumber, pageSize: 10, salesBatchId : props.salesBatchId, ...props.form.getFieldsValue() })
87 88
   }
88 89
 
89 90
   // 提交事件
@@ -116,7 +117,7 @@ const handleSubmit = (e, props) => {
116 117
           )}
117 118
         </Form.Item>
118 119
         <Form.Item>
119
-          {getFieldDecorator('showPosition')(
120
+          {getFieldDecorator('personType')(
120 121
             <Select style={{ width: '180px' }} placeholder="身份">
121 122
               <Option value="Realty Consultant">置业顾问</Option>
122 123
               <Option value="customer">用户</Option>

+ 142
- 4
src/pages/house/edit/components/visitRecord.jsx Zobrazit soubor

@@ -1,15 +1,153 @@
1 1
 import React, { useState, useEffect } from 'react';
2
-import { Form, Input, Button, Icon, Select, Tabs, Radio, DatePicker, message, Upload } from 'antd';
2
+import { Form, Input, Button, Icon, Select, Tabs, Radio, DatePicker, message, Upload, Table, Pagination } from 'antd';
3 3
 import { FormattedMessage } from 'umi-plugin-react/locale';
4 4
 import moment from 'moment';
5 5
 import router from 'umi/router';
6 6
 import apis from '../../../../services/apis';
7
+import BuildSelect from '../../../../components/SelectButton/BuildSelect';
8
+import AuthButton from '@/components/AuthButton';
9
+import styles from './style.less';
10
+import request from '../../../../utils/request';
7 11
 
8 12
 const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
9 13
 const { TextArea } = Input;
10 14
 
11
-const VisitRecord = props => {
12
-  return <div><span>访问记录</span></div>
13
-}
15
+const header = (props) => {
16
+  const [ data, setData ] = useState({})
17
+  // const [page, changePage] = useState({})
18
+  const {salesBatchId} = props.salesBatchId
19
+
20
+  useEffect(() => {
21
+    getList({ pageNum: 1, pageSize: 10, salesBatchId : salesBatchId});
22
+  },[])
23
+
24
+  // 查询列表
25
+  const getList = (params) => {
26
+    request({ ...apis.house.taHouseVisit, salesBatchId : salesBatchId, params: { ...params },}).then((data) => {
27
+        console.log(data)
28
+        setData(data)
29
+    })
30
+  }
31
+  
32
+  const columns = [
33
+    {
34
+      title: '头像',
35
+      align: 'center',
36
+      render: (text, records) => <img src={records.photoOravatar} width={50} height={50} />,
37
+    },
38
+    {
39
+      title: '昵称',
40
+      dataIndex: 'nameOrnick',
41
+      key: 'nameOrnick',
42
+      align: 'center',
43
+    },
44
+    {
45
+      title: '姓名',
46
+      dataIndex: 'name',
47
+      key: 'name',
48
+      align: 'center',
49
+    },
50
+    {
51
+      title: '手机号',
52
+      dataIndex: 'phone',
53
+      key: 'phone',
54
+      align: 'center',
55
+    },
56
+    {
57
+      title: '身份',
58
+      dataIndex: 'personType',
59
+      key: 'personType',
60
+      align: 'center',
61
+      render: (personType) => <span>{ personType === 'Realty Consultant' ? '置业顾问' : personType === 'customer' ? '用户' : '游客' }</span>
62
+    },
63
+    {
64
+      title: '访问时间',
65
+      dataIndex: 'createDate',
66
+      key: 'createDate',
67
+      align: 'center',
68
+      render: (x, row) => <><span>{moment(row.createDate).format('YYYY-MM-DD')}</span></>
69
+    },
70
+    {
71
+      title: '进入场景',
72
+      dataIndex: 'sceneName',
73
+      key: 'sceneName',
74
+      align: 'center',
75
+      render: (x, row) => <span>{ row.sceneName === 'mini_program_code' ? '扫码进入' : row.sceneName === 'search' ? '自主进入' : '小程序分享进入' }</span>
76
+    },
77
+    {
78
+      title: '分享内容',
79
+      dataIndex: 'salesBatchName',
80
+      key: 'salesBatchName',
81
+      align: 'center',
82
+      render: (x, row) => <span>{ row.salesBatchName }的房源列表</span>
83
+    },
84
+  ];
85
+  
86
+  const changePageNum = (pageNumber) => {
87
+      getList({ pageNum: pageNumber, pageSize: 10, salesBatchId : props.salesBatchId, ...props.form.getFieldsValue() })
88
+  }
89
+
90
+  // 提交事件
91
+const handleSubmit = (e, props) => {
92
+    e.preventDefault();
93
+    props.form.validateFields((err, values) => {
94
+      if (!err) {
95
+        console.log('提交数据: ', values)
96
+        getList({ pageNum: 1, pageSize: 10, ...values})
97
+      }
98
+    });
99
+  }
14 100
 
101
+   //重置搜索
102
+   function handleReset() {
103
+    props.form.resetFields();
104
+  }
105
+
106
+  const { getFieldDecorator } = props.form
107
+  return (
108
+
109
+    <>
110
+      <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
111
+        <Form.Item>
112
+          {getFieldDecorator('shareType')(
113
+            <Select style={{ width: '180px' }} placeholder="进入场景">
114
+              <Option value="mini_program_code">扫码进入</Option>
115
+              <Option value="buddy_share">小程序分享进入</Option>
116
+              <Option value="search">自主进入</Option>
117
+            </Select>,
118
+          )}
119
+        </Form.Item>
120
+        <Form.Item>
121
+          {getFieldDecorator('showPosition')(
122
+            <Select style={{ width: '180px' }} placeholder="身份">
123
+              <Option value="Realty Consultant">置业顾问</Option>
124
+              <Option value="customer">用户</Option>
125
+              <Option value="drift">游客</Option>
126
+            </Select>,
127
+          )}
128
+        </Form.Item>
129
+        <Form.Item>
130
+          {getFieldDecorator('phone')(
131
+            <Input placeholder="手机号"/>
132
+          )}
133
+        </Form.Item>
134
+        <Form.Item>
135
+        <AuthButton name="admin.extendContent.search" noRight={null}>
136
+          <Button type="primary" htmlType="submit" className={styles.searchBtn}>
137
+            搜索
138
+          </Button>
139
+          </AuthButton>
140
+          <Button style={{ marginLeft: 8 }} onClick={handleReset}>
141
+              重置
142
+            </Button>
143
+        </Form.Item>
144
+      </Form>
145
+      <Table dataSource={data.records} columns={columns} pagination={false} rowKey="carouseFigureList"/>
146
+      <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
147
+        <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} current={data.current}/>
148
+      </div>
149
+    </>
150
+  )
151
+}
152
+const VisitRecord = Form.create({ name: 'header' })(header);
15 153
 export default VisitRecord

+ 2
- 2
src/pages/house/edit/index.jsx Zobrazit soubor

@@ -71,8 +71,8 @@ function EditHouse(props) {
71 71
         { (tab === 'share' && <Share salesBatchId={{ salesBatchId: salesBatchData.salesBatchId || (props.location.query && props.location.query.id) }}/>)}
72 72
         { (tab === 'preselectionImg' && <PreselectionImg />)}
73 73
         { (tab === 'preselectionRecord' && <PreselectionRecord />)}
74
-        { (tab === 'shareRecord' && <ShareRecord />)}
75
-        { (tab === 'visitRecord' && <VisitRecord />)}
74
+        { (tab === 'shareRecord' && <ShareRecord salesBatchId={{ salesBatchId: salesBatchData.salesBatchId || (props.location.query && props.location.query.id) }}/>)}
75
+        { (tab === 'visitRecord' && <VisitRecord salesBatchId={{ salesBatchId: salesBatchData.salesBatchId || (props.location.query && props.location.query.id) }}/>)}
76 76
       </div>
77 77
     </>
78 78
   )

+ 5
- 0
src/services/apis.js Zobrazit soubor

@@ -1099,6 +1099,11 @@ export default {
1099 1099
     method: 'GET',
1100 1100
     action: 'admin.taHouseShare.get',
1101 1101
   },
1102
+  taHouseVisit:{
1103
+    url: `${prefix}/taHouseVisit`,
1104
+    method: 'GET',
1105
+    action: 'admin.taHouseVisit.get',
1106
+  },
1102 1107
   getTaSalesBatch:{
1103 1108
     url: `${prefix}/taSalesBatch/:id`,
1104 1109
     method: 'get',