Ver código fonte

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

傅行帆 5 anos atrás
pai
commit
90e325b206

+ 21
- 9
src/components/SelectButton/BuildSelect2.jsx Ver arquivo

@@ -30,9 +30,9 @@ const BuildingSelect2 = props => {
30 30
 
31 31
   const getBuildList = e => {
32 32
     request({ ...apis.building.buildingSelect, params: { cityId: props.cityId, pageNum: 1, pageSize: 999 } }).then(data => {
33
-        setData(data)
34
-        checkValue(data)
35
-        // 默认选中第一个
33
+      setData(data)
34
+      checkValue(data)
35
+      // 默认选中第一个
36 36
     })
37 37
   }
38 38
 
@@ -46,20 +46,32 @@ const BuildingSelect2 = props => {
46 46
     }
47 47
   }
48 48
 
49
+  const onChange = (buildingId) => {
50
+    const building = data.filter(x => buildingId === x.buildingId)[0]
51
+
52
+    props.onChange(buildingId, building)
53
+    // if (props.value) {
54
+    //   const tempData = data.filter(f => f.buildingId == props.value)
55
+    //   const va = (tempData.length > 0) ? props.value : '项目已下线,请重新选择项目'
56
+    //   props.onChange(va)
57
+
58
+    // }={props.onChange}building.buildingId
59
+  }
60
+
49 61
   return (
50
-      <Select
62
+    <Select
51 63
       showSearch
52 64
       value={props.value}
53 65
       style={{ width: '300px' }}
54 66
       placeholder="请选择项目"
55
-      onChange={props.onChange}
67
+      onChange={ onChange}
56 68
       filterOption={(input, option) =>
57 69
         option.props.children && option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
58 70
       }>
59
-          {data.map(building => (
60
-            <Option key={building.buildingId} value={building.buildingId}>{building.buildingName}</Option>
61
-          ))}
62
-      </Select>
71
+      {data.map(building => (
72
+        <Option key={building.buildingId} value={building.buildingId}>{building.buildingName}</Option>
73
+      ))}
74
+    </Select>
63 75
   )
64 76
 }
65 77
 export default BuildingSelect2

+ 12
- 12
src/components/SelectButton/QrcodeType.jsx Ver arquivo

