소스 검색

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

weichaochao 5 년 전
부모
커밋
9a12ed6a29
29개의 변경된 파일1463개의 추가작업 그리고 283개의 파일을 삭제
  1. 1
    0
      config/config.js
  2. 30
    24
      config/routes.js
  3. 1
    1
      src/components/HouseSelect/ApartmentSelect.jsx
  4. 9
    4
      src/pages/customer/customerlist/index.jsx
  5. 148
    0
      src/pages/house/add/HouseBatchAdd.jsx
  6. 84
    87
      src/pages/house/add/index.jsx
  7. 14
    0
      src/pages/house/edit/components/EnDash/index.jsx
  8. 109
    0
      src/pages/house/edit/components/HelpDoc/index.jsx
  9. 36
    0
      src/pages/house/edit/components/HelpDoc/style.less
  10. 40
    0
      src/pages/house/edit/components/HotBlock/index.jsx
  11. 46
    0
      src/pages/house/edit/components/HotBlock/style.less
  12. 136
    0
      src/pages/house/edit/components/HouseBatch.jsx
  13. 21
    0
      src/pages/house/edit/components/HouseGrid/Floor.jsx
  14. 31
    0
      src/pages/house/edit/components/HouseGrid/Room.jsx
  15. 15
    0
      src/pages/house/edit/components/HouseGrid/Unit.jsx
  16. 37
    0
      src/pages/house/edit/components/HouseGrid/index.js
  17. 72
    0
      src/pages/house/edit/components/HouseGrid/style.less
  18. 10
    3
      src/pages/house/edit/components/base.jsx
  19. 70
    8
      src/pages/house/edit/components/house.jsx
  20. 8
    8
      src/pages/house/edit/components/houseAdd.jsx
  21. 6
    0
      src/pages/house/edit/components/houseTab.jsx
  22. 90
    8
      src/pages/house/edit/components/preselectionImg.jsx
  23. 191
    9
      src/pages/house/edit/components/preselectionRecord.jsx
  24. 14
    2
      src/pages/house/edit/components/share.jsx
  25. 7
    7
      src/pages/house/edit/components/shareRecord.jsx
  26. 142
    4
      src/pages/house/edit/components/visitRecord.jsx
  27. 16
    8
      src/pages/house/edit/index.jsx
  28. 39
    110
      src/pages/house/list/index.jsx
  29. 40
    0
      src/services/apis.js

+ 1
- 0
config/config.js 파일 보기

@@ -84,6 +84,7 @@ export default {
84 84
     ie: 11,
85 85
   },
86 86
   publicPath: './',
87
+  // publicPath: 'https://njcjweb.oss-accelerate.aliyuncs.com/admin/',
87 88
   history: 'hash',
88 89
   devtool: isAntDesignProPreview ? 'source-map' : false,
89 90
   // umi routes: https://umijs.org/zh/guide/router.html

+ 30
- 24
config/routes.js 파일 보기

@@ -521,30 +521,36 @@ export default [
521 521
               },
522 522
             ],
523 523
           },
524
-          {
525
-            path: '/house',
526
-            name: '在线选房',
527
-            component: '../layouts/BlankLayout',
528
-            routes: [
529
-              {
530
-                path: '/house/list',
531
-                name: '房源管理',
532
-                component: './house/list/index',
533
-              },
534
-              {
535
-                path: '/house/add',
536
-                name: '新增', 
537
-                hideInMenu: true,
538
-                component: './house/add/index',
539
-              },
540
-              {
541
-                path: '/house/edit',
542
-                name: '编辑', 
543
-                hideInMenu: true,
544
-                component: './house/edit/index',
545
-              },
546
-            ],
547
-          },
524
+          // {
525
+          //   path: '/house',
526
+          //   name: '在线选房',
527
+          //   component: '../layouts/BlankLayout',
528
+          //   routes: [
529
+          //     {
530
+          //       path: '/house/list',
531
+          //       name: '房源管理',
532
+          //       component: './house/list/index',
533
+          //     },
534
+          //     {
535
+          //       path: '/house/add',
536
+          //       name: '新增', 
537
+          //       hideInMenu: true,
538
+          //       component: './house/add/index',
539
+          //     },
540
+          //     {
541
+          //       path: '/house/batch',
542
+          //       name: '批量上传', 
543
+          //       hideInMenu: true,
544
+          //       component: './house/add/HouseBatchAdd',
545
+          //     },
546
+          //     {
547
+          //       path: '/house/edit',
548
+          //       name: '编辑', 
549
+          //       hideInMenu: true,
550
+          //       component: './house/edit/index',
551
+          //     },
552
+          //   ],
553
+          // },
548 554
           // {
549 555
           //   path: '/miniapp',
550 556
           //   name: '小程序管理',

+ 1
- 1
src/components/HouseSelect/ApartmentSelect.jsx 파일 보기

