张延森 4 years ago
parent
commit
c7ea17738e

+ 3
- 3
config/routes.js View File

@@ -154,18 +154,18 @@ export default [
154 154
               },
155 155
               {
156 156
                 path: 'bill/management',
157
-                name: '收费管理',
157
+                name: '收费管理',
158 158
                 component: './property/bill/list',
159 159
               },
160 160
               {
161 161
                 path: 'bill/management/add',
162
-                name: '新增收费',
162
+                name: '新增收费项目',
163 163
                 component: './property/bill/edit',
164 164
                 hideInMenu: true,
165 165
               },
166 166
               {
167 167
                 path: 'bill/management/info',
168
-                name: '收费详情',
168
+                name: '收费详情',
169 169
                 component: './property/bill/info',
170 170
                 hideInMenu: true,
171 171
               },

+ 13
- 51
src/pages/property/bill/edit/components/AddOn.jsx View File

@@ -1,18 +1,16 @@
1 1
 import React, { useEffect, useState } from 'react'
2
-import { Button, Upload, Icon, Table, Select } from 'antd'
2
+import { Button, Upload, Icon, Table } from 'antd'
3 3
 import { fetch, apis } from '@/utils/request'
4 4
 import List from '../../../components/List'
5 5
 
6 6
 const billDownloadExcel = fetch(apis.bill.billDownloadExcel)
7 7
 const billUploadExcel = fetch(apis.bill.billUploadExcel)
8
-const fetchPhaseList = fetch(apis.buildingOwnerInfo.getPhaseList)
9
-const fetchBuildingList = fetch(apis.buildingOwnerInfo.getBuildingList)
10 8
 
11 9
 const Section = props => {
12 10
   return (
13
-    <p style={{ color: '#99a9bf', fontSize: '13px' }}>
11
+    <div style={{ color: '#99a9bf', fontSize: '13px' }}>
14 12
       {props.children}
15
-    </p>
13
+    </div>
16 14
   )
17 15
 }
18 16
 
