张延森 4 年之前
父節點
當前提交
0da2e17bd0

+ 7
- 5
src/pages/integralMall/exchangeRecords.jsx 查看文件

@@ -3,6 +3,7 @@ import { Form, Input, Button, Icon, Select, DatePicker, Table, Pagination } from
3 3
 import { FormattedMessage } from 'umi-plugin-react/locale';
4 4
 import styles from '../style/GoodsList.less';
5 5
 import router from 'umi/router';
6
+import Link from 'umi/link'
6 7
 import moment from 'moment';
7 8
 import BuildSelect from '../../components/SelectButton/BuildSelect'
8 9
 import apis from '../../services/apis';
@@ -96,13 +97,14 @@ function record(props) {
96 97
       dataIndex: 'personName',
97 98
       key: 'personName',
98 99
       align: 'center',
100
+      render: (_, row) => row.propId ? <Link to={`/property/proprietor/detail?id=${row.propId}`}>{row.personName}</Link> : row.personName
99 101
     },
100 102
     {
101
-      title: '用户类型',
102
-      dataIndex: 'personType',
103
-      key: 'personType',
104
-      align: 'center',
105
-      render: (personType) => <><span>{personType === 'prop' ? '物业相关' : personType === 'life-consultant' ? '生活管家' : ''}</span></>
103
+      title: '房产',
104
+      dataIndex: 'roomInfo',
105
+      key: 'roomInfo',
106
+      // align: 'center',
107
+      // render: (personType) => <><span>{personType === 'prop' ? '物业相关' : personType === 'life-consultant' ? '生活管家' : ''}</span></>
106 108
     },