@@ -38,7 +38,7 @@ const ApartmentSelect = props => {
38 38
 
39 39
   const checkValue = (data) => {
40 40
     if (props.value) {
41
-      const tempData = data.filter(f => f.buildingId == props.value)
41
+      const tempData = data.filter(f => f.apartmentId == props.value)
42 42
       const va = (tempData.length > 0) ? props.value : '已删除,请重新选择'
43 43
       props.onChange(va)
44 44
 

+ 9
- 4
src/pages/customer/customerlist/index.jsx 파일 보기

@@ -58,6 +58,8 @@ function body(props) {
58 58
 
59 59
   const [assistVisibleData, setAssistVisibleData] = useState({visible: false, customerId: ''})
60 60
 
61
+  const [loadingStatus, setLoadingStatus] = useState(false)
62
+
61 63
   // eslint-disable-next-line react-hooks/rules-of-hooks
62 64
   useEffect(() => {
63 65
     getList({ pageNumber: 1, pageSize: 10, customerType })
@@ -192,12 +194,15 @@ function body(props) {
192 194
   }
193 195
 
194 196
   function exportCustomer () {
197
+    setLoadingStatus(true)
195 198
     const fieldsValue = getFieldsValue()
196 199
     request({ ...apis.customer.customerRecommendExport, responseType: 'blob', params: { ...fieldsValue, customerType } })
197 200
       .then(response => {
198 201
         download(response)
202
+        setLoadingStatus(false)
199 203
       }).catch(error => {
200
-
204
+        message.err("连接超时");
205
+        setLoadingStatus(false)
201 206
       })
202 207
   }
203 208
 
@@ -459,11 +464,11 @@ function body(props) {
459 464
             </Button>
460 465
         </Form.Item>
461 466
       </Form>
462
-      {/* <AuthButton name="admin.customer.import" noRight={null}>
463
-        <Button type="primary" onClick={() => exportCustomer()} style={{ float: 'right', margin: '20px 0', zIndex: 1 }}>
467
+      <AuthButton name="admin.customer.import" noRight={null}>
468
+        <Button type="primary" loading={loadingStatus} onClick={() => exportCustomer()} style={{ float: 'right', margin: '20px 0', zIndex: 1 }}>
464 469
           导出
465 470
         </Button>
466
-      </AuthButton> */}
471
+      </AuthButton>
467 472
 
468 473
       <div style={{ margin: '20px 0'}}>
469 474
           <Radio.Group value={customerType} onChange={radioButtonHandleSizeChange} buttonStyle="solid">

+ 148
- 0
src/pages/house/add/HouseBatchAdd.jsx 파일 보기

@@ -0,0 +1,148 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Input, Button, Icon, Select, Tabs, Radio, DatePicker, message, Upload, Table } from 'antd';
3
+import { FormattedMessage } from 'umi-plugin-react/locale';
4
+import moment from 'moment';
5
+import router from 'umi/router';
6
+import { fetch } from '../../../utils/request';
7
+import apis from '../../../services/apis';
8
+import XForm, { FieldTypes } from '../../../components/XForm';
9
+import ApartmentSelect from '../../../components/HouseSelect/ApartmentSelect';
10
+import request from '@/utils/request';
11
+
12
+const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
13
+const { TextArea } = Input;
14
+
15
+function HouseBatchAdd(props) {
16
+
17
+const [data, setData] = useState({list: [], total: 0})
18
+
19
+const [uploadFile, setUploadFile] = useState(null)
20
+
21
+const uploadExcel = fetch(apis.house.uploadExcel)
22
+
23
+const uploaderProps = {
24
+  name: 'file',
25
+  accept: '.xls, .xlsx',
26
+  showUploadList: false,
27
+  customRequest({
28
+    action,
29
+    file,
30
+    headers,
31
+    onError,
32
+    onProgress,
33
+    onSuccess,
34
+    withCredentials,
35
+  }) {
36
+     
37
+    const data = new FormData()
38
+    data.append('file', file)
39
+    data.append('salesBatchId', props.location.query.salesBatchId)
40
+    data.append('buildingId', props.location.query.buildingId)
41
+
42
+    setUploadFile(file)
43
+
44
+    uploadExcel({ data }).then((res) => {
45
+      setData(res)
46
+      onSuccess(res, file);
47
+    }).catch(onError);
48
+
49
+    return {
50
+      abort() {
51
+        console.log('upload progress is aborted.');
52
+      },
53
+    };
54
+  },
55
+}
56
+
57
+//取消
58
+function handleCancel(){
59
+  router.push({
60
+    pathname: '/house/edit',
61
+    query: {
62
+      id: props.location.query.salesBatchId,
63
+      buildingId: props.location.query.buildingId,
64
+    },
65
+  });
66
+}
67
+
68
+function batchSaveHouse() {
69
+  const uploadData = new FormData()
70
+  uploadData.append('file', uploadFile)
71
+  uploadData.append('salesBatchId', props.location.query.salesBatchId)
72
+  uploadData.append('buildingId', props.location.query.buildingId)
73
+
74
+  request({ ...apis.house.saveExcelValue, data: uploadData,headers: "content-type=multipart/form-data" }).then(res => {
75
+    message.info('新增房源成功!请确认全部数据正常,然后在房源详情页 销售批次栏 选择 发布状态 为“是” 将房源 发布到小程序。如需要置业顾问或用户分享,请在房源详情中配套海报图和分享图。')
76
+    router.push({
77
+      pathname: '/house/edit',
78
+      query: {
79
+        id: props.location.query.salesBatchId,
80
+        buildingId: props.location.query.buildingId,
81
+      },
82
+    });
83
+  }).catch(err => {
84
+    // openNotificationWithIcon('error', err.message)
85
+  })
86
+}
87
+
88
+const columns = [
89
+  {
90
+    title: '期/区',
91
+    dataIndex: 'termName',
92
+    key: 'termName',
93
+  },
94
+  {
95
+    title: '楼栋',
96
+    dataIndex: 'blockName',
97
+    key: 'blockName',
98
+  },
99
+  {
100
+    title: '单元',
101
+    dataIndex: 'unitName',
102
+    key: 'unitName',
103
+  },
104
+  {
105
+    title: '层',
106
+    dataIndex: 'floorName',
107
+    key: 'floorName',
108
+  },
109
+  {
110
+    title: '房号',
111
+    dataIndex: 'roomName',
112
+    key: 'roomName',
113
+  },
114
+  {
115
+    title: '价格(万元)',
116
+    dataIndex: 'price',
117
+    key: 'price',
118
+  },
119
+  {
120
+    title: '预选基础热度',
121
+    dataIndex: 'heat',
122
+    key: 'heat',
123
+  },
124
+  {
125
+    title: '发布状态',
126
+    dataIndex: 'status',
127
+    key: 'status',
128
+    render: status => <><span>{status == 0 ? '否' : status == 1 ? '是' : ''}</span></>,
129
+  },
130
+]
131
+
132
+  return (
133
+    <>
134
+      <span>1.导入房源先下载模板--></span><a href="https://njcj.oss-cn-shanghai.aliyuncs.com/miniapp/upload/images/1581597350487-房源模板.xlsx" download="房源模板.xlsx"><Button type="primary" htmlType="submit">下载模板</Button></a><br/>
135
+      <span>2.使用excel打开模板文件,编辑房源数据并保存</span><br/>
136
+      <span>3.将编辑好的文件上传--></span><Upload {...uploaderProps}><Button type="primary" htmlType="submit">上传</Button></Upload><br/>
137
+      <span>4.检查导入的数据是否正常 ↓,不正常则重新编辑保存再次上传,请仔细阅读模板中的编辑规则</span>
138
+      <Table dataSource={data.list} columns={columns} pagination={{ total: data.total}}  rowKey="House" />
139
+      
140
+      <span>5.全部正常请点击提交</span>
141
+      <Button type="primary" onClick={() => batchSaveHouse()}>提交</Button>
142
+      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
143
+      <span>暂时未确定房源?  --></span><Button onClick={() => handleCancel()}>以后处理</Button>
144
+    </>
145
+  )
146
+}
147
+const WrappedHouseBatchAdd = Form.create({ name: 'house_batch' })(HouseBatchAdd);
148
+export default WrappedHouseBatchAdd

+ 84
- 87
src/pages/house/add/index.jsx 파일 보기

@@ -7,6 +7,7 @@ import moment from 'moment';
7 7
 import styles from '../../style/GoodsList.less';
8 8
 import SelectCity from '../../../components/SelectButton/CitySelect'
9 9
 import BuildSelect from '../../../components/SelectButton/BuildSelect'
10
+import ImageUpload from '../../../components/XForm/ImageUpload'
10 11
 import apis from '../../../services/apis';
11 12
 import request from '../../../utils/request';
12 13
 import AuthButton from '@/components/AuthButton';
@@ -15,6 +16,8 @@ const { Option } = Select;
15 16
 const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
16 17
 
17 18
 
19
+
20
+
18 21
 const header = props => {
19 22
   const { salesBatchId } = props.location.query
20 23
   console.log(salesBatchId)
@@ -26,11 +29,11 @@ const header = props => {
26 29
 
27 30
   // 查询列表
28 31
   const getSaleBatchData = (salesBatchId) => {
29
-    request({ ...apis.system.taPolicy, urlData: {id: salesBatchId} }).then((data) => {
30
-        console.log(data)
31
-        setSaleBatchData(data)
32
-    })
33
-  }
32
+      request({ ...apis.system.taPolicy, urlData: {id: salesBatchId} }).then((data) => {
33
+          console.log(data)
34
+          setSaleBatchData(data)
35
+      })
36
+    }
34 37
   }
35 38
 
36 39
   const cancelPage = () =>{
@@ -38,79 +41,13 @@ const header = props => {
38 41
       pathname: '/house/list',
39 42
     });
40 43
   }
41
-    const fields = [
42
-      {
43
-        label: '销售批次名',
44
-        name: 'salesBatchName',
45
-        type: FieldTypes.Text,
46
-        value: saleBatchData.salesBatchName,
47
-        rules: [
48
-          {
49
-            required: true,
50
-            message: '销售批次名',
51
-          },
52
-        ],
53
-      },
54
-      {
55
-        label: '销售楼盘',
56
-        name: 'buildingId',
57
-        render: <BuildSelect />,
58
-        value: saleBatchData.buildingId,
59
-        rules: [
60
-          {
61
-            required: true,
62
-            message: '请选择销售楼盘',
63
-          },
64
-        ],
65
-      },
66
-      {
67
-        label: '备注',
68
-        name: 'remark',
69
-        type: FieldTypes.Text,
70
-        value: saleBatchData.remark,
71
-      },
72
-      {
73
-        label: '发布状态',
74
-        name: 'status',
75
-        type: FieldTypes.Select,
76
-        dict: [{label:"否",value:0},{label:"是",value:1}],
77
-        value: saleBatchData.status != null ? saleBatchData.status : 1,
78
-        rules: [
79
-          {
80
-            required: true,
81
-            message: '请选择发布状态',
82
-          },
83
-        ],
84
-      },
85
-      {
86
-        label: '预选时间',
87
-        name: 'preSelectTime',
88
-        type: FieldTypes.RangePicker,       
89
-        value: saleBatchData.preselectionStartTime != null ? [moment(saleBatchData.preselectionStartTime, 'YYYY-MM-DD HH:mm:ss'), moment(saleBatchData.preselectionEndTime, 'YYYY-MM-DD HH:mm')] : null,
90
-        props: { showTime: { format: 'HH:mm:ss' }},
91
-        rules: [
92
-          { required: true, message: '请选择预选时间' },
93
-        ],
94
-      },
95
-      {
96
-        label: '分栋鸟瞰图',
97
-        name: 'aerialViewImg',
98
-        type: FieldTypes.ImageUploader,
99
-        value: saleBatchData.aerialViewImg,
100
-        help: '建议图片尺寸:220*176px,比例5:4,格式:jpg,文件小于300KB。分栋鸟瞰图会显示在楼盘详情页面。用户点击进入查看全部发布房源。可以适当在图中添加引导语。',
101
-        rules: [
102
-          {
103
-            required: true,
104
-            message: '请选择分栋鸟瞰图',
105
-          },
106
-        ],
107
-      },
108
-    ]
109
-  
110
-    const handleSubmit = values => { 
111
-     console.log('submit data --->', values)
112
-      
113
-     let {preSelectTime, ...submitValue} = values
44
+
45
+
46
+  function handleSubmit (e) {
47
+    e.preventDefault();
48
+    props.form.validateFields((err, values) => {
49
+      if (!err){
50
+        let {preSelectTime, ...submitValue} = values
114 51
         if(null != preSelectTime && preSelectTime.length > 0){
115 52
           const [preselectionStartTime, preselectionEndTime] = preSelectTime
116 53
           submitValue.preselectionStartTime = moment(preselectionStartTime).format('YYYY-MM-DD HH:mm:ss');
@@ -122,17 +59,77 @@ const header = props => {
122 59
         // getList({ pageNum: pageNumber, pageSize: 10, ...submitValue })
123 60
         console.log(submitValue)
124 61
         request({ ...apis.house.addTaSalesBatch, data: { ...submitValue },}).then((data) => {
125
-          message.info("保存成功")
126
-          cancelPage()
127
-      }).catch((err) => {
128
-        message.info(err.msg || err.message)
129
-      })
130
-    }
131
-     
62
+          message.info("保存成功,请上传房源")
63
+          console.log(data,"datattttttt")
64
+          router.push({
65
+            pathname: '/house/batch',
66
+            query: {
67
+              salesBatchId: data.salesBatchId,
68
+              buildingId: data.buildingId,
69
+            },
70
+          });
71
+        }).catch((err) => {
72
+          message.info(err.msg || err.message)
73
+        })
74
+      }
75
+    });
76
+  }
77
+
78
+  const { getFieldDecorator } = props.form;
132 79
 
133 80
   return (
134
-    <XForm onSubmit={handleSubmit} onCancel={cancelPage} fields={fields}></XForm>
135
-  );
81
+    <>
82
+      <Form labelCol={{ span: 7 }} wrapperCol={{ span: 12 }} onSubmit={handleSubmit}>
83
+        <Form.Item label="销售批次名">
84
+          {getFieldDecorator('salesBatchName', {
85
+            rules: [{ required: true, message: '请输入销售批次名' }],
86
+          })(<Input maxLength={20} />)}
87
+        </Form.Item>
88
+        <Form.Item label="销售楼盘">
89
+          {getFieldDecorator('buildingId', {
90
+            rules: [{ required: true, message: ' 请输入销售楼盘' }],
91
+          })(<BuildSelect />)}
92
+        </Form.Item>
93
+        <Form.Item label="备注">
94
+          {getFieldDecorator('remark')
95
+            (<Input maxLength={20}/>)}
96
+        </Form.Item>
97
+        <Form.Item label="发布状态">
98
+          {getFieldDecorator('status', {
99
+              rules: [{ required: true, message: '请选择发布状态' }],
100
+            })(<Select placeholder="发布状态" style={{ width: '300px' }}>
101
+            <Option value="0">否</Option>
102
+            <Option value="1">是</Option>
103
+          </Select>)}
104
+        </Form.Item>
105
+        <Form.Item label="预选时间">
106
+            {getFieldDecorator('preSelectTime', {
107
+              rules: [
108
+                {
109
+                  required: true,
110
+                  message: '请选择预选时间',
111
+                },
112
+              ],
113
+            })(<RangePicker style={{ width: '500px' }}format="YYYY-MM-DD HH:mm:ss" showTime={{ format: 'HH:mm:ss' }}/>)}
114
+        </Form.Item>
115
+        <Form.Item label="分栋鸟瞰图" help="建议尺寸:690*388px,比例16::9,格式:jpg,文件小于300KB。分栋鸟瞰图会显示在楼盘详情页面。用户点击进入查看全部发布房源。可以适当在图中添加引导语。">
116
+              {getFieldDecorator('aerialViewImg', {
117
+                  rules: [{ required: true, message: '请上传分栋鸟瞰图' }],
118
+              })(
119
+                <ImageUpload />,
120
+              )}
121
+        </Form.Item>  
122
+        <Form.Item wrapperCol={{ span: 15, offset: 7 }}>
123
+          <Button type="primary" htmlType="submit"style={{marginRight:'20px'}}>
124
+            下一步
125
+          </Button>
126
+          <Button onClick={() => router.go(-1)}>
127
+            取消
128
+          </Button>
129
+        </Form.Item>
130
+      </Form>
131
+    </>
132
+  )
136 133
 }
137 134
 
138 135
 const WrappedHeader = Form.create({ name: 'header' })(header);

+ 14
- 0
src/pages/house/edit/components/EnDash/index.jsx 파일 보기

@@ -0,0 +1,14 @@
1
+import React from 'react'
2
+
3
+export default function EnDash(props) {
4
+    const { size = 1, color = '#999', style = {}, ...left } = props
5
+
6
+    const newSt = { 
7
+        ...style,
8
+        display: 'flex',
9
+        alignItems: 'center',
10
+        justifyContent: 'center',
11
+    }
12
+
13
+    return <div style={newSt} { ...left }><hr style={{ border: 'none', borderBottom: `${size}px dashed ${color}`, width: '100%' }} /></div>
14
+}

+ 109
- 0
src/pages/house/edit/components/HelpDoc/index.jsx 파일 보기

@@ -0,0 +1,109 @@
1
+import React, { PureComponent } from 'react'
2
+import { Modal, Row, Col } from 'antd'
3
+import EnDash from '../EnDash'
4
+
5
+import Style from './style.less'
6
+import HotBlock from '../HotBlock'
7
+
8
+const dataset = [
9
+  {
10
+    label: '(0)',
11
+    value: 0,
12
+  },
13
+  {
14
+    label: '(1)',
15
+    value: 1,
16
+  },
17
+  {
18
+    label: '(2)',
19
+    value: 2,
20
+  },
21
+  {
22
+    label: '(3)',
23
+    value: 3,
24
+  },
25
+  {
26
+    label: '(4)',
27
+    value: 4,
28
+  },
29
+  {
30
+    label: '(5)',
31
+    value: 5,
32
+  },
33
+  {
34
+    label: '(6~10)',
35
+    value: 8,
36
+  },
37
+  {
38
+    label: '(11~20)',
39
+    value: 15,
40
+  },
41
+  {
42
+    label: '(21~30)',
43
+    value: 25,
44
+  },
45
+  {
46
+    label: '(31~40)',
47
+    value: 35,
48
+  },
49
+  {
50
+    label: '(41~50)',
51
+    value: 45,
52
+  },
53
+  {
54
+    label: '(51~100)',
55
+    value: 80,
56
+  },
57
+  {
58
+    label: '(101~200)',
59
+    value: 150,
60
+  },
61
+  {
62
+    label: '(200以上)',
63
+    value: 201,
64
+  },
65
+]
66
+
67
+function Cell(props) {
68
+  return (
69
+    <Row type="flex" align="middle" gutter={20}>
70
+      <Col span={4}>{props.left}</Col>
71
+      <Col span={12}><EnDash /></Col>
72
+      <Col span={6}>{props.right}</Col>
73
+    </Row>
74
+  )
75
+}
76
+
77
+export default function HelpDoc(props) {
78
+  return (
79
+    <Modal footer={null} title="相关说明" visible={props.visible} onCancel={props.onCancel} width={800}>
80
+      <div className={Style.article}>
81
+        <div className={Style.section}>
82
+          <div className={Style.title}>1.图例解释:</div>
83
+          <div>
84
+            <Cell left="1号楼" right="楼栋/幢" />
85
+            <Cell left="2单元" right="单元" />
86
+            <Cell left="3楼" right="楼层" />
87
+            <Cell left="301" right="房号" />
88
+            <Cell left="1人" right="预选人数" />
89
+            <Cell left="234万" right="价格" />
90
+            <Cell left="A户型" right="户型名" />
91
+          </div>
92
+        </div>
93
+        <div className={Style.section}>
94
+          <div className={Style.title}>2.预选人数(热度):</div>
95
+          <div>每有一位客户预选此房源,热度自动增加1,热度越大说明想购买此房源的用户越多,认筹摇号购买难度越大。</div>
96
+        </div>
97
+        <div className={Style.section}>
98
+          <div className={Style.title}>3.热度指标:</div>
99
+          <div className={Style.subtitle}>颜色越深代表热度越高。黑底白字代表房源未发布,未发布房源用户不会看到。</div>
100
+          <div className={Style.flex}>
101
+            {
102
+              dataset.map((block) => (<div className={Style['flex-item']} key={block.value}><HotBlock number={block.value}>{block.label}</HotBlock></div>))
103
+            }
104
+          </div>
105
+        </div>
106
+      </div>
107
+    </Modal>
108
+  );
109
+}

+ 36
- 0
src/pages/house/edit/components/HelpDoc/style.less 파일 보기

@@ -0,0 +1,36 @@
1
+.article {
2
+    .section {
3
+        font-size: 16px;
4
+        line-height: 1.8em;
5
+        color: #666;
6
+
7
+        & + .section {
8
+            margin-top: 24px;
9
+        }
10
+    }
11
+
12
+    .title {
13
+        font-size: 18px;
14
+        line-height: 2em;
15
+        color: #333;
16
+    }
17
+
18
+    .subtitle {
19
+        font-size: 14px;
20
+        line-height: 1.6em;
21
+        color: #999;
22
+    }
23
+
24
+    .flex {
25
+        display: flex;
26
+        flex-wrap: wrap;
27
+
28
+        .flex-item {
29
+            margin-top: 16px;
30
+            margin-right: 8px;
31
+            flex: none;
32
+            width: 100px;
33
+            text-align: center;
34
+        }
35
+    }
36
+}

+ 40
- 0
src/pages/house/edit/components/HotBlock/index.jsx 파일 보기

@@ -0,0 +1,40 @@
1
+import React from 'react'
2
+import classNames from 'classnames'
3
+
4
+import Style from './style.less'
5
+
6
+function computeLevel (num) {
7
+    switch (true) {
8
+      case num >= 200:
9
+        return 13;
10
+      case num > 100:
11
+        return 12;
12
+      case num > 50:
13
+        return 11;
14
+      case num > 40:
15
+        return 10;
16
+      case num > 30:
17
+        return 9;
18
+      case num > 20:
19
+        return 8;
20
+      case num > 20:
21
+        return 8;
22
+      case num > 10:
23
+        return 7;
24
+      case num >= 6:
25
+        return 6;
26
+      case num > 0:
27
+        return num;
28
+      default:
29
+        return 0;
30
+    }
31
+  }
32
+  
33
+  export default function HotBlock(props) {
34
+    const level = computeLevel(props.number)
35
+
36
+    const cls = classNames(Style.hotblock, Style[`bkg-${level}`])
37
+
38
+    return (<div className={cls}>{props.children}</div>)
39
+  }
40
+  

+ 46
- 0
src/pages/house/edit/components/HotBlock/style.less 파일 보기

@@ -0,0 +1,46 @@
1
+
2
+.hotblock {
3
+    &.bkg-0 {
4
+      background:#F8F8F8;
5
+    }
6
+    &.bkg-1 {
7
+      background:#F9DED1;
8
+    }
9
+    &.bkg-2 {
10
+      background:#F6D4C3;
11
+    }
12
+    &.bkg-3 {
13
+      background:#F8C6AD;
14
+    }
15
+    &.bkg-4 {
16
+      background:#FDDBDB;
17
+    }
18
+    &.bkg-5 {
19
+      background:#F9CCCC;
20
+    }
21
+    &.bkg-6 {
22
+      background:#F9B7B7;
23
+    }
24
+    &.bkg-7 {
25
+      background:#FFADAD;
26
+    }
27
+    &.bkg-8 {
28
+      background:#F59683;
29
+    }
30
+    &.bkg-9 {
31
+      background:#F7836C;
32
+    }
33
+    &.bkg-10 {
34
+      background:#F97459;
35
+    }
36
+    &.bkg-11 {
37
+      background:#FC6749;
38
+    }
39
+    &.bkg-12 {
40
+      background:#FD4E2B;
41
+    }
42
+    &.bkg-13 {
43
+      background:#FE2E2E;
44
+    }
45
+  }
46
+  

+ 136
- 0
src/pages/house/edit/components/HouseBatch.jsx 파일 보기

@@ -0,0 +1,136 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Input, Button, Icon, Select, Tabs, Radio, DatePicker, message, Upload, Table } from 'antd';
3
+import { FormattedMessage } from 'umi-plugin-react/locale';
4
+import moment from 'moment';
5
+import router from 'umi/router';
6
+import { fetch } from '../../../../utils/request';
7
+import apis from '../../../../services/apis';
8
+import XForm, { FieldTypes } from '../../../../components/XForm';
9
+import ApartmentSelect from '../../../../components/HouseSelect/ApartmentSelect';
10
+import request from '@/utils/request';
11
+
12
+const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
13
+const { TextArea } = Input;
14
+
15
+function HouseBatch(props) {
16
+
17
+const [data, setData] = useState({list: [], total: 0})
18
+
19
+const [uploadFile, setUploadFile] = useState(null)
20
+
21
+const uploadExcel = fetch(apis.house.uploadExcel)
22
+
23
+const uploaderProps = {
24
+  name: 'file',
25
+  accept: '.xls, .xlsx',
26
+  showUploadList: false,
27
+  customRequest({
28
+    action,
29
+    file,
30
+    headers,
31
+    onError,
32
+    onProgress,
33
+    onSuccess,
34
+    withCredentials,
35
+  }) {
36
+     
37
+    const data = new FormData()
38
+    data.append('file', file)
39
+    data.append('salesBatchId', props.salesBatchId)
40
+    data.append('buildingId', props.buildingId)
41
+
42
+    setUploadFile(file)
43
+
44
+    uploadExcel({ data }).then((res) => {
45
+      setData(res)
46
+      onSuccess(res, file);
47
+    }).catch(onError);
48
+
49
+    return {
50
+      abort() {
51
+        console.log('upload progress is aborted.');
52
+      },
53
+    };
54
+  },
55
+}
56
+
57
+//取消
58
+function handleCancel(){
59
+    props.onSuccess({type: "house"})
60
+}
61
+
62
+function batchSaveHouse() {
63
+  const uploadData = new FormData()
64
+  uploadData.append('file', uploadFile)
65
+  uploadData.append('salesBatchId', props.salesBatchId)
66
+  uploadData.append('buildingId', props.buildingId)
67
+
68
+  request({ ...apis.house.saveExcelValue, data: uploadData,headers: "content-type=multipart/form-data" }).then(res => {
69
+    message.info('上传成功')
70
+    props.onSuccess({type: "house"})
71
+  }).catch(err => {
72
+    // openNotificationWithIcon('error', err.message)
73
+  })
74
+}
75
+
76
+const columns = [
77
+  {
78
+    title: '期/区',
79
+    dataIndex: 'termName',
80
+    key: 'termName',
81
+  },
82
+  {
83
+    title: '楼栋',
84
+    dataIndex: 'blockName',
85
+    key: 'blockName',
86
+  },
87
+  {
88
+    title: '单元',
89
+    dataIndex: 'unitName',
90
+    key: 'unitName',
91
+  },
92
+  {
93
+    title: '层',
94
+    dataIndex: 'floorName',
95
+    key: 'floorName',
96
+  },
97
+  {
98
+    title: '房号',
99
+    dataIndex: 'roomName',
100
+    key: 'roomName',
101
+  },
102
+  {
103
+    title: '价格(万元)',
104
+    dataIndex: 'price',
105
+    key: 'price',
106
+  },
107
+  {
108
+    title: '预选基础热度',
109
+    dataIndex: 'heat',
110
+    key: 'heat',
111
+  },
112
+  {
113
+    title: '发布状态',
114
+    dataIndex: 'status',
115
+    key: 'status',
116
+    render: status => <><span>{status == 0 ? '否' : status == 1 ? '是' : ''}</span></>,
117
+  },
118
+]
119
+
120
+  return (
121
+    <>
122
+      <span>1.导入房源先下载模板--></span><a href="https://njcj.oss-cn-shanghai.aliyuncs.com/miniapp/upload/images/1581597350487-房源模板.xlsx" download="房源模板.xlsx"><Button type="primary" htmlType="submit">下载模板</Button></a><br/>
123
+      <span>2.使用excel打开模板文件,编辑房源数据并保存</span><br/>
124
+      <span>3.将编辑好的文件上传--></span><Upload {...uploaderProps}><Button type="primary" htmlType="submit">上传</Button></Upload><br/>
125
+      <span>4.检查导入的数据是否正常 ↓,不正常则重新编辑保存再次上传,请仔细阅读模板中的编辑规则</span>
126
+      <Table dataSource={data.list} columns={columns} pagination={{ total: data.total}}  rowKey="House" />
127
+      
128
+      <span>5.全部正常请点击提交</span>
129
+      <Button type="primary" onClick={() => batchSaveHouse()}>提交</Button>
130
+      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
131
+      <Button onClick={() => handleCancel()}>取消</Button>
132
+    </>
133
+  )
134
+}
135
+const WrappedHouseBatch = Form.create({ name: 'house_batch' })(HouseBatch);
136
+export default WrappedHouseBatch

+ 21
- 0
src/pages/house/edit/components/HouseGrid/Floor.jsx 파일 보기

@@ -0,0 +1,21 @@
1
+import React from 'react'
2
+import Style from './style.less'
3
+
4
+export default function Floor(props) {
5
+  const { floorName, roomList = [] } = props.dataset || {}
6
+
7
+  return (
8
+    <div className={Style.floor}>
9
+      <div className={Style['floor-head']}>{floorName}</div>
10
+      <div className={Style['floor-body']}>
11
+        {roomList.map((room) => {
12
+          return (
13
+            <div className={Style.item} key={room.houseId} >
14
+              {props.render(room)}
15
+            </div>
16
+          )
17
+        })}
18
+      </div>
19
+    </div>
20
+  );
21
+}

+ 31
- 0
src/pages/house/edit/components/HouseGrid/Room.jsx 파일 보기

@@ -0,0 +1,31 @@
1
+import React from 'react'
2
+import classNames from 'classnames'
3
+import HotBlock from "../HotBlock"
4
+import Style from './style.less'
5
+
6
+export default function Room(props) {
7
+  const { roomName, price, apartmentName, status, heat, realHeat } = props.dataset || {}
8
+  let personNum = props.hotType === 1 ? (heat || 0) : (realHeat || 0)
9
+  if (props.hotType === 3) {
10
+    personNum = 0 + heat + realHeat
11
+  }
12
+
13
+  const handleClick = () => {
14
+    if (props.onClick) {
15
+      props.onClick(props.dataset || {})
16
+    }
17
+  }
18
+
19
+  const wanY = Number(price / 10000).toFixed(0)
20
+
21
+  return (
22
+    <HotBlock number={personNum}>
23
+      <div className={classNames(Style.room, { [`${Style.offline}`]: status !== 1 })} onClick={handleClick}>
24
+        <div className={Style.warn}>{roomName}</div>
25
+        <div className={Style.warn}>{`(${personNum}人)`}</div>
26
+        <div className={Style.info}>{`${wanY} 万`}</div>
27
+        <div className={Style.info}>{apartmentName}</div>
28
+      </div>
29
+    </HotBlock>
30
+  )
31
+}

+ 15
- 0
src/pages/house/edit/components/HouseGrid/Unit.jsx 파일 보기

@@ -0,0 +1,15 @@
1
+import React from 'react'
2
+import Style from './style.less'
3
+
4
+export default function Unit(props) {
5
+  const { unitName, floorList = [] } = props.dataset || {}
6
+
7
+  return (
8
+    <div className={Style.unit}>
9
+      <div className={Style['unit-head']}>{unitName}</div>
10
+      <div className={Style['unit-body']}>
11
+        {floorList.map(floor => props.render(floor))}
12
+      </div>
13
+    </div>
14
+  )
15
+}

+ 37
- 0
src/pages/house/edit/components/HouseGrid/index.js 파일 보기

@@ -0,0 +1,37 @@
1
+import React from 'react'
2
+import { PageHeader, Card } from 'antd';
3
+import Floor from "./Floor";
4
+import Room from "./Room";
5
+import Unit from './Unit';
6
+
7
+
8
+export default function(props) {
9
+  const blockList = props.dataset || []
10
+  
11
+  // 仅仅是一个函数, 不是函数式组件
12
+  function renderRoom(room) {
13
+    return (<Room dataset={room} hotType={props.hotType} />)
14
+  }
15
+
16
+  // 仅仅是一个函数, 不是函数式组件
17
+  function renderFloor(floor) {
18
+    return (<Floor key={floor.floorId} dataset={floor} render={renderRoom} />)
19
+  }
20
+
21
+  return (
22
+    <div>
23
+      {
24
+        blockList.map((block) => (
25
+          <div key={block.blockId} style={{marginTop: '20px', overflowX: 'auto'}}>
26
+            <PageHeader title={`${block.termName} ${block.blockName}`} backIcon={false} />
27
+            <div style={{ display: 'flex', padding: '10px' }}>
28
+            {
29
+              (block.unitList || []).map((unit) => (<div key={unit.unitId} style={{ flex: 'auto', marginRight: '30px' }} ><Unit dataset={unit} render={renderFloor} /></div>))
30
+            }
31
+            </div>
32
+          </div>
33
+        ))
34
+      }
35
+    </div>
36
+  )
37
+}

+ 72
- 0
src/pages/house/edit/components/HouseGrid/style.less 파일 보기

@@ -0,0 +1,72 @@
1
+.room {
2
+  text-align: center;
3
+  margin-bottom: 12px;
4
+  padding: 10px;
5
+  font-size: 16px;
6
+  line-height: 1.4em;
7
+
8
+  .info {
9
+    color: #333;
10
+  }
11
+
12
+  .warn {
13
+    color: #730000;
14
+  }
15
+
16
+  &.offline {
17
+    color: #fff;
18
+    background: #000;
19
+    
20
+    .info, .warn {
21
+      color: #fff;
22
+    }
23
+  }
24
+}
25
+
26
+.floor {
27
+  display: flex;
28
+
29
+  &-head {
30
+    font-size: 20px;
31
+    padding-top: 36px;
32
+    flex: none;
33
+    width: 14%;
34
+    min-width: 100px;
35
+    text-align: center;
36
+  }
37
+
38
+  &-body {
39
+    padding-top: 10px;
40
+    text-align: center;
41
+    flex: auto;
42
+    display: flex;
43
+    justify-content: flex-start;
44
+    overflow-x: auto;
45
+
46
+    .item {
47
+      flex: none;
48
+      width: 110px;
49
+
50
+      & + .item {
51
+          margin-left: 2%;
52
+      }
53
+    }
54
+  }
55
+}
56
+
57
+.unit {
58
+  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
59
+  max-width: 600px;
60
+
61
+  &-head {
62
+    padding-left: 40px;
63
+    font-size: 22px;
64
+    line-height: 44px;
65
+    color: #000;
66
+    background: #f8f8f8;
67
+  }
68
+
69
+  &-body {
70
+    // padding: 0 20px;
71
+  }
72
+}

+ 10
- 3
src/pages/house/edit/components/base.jsx 파일 보기

@@ -45,7 +45,8 @@ const Base = props => {
45 45
       rules: [
46 46
         {
47 47
           required: true,
48
-          message: '销售批次名',
48
+          message: '销售批次名不合法',
49
+          max:20,
49 50
         },
50 51
       ],
51 52
     },
@@ -66,6 +67,12 @@ const Base = props => {
66 67
       name: 'remark',
67 68
       type: FieldTypes.Text,
68 69
       value: saleBatchData.remark,
70
+      rules: [
71
+        {
72
+          message: '最多20字',
73
+          max:20
74
+        }
75
+      ],
69 76
     },
70 77
     {
71 78
       label: '发布状态',
@@ -94,7 +101,7 @@ const Base = props => {
94 101
       name: 'aerialViewImg',
95 102
       type: FieldTypes.ImageUploader,
96 103
       value: saleBatchData.aerialViewImg,
97
-      help: '建议图片尺寸:220*176px,比例5:4,格式:jpg,文件小于300KB。分栋鸟瞰图会显示在楼盘详情页面。用户点击进入查看全部发布房源。可以适当在图中添加引导语。',
104
+      help: '建议图片尺寸:690*388px,比例16::9,格式:jpg,文件小于300KB。分栋鸟瞰图会显示在楼盘详情页面。用户点击进入查看全部发布房源。可以适当在图中添加引导语。',
98 105
       rules: [
99 106
         {
100 107
           required: true,
@@ -115,7 +122,7 @@ const Base = props => {
115 122
           submitValue.preselectionEndTime = null
116 123
         }        
117 124
         console.log(submitValue)
118
-        request({ ...apis.house.updateTaSalesBatch, urlData: {id: salesBatchId},data: values, }).then((data) => {
125
+        request({ ...apis.house.updateTaSalesBatch, urlData: {id: salesBatchId},data: submitValue, }).then((data) => {
119 126
           message.info("保存成功")
120 127
           cancelPage()
121 128
         }).catch((err) => {

+ 70
- 8
src/pages/house/edit/components/house.jsx 파일 보기

@@ -20,6 +20,8 @@ import ApartmentSelect from '../../../../components/HouseSelect/ApartmentSelect'
20 20
 function House(props) {
21 21
   // eslint-disable-next-line react-hooks/rules-of-hooks
22 22
   const [data, setData] = useState([])
23
+  const [viable, setViable] = useState(false)
24
+  const [houseIdList, setHouseIdList] = useState([])
23 25
 
24 26
   useEffect(() => {
25 27
     getList()
@@ -58,6 +60,7 @@ function House(props) {
58 60
   const rowSelection = {
59 61
     onChange: (selectedRowKeys, selectedRows) => {
60 62
       console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows);
63
+      setHouseIdList(selectedRows)
61 64
     },
62 65
   };
63 66
 
@@ -65,6 +68,19 @@ function House(props) {
65 68
     props.onSuccess(e);
66 69
   }
67 70
 
71
+  //打开model
72
+  function showAparement() {
73
+    if(houseIdList.length < 1){
74
+      openNotificationWithIcon('error', '请先选择需要改变的房源')
75
+      return
76
+    }
77
+    setViable(true)
78
+  }
79
+
80
+  function handleCancel() {
81
+    setViable(false)
82
+  }
83
+
68 84
   // 提交事件
69 85
   const handleSubmit = e => {
70 86
     e.preventDefault();
@@ -76,21 +92,39 @@ function House(props) {
76 92
     });
77 93
   }
78 94
 
95
+    // model提交事件
96
+    const handleSubmitApartMent = e => {
97
+      props.form.validateFields((err, values) => {
98
+        if (!err) {
99
+          if(!values.apartmentIdSelected){
100
+            openNotificationWithIcon('error', '请选择户型')
101
+            return
102
+          }
103
+          request({ ...apis.house.changeApartment, data: { apartmentId: values.apartmentIdSelected, houseIdList } }).then(res => {
104
+            setViable(false)
105
+            getList({ pageNumber: 1, pageSize: 10 })
106
+            openNotificationWithIcon('success', '操作成功')
107
+          }).catch(err => {
108
+            openNotificationWithIcon('error', err.message)
109
+          })
110
+        }
111
+      });
112
+    }
79 113
   /**
80 114
    * 删除
81 115
    *
82 116
    * @param {*} record
83 117
    */
84
-  function deleteApartment(record) {
85
-    confirm({
118
+  function deleteHouseResource(record) {
119
+    Modal.confirm({
86 120
       title: '确认删除当前数据?',
87 121
       content: '确定后成功删除,点击取消则放弃当前操作',
88 122
       okText: '确定',
89 123
       cancelText: '取消',
90 124
       onOk() {
91 125
         // 网路请求
92
-        request({ ...apis.building.buildingApartmentDelete, urlData: { id: record.apartmentId } }).then(res => {
93
-          getList()
126
+        request({ ...apis.house.houseDelete, urlData: { id: record.houseId } }).then(res => {
127
+          getList({ pageNumber: 1, pageSize: 10 })
94 128
           openNotificationWithIcon('success', '操作成功')
95 129
         }).catch(err => {
96 130
           // openNotificationWithIcon('error', err.message)
@@ -107,6 +141,11 @@ function House(props) {
107 141
       dataIndex: 'houseId',
108 142
       key: 'houseId',
109 143
     },
144
+    {
145
+      title: '期/区',
146
+      dataIndex: 'termName',
147
+      key: 'termName',
148
+    },
110 149
     {
111 150
       title: '楼栋',
112 151
       dataIndex: 'blockName',
@@ -146,6 +185,7 @@ function House(props) {
146 185
       title: '预选实际热度',
147 186
       dataIndex: 'realHeat',
148 187
       key: 'realHeat',
188
+      render:  (x, row) => <><span style={{color: 'blue',cursor: 'pointer'}} onClick={() => showEdi({type: "preselection",houseId: row.houseId})}>{row.realHeat}</span></>,
149 189
     },
150 190
     {
151 191
       title: '发布状态',
@@ -165,7 +205,7 @@ function House(props) {
165 205
       render: (_, record) => (
166 206
         <>
167 207
           <Button type="link" style={{ color: 'red' }} onClick={() => showEdi({type: "add",houseId: record.houseId})}>编辑</Button>
168
-          <Button type="link" style={{ color: 'red' }} onClick={() => deleteApartment(record)}>删除</Button>
208
+          <Button type="link" style={{ color: 'red' }} onClick={() => deleteHouseResource(record)}>删除</Button>
169 209
         </>
170 210
       ),
171 211
     },
@@ -227,10 +267,32 @@ function House(props) {
227 267
         </Form.Item>
228 268
       </Form>
229 269
       <Button type="primary" onClick={() => showEdi({type: "add",houseId: ''})}>新增房源</Button>
230
-      <Button type="primary" onClick={() => showEdi()} style={{ marginLeft: '18px'}}>批量导入房源</Button>
231
-      <Button type="primary" onClick={() => showEdi()} style={{ marginLeft: '18px'}}>批量修改对应户型</Button>
270
+      <Button type="primary" onClick={() => showEdi({type: "batch"})} style={{ marginLeft: '18px'}}>批量导入房源</Button>
271
+      <Button type="primary" onClick={() => showAparement()} style={{ marginLeft: '18px'}}>批量修改对应户型</Button>
232 272
       <Button type="danger" style={{ marginLeft: '18px'}} onClick={() => router.go(-1)}>返回</Button>
233
-      <Table rowSelection={rowSelection} dataSource={data.records} columns={columns} pagination={{ total: data.total, onChange: e => this.changePageNum(e) }} rowKey="House" />
273
+      <Table rowSelection={rowSelection} dataSource={data.records} columns={columns} pagination={{ total: data.total, onChange: e => changePageNum(e) }} rowKey="House" />
274
+      <Modal
275
+            title="批量修改对应户型"
276
+            width={400}
277
+            destroyOnClose="true"
278
+            footer={null}
279
+            visible={viable}
280
+            onOk={() => this.handleOk()}
281
+            onCancel={e => handleCancel(e)}
282
+          >
283
+            <Form onSubmit={e => handleSubmitApartMent(e)}>
284
+              <Form.Item label="将所选房源对应户型信息修改为" >
285
+                {getFieldDecorator('apartmentIdSelected')(
286
+                <ApartmentSelect buildingId={props.buildingId} />
287
+                )}
288
+              </Form.Item>
289
+              <Form.Item style={{ width: '400px', margin: 'auto', display: 'flex', justifyContent: 'space-between' }}>
290
+                <Button type="primary" htmlType="submit">保存</Button>
291
+                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
292
+                <Button onClick={() => handleCancel()}>取消</Button>
293
+              </Form.Item>
294
+            </Form>
295
+        </Modal>
234 296
     </>
235 297
   )
236 298
 }

+ 8
- 8
src/pages/house/edit/components/houseAdd.jsx 파일 보기

@@ -49,7 +49,7 @@ function HouseAdd(props) {
49 49
       if (!err) {
50 50
           if(houseId){
51 51
             request({ ...apis.house.houseEdit,urlData: {id: houseId}, data: { ...values,buildingId: props.buildingId, salesBatchId: props.salesBatchId } }).then((data) => {
52
-              message.info('保存成功')
52
+              message.info('修改成功')
53 53
               props.onSuccess({type: "house"})
54 54
             }).catch((err) => {
55 55
               // message.info(err.msg || err.message)
@@ -74,7 +74,7 @@ function HouseAdd(props) {
74 74
   return (
75 75
     <>
76 76
       <Form {...formItemLayout} onSubmit={handleSubmit}>
77
-      <Form.Item label="期">
77
+      <Form.Item label="期" >
78 78
         {getFieldDecorator('termName', {
79 79
           rules: [
80 80
             {
@@ -82,7 +82,7 @@ function HouseAdd(props) {
82 82
               message: '请输入楼栋',
83 83
             },
84 84
           ],
85
-        })(<Input/>)}
85
+        })(<Input disabled={houseId && houseId !== '' ? true : false}/>)}
86 86
         </Form.Item>
87 87
         <Form.Item label="楼栋">
88 88
         {getFieldDecorator('blockName', {
@@ -92,7 +92,7 @@ function HouseAdd(props) {
92 92
               message: '请输入楼栋',
93 93
             },
94 94
           ],
95
-        })(<Input/>)}
95
+        })(<Input disabled={houseId && houseId !== '' ? true : false}/>)}
96 96
         </Form.Item>
97 97
         <Form.Item label="单元">
98 98
         {getFieldDecorator('unitName', {
@@ -102,7 +102,7 @@ function HouseAdd(props) {
102 102
               message: '请输入单元',
103 103
             },
104 104
           ],
105
-        })(<Input/>)}
105
+        })(<Input disabled={houseId && houseId !== '' ? true : false}/>)}
106 106
         </Form.Item>
107 107
         <Form.Item label="层">
108 108
         {getFieldDecorator('floorName', {
@@ -112,7 +112,7 @@ function HouseAdd(props) {
112 112
               message: '请输入楼层',
113 113
             },
114 114
           ],
115
-        })(<Input/>)}
115
+        })(<Input disabled={houseId && houseId !== '' ? true : false}/>)}
116 116
         </Form.Item>
117 117
         <Form.Item label="房号">
118 118
         {getFieldDecorator('roomName', {
@@ -160,8 +160,8 @@ function HouseAdd(props) {
160 160
           ],
161 161
         })(
162 162
           <Select placeholder="发布状态">
163
-            <Option value="0">否</Option>
164
-            <Option value="1">是</Option>
163
+            <Option value={0}>否</Option>
164
+            <Option value={1}>是</Option>
165 165
           </Select>,
166 166
         )}
167 167
         </Form.Item>

+ 6
- 0
src/pages/house/edit/components/houseTab.jsx 파일 보기

@@ -7,6 +7,8 @@ import { router } from 'umi';
7 7
 
8 8
 import House from './house'
9 9
 import HouseAdd from './houseAdd'
10
+import HouseBatch from './HouseBatch'
11
+import PreselectionRecord from './preselectionRecord'
10 12
 
11 13
 
12 14
 
@@ -15,6 +17,9 @@ function EditHouse(props) {
15 17
   const [houseId, setHouseId] = useState('')
16 18
 
17 19
   function changeTab(e) {
20
+    if(e.type === "preselection"){
21
+      props.onSuccess(e)
22
+    }
18 23
     setTab(e.type)
19 24
     if(e.type === "add"){
20 25
       setHouseId(e.houseId)
@@ -26,6 +31,7 @@ function EditHouse(props) {
26 31
       <div style={{ marginTop: '20px' }}>
27 32
         { (tab === 'house' && <House salesBatchId={props.salesBatchId} buildingId={props.buildingId} onSuccess={e => changeTab(e)}/>)} 
28 33
         { (tab === 'add' && <HouseAdd salesBatchId={props.salesBatchId} buildingId={props.buildingId} houseId={houseId} onSuccess={e => changeTab(e)}/>)} 
34
+        { (tab === 'batch' && <HouseBatch salesBatchId={props.salesBatchId} buildingId={props.buildingId} onSuccess={e => changeTab(e)}/>)} 
29 35
       </div>
30 36
     </>
31 37
   )

+ 90
- 8
src/pages/house/edit/components/preselectionImg.jsx 파일 보기

@@ -1,15 +1,97 @@
1 1
 import React, { useState, useEffect } from 'react';
2
-import { Form, Input, Button, Icon, Select, Tabs, Radio, DatePicker, message, Upload } from 'antd';
3
-import { FormattedMessage } from 'umi-plugin-react/locale';
4
-import moment from 'moment';
5
-import router from 'umi/router';
6
-import apis from '../../../../services/apis';
2
+import { Form, Button, Radio, Icon } from 'antd';
3
+import HouseGrid from './HouseGrid';
4
+import { fetch, apis } from '../../../../utils/request'
5
+import HelpDoc from './HelpDoc';
7 6
 
8
-const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
9
-const { TextArea } = Input;
7
+const getHouseList = fetch(apis.house.listHouseResources)
8
+
9
+function groupHouseList(houseList = []) {
10
+  // 先按照楼层分组
11
+  const floorList = houseList.reduce((list, room) => {
12
+    let found = false
13
+
14
+    list.forEach((floor) => {
15
+      if (floor.floorId === room.floorId) {
16
+        found = true
17
+        floor.roomList.push(room)
18
+      }
19
+    })
20
+    
21
+    if (!found) {
22
+      list.push({ ...room, roomList: [ room ]})
23
+    }
24
+
25
+    return list
26
+  }, [])
27
+
28
+  // 再按照单元分组
29
+  const unitList = floorList.reduce((list, floor) => {
30
+    let found = false
31
+    list.forEach((unit) => {
32
+      if (unit.unitId === floor.unitId) {
33
+        found = true
34
+        unit.floorList.push(floor)
35
+      }
36
+    })
37
+    
38
+    if (!found) {
39
+      list.push({ ...floor, floorList: [ floor ]})
40
+    }
41
+
42
+    return list
43
+  }, [])
44
+
45
+  // 最后按照楼栋分组
46
+  return unitList.reduce((list, unit) => {
47
+    let found = false
48
+    list.forEach((block) => {
49
+      if (block.blockId === unit.blockId) {
50
+        found = true
51
+        block.unitList.push(unit)
52
+      }
53
+    })
54
+    
55
+    if (!found) {
56
+      list.push({ ...unit, unitList: [ unit ]})
57
+    }
58
+
59
+    return list
60
+  }, [])
61
+}
10 62
 
11 63
 const PreselectionImg = props => {
12
-  return <div><span>预选热度图</span></div>
64
+  const salesBatchId = props.salesBatchId
65
+  const [hotType, setHotType] = useState(1)
66
+  const [blockList, setBlockList] = useState([])
67
+  const [showHelp, setShowHelp] = useState(false)
68
+
69
+  useEffect(() => {
70
+    if (salesBatchId) {
71
+      getHouseList({ params: { salesBatchId } }).then(res => {
72
+        const groupedData = groupHouseList(res)
73
+        setBlockList(groupedData)
74
+      })
75
+    }
76
+  }, [salesBatchId])
77
+
78
+  return (
79
+    <div>
80
+      <Form layout="inline">
81
+        <Form.Item label="热度选择">
82
+          <Radio.Group onChange={e => setHotType(e.target.value)} value={hotType}>
83
+            <Radio value={1}>基础热度</Radio>
84
+            <Radio value={2}>实际热度</Radio>
85
+            <Radio value={3}>显示热度</Radio>
86
+            <Icon type="question-circle" theme="filled" style={{ fontSize: '18px', color: '#F00' }} onClick={() => setShowHelp(true)} />
87
+          </Radio.Group>
88
+        </Form.Item>
89
+        <div>基础热度即预设的预选数量,实际并不存在用户预选,用来美化数据。实际热度即真实用户预选数量,基础热度+实际热度=显示热度</div>
90
+      </Form>
91
+      <HouseGrid dataset={blockList} hotType={hotType} />
92
+      <HelpDoc visible={showHelp} onCancel={() => setShowHelp(false)} />
93
+    </div>
94
+  )
13 95
 }
14 96
 
15 97
 export default PreselectionImg

+ 191
- 9
src/pages/house/edit/components/preselectionRecord.jsx 파일 보기

@@ -1,15 +1,197 @@
1 1
 import React, { useState, useEffect } from 'react';
2
-import { Form, Input, Button, Icon, Select, Tabs, Radio, DatePicker, message, Upload } from 'antd';
3
-import { FormattedMessage } from 'umi-plugin-react/locale';
2
+import { Form, Icon, Input, Button, DatePicker, Select, Card, Row, Col, Pagination, Alert, Radio, Tag, Tooltip, Tabs, Table, notification, Modal } from 'antd';
4 3
 import moment from 'moment';
5
-import router from 'umi/router';
4
+import request from '../../../../utils/request';
6 5
 import apis from '../../../../services/apis';
6
+import Styles from './style.less';
7
+import { router } from 'umi';
8
+import BlockSelect from '../../../../components/HouseSelect/BlockSelect'
9
+import UnitSelect from '../../../../components/HouseSelect/UnitSelect'
10
+import FloorSelect from '../../../../components/HouseSelect/FloorSelect'
11
+import RoomSelect from '../../../../components/HouseSelect/RoomSelect'
12
+import ApartmentSelect from '../../../../components/HouseSelect/ApartmentSelect';
7 13
 
8
-const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
9
-const { TextArea } = Input;
14
+/**
15
+ *图片设置
16
+ *
17
+ * @param {*} props
18
+ * @returns
19
+ */
20
+function PreselectionRecord(props) {
21
+  // eslint-disable-next-line react-hooks/rules-of-hooks
22
+  const [data, setData] = useState([])
23
+  const {salesBatchId} = props.salesBatchId
24
+  console.log(salesBatchId,'updateNameupdateNameupdateName');
25
+  useEffect(() => {
26
+    getList()
27
+  }, [])
10 28
 
11
-const PreselectionRecord = props => {
12
-  return <div><span>预选记录</span></div>
13
-}
29
+  function openNotificationWithIcon(type, message) {
30
+    notification[type]({
31
+      message,
32
+      description:
33
+        '',
34
+    });
35
+  }
36
+
37
+  function getList(params) {
38
+    // 网路请求
39
+    request({ ...apis.house.taPreselectRecord, params: { ...params,salesBatchId: salesBatchId, houseId: props.houseId } }).then(res => {
40
+      console.log(res,"resresres")
41
+      setData(res)
42
+    }).catch(err => {
43
+      openNotificationWithIcon('error', err.message)
44
+    })
45
+  }
46
+
47
+    // 重置搜索
48
+    function handleReset () {
49
+      props.form.resetFields();
50
+      getList({ pageNumber: 1, pageSize: 10 })
51
+    }
52
+
53
+      // 分页
54
+  function changePageNum(pageNumber) {
55
+    // eslint-disable-next-line react-hooks/rules-of-hooks
56
+    getList({ pageNumber: pageNumber, pageSize: 10})
57
+  }
14 58
 
15
-export default PreselectionRecord
59
+  const rowSelection = {
60
+    onChange: (selectedRowKeys, selectedRows) => {
61
+      console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows);
62
+    },
63
+  };
64
+
65
+  // 提交事件
66
+  const handleSubmit = e => {
67
+    e.preventDefault();
68
+    props.form.validateFields((err, values) => {
69
+      if (!err) {
70
+        console.log('提交数据: ', values)
71
+        getList({ pageNumber: 1, pageSize: 10, ...values })
72
+      }
73
+    });
74
+  }
75
+
76
+
77
+  const columns = [
78
+    {
79
+      title: '房源编号',
80
+      dataIndex: 'houseId',
81
+      key: 'houseId',
82
+    },
83
+    {
84
+      title: '期/区',
85
+      dataIndex: 'termname',
86
+      key: 'termname',
87
+    },
88
+    {
89
+      title: '楼栋',
90
+      dataIndex: 'blockName',
91
+      key: 'blockName',
92
+      // render: blockName => <><span>{blockName}幢</span></>,
93
+    },
94
+    {
95
+      title: '单元',
96
+      dataIndex: 'unitName',
97
+      key: 'unitName',
98
+      // render: unitName => <><span>{unitName}单元</span></>,
99
+    },
100
+    {
101
+      title: '层',
102
+      dataIndex: 'floorName',
103
+      key: 'floorName',
104
+      // render: floorName => <><span>{floorName}层</span></>,
105
+    },
106
+    {
107
+      title: '房号',
108
+      dataIndex: 'roomName',
109
+      key: 'roomName',
110
+    },
111
+    {
112
+      title: '对应户型',
113
+      dataIndex: 'apartmentName',
114
+      key: 'apartmentName',
115
+    },
116
+    {
117
+      title: '用户昵称',
118
+      dataIndex: 'nameOrnick',
119
+      key: 'nameOrnick',
120
+    },
121
+    {
122
+      title: '用户姓名',
123
+      dataIndex: 'name',
124
+      key: 'name',
125
+    },
126
+    {
127
+      title: '用户头像',
128
+      dataIndex: 'avatarurl',
129
+      key: 'avatarurl',
130
+      render: (text, records) => <img src={records.avatarurl} width={50} height={50} />,
131
+    },
132
+    {
133
+      title: '用户手机号',
134
+      dataIndex: 'phone',
135
+      key: 'phone',
136
+    },
137
+    
138
+    {
139
+      title: '预选状态',
140
+      dataIndex: 'status',
141
+      key: 'status',
142
+      render: status => <><span>{status == 0 ? '否' : status == 1 ? '是' : ''}</span></>,
143
+    },
144
+    {
145
+      title: '状态修改时间',
146
+      dataIndex: 'updateDate',
147
+      key: 'updateDate',
148
+    },
149
+    {
150
+      title: '最后修改人',
151
+      dataIndex: 'updateName',
152
+      key: 'updateName',
153
+    },
154
+  ]
155
+  const { getFieldDecorator } = props.form
156
+  return (
157
+    <>
158
+    <Form layout="inline" onSubmit={e => handleSubmit(e)}>
159
+        <Form.Item>
160
+          {getFieldDecorator('houseId')(
161
+            <Input placeholder="房源编号"/>,
162
+          )}
163
+        </Form.Item>
164
+        <Form.Item>
165
+          {getFieldDecorator('phone')(
166
+            <Input placeholder="用户手机号"/>,
167
+          )}
168
+        </Form.Item>
169
+        <Form.Item>
170
+          {getFieldDecorator('apartmentId')(
171
+             <ApartmentSelect buildingId={props.buildingId} />
172
+          )}
173
+        </Form.Item>
174
+        <Form.Item>
175
+          {getFieldDecorator('status')(
176
+             <Select placeholder="预选状态" style={{width: '120px'}}>
177
+             <Option value="0">否</Option>
178
+             <Option value="1">是</Option>
179
+           </Select>,
180
+          )}
181
+        </Form.Item>
182
+        
183
+        <Form.Item>
184
+          <Button type="primary" htmlType="submit" >
185
+            搜索
186
+          </Button>
187
+          <Button style={{ marginLeft: 8 }} onClick={handleReset}>
188
+            重置
189
+            </Button>
190
+        </Form.Item>
191
+      </Form>
192
+      <Table rowSelection={rowSelection} dataSource={data.records} columns={columns} pagination={{ total: data.total, onChange: e => this.changePageNum(e) }} rowKey="House" />
193
+    </>
194
+  )
195
+}
196
+const WrappedHeader = Form.create({ name: 'PreselectionRecord' })(PreselectionRecord);
197
+export default WrappedHeader

+ 14
- 2
src/pages/house/edit/components/share.jsx 파일 보기

@@ -35,9 +35,21 @@ const Share = props => {
35 35
       }).catch(err => {
36 36
         message.info(err.msg || err.message)
37 37
       })
38
+      getMiniappName();
38 39
     }, [])
39 40
   }
40 41
 
42
+  // 获取小程序名称
43
+  const [miniappName, setMiniappName] = useState('')
44
+  function getMiniappName() {
45
+
46
+    request({ ...apis.building.getMiniappName }).then(res => {
47
+    
48
+      setMiniappName(res)
49
+     
50
+    })
51
+  }
52
+
41 53
   const submitShare = () => {
42 54
     if (salesBatchId) {
43 55
       if (shareContentId) {
@@ -72,9 +84,9 @@ const Share = props => {
72 84
       <div>
73 85
         <p style={{ display: 'flex', alignItems: 'center', fontSize: '14px', color: '#999', margin: '0', lineHeight: '0' }}>
74 86
           <img src={logo} style={{ width: '22px', marginRight: '10px' }} />
75
-          知与行互动
87
+            {miniappName}
76 88
         </p>
77
-        <p style={{ fontSize: '16px', color: '#222', fontWeight: '600', margin: '0' }}>{inputValue ? inputValue : '置业V客厅 精准获客平台'}</p>
89
+        <p style={{ fontSize: '16px', color: '#222', fontWeight: '600', margin: '0' }}>{miniappName ? miniappName : '置业V客厅 精准获客平台'}</p>
78 90
         <img style={{ width: '200px', height: '160px' }} src={imgValue ? imgValue : poster2} alt="" />
79 91
       </div>
80 92
     </div>

+ 7
- 7
src/pages/house/edit/components/shareRecord.jsx 파일 보기

@@ -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 : 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 : salesBatchId, ...props.form.getFieldsValue() })
87 88
   }
88 89
 
89 90
   // 提交事件
@@ -92,7 +93,7 @@ const handleSubmit = (e, props) => {
92 93
     props.form.validateFields((err, values) => {
93 94
       if (!err) {
94 95
         console.log('提交数据: ', values)
95
-        getList({ pageNum: 1, pageSize: 10, ...values, showType: 'banner' })
96
+        getList({ pageNum: 1, pageSize: 10, salesBatchId : salesBatchId,  ...values })
96 97
       }
97 98
     });
98 99
   }
@@ -116,11 +117,10 @@ 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>
123
-              <Option value="drift">游客</Option>
124 124
             </Select>,
125 125
           )}
126 126
         </Form.Item>

+ 142
- 4
src/pages/house/edit/components/visitRecord.jsx 파일 보기

@@ -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

+ 16
- 8
src/pages/house/edit/index.jsx 파일 보기

@@ -42,6 +42,7 @@ function EditHouse(props) {
42 42
   console.log(props.location.query.id)
43 43
   const [tab, setTab] = useState('base')
44 44
   const [salesBatchData, setSalesBatchData] = useState({ salesBatchId: undefined })
45
+  const [houseId, setHouseId] = useState('')
45 46
 
46 47
   function tabsCallback(e) {
47 48
     setTab(e.target.value)
@@ -52,6 +53,13 @@ function EditHouse(props) {
52 53
     setBuildingData(e)
53 54
   }
54 55
 
56
+  function housTabChange(e) {
57
+    setHouseId(e.houseId)
58
+    setTab('preselectionRecord')
59
+  }
60
+
61
+  const batchId = salesBatchData.salesBatchId || (props.location.query && props.location.query.id)
62
+
55 63
   return (
56 64
     <>
57 65
       <Radio.Group value={ tab } buttonStyle="solid" onChange={e => tabsCallback(e)}>
@@ -65,14 +73,14 @@ function EditHouse(props) {
65 73
         <Radio.Button value="visitRecord">访问记录</Radio.Button>
66 74
       </Radio.Group>
67 75
       <div style={{ marginTop: '20px' }}>
68
-        { (tab === 'base' && <Base salesBatchId={{ salesBatchId: salesBatchData.salesBatchId || (props.location.query && props.location.query.id) }} onSuccess={e => buildingOnSuccess(e)}/>)} 
69
-        { (tab === 'house' && <HouseTab salesBatchId={props.location.query.id} buildingId={props.location.query.buildingId}/>)}
70
-        { (tab === 'poster' && <Poster salesBatchId={{ salesBatchId: salesBatchData.salesBatchId || (props.location.query && props.location.query.id) }}/>)}
71
-        { (tab === 'share' && <Share salesBatchId={{ salesBatchId: salesBatchData.salesBatchId || (props.location.query && props.location.query.id) }}/>)}
72
-        { (tab === 'preselectionImg' && <PreselectionImg />)}
73
-        { (tab === 'preselectionRecord' && <PreselectionRecord />)}
74
-        { (tab === 'shareRecord' && <ShareRecord />)}
75
-        { (tab === 'visitRecord' && <VisitRecord />)}
76
+        { (tab === 'base' && <Base salesBatchId={{ batchId }} onSuccess={e => buildingOnSuccess(e)}/>)} 
77
+        { (tab === 'house' && <HouseTab salesBatchId={props.location.query.id} buildingId={props.location.query.buildingId} onSuccess={e => housTabChange(e)}/>)}
78
+        { (tab === 'poster' && <Poster salesBatchId={{ batchId }}/>)}
79
+        { (tab === 'share' && <Share salesBatchId={{ batchId }}/>)}
80
+        { (tab === 'preselectionImg' && <PreselectionImg salesBatchId={batchId} />)}
81
+        { (tab === 'preselectionRecord' && <PreselectionRecord houseId={houseId} buildingId={props.location.query.buildingId} salesBatchId={{ batchId }}/>)}
82
+        { (tab === 'shareRecord' && <ShareRecord salesBatchId={{ batchId }}/>)}
83
+        { (tab === 'visitRecord' && <VisitRecord salesBatchId={{ batchId }}/>)}
76 84
       </div>
77 85
     </>
78 86
   )

+ 39
- 110
src/pages/house/list/index.jsx 파일 보기

@@ -1,5 +1,5 @@
1 1
 import React, { useState, useEffect } from 'react';
2
-import { Form, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal, DatePicker } from 'antd';
2
+import { Form, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal, DatePicker, notification } from 'antd';
3 3
 import { FormattedMessage } from 'umi-plugin-react/locale';
4 4
 import router from 'umi/router';
5 5
 import moment from 'moment';
@@ -17,9 +17,9 @@ const header = props => {
17 17
   // eslint-disable-next-line react-hooks/rules-of-hooks
18 18
   const [data, setData] = useState({ list: [], total: 0 })
19 19
   //   const [page, changePage] = useState({})
20
+  const [houseIdList, setHouseIdList] = useState([])
20 21
   const [time, setTime] = useState('')
21 22
 
22
-  //==========看这里-- 新功能都用house为中间单词,我已经创建好了,你只要修改list的指向链接就行,看完删除=========
23 23
   // 查询列表
24 24
   const getList = params => {
25 25
     request({ ...apis.house.taSalesBatch, params: { ...params } }).then(data => {
@@ -33,7 +33,7 @@ const header = props => {
33 33
     getList({ pageNum: 1, pageSize: 10 });
34 34
   }, [])
35 35
 
36
-  // 跳转到编辑商品
36
+  // 跳转到编辑
37 37
   const toAddHouse = rowData => () => {
38 38
     if(rowData) {
39 39
       router.push({
@@ -50,6 +50,30 @@ const header = props => {
50 50
     });
51 51
   }
52 52
 
53
+  function openNotificationWithIcon(type, message) {
54
+    notification[type]({
55
+      message,
56
+      description:
57
+        '',
58
+    });
59
+  }
60
+
61
+  
62
+  const toDelBatch = rowData => () =>{
63
+    console.log(houseIdList, 'houseIdListhouseIdList')
64
+    if(houseIdList.length < 1){
65
+      openNotificationWithIcon('error', '请先选择需要删除的批次')
66
+      return
67
+    }
68
+    console.log(houseIdList,'houseIdListhouseIdList');
69
+    request({ ...apis.house.deleteTaSalesBatch, data: houseIdList, }).then((data) => {
70
+      message.info("操作成功")
71
+      getList({ pageNum: 1, pageSize: 10 });
72
+    }).catch((err) => {
73
+      // message.info(err.msg)
74
+    })
75
+  }
76
+
53 77
   const newQrcode = row => {
54 78
     const x = new XMLHttpRequest();
55 79
     const resourceUrl = row.qrCode
@@ -66,23 +90,6 @@ const header = props => {
66 90
     x.send();
67 91
   }
68 92
 
69
-  const getActivityDetail = (dynamicId) => () => {
70
-    router.push({
71
-      pathname: '/activity/detailActivity',
72
-      query: {
73
-        dynamicId,
74
-      },
75
-    });
76
-  }
77
-
78
-  const getJoinPeople = (dynamicId) => () => {
79
-    router.push({
80
-      pathname: '/activity/SignList',
81
-      query: {
82
-        dynamicId,
83
-      },
84
-    });
85
-  }
86 93
   /**
87 94
    *
88 95
    *
@@ -140,98 +147,17 @@ const header = props => {
140 147
     });
141 148
   }
142 149
 
143
-  const finishDynamic = row => {
144
-    Modal.confirm({
145
-      title: '活动会被强制结束,小程序端无法再发起或参与此活动,如果不想让客户看到活动,请再点击取消发布按钮',
146
-      okText: '确定',
147
-      cancelText: '取消',
148
-      onOk () {
149
-        request({ ...apis.activity.finish, data: { dynamicId: row.dynamicId, top: '' } }).then(data => {
150
-          console.log(data)
151
-          message.info('操作成功!')
152
-          getList({ pageNum: 1, pageSize: 10, ...props.form.getFieldsValue() })
153
-        }).catch(err => {
154
-          console.log(err)
155
-          message.info(err.msg || err.message)
156
-        })
157
-      },
158
-    });
159
-  }
160
-
161
-  //   置顶
162
-  const topDynamic = row => () => {
163
-    const weight = Math.abs(row.weight - 1)
164
-    request({ ...apis.activity.weight, params: { dynamicId: row.dynamicId, weight } }).then(data => {
165
-      console.log(data)
166
-      message.info('操作成功!')
167
-      getList({ pageNum: 1, pageSize: 10, ...props.form.getFieldsValue() })
168
-    }).catch(err => {
169
-      console.log(err)
170
-      message.info(err.msg || err.message)
171
-    })
172
-  }
173
-
174
-  //   推首页
175
-  const homeDynamic = row => () => {
176
-    const home = Math.abs(row.home - 1)
177
-    request({ ...apis.activity.home, params: { dynamicId: row.dynamicId, home } }).then(data => {
178
-      console.log(data)
179
-      message.info('操作成功!')
180
-      getList({ pageNum: 1, pageSize: 10, ...props.form.getFieldsValue() })
181
-    }).catch(err => {
182
-      console.log(err)
183
-      message.info(err.msg || err.message)
184
-    })
185
-  }
186
-
187
-  const sendOrPublicDynamic = row => {
188
-    if (row.status === 1) {
189
-      cancelDynamic(row)
190
-    } else {
191
-      sendDynamic(row)
192
-    }
193
-  }
194
-
195
-  // 取消活动
196
-  const cancelDynamic = row => {
197
-    Modal.confirm({
198
-      title: '活动会在小程序端隐藏,后台可以继续编辑重新发布',
199
-      okText: '确认',
200
-      cancelText: '取消',
201
-      onOk() {
202
-        request({ ...apis.activity.cancel, urlData: { id: row.dynamicId } }).then(data => {
203
-          message.info('操作成功!')
204
-          getList({ pageNum: 1, pageSize: 10, ...props.form.getFieldsValue()  })
205
-        }).catch(err => {
206
-          console.log(err)
207
-          message.info(err.msg || err.message)
208
-        })
209
-      }
210
-    });
211
-  }
212
-
213
-  // 发布活动
214
-  const sendDynamic = row => {
215
-    Modal.confirm({
216
-      title: '确定发布吗?',
217
-      okText: '确认',
218
-      cancelText: '取消',
219
-      onOk() {
220
-        request({ ...apis.activity.send, urlData: { id: row.dynamicId } }).then(data => {
221
-          message.info('操作成功!')
222
-          getList({ pageNum: 1, pageSize: 10, ...props.form.getFieldsValue() });
223
-        }).catch(err => {
224
-          console.log(err)
225
-          message.info(err.msg || err.message)
226
-        })
227
-      }
228
-    });
229
-  }
230
-
231 150
   const changePageNum = pageNumber => {
232 151
     getList({ pageNum: pageNumber, pageSize: 10, ...props.form.getFieldsValue() })
233 152
   }
234 153
 
154
+  const rowSelection = {
155
+    onChange: (selectedRowKeys, selectedRows) => {
156
+      console.log('selectedRowKeys:', selectedRowKeys, 'selectedRows: ', selectedRows);
157
+      setHouseIdList(selectedRows)
158
+    },
159
+  };
160
+
235 161
   // 提交事件
236 162
   const handleSubmit = e => {
237 163
     e.preventDefault();
@@ -302,10 +228,13 @@ const header = props => {
302 228
             </Button>
303 229
         </Form.Item>
304 230
       </Form>
305
-      <AuthButton name="admin.buildingDynamic.add.post" noRight={null}>
231
+      <AuthButton name="admin.salesBatch.add.post" noRight={null}>
306 232
         <Button type="danger" className={styles.addBtn} onClick={toAddHouse()}>新增</Button>
307 233
       </AuthButton>
308
-      <Table
234
+      <AuthButton name="admin.salesBatch.del" noRight={null}>
235
+        <Button type="primary" className={styles.addBtn} onClick={toDelBatch()} style={{marginLeft:'30px'}}>删除</Button>
236
+      </AuthButton>
237
+      <Table rowSelection={rowSelection}
309 238
        dataSource={data.records} columns={columns} pagination={false} rowKey="activityList" />
310 239
       <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
311 240
         <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={e => changePageNum(e)} current={data.current}/>

+ 40
- 0
src/services/apis.js 파일 보기

@@ -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',
@@ -1109,6 +1114,11 @@ export default {
1109 1114
     method: 'put',
1110 1115
     action: 'admin.taHouseShare.put',
1111 1116
   },
1117
+  deleteTaSalesBatch:{
1118
+    url: `${prefix}/taSalesBatch`,
1119
+    method: 'put',
1120
+    action: 'admin.taHouseShare.put',
1121
+  },
1112 1122
   taHousingResources: {
1113 1123
     method: 'GET',
1114 1124
     url: `${prefix}/taHousingResources`,
@@ -1153,6 +1163,36 @@ export default {
1153 1163
     url: `${prefix}/taHousingResources/:id`,
1154 1164
     method: 'PUT',
1155 1165
     action: 'admin.taHousingResources.id.put',
1166
+  },
1167
+  taPreselectRecord: {
1168
+    url: `${prefix}/taPreselectRecord`,
1169
+    method: 'GET',
1170
+    action: 'admin.taPreselectRecord.get',
1171
+  },
1172
+  houseDelete: {
1173
+    url: `${prefix}/houseDelete/:id`,
1174
+    method: 'DELETE',
1175
+    action: 'admin.houseDelete.id.put',
1176
+  },
1177
+  changeApartment: {
1178
+    method: 'PUT',
1179
+    url: `${prefix}/house/changeApartment`,
1180
+    action: 'admin.house.changeApartment.get',
1181
+  },
1182
+  uploadExcel: {
1183
+    url: `${prefix}/house/uploadExcel`,
1184
+    method: 'POST',
1185
+    action: 'upload',
1186
+  },
1187
+  saveExcelValue: {
1188
+    url: `${prefix}/house/saveExcelValue`,
1189
+    method: 'POST',
1190
+    action: 'upload',
1191
+  },
1192
+  listHouseResources: {
1193
+    url: `${prefix}/listHousingResources`,
1194
+    method: 'GET',
1195
+    action: 'admin.taHousingResources.get',
1156 1196
   }
1157 1197
  },
1158 1198
 }