@@ -18,43 +18,43 @@ const qrcodeType = props => {
18 18
     const data = [
19 19
         {
20 20
             name: '项目',
21
-            value: 'building',
22
-            visible: true,
21
+            value: 'project',
22
+            visible,
23 23
         },
24 24
         {
25
-            name: '报名活动',
25
+            name: '常规活动',
26 26
             value: 'activity',
27
-            visible: true,
27
+            visible,
28 28
         },
29 29
         {
30 30
             name: '助力活动',
31 31
             value: 'help',
32
-            visible: true,
32
+            visible,
33 33
         },
34 34
         {
35 35
             name: '拼团活动',
36 36
             value: 'group',
37
-            visible: true,
37
+            visible,
38 38
         },
39 39
         {
40 40
             name: 'H5活动',
41 41
             value: 'h5',
42
-            visible,
42
+            visible: true,
43 43
         },
44 44
         {
45 45
             name: '直播活动',
46 46
             value: 'live',
47
-            visible,
47
+            visible: true,
48 48
         },
49 49
         {
50 50
             name: '资讯',
51 51
             value: 'news',
52
-            visible: true,
52
+            visible,
53 53
         },
54 54
         {
55
-            name: '在线选房',
56
-            value: 'house',
57
-            visible: true,
55
+            name: '销售批次',
56
+            value: 'salesBatch',
57
+            visible,
58 58
         },
59 59
     ]
60 60
 

+ 1
- 1
src/pages/customer/customerlist/index.jsx Ver arquivo

@@ -77,7 +77,7 @@ function body(props) {
77 77
     if (localStorage.getItem("state")) {
78 78
       console.log(localStorage.getItem("state"), 'state')
79 79
       if (JSON.parse(localStorage.getItem("state")) == 'private') {
80
-        const localStorageValue = JSON.parse(localStorage.getItem("priPageParams"))
80
+        const localStorageValue = JSON.parse(localStorage.getItem('priPageParams'))
81 81
         localStorageValue.startCreateDate = localStorageDate(localStorageValue.startCreateDate)
82 82
         localStorageValue.endCreateDate = localStorageDate(localStorageValue.endCreateDate)
83 83
         props.form.setFieldsValue(localStorageValue);

+ 55
- 17
src/pages/qrcode/qrcodelist/add.jsx Ver arquivo

@@ -20,18 +20,24 @@ const header = props => {
20 20
 
21 21
     const [visible, setVisible] = useState(true)
22 22
 
23
+    const [targetType, setTargetType] = useState()
24
+
25
+    const [buildingId, setBuildingId] = useState()
26
+
27
+    const [targetName, setTargetName] = useState()
28
+
23 29
     useEffect(() => {
24 30
 
25 31
     }, [])
26 32
 
27 33
     function addQrcode(params) {
28
-        // request({ ...apis.qrcode.add, data: { ...params } }).then((data) => {
29
-        //     //   setData(data)
30
-        //     //   router.go(-1)
31
-        // }).catch((err) => {
32
-        //     console.log(err)
33
-        //     message.info(err.msg || err.message)
34
-        // })
34
+        request({ ...apis.qrcode.add, data: { ...params } }).then((data) => {
35
+            //   setData(data)
36
+            router.go(-1)
37
+        }).catch((err) => {
38
+            console.log(err)
39
+            message.info(err.msg || err.message)
40
+        })
35 41
     }
36 42
 
37 43
     function handleSubmit(e) {
@@ -39,7 +45,14 @@ const header = props => {
39 45
         props.form.validateFields((err, values) => {
40 46
             if (!err) {
41 47
                 console.log(values)
42
-                // addQrcode(values)
48
+                if (targetType === 'project') {
49
+                    values.targetId = values.buildingId
50
+                    values.targetName = targetName
51
+                }else{
52
+                    values.targetId = values.targetName.id
53
+                    values.targetName = values.targetName.name
54
+                }
55
+                addQrcode(values)
43 56
             }
44 57
         },
45 58
         )
@@ -50,16 +63,38 @@ const header = props => {
50 63
         console.log(`switch to ${checked}`);
51 64
         setVisible(checked)
52 65
     }
53
-    // qrcode
66
+
67
+    // QrcodeType
68
+    function onTtypeChange(values) {
69
+        console.log(`onTtypeChange to ${values}`);
70
+        setTargetType(values)
71
+        // props.form.setFields({
72
+        //     targetiId: values.id,
73
+        // })
74
+    }
75
+
76
+    // BuildingChange
77
+    function onBuildingChange(values, data) {
78
+        console.log(`onBuildingChange to ${values}`, data);
79
+        setBuildingId(values)
80
+        setTargetName(data.buildingName)
81
+    }
82
+
83
+    // BuildingChange
84
+    function onTargetName(values, data) {
85
+        console.log(`onTargetName to ${values}`, data);
86
+
87
+    }
88
+
54 89
 
55 90
     const { getFieldDecorator } = props.form
56 91
 
57 92
     return (
58 93
 
59 94
         <>
60
-            <Form labelCol={{ span: 7 }} wrapperCol={{ span: 12 }} onSubmit={handleSubmit}>
95
+            <Form labelCol={{ span: 8 }} wrapperCol={{ span: 12 }} onSubmit={handleSubmit}>
61 96
                 <Form.Item label="是否关联项目">
62
-                    {getFieldDecorator('12', {
97
+                    {getFieldDecorator('a', {
63 98
                         initialValue: true,
64 99
                         rules: [{ required: true, message: '' }],
65 100
                     })(<Switch onChange={onChange} defaultChecked />)}
@@ -67,18 +102,21 @@ const header = props => {
67 102
                 {visible && <Form.Item label="关联项目">
68 103
                     {getFieldDecorator('buildingId', {
69 104
                         rules: [{ required: true, message: '' }],
70
-                    })(<BuildSelect />)}
105
+                    })(<BuildSelect onChange={onBuildingChange} />)}
71 106
                 </Form.Item>}
72 107
                 <Form.Item label="二维码内容类型">
73 108
                     {getFieldDecorator('targetType', {
74 109
                         rules: [{ required: true, message: '' }],
75
-                    })(<QrcodeType visible={visible} ></QrcodeType>)}
110
+                    })(<QrcodeType visible={visible} onChange={onTtypeChange}></QrcodeType>)}
76 111
                 </Form.Item>
77
-                <Form.Item label="二维码内容">
112
+                {targetType !== 'project' && <Form.Item label="二维码内容">
78 113
                     {getFieldDecorator('targetName', {
79 114
                         rules: [{ required: true, message: '' }],
80
-                    })(<QrText />)}
81
-                </Form.Item>
115
+                    })(<QrText targetType={targetType} buildingId={buildingId} onChange={onTargetName}/>)}
116
+                </Form.Item>}
117
+                {targetType === 'project' && <div>
118
+                    {getFieldDecorator('targetName')}
119
+                </div>}
82 120
                 <Form.Item label="是否关联项目">
83 121
                     {getFieldDecorator('channelId')(
84 122
                         <ChannelSelect />,
@@ -87,7 +125,7 @@ const header = props => {
87 125
 
88 126
                 <Form.Item wrapperCol={{ span: 15, offset: 8 }}>
89 127
                     <div style={{ width: '190px' }}>
90
-                        <Button type="primary" htmlType="submit">保存</Button>
128
+                        <Button type="primary" style={{ marginRight: '20px' }} htmlType="submit">立即生成</Button>
91 129
                         <Button onClick={() => router.go(-1)} htmlType="submit">取消</Button>
92 130
                     </div>
93 131
                 </Form.Item>

+ 217
- 11
src/pages/qrcode/qrcodelist/components/qrText.jsx Ver arquivo

@@ -2,7 +2,15 @@ import React, { useState, useEffect, useMemo } from 'react';
2 2
 import { Button, Form, Modal, Pagination, Table, Input } from 'antd';
3 3
 import Navigate from '@/components/Navigate';
4 4
 import EditIcon from '@/components/EditIcon';
5
+import { apis, fetch } from '../../../../utils/request';
5 6
 
7
+const getH5List = fetch(apis.h5Activity.EffectiveList)
8
+const getActivities = fetch(apis.activity.listSelected)
9
+const getHelpList = fetch(apis.helpActivity.effectiveList)
10
+const getGroupList = fetch(apis.groupActivity.EffectiveList)
11
+const getLiveList = fetch(apis.taliveActivity.taLiveActivity)
12
+const getNewsList = fetch(apis.news.getList)
13
+const getSalesBatchList = fetch(apis.house.taSalesBatch)
6 14
 
7 15
 const name = '324'
8 16
 
@@ -16,21 +24,220 @@ const qrText = props => {
16 24
     const {
17 25
         value,
18 26
         onChange,
27
+        targetType,
28
+        buildingId,
19 29
         ...rest
20
-      } = props;
21
-    // const [data, setData] = useState([])
30
+    } = props;
31
+    const [data, setData] = useState([])
22 32
     const [visible, setVisible] = useState(false);
23 33
     const [info, setInfo] = useState({ title: value });
24 34
 
35
+    // activity
36
+    const getActivitiesData = e => getActivities({
37
+        params: {
38
+            buildingId,
39
+            pageNum: 1,
40
+            pageSize: 999,
41
+            activityStatus: 2,
42
+            name: e,
43
+        },
44
+    }).then(data => {
45
+        const list = []
46
+
47
+        let obj = {};
48
+        data.list.map(item => {
49
+            obj = item;
50
+            obj['name'] = item['title'];
51
+            obj['id'] = item['dynamicId'];
52
+            delete obj['title'];
53
+            delete obj['dynamicId'];
54
+            list.push(obj)
55
+        })
56
+        setData(list)
57
+    })
58
+
59
+    // help
60
+    const getHelpData = e => getHelpList({
61
+        params: {
62
+            buildingId,
63
+            pageNum: 1,
64
+            pageSize: 999,
65
+            status: 1,
66
+            name: e,
67
+        },
68
+    }).then(data => {
69
+        const list = []
70
+
71
+        let obj = {};
72
+        data.records.map(item => {
73
+            obj = item;
74
+            obj['name'] = item['title'];
75
+            obj['id'] = item['helpActivityId'];
76
+            delete obj['title'];
77
+            delete obj['helpActivityId'];
78
+            list.push(obj)
79
+        })
80
+        setData(list)
81
+
82
+    })
83
+
84
+    //  group
85
+    const getGroupData = e => getGroupList({
86
+        params: {
87
+            buildingId,
88
+            pageNum: 1,
89
+            pageSize: 999,
90
+            status: 1,
91
+            name: e,
92
+        },
93
+    }).then(data => {
94
+        const list = []
95
+
96
+        let obj = {};
97
+        data.records.map(item => {
98
+            obj = item;
99
+            obj['name'] = item['activityName'];
100
+            delete obj['activityName'];
101
+            obj['id'] = item['groupActivityId'];
102
+            delete obj['groupActivityId'];
103
+            
104
+            list.push(obj)
105
+        })
106
+        setData(list)
107
+    })
108
+
109
+    // h5
110
+    const getH5Data = e => getH5List({
111
+        params: {
112
+            pageNum: 1,
113
+            pageSize: 999,
114
+            isMiniapp: 1,
115
+            status: 1,
116
+            buildingId,
117
+            name: e,
118
+        },
119
+    }).then(data => {
120
+        const list = []
121
+
122
+        let obj = {};
123
+        data.records.map(item => {
124
+            obj = item;
125
+            obj['id'] = item['drainageId'];
126
+            delete obj['drainageId'];
127
+            
128
+            list.push(obj)
129
+        })
130
+        setData(list)
131
+        // updateGroup(buildingId ? undefined : value);
132
+    })
133
+
134
+    //  live
135
+    const getLiveData = e => getLiveList({
136
+        params: {
137
+            buildingId,
138
+            pageNum: 1,
139
+            pageSize: 999,
140
+            status: 1,
141
+            liveActivityTitle: e,
142
+        },
143
+    }).then(data => {
144
+        const list = []
145
+        let obj = {};
146
+        data.records.map(item => {
147
+            obj = item;
148
+            obj['name'] = item['liveActivityTitle'];
149
+            delete obj['liveActivityTitle'];
150
+            obj['id'] = item['liveActivityId'];
151
+            delete obj['liveActivityId'];
152
+            list.push(obj)
153
+        })
154
+
155
+        
156
+        setData(list)
157
+    })
158
+
159
+    // news
160
+    const getNewsData = e => getNewsList({
161
+        params: {
162
+            buildingId,
163
+            pageNum: 1,
164
+            pageSize: 999,
165
+            newsStatus: 0,
166
+            title: e,
167
+        },
168
+    }).then(data => {
169
+        const list = []
170
+
171
+        let obj = {};
172
+        data.records.map(item => {
173
+            obj = item;
174
+            obj['name'] = item['newsName'];
175
+            delete obj['newsName'];
176
+            obj['id'] = item['newsId'];
177
+            delete obj['newsId'];
178
+            list.push(obj)
179
+        })
180
+
181
+        
182
+        setData(list)
183
+    })
184
+
185
+    // salesBatch
186
+    const getSalesBatchData = e => getSalesBatchList({
187
+        params: {
188
+            buildingId,
189
+            pageNum: 1,
190
+            pageSize: 999,
191
+            status: 1,
192
+            salesBatchName: e,
193
+        },
194
+    }).then(data => {
195
+        const list = []
196
+
197
+        let obj = {};
198
+        data.records.map(item => {
199
+            obj = item;
200
+            obj['name'] = item['salesBatchName'];
201
+            delete obj['salesBatchName'];
202
+            obj['id'] = item['salesBatchId'];
203
+            delete obj['salesBatchId'];
204
+            list.push(obj)
205
+        })
206
+        setData(list)
207
+        // salesBatchNamesalesBatchId
208
+    })
209
+
210
+    // getNewsList
211
+
25 212
     useEffect(() => {
26
-        // value?useState
27
-    }, [])
213
+        console.log(targetType, buildingId, '234234')
214
+        // eslint-disable-next-line default-case
215
+
216
+        getData()
217
+    }, [targetType, buildingId])
218
+
219
+    const getData = e => {
220
+        // eslint-disable-next-line default-case
221
+        switch (targetType) {
222
+            // case 'project': { getActivitiesData(e); break; }
223
+            case 'activity': { getActivitiesData(e); break; }
224
+            case 'help': { getHelpData(e); break; }
225
+            case 'group': { getGroupData(e); break; }
226
+            case 'h5': { getH5Data(e); break; }
227
+            case 'live': { getLiveData(e); break; }
228
+            case 'news': { getNewsData(e); break; }
229
+            case 'salesBatch': { getSalesBatchData(e); break; }
230
+        }
231
+    }
232
+
28 233
 
29 234
     function handleSubmit(e) {
235
+
30 236
         e.preventDefault();
31 237
         props.form.validateFields((err, values) => {
32 238
             if (!err) {
33 239
                 console.log(values)
240
+                getData(values.name)
34 241
             }
35 242
         }
36 243
         )
@@ -39,19 +246,18 @@ const qrText = props => {
39 246
     const onChoice = e => {
40 247
         setInfo(e)
41 248
         setVisible(false)
42
-        onChange(e.id)
249
+        onChange(e)
43 250
     }
44 251
 
45 252
     const columns = [
46 253
 
47 254
         {
48 255
             title: '标题',
49
-            dataIndex: 'title',
50
-            key: 'title',
256
+            dataIndex: 'name',
257
+            key: 'name',
51 258
             align: 'center',
52 259
 
53 260
         },
54
-
55 261
         {
56 262
             title: '操作',
57 263
             dataIndex: '',
@@ -66,7 +272,7 @@ const qrText = props => {
66 272
 
67 273
     return (
68 274
         <>
69
-            <div>{info.title} <Navigate onClick={() => setVisible(true)}>请选择</Navigate></div>
275
+            <div onClick={() => setVisible(true)}>{info.name} {!info.name && <Navigate >请选择</Navigate>}</div>
70 276
 
71 277
             <Modal
72 278
                 title="请选择"
@@ -77,7 +283,7 @@ const qrText = props => {
77 283
             >
78 284
                 <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
79 285
                     <Form.Item>
80
-                        {getFieldDecorator('contractTemplateName')(
286
+                        {getFieldDecorator('name')(
81 287
                             <Input placeholder="请输入标题" />,
82 288
                         )}
83 289
                     </Form.Item>
@@ -86,7 +292,7 @@ const qrText = props => {
86 292
                         {/* <Button style={{ marginLeft: 8 }} onClick={handleReset}>重置</Button> */}
87 293
                     </Form.Item>
88 294
                 </Form>
89
-                <Table columns={columns} dataSource={data} pagination={false} />
295
+                <Table columns={columns} dataSource={data} />
90 296
                 {/* <Pagination defaultCurrent={1} total={dataInfo.total} onChange={e => changePageNum(e)} current={dataInfo.current} /> */}
91 297
             </Modal>
92 298
         </>

+ 31
- 30
src/pages/qrcode/qrcodelist/dataRecord.jsx Ver arquivo

@@ -3,9 +3,7 @@ import { Input, Menu, Dropdown, Button, Icon, Modal, message, Table, Divider, Ta
3 3
 import router from 'umi/router';
4 4
 import apis from '../../../services/apis';
5 5
 import request from '../../../utils/request';
6
-import Visitors from './table/visitors'
7
-import VisitNum from './table/visitNum'
8
-import Newuser from './table/newuser'
6
+import Tables from './table'
9 7
 import moment from 'moment';
10 8
 
11 9
 const { TabPane } = Tabs;
@@ -14,22 +12,24 @@ const { TabPane } = Tabs;
14 12
 
15 13
 const DataRecord = props => {
16 14
 
15
+    const id = props.location.query.id
16
+
17 17
     const [tab, setTab] = useState('1')
18 18
     const [data, setData] = useState({})
19 19
     const [showHelp, setShowHelp] = useState(false)
20 20
 
21 21
     useEffect(() => {
22 22
 
23
-        // getData({ id: id, type: type })
23
+        getStatisticData({ qrCodeId: id })
24 24
 
25 25
     }, [])
26 26
 
27
-    const getData = (params) => {
27
+    const getStatisticData = (params) => {
28 28
 
29
-        // request({ ...apis.activityDataStatis.getStatisticData, params: { ...params, } }).then((data) => {
30
-        //     console.log(data)
31
-        //     setData(data || {})
32
-        // })
29
+        request({ ...apis.qrcode.getStatisticData, params: { ...params } }).then(data => {
30
+            console.log(data)
31
+            setData(data)
32
+        })
33 33
     }
34 34
 
35 35
     function tabsCallback(e) {
@@ -40,21 +40,21 @@ const DataRecord = props => {
40 40
     return <>
41 41
         <div>
42 42
             <div>
43
-            <Icon type="question-circle" theme="filled" style={{ fontSize: '25px', color: '#F00', marginLeft: '30px' }} onClick={() => setShowHelp(true)} />
44
-          <Modal
45
-            title="指标说明(数据会存在一定时间延迟)"
46
-            centered
47
-            visible={showHelp}
48
-            footer={null}
49
-            onCancel={() => setShowHelp(false)}
50
-          >
51
-              <p style={{ fontSize: '0.106rem', color: '#333', marginBottom: '8px' }}>新增注册用户:</p>
52
-            <p style={{ fontSize: '0.106rem', color: '#999', marginBottom: '8px' }}>通过当前二维码授权手机号的总人数</p>
53
-            <p style={{ fontSize: '0.106rem', color: '#333', marginBottom: '8px' }}>访问人数:</p>
54
-            <p style={{ fontSize: '0.106rem', color: '#999', marginBottom: '8px' }}>通过当前二维码访问小程序的总人数</p>
55
-            <p style={{ fontSize: '0.106rem', color: '#333', marginBottom: '8px' }}>访问次数:</p>
56
-            <p style={{ fontSize: '0.106rem', color: '#999', marginBottom: '8px' }}>通过当前二维码访问小程序的总次数</p>
57
-          </Modal>
43
+                <Icon type="question-circle" theme="filled" style={{ fontSize: '25px', color: '#F00', marginLeft: '30px' }} onClick={() => setShowHelp(true)} />
44
+                <Modal
45
+                    title="指标说明(数据会存在一定时间延迟)"
46
+                    centered
47
+                    visible={showHelp}
48
+                    footer={null}
49
+                    onCancel={() => setShowHelp(false)}
50
+                >
51
+                    <p style={{ fontSize: '0.106rem', color: '#333', marginBottom: '8px' }}>新增注册用户:</p>
52
+                    <p style={{ fontSize: '0.106rem', color: '#999', marginBottom: '8px' }}>通过当前二维码授权手机号的总人数</p>
53
+                    <p style={{ fontSize: '0.106rem', color: '#333', marginBottom: '8px' }}>访问人数:</p>
54
+                    <p style={{ fontSize: '0.106rem', color: '#999', marginBottom: '8px' }}>通过当前二维码访问小程序的总人数</p>
55
+                    <p style={{ fontSize: '0.106rem', color: '#333', marginBottom: '8px' }}>访问次数:</p>
56
+                    <p style={{ fontSize: '0.106rem', color: '#999', marginBottom: '8px' }}>通过当前二维码访问小程序的总次数</p>
57
+                </Modal>
58 58
                 <Button style={{ float: 'right', zIndex: 1 }} onClick={() => router.go(-1)}>
59 59
                     返回
60 60
                </Button>
@@ -89,17 +89,18 @@ const DataRecord = props => {
89 89
         </div>
90 90
         <div>
91 91
             <Tabs type="card" value={tab} buttonStyle="solid" onChange={e => tabsCallback(e)}>
92
-                <TabPane tab="访问人数" key="1" ></TabPane>
93
-                <TabPane tab="访问次数" key="2" ></TabPane>
94
-                <TabPane tab="新增注册用户" key="3" ></TabPane>
92
+                <TabPane tab="访问人数" key="visitors" ></TabPane>
93
+                <TabPane tab="访问次数" key="visitNum" ></TabPane>
94
+                <TabPane tab="新增注册用户" key="newuser" ></TabPane>
95 95
             </Tabs>
96 96
             <div style={{ marginTop: '20px' }}>
97
+                <Tables id={id} type={tab} />
97 98
                 {/* 访问人数 */}
98
-                {(tab === '1' && <Visitors />)}
99
+                {/* {(tab === '1' && <Tables id={id} type="visitors"/>)} */}
99 100
                 {/* 访问次数 */}
100
-                {(tab === '2' && <VisitNum />)}
101
+                {/* {(tab === '2' && <Tables id={id} type="visitors"/>)} */}
101 102
                 {/* 新增注册用户 */}
102
-                {(tab === '3' && <Newuser />)}
103
+                {/* {(tab === '3' && <Tables id={id} type="visitors"/>)} */}
103 104
 
104 105
             </div>
105 106
         </div>

+ 104
- 57
src/pages/qrcode/qrcodelist/index.jsx Ver arquivo

@@ -6,6 +6,8 @@ import AuthButton from '@/components/AuthButton';
6 6
 import withActions from '@/components/ActionList';
7 7
 import EditIcon from '@/components/EditIcon';
8 8
 import Navigate from '@/components/Navigate';
9
+import QrcodeType from '@/components/SelectButton/QrcodeType'
10
+import { ConfirmButton } from '@/components/ModalButton';
9 11
 import styles from '../../style/GoodsList.less';
10 12
 import BuildSelect from '@/components/SelectButton/BuildSelect'
11 13
 import ChannelSelect from '@/components/SelectButton/channelSelect'
@@ -13,27 +15,60 @@ import apis from '../../../services/apis';
13 15
 import request from '../../../utils/request';
14 16
 
15 17
 // import RaiseHelpDoc from '../edit/components/RaiseHelpDoc';
18
+const typeName = targetType => {
19
+    // eslint-disable-next-line default-case
20
+    switch (targetType) {
21
+        case 'project': return '项目';
22
+        case 'activity': return '常规活动';
23
+        case 'help': return '助力活动';
24
+        case 'group': return '拼团活动';
25
+        case 'h5': return 'H5活动';
26
+        case 'live': return '直播活动';
27
+        case 'news': return '资讯';
28
+        case 'salesBatch': return '销售批次';
29
+    }
30
+}
31
+// const typeName = {
32
+//     project: '项目',
33
+//     activity: '常规活动',
34
+//     help: '常规活动',
35
+//     group: '拼团活动',
36
+//     h5: 'H5活动',
37
+//     live: '直播活动',
38
+//     news: '资讯',
39
+//     salesBatch: '销售批次',
40
+// }
41
+
16 42
 
17
-const data = [{
18
-    id: '1',
19
-}]
20 43
 
21 44
 const qrcodelist = props => {
22
-    // const [data, setData] = useState([])
45
+    const [data, setData] = useState([])
23 46
     const [showHelp, setShowHelp] = useState(false)
47
+    const [qrcodeList, setQrcodeList] = useState([])
24 48
 
25
-    // 查询列表
26
-    //   const getList = params => {
27
-    //     request({ ...apis.taEcontract.listContractTemplate, params: { ...params } }).then(data => {
28
-    //       console.log(data)
29
-    //       setData(data)
30
-    //     })
31
-    //   }
32 49
 
33 50
     // eslint-disable-next-line react-hooks/rules-of-hooks
34
-    //   useEffect(() => {
35
-    //     getList({ pageNum: 1, pageSize: 10 });
36
-    //   }, [])
51
+    useEffect(() => {
52
+        getList({ pageNum: 1, pageSize: 10 });
53
+    }, [])
54
+
55
+    // 查询列表
56
+    const getList = params => {
57
+        request({ ...apis.qrcode.list, params: { ...params } }).then(data => {
58
+            console.log(data)
59
+            setData(data)
60
+        })
61
+    }
62
+
63
+    const batchDelete = () => {
64
+        request({ ...apis.qrcode.batchDelete, data: qrcodeList, }).then((data) => {
65
+            message.info("操作成功")
66
+            getList({ pageNum: 1, pageSize: 10 });
67
+        }).catch((err) => {
68
+            // message.info(err.msg)
69
+        })
70
+    }
71
+
37 72
 
38 73
     const toAdd = () => {
39 74
         router.push({
@@ -41,9 +76,11 @@ const qrcodelist = props => {
41 76
         });
42 77
     }
43 78
 
44
-    const toDataRecord = () => {
79
+    const toDataRecord = (id) => {
80
+        console.log(id)
45 81
         router.push({
46 82
             pathname: '/qrcode/qrcodelist/dataRecord',
83
+            query: { id, }
47 84
         });
48 85
     }
49 86
 
@@ -56,36 +93,36 @@ const qrcodelist = props => {
56 93
     const columns = [
57 94
         {
58 95
             title: '二维码',
59
-            dataIndex: 'contractTemplateName',
60
-            key: 'contractTemplateName',
96
+            dataIndex: 'qrCodeUrl',
97
+            key: 'qrCodeUrl',
61 98
             align: 'center',
62
-            render: (x, row) => <Navigate >{row.contractTemplateName}</Navigate>,
99
+            render: (x, row) => <img src={row.qrCodeUrl} alt="" width="100px"></img >,
63 100
         },
64 101
         {
65 102
             title: '二维码内容',
66
-            dataIndex: 'createDate',
67
-            key: 'createDate',
103
+            dataIndex: 'targetName',
104
+            key: 'targetName',
68 105
             align: 'center',
69 106
 
70 107
         },
71 108
         {
72 109
             title: '二维码类型',
73
-            dataIndex: 'createDate',
74
-            key: 'createDate',
110
+            dataIndex: 'targetType',
111
+            key: 'targetType',
75 112
             align: 'center',
76
-
113
+            render: (x, row) => <span >{typeName(row.targetType)}</span>,
77 114
         },
78 115
         {
79 116
             title: '关联项目',
80
-            dataIndex: 'createDate',
81
-            key: 'createDate',
117
+            dataIndex: 'buildingName',
118
+            key: 'buildingName',
82 119
             align: 'center',
83 120
 
84 121
         },
85 122
         {
86 123
             title: '关联渠道',
87
-            dataIndex: 'createDate',
88
-            key: 'createDate',
124
+            dataIndex: 'channelName',
125
+            key: 'channelName',
89 126
             align: 'center',
90 127
 
91 128
         },
@@ -94,7 +131,7 @@ const qrcodelist = props => {
94 131
             dataIndex: 'createDate',
95 132
             key: 'createDate',
96 133
             align: 'center',
97
-
134
+            render: (x, row) => <><span>{`${moment(row.createDate).format('YYYY-MM-DD HH:mm:ss')}`}</span></>,
98 135
         },
99 136
         {
100 137
             title: '操作',
@@ -104,39 +141,50 @@ const qrcodelist = props => {
104 141
             render: withActions((text, record) => [
105 142
                 <EditIcon type="download" text="下载二维码" ></EditIcon>,
106 143
 
107
-                <EditIcon type="data" text="数据" onClick={() => toDataRecord(record.id)} ></EditIcon>,
144
+                <EditIcon type="data" text="数据" onClick={() => toDataRecord(record.qrCodeId)} ></EditIcon>,
108 145
 
109 146
             ]),
110 147
         },
111 148
     ];
112 149
 
113 150
 
114
-    //   const changePageNum = pageNumber => {
115
-    //     getList({ pageNum: pageNumber, pageSize: 10, ...props.form.getFieldsValue() })
116
-    //   }
151
+    const changePageNum = pageNumber => {
152
+        getList({ pageNum: pageNumber, pageSize: 10, ...props.form.getFieldsValue() })
153
+    }
154
+
155
+
117 156
 
118 157
     const rowSelection = {
119 158
         onChange: (selectedRowKeys, selectedRows) => {
120 159
             console.log('selectedRowKeys:', selectedRowKeys, 'selectedRows: ', selectedRows);
121
-            //   setContractList(selectedRows)
160
+            setQrcodeList(selectedRows)
122 161
         },
123 162
     };
124 163
 
125 164
     //   // 提交事件
126
-    //   const handleSubmit = e => {
127
-    //     e.preventDefault();
128
-    //     props.form.validateFields((err, values) => {
129
-    //       if (!err) {      
130
-    //         getList({ pageNum: 1, pageSize: 10, ...values })
131
-    //       }
132
-    //     });
133
-    //   }
165
+    const handleSubmit = e => {
166
+        e.preventDefault();
167
+        props.form.validateFields((err, values) => {
168
+            if (!err) {
169
+                getList({ pageNum: 1, pageSize: 10, ...values })
170
+            }
171
+        });
172
+    }
134 173
 
135 174
     //   // 重置搜索
136 175
     function handleReset() {
137 176
         props.form.resetFields();
138 177
         // setTime('')
139
-        // getList({ pageNum: 1, pageSize: 10 })
178
+        getList({ pageNum: 1, pageSize: 10 })
179
+    }
180
+
181
+    function before() {
182
+        if (qrcodeList.length <= 0) {
183
+            message.info('请至少选择一条数据');
184
+            return true
185
+        }
186
+
187
+        return false
140 188
     }
141 189
 
142 190
     const { getFieldDecorator } = props.form
@@ -145,27 +193,25 @@ const qrcodelist = props => {
145 193
         <>
146 194
             <Form layout="inline" style={{ marginBottom: '10px' }} onSubmit={e => handleSubmit(e)}>
147 195
                 <Form.Item>
148
-                    {getFieldDecorator('qrcodetype')(
149
-                        <Input
150
-                            placeholder="二维码类型"
151
-                        />,
196
+                    {getFieldDecorator('targetType')(
197
+                        <QrcodeType all visible />,
152 198
                     )}
153 199
                 </Form.Item>
154 200
                 <Form.Item>
155
-                    {getFieldDecorator('qrcodename')(
201
+                    {getFieldDecorator('targetName')(
156 202
                         <Input
157 203
                             placeholder="二维码内容"
158 204
                         />,
159 205
                     )}
160 206
                 </Form.Item>
161 207
                 <Form.Item>
162
-                    {getFieldDecorator('channe')(
208
+                    {getFieldDecorator('channelId')(
163 209
                         <ChannelSelect all />,
164 210
                     )}
165 211
                 </Form.Item>
166 212
                 <Form.Item>
167
-                    {getFieldDecorator('build')(
168
-                        <BuildSelect />,
213
+                    {getFieldDecorator('buildingId')(
214
+                        <BuildSelect on />,
169 215
                     )}
170 216
                 </Form.Item>
171 217
                 <Form.Item>
@@ -173,10 +219,11 @@ const qrcodelist = props => {
173 219
                     <Button style={{ marginLeft: 8 }} onClick={handleReset}>重置</Button>
174 220
                 </Form.Item>
175 221
             </Form>
176
-
222
+            {/* title="确认删除?" */}
177 223
             <Button type="danger" onClick={() => toAdd()}>新增</Button>
178
-
179
-            <Button type="primary" style={{ marginLeft: '30px' }}>删除</Button>
224
+            <ConfirmButton type="link" title="确认删除选中数据?" before={before} onClick={() => batchDelete()}>
225
+                <Button type="primary" style={{ marginLeft: '30px' }}>删除</Button>
226
+            </ConfirmButton>
180 227
             <Icon type="question-circle" theme="filled" style={{ fontSize: '25px', color: '#F00', marginLeft: '30px' }} onClick={() => setShowHelp(true)} />
181 228
             <Modal
182 229
                 title="相关说明"
@@ -194,10 +241,10 @@ const qrcodelist = props => {
194 241
             </Modal>
195 242
 
196 243
             <Table rowSelection={rowSelection}
197
-                dataSource={data} columns={columns} pagination={false} rowKey={r => r.id} />
198
-            {/* <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
199
-        <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={e => changePageNum(e)} current={data.current}/>
200
-      </div> */}
244
+                dataSource={data.records} columns={columns} pagination={false} rowKey={r => r.qrCodeId} style={{ marginTop: '20px' }}/>
245
+            <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
246
+                <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={e => changePageNum(e)} current={data.current} />
247
+            </div>
201 248
         </>
202 249
     )
203 250
 }

+ 121
- 0
src/pages/qrcode/qrcodelist/table/index.jsx Ver arquivo

@@ -0,0 +1,121 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal, DatePicker } from 'antd';
3
+import router from 'umi/router';
4
+import apis from '../../../../services/apis';
5
+import request from '../../../../utils/request';
6
+import AuthButton from '../../../../components/AuthButton';
7
+import WxDictSelect from '@/components/SelectButton/WxDictSelect';
8
+import moment from 'moment';
9
+
10
+const table = props => {
11
+    const { id, type } = props
12
+    const [data, setData] = useState({})
13
+
14
+
15
+    useEffect(() => {
16
+        // console.log(activityId, activityType)
17
+        // getList({ pageNum: 1, pageSize: 10 })
18
+
19
+    }, [])
20
+
21
+    const getList = params => {
22
+        // console.log(params)
23
+        // request({ ...apis.activityDataStatis.activityVisitNum, params: { ...params, activityId: activityId, activityType: activityType, ...date } }).then(data => {
24
+        //   console.log(data)
25
+        //   props.getData()
26
+        //   setData(data)
27
+        // }).catch(e => {
28
+        //   console.log(e)
29
+        // })
30
+    }
31
+
32
+    const visitNum = {
33
+        title: '访问时间',
34
+        dataIndex: 'visitDate',
35
+        key: 'visitDate',
36
+        render: (x, row) => <><span>{`${moment(row.visitDate).format('YYYY-MM-DD HH:mm:ss')}`}</span></>,
37
+    }
38
+
39
+    const visitors = {
40
+        title: '访问次数',
41
+        dataIndex: 'visitNum',
42
+        key: 'visitNum',
43
+    }
44
+
45
+    const newuser = {
46
+        title: '注册时间',
47
+        dataIndex: 'visitDate',
48
+        key: 'visitDate',
49
+        render: (x, row) => <><span>{`${moment(row.visitDate).format('YYYY-MM-DD HH:mm:ss')}`}</span></>,
50
+    }
51
+
52
+    const columns = [
53
+        {
54
+            title: '姓名',
55
+            dataIndex: 'nickName',
56
+            key: 'nickName',
57
+        },
58
+        {
59
+            title: '电话',
60
+            dataIndex: 'phone',
61
+            key: 'phone',
62
+        },
63
+        {
64
+            title: '性别',
65
+            dataIndex: 'gender',
66
+            key: 'gender',
67
+        },
68
+        {
69
+            title: '归属地',
70
+            dataIndex: 'province',
71
+            key: 'province',
72
+        },
73
+        // eslint-disable-next-line no-nested-ternary
74
+        type === 'visitNum' ? visitNum : type === 'visitors' ? visitors : newuser,
75
+        // visitNum,
76
+        // visitors,
77
+        // newuser,
78
+    ]
79
+
80
+
81
+    const changePageNum = pageNumber => {
82
+        getList({ pageNum: pageNumber, pageSize: 10, ...props.form.getFieldsValue() })
83
+    }
84
+
85
+
86
+
87
+    const exportActivityStats = () => {
88
+
89
+        // request({ ...apis.activityDataStatis.activityVisitNumExport, params: { activityId: activityId, activityType: activityType, ...props.form.getFieldsValue(), ...date } }).then(data => {
90
+        //   if (!data) {
91
+        //     return
92
+        //   }
93
+        //   const url = window.URL.createObjectURL(new Blob([data]))
94
+        //   const link = document.createElement('a')
95
+        //   link.style.display = 'none'
96
+        //   link.href = url
97
+        //   link.setAttribute('download', '访问统计.xlsx')
98
+        //   document.body.append(link)
99
+        //   link.click()
100
+        // }).catch()
101
+    }
102
+
103
+    return <>
104
+        <div>
105
+            <div>
106
+
107
+
108
+                <Button type="primary" style={{ float: 'right', marginBottom: '20px', zIndex: 1 }} onClick={exportActivityStats} >
109
+                    导出
110
+            </Button>
111
+
112
+            </div>
113
+            <Table style={{ marginTop: '30px' }} dataSource={data.records} columns={columns} pagination={false} rowKey="activityList" />
114
+            <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
115
+                <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} current={data.current} />
116
+            </div>
117
+        </div>
118
+    </>
119
+}
120
+
121
+export default table

+ 14
- 5
src/pages/qrcode/qrcodelist/table/visitors.jsx Ver arquivo

@@ -42,6 +42,12 @@ const visitors = props => {
42 42
   //   }).catch()
43 43
   // }
44 44
 
45
+  const visitorsa = {
46
+    title: '访问次数',
47
+    dataIndex: 'visitNum',
48
+    key: 'visitNum',
49
+  }
50
+
45 51
   const columns = [
46 52
     {
47 53
       title: '姓名',
@@ -63,13 +69,16 @@ const visitors = props => {
63 69
       dataIndex: 'province',
64 70
       key: 'province',
65 71
     },
66
-    {
67
-      title: '访问次数',
68
-      dataIndex: 'visitNum',
69
-      key: 'visitNum',
70
-    },
72
+    visitorsa,
71 73
   ]
72 74
 
75
+  // {
76
+  //   title: '访问时间',
77
+  //   dataIndex: 'visitDate',
78
+  //   key: 'visitDate',
79
+  //   render: (x, row) => <><span>{`${moment(row.visitDate).format('YYYY-MM-DD HH:mm:ss')}`}</span></>,
80
+  // },
81
+
73 82
 
74 83
   const changePageNum = pageNumber => {
75 84
     getList({ pageNum: pageNumber, pageSize: 10, ...props.form.getFieldsValue() })

+ 12
- 4
src/services/apis.js Ver arquivo

@@ -1818,15 +1818,23 @@ export default {
1818 1818
   qrcode: {
1819 1819
     list: {
1820 1820
       method: 'GET',
1821
-      url: `${prefix}/activityStatistical/total`,
1821
+      url: `${prefix}/listQrCode`,
1822 1822
       action: 'admin.contract.list.get',
1823 1823
     },
1824 1824
     add: {
1825 1825
       method: 'post',
1826
-      url: `${prefix}/taQrcode/:id`,
1826
+      url: `${prefix}/taQrcode`,
1827 1827
       action: 'admin.qrcode.add.post',
1828 1828
     },
1829
-
1830
-
1829
+    batchDelete: {
1830
+      method: 'DELETE',
1831
+      url: `${prefix}/qrCode/batchDelete`,
1832
+      action: 'admin.qrcode.batchDelete.DELETE',
1833
+    },
1834
+    getStatisticData: {
1835
+      method: 'GET',
1836
+      url: `${prefix}/qrCode/getStatisticData`,
1837
+      action: 'admin.qrcode.getStatisticData.get',
1838
+    },
1831 1839
   },
1832 1840
 }