@@ -20,13 +18,11 @@ export default props => {
20 18
   const [loading, setLoading] = useState(false)
21 19
   const [listData, setListData] = useState([])
22 20
   const [pagination, setPagination] = useState({})
23
-  const [phaseId, setPhaseId] = useState(null)
24
-  const [buildingId, setBuildingId] = useState(null)
25
-  const [phaseList, setPhaseList] = useState([])
26
-  const [buildingList, setBuildingList] = useState([])
21
+
22
+  const {communityId, phaseId, buildingId, dataSource} = props
27 23
 
28 24
   const handleDownloadExcel = () => {
29
-    billDownloadExcel({params: {phaseId,buildingId}}).then(res => {
25
+    billDownloadExcel({params: {communityId, phaseId,buildingId}}).then(res => {
30 26
       const url = window.URL.createObjectURL(new Blob([res]))
31 27
       const link = document.createElement('a')
32 28
       link.href = url
@@ -62,52 +58,18 @@ export default props => {
62 58
     input.click()
63 59
   }
64 60
 
65
-  const handlePhaseChange = (e) => {
66
-    setPhaseId(e)
67
-  }
68
-
69
-  const handleBuildingChange = (e) => {
70
-    setBuildingId(e)
71
-  }
72
-
73
-
74
-  // 获取期
75
-  useEffect(() => {
76
-    fetchPhaseList().then(res => setPhaseList(res))
77
-  }, [])
78
-
79
-  // 楼栋
80
-  useEffect(() => {
81
-    if (phaseId) {
82
-      fetchBuildingList({params: {phaseId}}).then(res => setBuildingList(res))
83
-    }
84
-    setBuildingId()
85
-  }, [phaseId])
86
-
87 61
   useEffect(() => {
88
-    if (props.dataSource) {
89
-      setListData(props.dataSource.billInvoice)
90
-      setPagination({ total: props.dataSource.total })
62
+    if (dataSource) {
63
+      setListData(dataSource.billInvoice)
64
+      setPagination({ total: dataSource.total })
91 65
       
92 66
     }
93
-  }, [props.dataSource])
67
+  }, [dataSource])
94 68
 
95 69
   return (
96 70
     <div>
97 71
       <Section>
98
-        <span>如果还未制作账单,请先下载账单模板,按规则填写费用后再上传</span>
99
-        <Select onChange={handlePhaseChange} style={{ width: '120px' }} placeholder="期/区">
100
-          {
101
-            phaseList.map(x => (<Select.Option key={x.id} value={x.id}>{x.name}</Select.Option>))
102
-          }
103
-        </Select>
104
-             
105
-        <Select onChange={handleBuildingChange} style={{ width: '120px' }} placeholder="栋">
106
-          {
107
-            buildingList.map(x => (<Select.Option key={x.id} value={x.id}>{x.name}</Select.Option>))
108
-          }
109
-        </Select>
110
-            
72
+        <span> 如果还未制作账单,请先下载账单模板,按规则填写费用后再上传 </span>            
111 73
         <Button type="link" size="small" style={{ marginLeft: '6px' }} onClick={handleDownloadExcel}><Icon type="download" />下载模板</Button>
112 74
         <Button type="link" size="small" onClick={handleUploadExcel}><Icon type="upload" />选取账单文件并预览</Button>
113 75
       </Section>
@@ -116,8 +78,8 @@ export default props => {
116 78
       </Section>
117 79
       <List dataSource={listData} loading={loading} pagination={pagination} size="small" bordered>
118 80
         <Table.Column align="center" title="房屋信息" dataIndex="phase" key="phase" render={(_, row) => (row.phase + row.building + row.unit + row.level + row.roomNo)} />
119
-        <Table.Column align="center" title="收费说明" dataIndex="billExplain" key="billExplain" />
120
-        <Table.Column align="center" title="收费金额(元)" dataIndex="payPrice" key="payPrice" render={payPrice => (payPrice === null || payPrice === undefined ? '' : Number(payPrice/100).toFixed(2))} />
81
+        {/* <Table.Column align="center" title="收费说明" dataIndex="billExplain" key="billExplain" /> */}
82
+        <Table.Column align="center" title="收费金额(元)" dataIndex="payPrice" key="payPrice" width={160} render={payPrice => (payPrice === null || payPrice === undefined ? '' : Number(payPrice/100).toFixed(2))} />
121 83
       </List>
122 84
       <Section>
123 85
         <span>点击发送后账单会发送给对应家庭,家庭中的成员都可以查看到他们家的收费项,缴费成功无法线上退款,只能线下当面退款,请先保存为草稿,核对无误后再发送账单给住户</span>

+ 71
- 20
src/pages/property/bill/edit/index.jsx View File

@@ -1,7 +1,8 @@
1 1
 import React, { useEffect, useState, useRef } from 'react'
2 2
 import router from 'umi/router'
3 3
 import { fetch, apis } from '@/utils/request'
4
-import { Button, Form, Input, DatePicker, notification, Modal } from 'antd'
4
+import { Button, Form, Input, Select, DatePicker, notification, Modal, Spin } from 'antd'
5
+import CommunitySelect from '@/components/CommunitySelect'
5 6
 import AddOn from './components/AddOn'
6 7
 
7 8
 const formItemLayout = {
@@ -30,11 +31,20 @@ const tailFormItemLayout = {
30 31
 
31 32
 const billUploadExcelAdd = fetch(apis.bill.billUploadExcelAdd)
32 33
 const billInvoiceGetInvoiceInvalid = fetch(apis.bill.billInvoiceGetInvoiceInvalid)
34
+const fetchPhaseList = fetch(apis.buildingOwnerInfo.getPhaseList)
35
+const fetchBuildingList = fetch(apis.buildingOwnerInfo.getBuildingList)
33 36
 
34 37
 export default Form.create()(props => {
38
+  const [loading, setLoading] = useState(false)
35 39
   const [queryParams, setQueryParams] = useState({ pageNum: 1, pageSize: 10 })
36 40
   const [formData, setFormData] = useState()
37 41
   const [addOnData, setAddOnData] = useState()
42
+  const [communityId, setCommunityId] = useState()
43
+  const [phaseId, setPhaseId] = useState()
44
+  const [buildingId, setBuildingId] = useState()
45
+  const [phaseList, setPhaseList] = useState([])
46
+  const [buildingList, setBuildingList] = useState([])
47
+  const [rangeDate, setRangeDate] = useState([])
38 48
   const file = useRef()
39 49
   
40 50
   const { id } = props.location.query
@@ -50,38 +60,53 @@ export default Form.create()(props => {
50 60
           return
51 61
         }
52 62
 
63
+        if (!rangeDate || rangeDate.length !== 2) {
64
+          notification.warn({
65
+            message: '请设置缴费时间'
66
+          })
67
+          return
68
+        }
69
+
53 70
         const data = new FormData()
54 71
         data.append('file', file.current)
55
-        data.append('billExplain', values.billExplain)
72
+        data.append('communityId', communityId)
73
+        // data.append('billExplain', values.billExplain)
56 74
         data.append('billName', values.billName)
57
-        data.append('endDate', values.endDate)
75
+        data.append('startDate', rangeDate[0].format('YYYY-MM-DD'))
76
+        data.append('endDate', rangeDate[1].format('YYYY-MM-DD'))
58 77
         data.append('billStatus', billStatus)
59 78
 
60 79
         if (id) {
61 80
           data.append('billId', id)
62 81
         }
63 82
 
83
+        setLoading(true)
64 84
         billUploadExcelAdd({ data }).then(res => {
85
+          setLoading(false)
65 86
           Modal.success({
66 87
             content: '生成数据成功',
67 88
             onOk: () => router.go(-1)
68 89
           })
69
-        })
90
+        }).catch(e => console.error(e) || setLoading(false))
70 91
       }
71 92
     })
72 93
   }
73 94
 
74 95
   useEffect(() => {
75 96
     if (id) {
97
+      setLoading(true)
76 98
       billInvoiceGetInvoiceInvalid({
77 99
         data: {
78 100
           ...queryParams,
79 101
           billId: id,
102
+          communityId,
80 103
         }
81 104
       }).then(res => {
82 105
         setFormData(res.bill)
106
+        // setCommunityId(communityId)
83 107
         setAddOnData(res)
84
-      })
108
+        setLoading(false)
109
+      }).catch(e => console.error(e) || setLoading(false))
85 110
     }
86 111
   }, [id, queryParams])
87 112
 
@@ -89,19 +114,51 @@ export default Form.create()(props => {
89 114
     setFieldsValue(formData || {})
90 115
   }, [formData])
91 116
 
117
+  // 获取期
118
+  useEffect(() => {
119
+    if (communityId) {
120
+      fetchPhaseList({params: {communityId}}).then(res => setPhaseList(res))
121
+    }
122
+  }, [communityId])
123
+
124
+  // 楼栋
125
+  useEffect(() => {
126
+    if (phaseId) {
127
+      fetchBuildingList({params: {phaseId}}).then(res => setBuildingList(res))
128
+    }
129
+    setBuildingId()
130
+  }, [phaseId])
131
+
92 132
   return (
93
-    <div>
133
+    <Spin spinning={loading}>
94 134
       <Form {...formItemLayout} onSubmit={e => e.preventDefault()}>
95
-        <Form.Item label="收费组名称">
135
+        <Form.Item label="小区" required>
136
+          <CommunitySelect value={communityId} onChange={v => setCommunityId(v)} autoInited />
137
+        </Form.Item>
138
+        <Form.Item label="期/区">
139
+          <Select onChange={v => setPhaseId(v)} placeholder="期/区" allowClear>
140
+            {
141
+              phaseList.map(x => (<Select.Option key={x.id} value={x.id}>{x.name}</Select.Option>))
142
+            }
143
+          </Select>
144
+        </Form.Item>
145
+        <Form.Item label="楼栋">
146
+          <Select onChange={v => setBuildingId(v)} placeholder="栋" allowClear>
147
+            {
148
+              buildingList.map(x => (<Select.Option key={x.id} value={x.id}>{x.name}</Select.Option>))
149
+            }
150
+          </Select>
151
+        </Form.Item>
152
+        <Form.Item label="收费名称">
96 153
         {
97 154
           getFieldDecorator('billName', {
98 155
             rules: [
99
-              { required: true, message: '请填写收费组名称', },
156
+              { required: true, message: '请填写收费名称', },
100 157
             ],
101 158
           })(<Input />)
102 159
         }
103 160
         </Form.Item>
104
-        <Form.Item label="收费组说明">
161
+        {/* <Form.Item label="收费组说明">
105 162
         {
106 163
           getFieldDecorator('billExplain', {
107 164
             rules: [
@@ -109,18 +166,12 @@ export default Form.create()(props => {
109 166
             ],
110 167
           })(<Input />)
111 168
         }
112
-        </Form.Item>
113
-        <Form.Item label="截止时间">
114
-        {
115
-          getFieldDecorator('endDate', {
116
-            rules: [
117
-              { required: true, message: '请填写公告内容', },
118
-            ],
119
-          })(<DatePicker />)
120
-        }
169
+        </Form.Item> */}
170
+        <Form.Item label="缴费时间" required>
171
+          <DatePicker.RangePicker value={rangeDate} onChange={v => setRangeDate(v)} style={{width: '100%'}} />
121 172
         </Form.Item>
122 173
         <Form.Item label=" " colon={false}>
123
-          <AddOn dataSource={addOnData} onFileInput={f => file.current = f}/>
174
+          <AddOn dataSource={addOnData} onFileInput={f => file.current = f} communityId={communityId} phaseId={phaseId} buildingId={buildingId} />
124 175
         </Form.Item>
125 176
         <Form.Item {...tailFormItemLayout} >
126 177
           {/* <Button type="primary" onClick={() => handleSubmit(2)}>草稿</Button> */}
@@ -128,6 +179,6 @@ export default Form.create()(props => {
128 179
           <Button style={{ marginLeft: '24px' }} onClick={() => router.go(-1)}>取消</Button>
129 180
         </Form.Item>
130 181
       </Form>
131
-    </div>
182
+    </Spin>
132 183
   )
133 184
 })

+ 6
- 1
src/pages/property/bill/info/Add.jsx View File

@@ -5,6 +5,7 @@ import NavLink from 'umi/navlink'
5 5
 import List from '../../components/List'
6 6
 import AddOne from './components/AddOne'
7 7
 
8
+const getBillInfoBydId = fetch(apis.bill.getBillInfoBydId)
8 9
 const getTempBillInvoice = fetch(apis.bill.getTempBillInvoice)
9 10
 const addTempBillInvoice = fetch(apis.bill.addTempBillInvoice)
10 11
 const deleteTempBillInvoice = fetch(apis.bill.deleteTempBillInvoice)
@@ -13,7 +14,9 @@ const updateBillInvoiceStatus = fetch(apis.bill.updateBillInvoiceStatus)
13 14
 export default props => {
14 15
   const [loading, setLoading] = useState(false)
15 16
   const [showAdd, setShowAdd] = useState(false)
17
+  const [billInfo, setBillInfo] = useState({})
16 18
   const [listData, setListData] = useState([])
19
+  const [communityId, setCommunityId] = useState()
17 20
   const [formData, setFormData] = useState({})
18 21
 
19 22
   const { id } = props.location.query
@@ -32,6 +35,7 @@ export default props => {
32 35
   const handleAdd = (vals, callback) => {
33 36
     addTempBillInvoice({data: {
34 37
       billId: id,
38
+      communityId: billInfo.communityId,
35 39
       ...vals,
36 40
     }}).then(res => {
37 41
       callback()
@@ -63,6 +67,7 @@ export default props => {
63 67
   useEffect(() => {
64 68
     if (id) {
65 69
       getListData()
70
+      getBillInfoBydId({urlData: {id}}).then(x => setBillInfo(x))
66 71
     }
67 72
     getListData()
68 73
   }, [])
@@ -98,7 +103,7 @@ export default props => {
98 103
         />
99 104
       </List>
100 105
       <Modal title="收费组信息" visible={showAdd} footer={null} maskClosable={false} destroyOnClose onCancel={() => setShowAdd(false)}>
101
-        <AddOne onSubmit={handleAdd} onCancel={() => setShowAdd(false)} />
106
+        <AddOne communityId={billInfo.communityId} onSubmit={handleAdd} onCancel={() => setShowAdd(false)} />
102 107
       </Modal>
103 108
     </div>
104 109
   )

+ 5
- 4
src/pages/property/bill/info/components/AddOne.jsx View File

@@ -43,7 +43,8 @@ export default Form.create()(props => {
43 43
     unitList,
44 44
     levelList,
45 45
     roomNoList
46
-  } = useRoomSelect()
46
+  } = useRoomSelect(props.communityId)
47
+
47 48
   const [formData, setFormData] = useState({})
48 49
 
49 50
   const [phaseErr, setPhaseErr] = useState('')
@@ -159,13 +160,13 @@ export default Form.create()(props => {
159 160
           }
160 161
         </Select>
161 162
       </Form.Item>
162
-      <Form.Item label="收费单说明">
163
+      <Form.Item label="收费名称">
163 164
       {
164 165
         props.form.getFieldDecorator('billInvoiceExplain', {
165 166
           rules: [
166
-            {required: true, message: '请填写收费单说明'}
167
+            {required: true, message: '请填写收费名称'}
167 168
           ]
168
-        })(<Input placeholder="收费单说明" />)
169
+        })(<Input placeholder="收费名称" />)
169 170
       }
170 171
       </Form.Item>
171 172
       <Form.Item label="收费金额(元)">

+ 16
- 12
src/pages/property/bill/info/components/Edit.jsx View File

@@ -1,4 +1,4 @@
1
-import React, { useEffect, useState } from 'react'
1
+import React, { useEffect, useRef, useState } from 'react'
2 2
 import { Modal, Form, Input, DatePicker, Button } from 'antd'
3 3
 import moment from 'moment'
4 4
 
@@ -31,37 +31,41 @@ export default Form.create()(props => {
31 31
     e.preventDefault()
32 32
     props.form.validateFields((err, values) => {
33 33
       if (!err && props.onSubmit) {
34
-        const endDate = values.endDate ? moment(values.endDate).toDate() : undefined
35
-        props.onSubmit({...values, endDate})
34
+        const startDate = values.startDate ? moment(values.startDate).format('YYYY-MM-DDT00:00:00[Z]') : undefined
35
+        const endDate = values.endDate ? moment(values.endDate).format('YYYY-MM-DDT23:59:59[Z]') : undefined
36
+        props.onSubmit({...values, startDate, endDate})
36 37
       }
37 38
     })
38 39
   }
39 40
 
40 41
   useEffect(() => {
41 42
     const vals = props.initialData || {}
43
+    const startDate = vals.startDate ? moment(vals.startDate) : undefined
42 44
     const endDate = vals.endDate ? moment(vals.endDate) : undefined
43
-    props.form.setFieldsValue({...vals, endDate})
45
+    props.form.setFieldsValue({...vals, startDate, endDate})
44 46
   }, [props.initialData])
45 47
 
46 48
   return (
47
-    <Modal title="收费信息" visible={props.visible} footer={null} maskClosable={false} destroyOnClose onCancel={props.onCancel}>
49
+    <Modal title="收费信息" visible={props.visible} footer={null} maskClosable={false} onCancel={props.onCancel}>
48 50
       <Form {...formItemLayout} onSubmit={handleSubmit}>
49
-        <Form.Item label="收费名称">
51
+        <Form.Item label="收费名称">
50 52
         {
51 53
           props.form.getFieldDecorator('billName', {
52 54
             rules: [
53
-              { required: true, message: '请填写收费名称' },
55
+              { required: true, message: '请填写收费名称' },
54 56
             ],
55 57
           })(<Input placeholder="收费组名称" />)
56 58
         }
57 59
         </Form.Item>
58
-        <Form.Item label="收费组说明">
60
+        <Form.Item label="开始时间">
59 61
         {
60
-          props.form.getFieldDecorator('billExplain', {
62
+          props.form.getFieldDecorator('startDate', {
61 63
             rules: [
62
-              { required: true, message: '请填写收费组说明' },
64
+              { required: true, message: '请选择开始时间' },
63 65
             ],
64
-          })(<Input placeholder="收费组说明" />)
66
+          })(
67
+            <DatePicker placeholder="请选择开始时间" />
68
+          )
65 69
         }
66 70
         </Form.Item>
67 71
         <Form.Item label="截止时间">
@@ -71,7 +75,7 @@ export default Form.create()(props => {
71 75
               { required: true, message: '请选择截止时间' },
72 76
             ],
73 77
           })(
74
-            <DatePicker showTime placeholder="请选择截止时间" />
78
+            <DatePicker placeholder="请选择截止时间" />
75 79
           )
76 80
         }
77 81
         </Form.Item>

+ 7
- 9
src/pages/property/bill/info/index.jsx View File

@@ -49,7 +49,7 @@ const Condition = props => {
49 49
     unitList,
50 50
     levelList,
51 51
     roomNoList
52
-  } = useRoomSelect()
52
+  } = useRoomSelect(props.communityId)
53 53
   
54 54
   const handleSearch = vals => {
55 55
     const data = {
@@ -284,16 +284,14 @@ export default props => {
284 284
         style={{ borderBottom: '1px solid rgb(235, 237, 240)' }}
285 285
       >
286 286
         <Descriptions column={3}>
287
-          <Descriptions.Item label="收费组名称">{billData.billName}</Descriptions.Item>
288
-          <Descriptions.Item label="截止时间">{billData.endDate}</Descriptions.Item>
289
-          <Descriptions.Item label="收费组说明">
290
-            <Typography.Text ellipsis>{billData.billExplain}</Typography.Text>
291
-          </Descriptions.Item>
287
+          <Descriptions.Item label="收费名称">{billData.billName}</Descriptions.Item>
288
+          <Descriptions.Item label="开始时间">{(billData.startDate || '').substring(0, 10)}</Descriptions.Item>
289
+          <Descriptions.Item label="截止时间">{(billData.endDate || '').substring(0, 10)}</Descriptions.Item>
292 290
         </Descriptions>
293 291
       </PageHeader>
294 292
 
295 293
       <div style={{margin: '36px 0'}}>
296
-        <Condition onSearch={handleSearch} onReset={handleSearch} />
294
+        <Condition onSearch={handleSearch} communityId={billData.communityId} onReset={handleSearch} />
297 295
       </div>
298 296
 
299 297
       <div style={{margin: '24px 0'}}>
@@ -317,10 +315,10 @@ export default props => {
317 315
           <Table.Column title="缴费途径" dataIndex="payType" key="payType" render={t => getDictLabel(PayTypeDict, t)} />
318 316
           <Table.Column title="缴费人" dataIndex="payName" key="payName" />
319 317
           <Table.Column title="缴费时间" dataIndex="payDate" key="payDate" />
320
-          <Table.Column title="新建时间" dataIndex="createDate" key="createDate" render={t => t ? moment(t).format('YYYY-MM-DD HH:mm') : ''} />
318
+          {/* <Table.Column title="新建时间" dataIndex="createDate" key="createDate" render={t => t ? moment(t).format('YYYY-MM-DD HH:mm') : ''} />
321 319
           <Table.Column title="新建人" dataIndex="createUserName" key="createUserName" />
322 320
           <Table.Column title="修改时间" dataIndex="updateDate" key="updateDate" render={t => t ? moment(t).format('YYYY-MM-DD HH:mm'): ''}/>
323
-          <Table.Column title="修改人" dataIndex="updateUserName" key="updateUserName" />
321
+          <Table.Column title="修改人" dataIndex="updateUserName" key="updateUserName" /> */}
324 322
           <Table.Column
325 323
             title="操作"
326 324
             key="action"

+ 73
- 36
src/pages/property/bill/list/index.jsx View File

@@ -1,35 +1,74 @@
1 1
 import React, { useRef, useState, useEffect } from 'react'
2
-import { Spin, Form, Input, Divider, Button, Row, Col, Popconfirm } from 'antd'
2
+import { Spin, Form, Input, Divider, Button, Row, Col, Popconfirm, DatePicker, Select } from 'antd'
3 3
 import router from 'umi/router'
4 4
 import NavLink from 'umi/navlink'
5
+import moment from 'moment'
5 6
 import { fetch, fetchList, apis } from '@/utils/request'
7
+import CommunitySelect from '@/components/CommunitySelect'
6 8
 import Search from '../../components/Search'
7 9
 import List from '../../components/List'
8 10
 
9 11
 
10 12
 const Condition = props => {
13
+  const [communityId, setCommunityId] = useState()
14
+  const [rangeDate, setRangeDate] = useState([])
15
+
16
+  const handleCommunityChange = v => {
17
+    setCommunityId(v)
18
+
19
+    props.onCommunityChange(v)
20
+  }
21
+
22
+  const handleSearch = v => {
23
+    props.onSearch({
24
+      ...v,
25
+      startDate: rangeDate[0] ? rangeDate[0].format('YYYY-MM-DD') : undefined,
26
+      endDate: rangeDate[1] ? rangeDate[1].format('YYYY-MM-DD') : undefined,
27
+    })
28
+  }
29
+
30
+  const handleReset = v => {
31
+    setRangeDate([])
32
+    props.onReset({
33
+      ...v,
34
+      startDate: undefined,
35
+      endDate: undefined,
36
+    })
37
+  }
38
+
11 39
   return (    
12 40
     <Search
13
-      onSearch={props.onSearch}
14
-      onReset={props.onReset}
41
+      onSearch={handleSearch}
42
+      onReset={handleReset}
15 43
       render={form => {
16 44
         const { getFieldDecorator } = form
17 45
 
18 46
         return (
19 47
           <>
20
-            <Form.Item label="收费组编号">
48
+            <Form.Item label="小区">
49
+              <CommunitySelect value={communityId} onChange={handleCommunityChange} autoInited />
50
+            </Form.Item>
51
+            <Form.Item label="收费ID">
21 52
             {
22 53
               getFieldDecorator('billId')(<Input />)
23 54
             }
24 55
             </Form.Item>
25
-            <Form.Item label="收费组名">
56
+            <Form.Item label="收费名">
26 57
             {
27 58
               getFieldDecorator('billName')(<Input />)
28 59
             }
29 60
             </Form.Item>
30
-            <Form.Item label="收费组说明">
61
+            <Form.Item label="收费时间">
62
+              <DatePicker.RangePicker value={rangeDate} onChange={v => setRangeDate(v)} />
63
+            </Form.Item>
64
+            <Form.Item label="收费类型">
31 65
             {
32
-              getFieldDecorator('billExplain')(<Input />)
66
+              getFieldDecorator('isTicket')(
67
+                <Select style={{minWidth: 100}} allowClear>
68
+                  <Select.Option value={1}>物业</Select.Option>
69
+                  <Select.Option value={0}>工单</Select.Option>
70
+                </Select>
71
+              )
33 72
             }
34 73
             </Form.Item>
35 74
           </>
@@ -42,20 +81,27 @@ const Condition = props => {
42 81
 const TableList = props => {
43 82
   const columns = [
44 83
     {
45
-      title: '收费编号',
84
+      title: '收费编号',
46 85
       dataIndex: 'id',
47 86
       key: 'id',
48 87
       align: 'center',
49 88
     },
50 89
     {
51
-      title: '收费组名称',
90
+      title: '类型',
91
+      dataIndex: 'isTicket',
92
+      key: 'isTicket',
93
+      render: t => t === 1 || t === true ? '工单' : '物业'
94
+    },
95
+    {
96
+      title: '收费名称',
52 97
       dataIndex: 'billName',
53 98
       key: 'billName',
54 99
     },
55 100
     {
56
-      title: '收费组说明',
57
-      dataIndex: 'billExplain',
58
-      key: 'billExplain',
101
+      title: '收费时间',
102
+      dataIndex: 'startDate',
103
+      key: 'startDate',
104
+      render: (t, row) => `${row.startDate ? moment(row.startDate).format('YYYY-MM-DD') : '--'} ~ ${row.endDate ? moment(row.endDate).format('YYYY-MM-DD') : '--'}`
59 105
     },
60 106
     {
61 107
       title: '应缴户数',
@@ -73,14 +119,14 @@ const TableList = props => {
73 119
       key: 'unpayedNum',
74 120
     },
75 121
     {
76
-      title: '收费状态',
122
+      title: '收费状态',
77 123
       key: 'billStatus',
78 124
       render: (t, row) => {
79 125
         switch (row.billStatus) {
80 126
           case '0':
81
-            return '正在收费'
127
+            return '进行中'
82 128
           case '1':
83
-            return '收费完成'
129
+            return '完成'
84 130
           case '2':
85 131
             return '草稿'
86 132
           default:
@@ -88,18 +134,6 @@ const TableList = props => {
88 134
         }
89 135
       }
90 136
     },
91
-    {
92
-      title: '发布时间',
93
-      dataIndex: 'createDate',
94
-      key: 'createDate',
95
-      render: dt => (dt || '').substr(0, 16)
96
-    },
97
-    {
98
-      title: '截止时间',
99
-      dataIndex: 'endDate',
100
-      key: 'endDate',
101
-      render: dt => (dt || '').substr(0, 16)
102
-    },
103 137
     {
104 138
       title: '操作',
105 139
       key: 'action',
@@ -139,6 +173,7 @@ export default props => {
139 173
   const [listData, setListData] = useState([])
140 174
   const [pagination, setPagination] = useState({})
141 175
   const [queryParams, setQueryParams] = useState({ pageNum: 1, pageSize: 10 })
176
+  const [communityId, setCommunityId] = useState()
142 177
   
143 178
   const handleQuery = vals => {
144 179
     setQueryParams({
@@ -173,18 +208,20 @@ export default props => {
173 208
   }
174 209
 
175 210
   useEffect(() => {
176
-    setLoading(true)
177
-    FetchBillList(queryParams).then(res => {
178
-      const {list, ...pagi} = res[1]
179
-      setListData(list)
180
-      setPagination(pagi)
181
-      setLoading(false)
182
-    })
183
-  }, [queryParams])
211
+    if (communityId) {
212
+      setLoading(true)
213
+      FetchBillList({...queryParams, communityId}).then(res => {
214
+        const {list, ...pagi} = res[1]
215
+        setListData(list)
216
+        setPagination(pagi)
217
+        setLoading(false)
218
+      })
219
+    }
220
+  }, [queryParams, communityId])
184 221
 
185 222
   return (
186 223
     <div>
187
-      <Condition onReset={handleQuery} onSearch={handleQuery} />
224
+      <Condition onReset={handleQuery} onSearch={handleQuery} onCommunityChange={v => setCommunityId(v)} />
188 225
       <div style={{ margin: '24px 0' }}>
189 226
         <NavLink to={`/property/bill/management/add`}>
190 227
           <Button type="primary">添加</Button>