107 109
     {
108 110
       title: '手机号',

+ 11
- 55
src/pages/property/proprietor/Detail.jsx 查看文件

@@ -1,46 +1,28 @@
1 1
 import React, { useEffect, useState } from 'react'
2
-import { Button, Descriptions, List, Modal } from 'antd'
2
+import { Button, Tabs } from 'antd'
3 3
 import router from 'umi/router'
4 4
 import { fetch, apis } from '@/utils/request'
5
-import Section from './components/Section'
6
-import Edit from './components/Edit'
7
-
8
-const VerifyStatusDict = {
9
-  '0': '未审核',
10
-  '1': '通过',
11
-  '2': '不通过',
12
-}
5
+import Profile from './components/Profile'
6
+import PointList from './components/PointList'
13 7
 
14 8
 const buildingDetails = fetch(apis.buildingOwnerInfo.buildingDetails)
15
-const verifyinfoAdd = fetch(apis.buildingOwnerInfo.verifyinfoAdd)
16 9
 
17 10
 export default props => {
18
-  const [editorShow, setEditorShow] = useState(false)
19 11
   const [userData, setUserData] = useState({})
20 12
   
21 13
   const { id } = props.location.query
22
-  const roomName = userData.phaseName + userData.buildingName + userData.unitName + userData.levelName + userData.roomNoName
23
-
24
-  const handleEdit = vals => {
25
-    verifyinfoAdd({ urlData: { id }, params: vals }).then(res => {
26
-      Modal.success({
27
-        content: '提交修改成功',
28
-        onOk: () => {
29
-          setEditorShow(false)
30
-        }
31
-      })
32
-    })
33
-  }
34 14
 
35 15
   useEffect(() => {
36 16
     buildingDetails({ data: { id } }).then(res => {
37 17
       const { taUser = {}, taUserVerify = {}, roomInfoList = [] } = res || {}
38 18
       setUserData({
19
+        id,
39 20
         name: taUser.name,
40 21
         gender: taUser.gender,
41 22
         phone : taUser.phone,
42 23
         nickname : taUser.nickname,
43 24
         openid: taUser.openid,
25
+        personId: taUserVerify.personId,
44 26
         idCard: taUserVerify.idCard,
45 27
         avatarurl: taUser.avatarurl,
46 28
         ownerName: taUserVerify.ownerName,
@@ -54,44 +36,18 @@ export default props => {
54 36
         unitName: taUserVerify.unitName,
55 37
         buildingName: taUserVerify.buildingName,
56 38
         levelName: taUserVerify.levelName,
39
+        totalPoints: taUserVerify.totalPoints,
57 40
       })
58 41
     })
59 42
   }, [id])
60 43
 
61 44
   return (
62 45
     <div>
63
-      <Section title="基本信息">
64
-        <Descriptions column={3}>
65
-          <Descriptions.Item label="姓名">{userData.ownerName}</Descriptions.Item>
66
-          <Descriptions.Item label="性别">{!userData.idCard ? '' : (userData.idCard.substring(-2, 1) - 0) % 2 === 1 ? '男' : '女'}</Descriptions.Item>
67
-          <Descriptions.Item label="手机号">{userData.phone}</Descriptions.Item>
68
-          <Descriptions.Item label="微信昵称">{userData.nickname}</Descriptions.Item>
69
-          <Descriptions.Item label="微信ID">{userData.openid}</Descriptions.Item>
70
-          <Descriptions.Item label="身份证">{userData.idCard}</Descriptions.Item>
71
-          <Descriptions.Item label="头像">
72
-            <img src={userData.avatarurl} alt="" style={{ width: '128px', height: '128px' }}/>
73
-          </Descriptions.Item>
74
-        </Descriptions>
75
-      </Section>
76
-      <Section title="在当前房屋" subTitle={roomName} action={<Button type="link" onClick={() => setEditorShow(true)}>修改</Button>}>
77
-        <Descriptions column={3}>
78
-          <Descriptions.Item label="身份">业主</Descriptions.Item>
79
-          <Descriptions.Item label="审核状态">{VerifyStatusDict[userData.status]}</Descriptions.Item>
80
-          <Descriptions.Item label="资料手机">{userData.phone}</Descriptions.Item>
81
-          <Descriptions.Item label="人脸">
82
-            <img src={userData.faceImg} alt="" style={{ width: '128px', height: '128px' }}/>
83
-          </Descriptions.Item>
84
-        </Descriptions>
85
-      </Section>
86
-      <Section title="关联本小区其他房屋" subTitle="使用用户手机号在小区用户列表中搜索查看">
87
-        <List dataSource={userData.roomInfoList || []} renderItem={x => (<List.Item>{x}</List.Item>)} size="small" />
88
-      </Section>
89
-      <Edit
90
-        visible={editorShow}
91
-        userData={userData}
92
-        onSubmit={handleEdit}
93
-        onCancel={() => setEditorShow(false)}
94
-      />
46
+      <Tabs defaultActiveKey="1">
47
+        <Tabs.TabPane tab="详情" key="1"><Profile userData={userData} /></Tabs.TabPane>
48
+        <Tabs.TabPane tab="积分" key="2"><PointList userData={userData} /></Tabs.TabPane>
49
+      </Tabs>
50
+      
95 51
     </div>
96 52
   )
97 53
 }

+ 115
- 0
src/pages/property/proprietor/components/PointList.jsx 查看文件

@@ -0,0 +1,115 @@
1
+import React, { useEffect, useState } from 'react'
2
+import { Button, Modal, Table, Form, InputNumber, Input, notification } from 'antd'
3
+import moment from 'moment'
4
+import { fetchList, fetch, apis } from '@/utils/request'
5
+
6
+const getPointsRules = fetchList(apis.integralMall.tdPointsRules)
7
+const getPointsRecords = fetch(apis.customer.taPointsRecords)
8
+const savePointsRecords = fetch(apis.customer.savePointsRecords)
9
+
10
+const otherRules = [
11
+  {code: 'goods', ruleName: '商品兑换'}
12
+]
13
+
14
+const layout = {
15
+  labelCol: { span: 4 },
16
+  wrapperCol: { span: 16 },
17
+};
18
+
19
+const isNvl = x => x === undefined || x === null || x === ''
20
+
21
+export default props => {
22
+  const [loading, setLoading] = useState(false)
23
+  const [showModal, setShowModal] = useState(false)
24
+  const [pointsRules, setPointsRules] = useState([])
25
+  const [listData, setListData] = useState([])
26
+  const [queryParams, setQueryParams] = useState({pageNumber: 1, pageSize: 10})
27
+  const [pagination, setPagination] = useState()
28
+  
29
+  const [pointsAmount, setPointsAmount] = useState()
30
+  const [changeType, setChangeType] = useState(false)
31
+
32
+  const getChangeName = typ => {
33
+    const target = pointsRules.filter(x => x.code === typ)[0]
34
+
35
+    return target ? target.ruleName : typ
36
+  }
37
+
38
+  const handleChange = (page) => {
39
+    setQueryParams({
40
+      ...queryParams,
41
+      pageNumber: page.current
42
+    })
43
+  }
44
+
45
+  const handleSubmit = () => {
46
+    if (isNvl(pointsAmount) || isNvl(changeType)) {
47
+      notification.warn({message: '请填写积分或者说明'})
48
+      return
49
+    }
50
+
51
+    setLoading(true)
52
+    savePointsRecords({data: { personId: props.userData.personId, pointsAmount, changeType }}).then(res => {
53
+      setQueryParams({
54
+        ...queryParams,
55
+        pageNumber: 1
56
+      })
57
+      toggleModal()
58
+
59
+      notification.success({message: '积分维护成功'})
60
+      setLoading(false)
61
+    }).catch(e => console.error(e) || setLoading(false) || toggleModal())
62
+  }
63
+
64
+  const toggleModal = () => {
65
+    setShowModal(!showModal)
66
+    setPointsAmount()
67
+    setChangeType()
68
+  }
69
+
70
+  useEffect(() => {
71
+    setLoading(true)
72
+
73
+    const params = {
74
+      urlData: {id: props.userData.personId},
75
+      params: queryParams
76
+    }
77
+
78
+    getPointsRecords(params).then(res => {
79
+      const { records = [], current, total, pageSize } = res.result
80
+      setListData(records)
81
+      setPagination({current, total, pageSize})
82
+      setLoading(false)
83
+    }).catch(e => console.error(e) || setLoading(false))
84
+  }, [queryParams, props.userData])
85
+
86
+  useEffect(() => {
87
+    getPointsRules({pageNum: 1, pageSize: 100}).then(res => {
88
+      const [list] = res
89
+      setPointsRules((list || []).concat(otherRules))
90
+    })
91
+  }, [])
92
+
93
+  return (
94
+    <div>
95
+      <div style={{margin: '16px 0'}}>
96
+        <Button icon="plus" onClick={toggleModal}>积分维护</Button>
97
+      </div>
98
+      <Table loading={loading} dataSource={listData} pagination={pagination} onChange={handleChange} rowKey="pointsRecordId">
99
+        <Table.Column title="类型" dataIndex="changeType" key="changeType" render={t => getChangeName(t)} />
100
+        <Table.Column title="积分" dataIndex="pointsAmount" key="pointsAmount" render={t => getChangeName(t)} />
101
+        <Table.Column title="日期" dataIndex="createDate" key="createDate" render={t => moment(t).format('YYYY-MM-DD HH:mm')} />
102
+      </Table>
103
+      <Modal visible={showModal} title="积分维护" onOk={handleSubmit} onCancel={toggleModal}>
104
+        <Form {...layout}>
105
+          <Form.Item label="积分" required>
106
+            <InputNumber placeholder="负值代表消费积分" step={1} value={pointsAmount} style={{width: '100%'}} onChange={e => setPointsAmount(e - 0)}></InputNumber>
107
+          </Form.Item>
108
+          <Form.Item label="说明" required>
109
+            <Input placeholder="填写消费说明" value={changeType} onChange={e => setChangeType(e.target.value)}></Input>
110
+          </Form.Item>
111
+        </Form>
112
+      </Modal>
113
+    </div>
114
+  )
115
+}

+ 69
- 0
src/pages/property/proprietor/components/Profile.jsx 查看文件

@@ -0,0 +1,69 @@
1
+import React, { useEffect, useState } from 'react'
2
+import { Button, Descriptions, List, Modal } from 'antd'
3
+import router from 'umi/router'
4
+import { fetch, apis } from '@/utils/request'
5
+import Section from './Section'
6
+import Edit from './Edit'
7
+
8
+const VerifyStatusDict = {
9
+  '0': '未审核',
10
+  '1': '通过',
11
+  '2': '不通过',
12
+}
13
+
14
+const verifyinfoAdd = fetch(apis.buildingOwnerInfo.verifyinfoAdd)
15
+
16
+export default props => {
17
+  const [editorShow, setEditorShow] = useState(false)
18
+  const { userData = {} } = props
19
+  
20
+  const roomName = userData.phaseName + userData.buildingName + userData.unitName + userData.levelName + userData.roomNoName
21
+
22
+  const handleEdit = vals => {
23
+    verifyinfoAdd({ urlData: { id: userData.id }, params: vals }).then(res => {
24
+      Modal.success({
25
+        content: '提交修改成功',
26
+        onOk: () => {
27
+          setEditorShow(false)
28
+        }
29
+      })
30
+    })
31
+  }
32
+
33
+  return (
34
+    <div>
35
+      <Section title="基本信息">
36
+        <Descriptions column={3}>
37
+          <Descriptions.Item label="姓名">{userData.ownerName}</Descriptions.Item>
38
+          <Descriptions.Item label="性别">{!userData.idCard ? '' : (userData.idCard.substring(-2, 1) - 0) % 2 === 1 ? '男' : '女'}</Descriptions.Item>
39
+          <Descriptions.Item label="手机号">{userData.phone}</Descriptions.Item>
40
+          <Descriptions.Item label="微信昵称">{userData.nickname}</Descriptions.Item>
41
+          <Descriptions.Item label="总积分">{userData.totalPoints || 0}</Descriptions.Item>
42
+          <Descriptions.Item label="身份证">{userData.idCard}</Descriptions.Item>
43
+          <Descriptions.Item label="头像">
44
+            <img src={userData.avatarurl} alt="" style={{ width: '64px', height: '64px' }}/>
45
+          </Descriptions.Item>
46
+        </Descriptions>
47
+      </Section>
48
+      <Section title="在当前房屋" subTitle={roomName} action={<Button type="link" onClick={() => setEditorShow(true)}>修改</Button>}>
49
+        <Descriptions column={3}>
50
+          <Descriptions.Item label="身份">业主</Descriptions.Item>
51
+          <Descriptions.Item label="审核状态">{VerifyStatusDict[userData.status]}</Descriptions.Item>
52
+          <Descriptions.Item label="资料手机">{userData.phone}</Descriptions.Item>
53
+          {/* <Descriptions.Item label="人脸">
54
+            <img src={userData.faceImg} alt="" style={{ width: '128px', height: '128px' }}/>
55
+          </Descriptions.Item> */}
56
+        </Descriptions>
57
+      </Section>
58
+      <Section title="关联本小区其他房屋" subTitle="使用用户手机号在小区用户列表中搜索查看">
59
+        <List dataSource={userData.roomInfoList || []} renderItem={x => (<List.Item>{x}</List.Item>)} size="small" />
60
+      </Section>
61
+      <Edit
62
+        visible={editorShow}
63
+        userData={userData}
64
+        onSubmit={handleEdit}
65
+        onCancel={() => setEditorShow(false)}
66
+      />
67
+    </div>
68
+  )
69
+}

+ 5
- 0
src/services/apis.js 查看文件

@@ -361,6 +361,11 @@ export default {
361 361
       url: `${prefix}/mine/taPointsRecords/:id`,
362 362
       action: 'admin.mine.taPointsRecords.id.get',
363 363
     },
364
+    savePointsRecords: {
365
+      method: 'POST',
366
+      url: `${prefix}/taPointsRecords`,
367
+      action: 'admin.mine.taPointsRecords.save',
368
+    },
364 369
     recommend: {
365 370
       method: 'GET',
366 371
       url: `${prefix}/customer/recommend/:id`,