Procházet zdrojové kódy

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

周立森 před 5 roky
rodič
revize
7ef20fe3e4

+ 6
- 1
config/config.js Zobrazit soubor

@@ -166,7 +166,7 @@ export default {
166 166
                 },
167 167
                 {
168 168
                   path: '/customer/independentList',
169
-                  name: '经人',
169
+                  name: '经人',
170 170
                   component: './customer/independentList/index',
171 171
                 },
172 172
               ],
@@ -201,6 +201,11 @@ export default {
201 201
                   name: '商品核销',
202 202
                   component: './integralMall/writeOff',
203 203
                 },
204
+                {
205
+                  path: '/integralMall/verifyList',
206
+                  name: '',
207
+                  component: './integralMall/verifyList',
208
+                },
204 209
               ],
205 210
             },
206 211
             {

+ 1
- 0
package.json Zobrazit soubor

@@ -46,6 +46,7 @@
46 46
     "antd": "^3.20.0",
47 47
     "classnames": "^2.2.6",
48 48
     "dva": "^2.4.1",
49
+    "echarts": "^4.3.0",
49 50
     "lodash": "^4.17.11",
50 51
     "md5": "^2.2.1",
51 52
     "moment": "^2.24.0",

+ 49
- 0
src/components/EchartsTest/EChart.jsx Zobrazit soubor

@@ -0,0 +1,49 @@
1
+import React, { Component } from 'react';
2
+
3
+// 引入 ECharts 主模块
4
+import echarts from 'echarts/lib/echarts';
5
+// 引入柱状图
6
+import  'echarts/lib/chart/bar';
7
+// 引入提示框和标题组件
8
+import 'echarts/lib/component/tooltip';
9
+import 'echarts/lib/component/title';
10
+
11
+class EchartsTest extends Component {
12
+    chartRef = undefined
13
+    chart = undefined
14
+    defaultChartOption = {}
15
+
16
+    componentDidMount() {
17
+        this.chart = echarts.init(this.chartRef.current)
18
+
19
+        // 绘制图表
20
+        this.chart.setOption({
21
+            ...this.defaultChartOption,
22
+            ...this.props.options || {},
23
+        });
24
+    }
25
+
26
+    componentDidUpdate(preProps) {
27
+        if (preProps.options != this.props.options) {
28
+            this.chart.setOption({
29
+                ...this.defaultChartOption,
30
+                ...this.props.options || {},
31
+            });
32
+        }
33
+    }
34
+
35
+    handleDom = ref => this.chartRef = ref
36
+
37
+    render() {
38
+        const style = {
39
+            width: '600px',
40
+            ...this.props.style || {}
41
+        }
42
+
43
+        return (
44
+            <div ref={this.handleDom} style={style}></div>
45
+        );
46
+    }
47
+}
48
+
49
+export default EchartsTest;

+ 37
- 0
src/components/EchartsTest/Line.jsx Zobrazit soubor

@@ -0,0 +1,37 @@
1
+import React, { useEffect } from 'react';
2
+import EChart from './EChart';
3
+
4
+
5
+const Line = (props) => {
6
+
7
+  const {person_realty_consultant, person_estate_agent, person_null} = xxx
8
+
9
+  const options = {
10
+    xAxis: {},
11
+    legend: {
12
+      left: '70%',
13
+      data: ['来源置业顾问', '来源全民经纪人', '自主进入'],
14
+    },
15
+    series: [
16
+      {
17
+        type: 'pie',
18
+        datasetIndex: 1,
19
+        center: ['75%', '50%'],
20
+        radius: [0, '50%'],
21
+      },
22
+    ],
23
+    dataset: {
24
+      id: 'pie',
25
+      source: [
26
+        { form: '来源置业顾问', value: person_realty_consultant },
27
+        { form: '来源全民经纪人', value: person_estate_agent },
28
+        { form: '自主进入', value: person_null },
29
+      ]
30
+    },
31
+  }
32
+
33
+  return (
34
+    <EChart options={options} />
35
+  )
36
+
37
+}

+ 17
- 0
src/components/EchartsTest/index.jsx Zobrazit soubor

@@ -0,0 +1,17 @@
1
+import React, { Component } from 'react';
2
+
3
+// 引入 ECharts 主模块
4
+import echarts from 'echarts/lib/echarts';
5
+// 引入柱状图
6
+import  'echarts/lib/chart/bar';
7
+// 引入提示框和标题组件
8
+import 'echarts/lib/component/tooltip';
9
+import 'echarts/lib/component/title';
10
+class Chart extends Component {
11
+
12
+  render() { 
13
+    return ( <div></div> );
14
+  }
15
+}
16
+ 
17
+export default Chart;

+ 17
- 16
src/pages/Welcome.jsx Zobrazit soubor

@@ -1,21 +1,20 @@
1 1
 import React from 'react';
2 2
 import { Card, Typography, Alert, Row, Col } from 'antd';
3 3
 import { FormattedMessage } from 'umi-plugin-react/locale';
4
-
5
-// const CodePreview = ({ children }) => (
6
-//   <pre
7
-//     style={{
8
-//       background: '#f2f4f5',
9
-//       padding: '12px 20px',
10
-//       margin: '12px 0',
11
-//     }}
12
-//   >
13
-//     <code>
14
-//       <Typography.Text copyable>{children}</Typography.Text>
15
-//     </code>
16
-//   </pre>
17
-// );
18
-
4
+import EchartsTest from '../components/EchartsTest'
5
+const option = {
6
+  xAxis: {
7
+    type: 'category',
8
+    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
9
+  },
10
+  yAxis: {
11
+    type: 'value'
12
+  },
13
+  series: [{
14
+    data: [820, 932, 901, 934, 1290, 1330, 1320],
15
+    type: 'line'
16
+  }]
17
+};
19 18
 export default () => (
20 19
   <>
21 20
     <div style={{ display: 'flex' }}>
@@ -44,6 +43,8 @@ export default () => (
44 43
         <span style={{ fontSize: '52px', color: '#fff', marginLeft: '26px', fontFamily: 'fantasy' }}>91</span>
45 44
       </div>
46 45
     </div>
47
-    <div>11111111111111</div>
46
+    <EchartsTest style={{width: 500, height:500}}></EchartsTest>
47
+
48 48
   </>
49 49
 );
50
+

+ 1
- 0
src/pages/channel/brokerList.jsx Zobrazit soubor

@@ -70,6 +70,7 @@ const columns = [
70 70
     dataIndex: 'sex',
71 71
     key: 'sex',
72 72
     align: 'center',
73
+    render: (text, list) => <a style={ { color: '#66B3FF' } } >{ list.sex === 1 ? '男' : '女' }</a>,
73 74
   },
74 75
   {
75 76
     title: '推荐客户',

+ 142
- 0
src/pages/customer/customerlist/components/attribution.jsx Zobrazit soubor

@@ -0,0 +1,142 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Icon, Input, Button, DatePicker, Select, Card, Row, Col, Pagination, Alert, Table, Avatar, Radio, Modal, Descriptions } from 'antd';
3
+import moment from 'moment';
4
+import request from '../../../../utils/request';
5
+import apis from '../../../../services/apis';
6
+import Styles from '../style.less';
7
+
8
+
9
+const { Option } = Select;
10
+// eslint-disable-next-line @typescript-eslint/no-unused-vars
11
+const { Meta } = Card;
12
+
13
+/**
14
+ * 调整归属
15
+ *
16
+ * @param {*} props
17
+ * @returns
18
+ */
19
+class ModalAttribution extends React.Component {
20
+  constructor(props) {
21
+    super(props);
22
+    this.state = {
23
+       dataSource: { records: [] },
24
+       visibleData: { visible: false, customerId: '', realtyConsultant: '' },
25
+    }
26
+  }
27
+
28
+  // 挂载之后
29
+  componentDidMount() {
30
+    this.getList({ pageNumber: 1, pageSize: 5 })
31
+  }
32
+
33
+  componentDidUpdate(preProps, preState) {
34
+    if (this.props.visibleData.customerId !== preState.visibleData.customerId) {
35
+      this.getList({ pageNumber: 1, pageSize: 5 })
36
+      this.setState({ visibleData: this.props.visibleData });
37
+    }
38
+  }
39
+
40
+  // 弹框确定按钮
41
+  // eslint-disable-next-line react/sort-comp
42
+  handleOk() {
43
+    this.setState({ visibleData: { visible: false, customerId: '', realtyConsultant: '' } })
44
+  }
45
+
46
+  // 弹框取消按钮
47
+  handleCancel() {
48
+    this.setState({ visibleData: { visible: false, customerId: '', realtyConsultant: '' } })
49
+  }
50
+
51
+  getList(params) {
52
+    // 网路请求
53
+    request({ ...apis.customer.consultant, params: { ...params } }).then(res => {
54
+      this.setState({ dataSource: res })
55
+    }).catch(err => {
56
+      // eslint-disable-next-line no-unused-expressions
57
+      <Alert
58
+        style={{
59
+          marginBottom: 24,
60
+        }}
61
+        message={err}
62
+        type="error"
63
+        showIcon
64
+      />
65
+    })
66
+  }
67
+
68
+   // 分页
69
+  onChange(pageNum) {
70
+    this.getList({ pageNumber: pageNum, pageSize: 5 })
71
+  }
72
+
73
+  // 提交
74
+  submitGm() {
75
+    const { url, method } = apis.customer.recommendEdit
76
+    const tempUrl = url.substring(0, url.lastIndexOf('id')).concat(this.state.visibleData.customerId)
77
+
78
+    // 网路请求
79
+    request({ url: tempUrl, method, data: { ...this.state.visibleData } }).then(res => {
80
+      this.handleCancel()
81
+    }).catch(err => {
82
+      // eslint-disable-next-line no-unused-expressions
83
+      <Alert
84
+        style={{
85
+          marginBottom: 24,
86
+        }}
87
+        message={err}
88
+        type="error"
89
+        showIcon
90
+      />
91
+    })
92
+  }
93
+
94
+  render() {
95
+    const columns = [
96
+      {
97
+        title: '姓名',
98
+        dataIndex: 'name',
99
+        key: 'name',
100
+      },
101
+      {
102
+        title: '电话',
103
+        dataIndex: 'phone',
104
+        key: 'phone',
105
+      },
106
+      {
107
+        title: '部门',
108
+        dataIndex: 'department',
109
+        key: 'department',
110
+      },
111
+      {
112
+        title: '岗位',
113
+        dataIndex: 'post',
114
+        key: 'post',
115
+      },
116
+      {
117
+        title: '操作',
118
+        dataIndex: 'personId',
119
+        key: 'personId',
120
+        // eslint-disable-next-line no-nested-ternary
121
+        render: (_, record) => <><Button className={Styles.SubmitButton} onClick={() => this.submitGm()}>确定</Button></>,
122
+      },
123
+    ]
124
+    return (
125
+      <>
126
+        <Modal
127
+            title="选择置业顾问"
128
+            width={800}
129
+            destroyOnClose="true"
130
+            footer={null}
131
+            visible={this.state.visibleData.visible}
132
+            // onOk={() => this.handleOk()}
133
+            onCancel={(e) => this.handleCancel(e)}
134
+          >
135
+            <Table dataSource={this.state.dataSource.records} columns={columns} pagination={{ total: this.state.dataSource.total, onChange: e => this.onChange(e) }} />
136
+          </Modal>
137
+      </>
138
+    );
139
+  }
140
+}
141
+
142
+export default ModalAttribution

+ 154
- 0
src/pages/customer/customerlist/components/integralRecord.jsx Zobrazit soubor

@@ -0,0 +1,154 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Icon, Input, Button, DatePicker, Select, Card, Row, Col, Pagination, Alert, Table, Avatar, Radio, Modal, Descriptions } from 'antd';
3
+import moment from 'moment';
4
+import request from '../../../../utils/request';
5
+import apis from '../../../../services/apis';
6
+import Styles from '../style.less';
7
+
8
+
9
+const { Option } = Select;
10
+// eslint-disable-next-line @typescript-eslint/no-unused-vars
11
+const { Meta } = Card;
12
+
13
+/**
14
+ * 积分记录
15
+ *
16
+ * @param {*} props
17
+ * @returns
18
+ */
19
+class ModalIntegralRecord extends React.Component {
20
+  constructor(props) {
21
+    super(props);
22
+    this.state = {
23
+       dataSource: { result: { records: [] }, totalPoints: 0 },
24
+       visibleData: { visible: false, customerId: '' },
25
+    }
26
+  }
27
+
28
+  // 挂载之后
29
+  componentDidMount() {
30
+    this.getList({ pageNumber: 1, pageSize: 5 })
31
+  }
32
+
33
+  componentDidUpdate(preProps, preState) {
34
+    console.log(this.props.visibleData)
35
+    if (this.props.visibleData.customerId !== preState.visibleData.customerId) {
36
+      this.getList({ pageNumber: 1, pageSize: 5 })
37
+      this.setState({ visibleData: this.props.visibleData });
38
+    }
39
+  }
40
+
41
+  // 弹框确定按钮
42
+  // eslint-disable-next-line react/sort-comp
43
+  handleOk() {
44
+    this.setState({ visibleData: { visible: false, customerId: '' } })
45
+  }
46
+
47
+  // 弹框取消按钮
48
+  handleCancel() {
49
+    this.setState({ visibleData: { visible: false, customerId: '' } })
50
+  }
51
+
52
+  getList(params) {
53
+    const { customerId } = this.state.visibleData
54
+    if (customerId === '' || customerId === undefined) {
55
+      return
56
+    }
57
+    // 网路请求
58
+    const { url, method } = apis.customer.taPointsRecords
59
+    const tempUrl = url.substring(0, url.lastIndexOf('id')).concat(customerId)
60
+
61
+    // 网路请求
62
+    request({ url: tempUrl, method, params: { ...params } }).then(res => {
63
+      this.setState({ dataSource: res })
64
+    }).catch(err => {
65
+      // eslint-disable-next-line no-unused-expressions
66
+      <Alert
67
+        style={{
68
+          marginBottom: 24,
69
+        }}
70
+        message={err}
71
+        type="error"
72
+        showIcon
73
+      />
74
+    })
75
+  }
76
+
77
+   // 分页
78
+  onChange(pageNum) {
79
+    this.getList({ pageNumber: pageNum, pageSize: 5 })
80
+  }
81
+
82
+  // 积分类型
83
+  showChangeType(str) { 
84
+
85
+    switch (str) {
86
+      case 'goods':
87
+        return '兑换商品'
88
+      case 'checkin':
89
+        return '签到'
90
+      case 'share-poster':
91
+        return '分享'
92
+      case 'signup-agent':
93
+        return '注册经纪人'
94
+      case 'recommend-customer':
95
+        return '推荐客户'
96
+      default:
97
+        return '未知类型'
98
+    }
99
+  }
100
+  
101
+  // 判断是否是 - 开头
102
+  subPoints(points) { 
103
+    let subStr = points.toString().substring(0, 1)
104
+    if (subStr === '-') {
105
+      return true
106
+    }
107
+    return false
108
+  }
109
+
110
+  render() {
111
+    const columns = [
112
+      {
113
+        title: '序号',
114
+        dataIndex: 'index',
115
+        key: 'index',
116
+      },
117
+      {
118
+        title: '积分类型',
119
+        dataIndex: 'changeType',
120
+        key: 'changeType',
121
+        render: (_, record) => { this.showChangeType(record.changeType) },
122
+      },
123
+      {
124
+        title: '积分变化',
125
+        dataIndex: 'pointsAmount',
126
+        key: 'pointsAmount',
127
+        render: (_, record) => { <span style={this.subPoints(record.pointsAmount) && {color: 'red'}}>{ record.pointsAmount }</span> },
128
+      },
129
+      {
130
+        title: '发生时间',
131
+        dataIndex: 'createDate',
132
+        key: 'createDate',
133
+        render: (_, record) => { moment(record.createDate).format('YYYY-MM-DD') },
134
+      },
135
+    ]
136
+    return (
137
+      <>
138
+        <Modal
139
+            title={ "当前可用积分:" + this.state.dataSource.totalPoints }
140
+            width={800}
141
+            destroyOnClose="true"
142
+            footer={null}
143
+            visible={this.state.visibleData.visible}
144
+            // onOk={() => this.handleOk()}
145
+            onCancel={(e) => this.handleCancel(e)}
146
+          >
147
+            <Table dataSource={this.state.dataSource.result.records} columns={columns} pagination={{ total: this.state.dataSource.result.total, onChange: e => this.onChange(e) }} />
148
+          </Modal>
149
+      </>
150
+    );
151
+  }
152
+}
153
+
154
+export default ModalIntegralRecord

+ 26
- 140
src/pages/customer/customerlist/index.jsx Zobrazit soubor

@@ -5,140 +5,14 @@ import request from '../../../utils/request';
5 5
 import apis from '../../../services/apis';
6 6
 import Styles from './style.less';
7 7
 
8
+import Attribution from './components/attribution'
9
+import IntegralRecord from './components/integralRecord'
10
+
8 11
 
9 12
 const { Option } = Select;
10 13
 // eslint-disable-next-line @typescript-eslint/no-unused-vars
11 14
 const { Meta } = Card;
12 15
 
13
-/**
14
- * 调整归属
15
- *  (废弃, 后面研究)
16
- *
17
- * @param {*} props
18
- * @returns
19
- */
20
-class ModalTable extends React.Component {
21
-  constructor(props) {
22
-    super(props);
23
-    this.state = {
24
-       dataSource: { records: [] },
25
-       visibleData: { visible: false, customerId: '', realtyConsultant: '' },
26
-    }
27
-  }
28
-
29
-  // 挂载之后
30
-  componentDidMount() {
31
-    this.getList({ pageNumber: 1, pageSize: 5 })
32
-  }
33
-
34
-  componentDidUpdate(preProps, preState) {
35
-    if (this.props.visibleData.customerId !== preState.visibleData.customerId) {
36
-      this.getList({ pageNumber: 1, pageSize: 5 })
37
-      this.setState({ visibleData: this.props.visibleData });
38
-    }
39
-  }
40
-
41
-  // 弹框确定按钮
42
-  // eslint-disable-next-line react/sort-comp
43
-  handleOk() {
44
-    this.setState({ visibleData: { visible: false, customerId: '', realtyConsultant: '' } })
45
-  }
46
-
47
-  // 弹框取消按钮
48
-  handleCancel() {
49
-    this.setState({ visibleData: { visible: false, customerId: '', realtyConsultant: '' } })
50
-  }
51
-
52
-  getList(params) {
53
-    // 网路请求
54
-    request({ ...apis.customer.consultant, params: { ...params } }).then(res => {
55
-      this.setState({ dataSource: res })
56
-    }).catch(err => {
57
-      // eslint-disable-next-line no-unused-expressions
58
-      <Alert
59
-        style={{
60
-          marginBottom: 24,
61
-        }}
62
-        message={err}
63
-        type="error"
64
-        showIcon
65
-      />
66
-    })
67
-  }
68
-
69
-   // 分页
70
-  onChange(pageNum) {
71
-    this.getList({ pageNumber: pageNum, pageSize: 5 })
72
-  }
73
-
74
-  // 提交
75
-  submitGm() {
76
-    const { url, method } = apis.customer.recommendEdit
77
-    const tempUrl = url.substring(0, url.lastIndexOf('id')).concat(this.state.visibleData.customerId)
78
-
79
-    // 网路请求
80
-    request({ url: tempUrl, method, data: { ...this.state.visibleData } }).then(res => {
81
-      this.handleCancel()
82
-    }).catch(err => {
83
-      // eslint-disable-next-line no-unused-expressions
84
-      <Alert
85
-        style={{
86
-          marginBottom: 24,
87
-        }}
88
-        message={err}
89
-        type="error"
90
-        showIcon
91
-      />
92
-    })
93
-  }
94
-
95
-  render() {
96
-    const columns = [
97
-      {
98
-        title: '姓名',
99
-        dataIndex: 'name',
100
-        key: 'name',
101
-      },
102
-      {
103
-        title: '电话',
104
-        dataIndex: 'phone',
105
-        key: 'phone',
106
-      },
107
-      {
108
-        title: '部门',
109
-        dataIndex: 'department',
110
-        key: 'department',
111
-      },
112
-      {
113
-        title: '岗位',
114
-        dataIndex: 'post',
115
-        key: 'post',
116
-      },
117
-      {
118
-        title: '操作',
119
-        dataIndex: 'personId',
120
-        key: 'personId',
121
-        // eslint-disable-next-line no-nested-ternary
122
-        render: (_, record) => <><Button className={Styles.SubmitButton} onClick={() => this.submitGm()}>确定</Button></>,
123
-      },
124
-    ]
125
-    return (
126
-      <>
127
-        <Modal
128
-            title="选择置业顾问"
129
-            destroyOnClose="true"
130
-            footer={null}
131
-            visible={this.state.visibleData.visible}
132
-            // onOk={() => this.handleOk()}
133
-            onCancel={(e) => this.handleCancel(e)}
134
-          >
135
-            <Table dataSource={this.state.dataSource.records} columns={columns} pagination={{ total: this.state.dataSource.total, onChange: e => this.onChange(e) }} />
136
-          </Modal>
137
-      </>
138
-    );
139
-  }
140
-}
141
-
142 16
 /**
143 17
  *
144 18
  *
@@ -158,9 +32,13 @@ function body(props) {
158 32
   // 调整归属 ============  start
159 33
   // eslint-disable-next-line react-hooks/rules-of-hooks
160 34
   const [gVisibleData, setGVisibleData] = useState({ visible: false, customerId: '', realtyConsultant: '' })
161
-
162 35
   // 调整归属 ============= end
163 36
 
37
+  // 积分记录 ============  start
38
+  // eslint-disable-next-line react-hooks/rules-of-hooks
39
+  const [recordVisibleData, setRecordVisibleData] = useState({ visible: false, customerId: '' })
40
+  // 积分记录 ============= end
41
+
164 42
   // eslint-disable-next-line react-hooks/rules-of-hooks
165 43
   useEffect(() => {
166 44
     getList({ pageNumber: 1, pageSize: 10, customerType })
@@ -212,12 +90,18 @@ function body(props) {
212 90
     getList({ pageNumber: 1, pageSize: 10, customerType: value })
213 91
   }
214 92
 
215
-  // 调整归属 ============ start
216
-  // 调整归属 显示
217
-  function gM(row) {
218
-    setGVisibleData({ visible: true, customerId: row.customerId, realtyConsultant: row.realtyConsultant })
93
+  // 这里有个 Bug, 就是 Modal 弹框,会联动出现, 比如 我点击 调整归属的Model弹框, 那么 积分记录的Model弹框莫名其妙的也显示了
94
+  // 所有这里临时解决方法是,弹出一个Modal对话框的时候,把其他的对话框给隐藏
95
+
96
+function showGM(record) {
97
+    setGVisibleData({ visible: true, customerId: record.customerId, realtyConsultant: record.realtyConsultant })
98
+    setRecordVisibleData({ visible: false, customerId: '' })
99
+  }
100
+
101
+  function showRecord(record) {
102
+    setRecordVisibleData({ visible: true, customerId: record.customerId })
103
+    setGVisibleData({ visible: false, customerId: '', realtyConsultant: '' })
219 104
   }
220
-  // 调整归属 ============ end
221 105
 
222 106
   const columns = [
223 107
     {
@@ -272,13 +156,13 @@ function body(props) {
272 156
       // eslint-disable-next-line no-nested-ternary
273 157
       render: (_, record) => (
274 158
         <>
275
-          <sapn className={ customerType === 'private' ? Styles.text : Styles.displayS }>变更状态</sapn>
159
+          <Button className={ customerType === 'private' ? Styles.text : Styles.displayS } type="link">变更状态</Button>
276 160
           &nbsp;&nbsp;
277
-          <sapn className={ customerType === 'private' ? Styles.text : Styles.displayS } onClick={() => gM(record)}>调整归属</sapn>
161
+          <Button className={ customerType === 'private' ? Styles.text : Styles.displayS } type="link" onClick={() => showGM(record)}>调整归属</Button>
278 162
           <br/>
279
-          <sapn className={ Styles.text }>查看详情</sapn>
163
+          <Button className={ customerType === 'private' ? Styles.text : Styles.displayS } type="link">查看详情</Button>
280 164
           &nbsp;&nbsp;
281
-          <sapn className={ Styles.text }>积分记录</sapn>
165
+          <Button className={ customerType === 'private' ? Styles.text : Styles.displayS } type="link" onClick={ () => showRecord(record) }>积分记录</Button>
282 166
         </>
283 167
       ),
284 168
     },
@@ -345,8 +229,10 @@ function body(props) {
345 229
       <Table dataSource={dataSource.records} columns={columns} pagination={{ total: dataSource.total, onChange }} />
346 230
 
347 231
         {/* 调整归属 */}
348
-        <ModalTable visibleData={gVisibleData} />
232
+        <Attribution visibleData={gVisibleData} />
349 233
 
234
+        {/* 积分记录 */}
235
+        <IntegralRecord visibleData={recordVisibleData} />
350 236
     </>
351 237
   );
352 238
 }

+ 0
- 1
src/pages/customer/report/index.jsx Zobrazit soubor

@@ -159,7 +159,6 @@ function body(props) {
159 159
           </Button>
160 160
         </Form.Item>
161 161
       </Form>
162
-
163 162
       <Table dataSource={dataSource.records} columns={columns} pagination={{ total: dataSource.total, onChange }} />
164 163
     </>
165 164
   );

+ 115
- 67
src/pages/integralMall/achieve.jsx Zobrazit soubor

@@ -1,86 +1,134 @@
1
-import React from 'react';
2
-import { Form, Input, Button, Icon, Tabs, Row, Col, Table } from 'antd';
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Input, Button, Icon, Tabs, Row, Col, Table, Pagination, Alert, message } from 'antd';
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
-
6
+import moment from 'moment';
7
+import BuildSelect from '../../components/SelectButton/BuildSelect'
8
+import request from '../../utils/request'
7 9
 
8 10
 const { TabPane } = Tabs;
9
-function callback(key) {
10
-  console.log(key);
11
+
12
+
13
+
14
+
15
+function header(props) {
16
+  const [ carType, setCarType ] = useState({})
17
+  const callback = (key) => {
18
+    setCarType(key)
19
+    getList({ pageNum: 1, pageSize: 10 , type: key});
20
+  }
21
+  
22
+// 获取初始化数据
23
+const [ data, setData ] = useState({})
24
+
25
+useEffect(() => {
26
+  getList({ pageNum: 1, pageSize: 10 , type: 'platform'});
27
+},[])
28
+
29
+// 查询列表
30
+const getList = (params) => {
31
+  request({
32
+      url: '/api/admin/tdPointsRules',
33
+      method: 'GET',
34
+      params: { ...params },
35
+  }).then((data) => {
36
+      console.log(data)
37
+      setData(data)
38
+  })
11 39
 }
12 40
 
13
-/**
14
- *
15
- *
16
- * @param {*} props
17
- * @returns
18
- */
19
-const dataSource = [
20
-  {
21
-    key: '1',
22
-    img: 'http://img0.imgtn.bdimg.com/it/u=4246326797,2657995307&fm=26&gp=0.jpg',
23
-    name: '华为P30 Pro',
24
-  },
25
-  {
26
-    key: '2',
27
-    img: '',
28
-    name: '大米',
29
-  },
30
-];
41
+const changePageNum = (pageNumber) => {
42
+  getList({ pageNum: pageNumber, pageSize: 10, type: carType })
43
+}
31 44
 
32
-const columns = [
33
-  {
34
-    title: '类型',
35
-    dataIndex: 'type',
36
-    key: 'type',
37
-    align: 'center',
38
-  },
39
-  {
40
-    title: '获取积分',
41
-    dataIndex: 'intergral',
42
-    key: 'intergral',
43
-    align: 'center',
44
-  },
45
-  {
46
-    title: '状态',
47
-    dataIndex: 'state',
48
-    key: 'state',
49
-    align: 'center',
50
-  },
51
-  {
52
-    title: '说明',
53
-    dataIndex: 'desc',
54
-    key: 'desc',
55
-    align: 'center',
56
-  },
57
-  {
58
-    title: '操作时间',
59
-    dataIndex: 'time',
60
-    key: 'time',
61
-    align: 'center',
62
-  },
63
-  {
64
-    title: '操作',
65
-    dataIndex: 'handle',
66
-    key: 'handle',
67
-    align: 'center',
68
-    render: () => <><span style={{ color: '#EF273A', marginRight: '20px' }} >停用<Icon type="stop" className={styles.shoppingCart} /></span><span style={{ color: '#EF273A', marginRight: '20px' }} >启用<Icon type="check-circle" className={styles.shoppingCart} /></span><span style={{ color: '#FF925C' }}>编辑<Icon type="form" className={styles.edit} /></span></>,
69
-  },
70 45
 
71
-];
46
+  // 提交事件
47
+  const handleSubmit = (e, props) => {
48
+    e.preventDefault();
49
+    props.form.validateFields((err, values) => {
50
+      if (!err) {
51
+        getList({ pageNum: 1, pageSize: 10, ...values, type: carType})
52
+      }
53
+    });
54
+  }
72 55
 
56
+  const changeStatus = (row) => () => {
57
+    request({
58
+      url: '/api/admin/tdPointsRules/change',
59
+      method: 'PUT',
60
+      data: { ...row },
61
+    }).then((data) => {
62
+      message.info('操作成功!')
63
+      getList({ pageNum: 1, pageSize: 10, type: carType})
64
+    })
65
+  }
66
+
67
+const columns = [
68
+    {
69
+      title: '类型',
70
+      dataIndex: 'ruleName',
71
+      key: 'ruleName',
72
+      align: 'center',
73
+    },
74
+    {
75
+      title: '获取积分',
76
+      dataIndex: 'pointsAmount',
77
+      key: 'pointsAmount',
78
+      align: 'center',
79
+    },
80
+    {
81
+      title: '状态',
82
+      dataIndex: 'status',
83
+      key: 'status',
84
+      align: 'center',
85
+      render: (status) => <span>{status == 1 ? '启用' : '停用'}</span>
86
+    },
87
+    {
88
+      title: '操作时间',
89
+      dataIndex: 'updateDate',
90
+      key: 'updateDate',
91
+      align: 'center',
92
+      render: (updateDate) => <><span>{updateDate != null ? moment(updateDate).format('YYYY-MM-DD') : ''}</span></>
93
+    },
94
+    {
95
+      title: '操作',
96
+      dataIndex: 'handle',
97
+      key: 'handle',
98
+      align: 'center',
99
+      render: (x,row) => <><span style={{ color: '#EF273A', marginRight: '20px' }} onClick={changeStatus(row)}>{row.status == 1?'停用':'启用'}<Icon type="stop" className={styles.shoppingCart} /></span>
100
+                      <span style={{ color: '#FF925C' }}>{row.buildingId != null ? '编辑'`${<Icon type="form" className={styles.edit} />}` : ''}</span></>,
101
+    },
102
+  ];
73 103
 
74
-function header(props) {
75 104
   const { getFieldDecorator } = props.form
76 105
   return (
77 106
     <>
78 107
       <Tabs onChange={callback} type="card">
79
-        <TabPane tab="平台积分" key="1">
80
-          <Table style={{ marginTop: '40px' }} dataSource={dataSource} columns={columns} />
108
+        <TabPane tab="平台积分" key="platform">
109
+          <Table style={{ marginTop: '40px' }} dataSource={data.records} columns={columns} pagination={false}/>
110
+          <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
111
+            <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} />
112
+          </div>
81 113
         </TabPane>
82
-        <TabPane tab="项目积分" key="2">
83
-          <Table style={{ marginTop: '40px' }} dataSource={dataSource} columns={columns} />
114
+        <TabPane tab="项目积分" key="project">
115
+        <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
116
+            <Form.Item>
117
+              {getFieldDecorator('buildingId')(
118
+                <BuildSelect />,
119
+              )}
120
+            </Form.Item>
121
+             
122
+            <Form.Item>
123
+              <Button type="primary" htmlType="submit" className={styles.searchBtn}>
124
+                搜索
125
+              </Button>
126
+            </Form.Item>
127
+          </Form>
128
+          <Table style={{ marginTop: '40px' }} dataSource={data.records} columns={columns} pagination={false}/>
129
+          <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
130
+            <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} />
131
+          </div>
84 132
         </TabPane>
85 133
       </Tabs>,
86 134
     </>

+ 128
- 0
src/pages/integralMall/verifyList.jsx Zobrazit soubor

@@ -0,0 +1,128 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal, DatePicker } from 'antd';
3
+import { FormattedMessage } from 'umi-plugin-react/locale';
4
+import styles from '../style/GoodsList.less';
5
+import router from 'umi/router';
6
+import moment from 'moment';
7
+
8
+import request from '../../utils/request'
9
+
10
+const { Option } = Select;
11
+const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
12
+
13
+const header = (props) => {
14
+  const [ data, setData ] = useState({})
15
+
16
+  useEffect(() => {
17
+    getVerifyList({pageNum: 1,pageSize: 10, phone: props.location.query.telValue });
18
+  },[])
19
+
20
+  // 查询列表
21
+  const getVerifyList = (params) => {
22
+    request({
23
+      url: '/api/admin/taPointsExchange',
24
+      method: 'GET',
25
+      params: { ...params },
26
+    }).then((data) => {
27
+        setData(data)
28
+    })
29
+  }
30
+
31
+  const changePageNum = (pageNumber) => {
32
+    getVerifyList({ pageNum: 1, pageSize: 10, phone: props.location.query.telValue })
33
+  }
34
+
35
+  const toBack = () => {
36
+    router.push({
37
+      pathname: '/integralMall/writeOff',
38
+    });
39
+  }
40
+
41
+  const changeStatus = (row) => () => {
42
+    request({
43
+      url: '/api/admin/taPointsExchange/change',
44
+      method: 'PUT',
45
+      data: row
46
+    }).then((data) => {
47
+        message.info("操作成功")
48
+        getVerifyList({ pageNum: pageNumber, pageSize: 10, phone: props.location.query.telValue })
49
+    })
50
+  }
51
+  
52
+  const columns = [
53
+    {
54
+      title: '用户姓名',
55
+      dataIndex: 'personName',
56
+      key: 'personName',
57
+      align: 'center',
58
+    },
59
+    {
60
+      title: '用户类型',
61
+      dataIndex: 'personType',
62
+      key: 'personType',
63
+      align: 'center',
64
+      render: (personType)=> <><span>{personType === 'Realty Consultant' ? '置业顾问' : personType === 'Sales Executive' ? '销售主管' : personType === 'estate agent' ? '经纪人' : ''}</span></>
65
+    },
66
+    {
67
+      title: '手机号',
68
+      dataIndex: 'phone',
69
+      key: 'phone',
70
+      align: 'center',
71
+    },
72
+    {
73
+      title: '商品图片',
74
+      dataIndex: 'image',
75
+      key: 'image',
76
+      align: 'center',
77
+      render: (text, record) => <img src={record.image} className={styles.touxiang} />,
78
+    },
79
+    {
80
+      title: '商品名称',
81
+      dataIndex: 'targetName',
82
+      key: 'targetName',
83
+      align: 'center',
84
+    },
85
+    {
86
+      title: '兑换时间',
87
+      dataIndex: 'createDate',
88
+      key: 'createDate',
89
+      align: 'center',
90
+      render: (createDate) => <><span>{moment(createDate).format('YYYY-MM-DD HH:mm')}</span></>
91
+    },
92
+    {
93
+      title: '领取时间',
94
+      dataIndex: 'verifyDate',
95
+      key: 'verifyDate',
96
+      align: 'center',
97
+      render: (verifyDate) => <><span>{verifyDate != null ? moment(verifyDate).format('YYYY-MM-DD HH:mm') : ''}</span></>
98
+    },
99
+    {
100
+      title: '状态',
101
+      dataIndex: 'status',
102
+      key: 'status',
103
+      align: 'center',
104
+      render: (status)=> <><span>{status == 1 ? '已领取' : '未领取'}</span></>
105
+    },
106
+    {
107
+      title: '操作',
108
+      dataIndex: 'handle',
109
+      key: 'handle',
110
+      align: 'center',
111
+      render: (x,row) => <span style={{ color: '#1990FF' }} onClick={changeStatus(row)}>{ row.status == 1?'':'核销' }</span>
112
+           
113
+    },
114
+  ];
115
+
116
+  return (
117
+    <>
118
+      <Button type="primary" className={styles.addBtn} onClick={toBack}>返回</Button>
119
+      <Table dataSource={data.records} columns={columns} pagination={false} />
120
+      <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
121
+        <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} />
122
+      </div>
123
+    </>
124
+  )
125
+}
126
+const WrappedHeader = Form.create({ name: 'header' })(header);
127
+
128
+export default WrappedHeader

+ 22
- 4
src/pages/integralMall/writeOff.jsx Zobrazit soubor

@@ -1,5 +1,5 @@
1
-import React from 'react';
2
-import { Form, Input, Button, Icon, Tabs, Row, Col } from 'antd';
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Input, Button, Icon, Tabs, Row, Col, message } from 'antd';
3 3
 import { FormattedMessage } from 'umi-plugin-react/locale';
4 4
 import styles from '../style/GoodsList.less';
5 5
 import router from 'umi/router';
@@ -20,6 +20,24 @@ function callback(key) {
20 20
  */
21 21
 
22 22
 function header(props) {
23
+  const [telValue, setTelValue] = useState('')
24
+  const changeTel = (e) => {
25
+    setTelValue(e.target.value)
26
+  }
27
+
28
+  const verifyTel = () =>{
29
+    if(telValue === ""){
30
+      message.error("请输入手机号");
31
+      return;
32
+    }
33
+    router.push({
34
+      pathname: '/integralMall/verifyList',
35
+      query: {
36
+        telValue
37
+      },
38
+    });
39
+  }
40
+
23 41
   const { getFieldDecorator } = props.form
24 42
   return (
25 43
     <>
@@ -60,8 +78,8 @@ function header(props) {
60 78
             </Col>
61 79
           </Row>
62 80
           <div style={{ margin: '110px auto', display: 'block',textAlign:'center' }}>
63
-            <Input placeholder="请输入手机号" style={{width:'200px'}} />
64
-            <Button type="primary" style={{marginLeft:'10px', padding: '6px 46px', backgroundColor: '#EA2323', border: 'none' }}>立即核销</Button>
81
+            <Input placeholder="请输入手机号" style={{width:'200px'}} onChange={changeTel}/>
82
+            <Button type="primary" style={{marginLeft:'10px', padding: '6px 46px', backgroundColor: '#EA2323', border: 'none' }} onClick={verifyTel}>立即核销</Button>
65 83
           </div>
66 84
         </TabPane>
67 85
       </Tabs>,

+ 101
- 88
src/pages/news/type/NewsType.jsx Zobrazit soubor

@@ -1,115 +1,128 @@
1
-import React from 'react';
1
+import React, { useState, useEffect } from 'react';
2 2
 import { Form, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal,Breadcrumb } from 'antd';
3 3
 import { FormattedMessage } from 'umi-plugin-react/locale';
4
-import styles from './style.less';
4
+import styles from '../../style/GoodsList.less';
5 5
 import router from 'umi/router';
6
+import BuildSelect from '../../../components/SelectButton/BuildSelect'
7
+
8
+import request from '../../../utils/request'
6 9
 
7 10
 const { Option } = Select;
8
-// 提交事件
9
-function handleSubmit(e, props) {
10
-  e.preventDefault();
11
-  props.form.validateFields((err, values) => {
12
-    if (!err) {
13
-      console.log('提交数据: ', values)
14
-    }
15
-  });
16
-}
17
-// Change 事件
18
-function handleSelectChange(props) {
19
-  console.log(props)
20
-}
21 11
 
22
-// 分页
23
-function onChange(pageNumber) {
24
-  console.log('Page: ', pageNumber);
25
-}
26 12
 
27
-// 跳转到编辑资讯
28
-function toEditNews() {
29
-  router.push({
30
-    pathname: '/news/type/editNews',
31
-    query: {
32
-      a: 'b',
33
-    },
34
-  });
35
-}
13
+function header(props) {
14
+  // 获取初始化数据
15
+  const [ data, setData ] = useState({})
36 16
 
37
-/**
38
- *
39
- *
40
- * @param {*} props
41
- * @returns
42
- */
17
+  useEffect(() => {
18
+    getList({ pageNum: 1, pageSize: 10 });
19
+  },[])
43 20
 
44
-const dataSource = [
45
-  {
46
-    key: '1',
47
-    img: 'http://img0.imgtn.bdimg.com/it/u=4246326797,2657995307&fm=26&gp=0.jpg',
48
-    name: '华为P30 Pro',
49
-  },
50
-  {
51
-    key: '2',
52
-    img: '',
53
-    name: '大米',
54
-  },
55
-];
21
+  // 查询列表
22
+  const getList = (params) => {
23
+    request({
24
+        url: '/api/admin/taNewsType',
25
+        method: 'GET',
26
+        params: { ...params },
27
+    }).then((data) => {
28
+        console.log(data)
29
+        setData(data)
30
+    })
31
+  }
32
+  
33
+  // 提交事件
34
+  const handleSubmit = (e, props) => {
35
+    e.preventDefault();
36
+    props.form.validateFields((err, values) => {
37
+      if (!err) {
38
+        getList({ pageNum: 1, pageSize: 10, ...values })
39
+      }
40
+    });
41
+  }
56 42
 
57
-const columns = [
58
-  {
59
-    title: '类型图片',
60
-    dataIndex: 'img',
61
-    key: 'img',
62
-    align: 'left',
63
-    render: (text, record) => <img src={record.img} className={styles.touxiang} />,
64
-  },
65
-  {
66
-    title: '名称',
67
-    dataIndex: 'name',
68
-    key: 'name',
69
-    align: 'center',
43
+  const changePageNum = (pageNumber) => {
44
+    getList({ pageNum: pageNumber, pageSize: 10 })
45
+  }
46
+
47
+
48
+  // 跳转到编辑咨询
49
+  const toEditNews = (id) => () => {
50
+    router.push({
51
+      pathname: '/news/type/editNews',
52
+      query: {
53
+        id
54
+      },
55
+    });
56
+  }
57
+
58
+  
59
+  const changeNewsStatus = (row, newsId) => () => {
60
+    Modal.confirm({
61
+      title: '确认删除该商品?',
62
+      okText: '确认',
63
+      cancelText: '取消',
64
+      onOk() {
65
+        request({
66
+          url: '/api/admin/taNewsType/' + newsId,
67
+          method: 'DELETE',
68
+          data: { ...row },
69
+        }).then((data) => {
70
+          message.info('操作成功!')
71
+          getList({ pageNum: 1, pageSize: 10 });
72
+        })
73
+      }
74
+    });
75
+  }
76
+  /**
77
+   *
78
+   *
79
+   * @param {*} props
80
+   * @returns
81
+   */
82
+  const columns = [
83
+    {
84
+      title: '类型图',
85
+      dataIndex: 'newsTypeImg',
86
+      key: 'newsTypeImg',
87
+      align: 'center',
88
+      render: (text, record) => <img src={record.newsTypeImg} className={styles.touxiang} />,
89
+    },
90
+    {
91
+      title: '名称',
92
+      dataIndex: 'newsTypeName',
93
+      key: 'newsTypeName',
94
+      align: 'center',
70 95
 
71
-  },
72
-  {
73
-    title: '操作',
74
-    dataIndex: 'handle',
75
-    key: 'handle',
76
-    align: 'center',
77
-    render: () => <>
78
-    <span style={{ color: '#1990FF', marginRight: '20px' }} onClick={confirm}>删除<Icon type="shopping-cart" className={styles.shoppingCart} /></span>
79
-    <span style={{ color: '#FF925C' }} onClick={toEditNews}>编辑<Icon type="form" className={styles.edit} /></span></>,
80
-  },
81
-];
82
-function confirm() {
83
-  Modal.confirm({
84
-    title: '确认删除该类型?',
85
-    okText: '确认',
86
-    cancelText: '取消',
87
-    onOk() {
88
-      console.log('OK');
89 96
     },
90
-    onCancel() {
91
-      console.log('Cancel');
97
+    {
98
+      title: '操作',
99
+      dataIndex: 'handle',
100
+      key: 'handle',
101
+      align: 'center',
102
+      render: (x, row) => <><span style={{ color: '#EF273A', marginRight: '20px' }} onClick={changeNewsStatus(row, row.newsTypeId)}>{row.status == 1 ? '删除' : '上架'}<Icon type="shopping-cart" className={styles.shoppingCart} />
103
+                            </span><span style={{ color: '#FF925C' }} onClick={toEditNews(row.newsTypeId)}>编辑<Icon type="form" className={styles.edit} /></span></>,
92 104
     },
93
-  });
105
+  ];
94 106
 
95
-}
96
-function header(props) {
97 107
   const { getFieldDecorator } = props.form
98 108
   return (
99 109
 
100 110
     <>
101 111
       <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
102 112
         <Form.Item>
103
-          {getFieldDecorator('goodState')(
104
-            <Select style={{ width: '180px' }} placeholder="请选择" onChange={handleSelectChange}>
105
-              <Option value="1">上架</Option>
106
-              <Option value="0">下架</Option>
113
+          {getFieldDecorator('status')(
114
+            <Select style={{ width: '180px' }} placeholder="请选择">
115
+              <Option value="1">上架</Option>
116
+              <Option value="0">下架</Option>
107 117
             </Select>,
108 118
           )}
109 119
         </Form.Item>
110 120
       </Form>
111
-      <Button type="primary" className={styles.addBtn} onClick={toEditNews}>新增</Button>
112
-      <Table dataSource={dataSource} columns={columns} />
121
+      <Button type="primary" className={styles.addBtn} onClick={toEditNews()}>新增</Button>
122
+      <Table dataSource={data.records} columns={columns} pagination={false} />
123
+      <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
124
+        <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} />
125
+      </div>
113 126
     </>
114 127
   )
115 128
 }

+ 73
- 49
src/pages/news/type/editNews.jsx Zobrazit soubor

@@ -2,6 +2,8 @@ import React, { useState, useEffect } from 'react';
2 2
 import { Input, Menu, Dropdown, Button, Icon, message, Table, Divider, Tag, Select, Form, Alert } from 'antd';
3 3
 import { FormattedMessage } from 'umi-plugin-react/locale';
4 4
 import channels from '../../channel/channelList.less';
5
+import BuildSelect from '../../../components/SelectButton/BuildSelect'
6
+import XForm, { FieldTypes } from '../../../components/XForm';
5 7
 import router from 'umi/router';
6 8
 import request from '../../../utils/request'
7 9
 
@@ -9,65 +11,87 @@ const { TextArea } = Input;
9 11
 const { Option } = Select;
10 12
 
11 13
 const header = props => {
14
+  const newsId = props.location.query.id
15
+  console.log("newsId" + newsId);
16
+  const [ newsData, setNewsData ] = useState({})
17
+  if(newsId){
18
+    useEffect(() => {
19
+      getNewsData(newsId);
20
+    },[])
12 21
 
13
-  const [data, setData] = useState({ channelNmae: [], result: [] })
14
-
15
-  function goBack(){
16
-    router.push({
17
-      pathname: '/news/type/NewsType',
18
-    });
19
-  }
20
-
21
-  function addChannel(params) {
22
+  // 查询列表
23
+  const getNewsData = (newsId) => {
22 24
     request({
23
-      url: '/api/admin/channel',
24
-      method: 'POST',
25
-      data: { ...params },
26
-      // eslint-disable-next-line no-shadow
27
-    }).then(data => {
28
-      console.log(data)
29
-      setData(data)
30
-      // eslint-disable-next-line no-unused-expressions
31
-      router.go(-1)
25
+        url: '/api/admin/taNewsType/' + newsId,
26
+        method: 'GET',
27
+    }).then((data) => {
28
+        console.log(data)
29
+        setNewsData(data)
32 30
     })
33 31
   }
32
+  }
34 33
 
35
-  function handleSubmit(e) {
36
-    e.preventDefault();
37
-    props.form.validateFields((err, values) => {
38
-      if (!err) {
39
-        console.log('Received values of form: ', values);
40
-        // eslint-disable-next-line max-len
41
-        addChannel({ channelName: values.channelName, channelContact: values.channelContact, contactTel: values.contactTel })
34
+  const fields = [
35
+    {
36
+      label: '所属项目',
37
+      name: 'buildingId',
38
+      render: <BuildSelect />,
39
+      value: newsData.buildingId,
40
+      rules: [
41
+        {required: true, message: '请选择所属项目'},
42
+      ]
43
+    },
44
+    {
45
+      label: '类型图',
46
+      name: 'newsTypeImg',
47
+      type: FieldTypes.ImageUploader,
48
+      value: newsData.newsTypeImg,
49
+    },
50
+    {
51
+      label: '名称',
52
+      name: 'newsTypeName',
53
+      type: FieldTypes.Text,
54
+      value: newsData.newsTypeName,
55
+      rules: [
56
+        {required: true, message: '请输入咨询名称'},
57
+      ]
58
+    },
59
+  ]
60
+
61
+   
62
+  const handleSubmit = (values) => {
63
+    if(newsId){
64
+      values.newsTypeId = newsId
65
+      request({
66
+        url: '/api/admin/taNewsType/' + newsId,
67
+        method: 'PUT',
68
+        data: values,
69
+      }).then((data) => {
70
+        cancelPage()
71
+      }).catch((err) => {
72
+        message.info(err.msg || err.message)
73
+      })
74
+      }else{
75
+      request({
76
+        url: '/api/admin/taNewsType',
77
+        method: 'POST',
78
+        data: values,
79
+      }).then((data) => {
80
+        cancelPage()
81
+      }).catch((err) => {
82
+        message.info(err.msg || err.message)
83
+      })
42 84
       }
43
-    });
44 85
   }
45 86
 
46
-  const { getFieldDecorator } = props.form;
87
+  const cancelPage = () => {
88
+    router.push({
89
+      pathname: '/news/type/NewsType',
90
+    });
91
+  }
47 92
 
48 93
   return (
49
-    <>
50
-      <Form labelCol={{ span: 7 }} wrapperCol={{ span: 12 }} onSubmit={handleSubmit}>
51
-      <Form.Item label="类型图片">
52
-          {getFieldDecorator('newsName', {
53
-            rules: [{ message: '' }],
54
-          })(<Input className={channels.inpuit} />)}
55
-        </Form.Item>
56
-        <Form.Item label="名称">
57
-          {getFieldDecorator('newsName', {
58
-            rules: [{ message: '请输入资讯名称' }],
59
-          })(<Input className={channels.inpuit} />)}
60
-        </Form.Item>
61
-        <Form.Item wrapperCol={{ span: 15, offset: 7 }}>
62
-          <Button type="primary" htmlType="submit">
63
-            保存
64
-          </Button>
65
-          <Button className={channels.formButton} onClick={goBack} type="primary" htmlType="submit">
66
-            取消
67
-          </Button>
68
-        </Form.Item>
69
-      </Form>
70
-    </>
94
+    <XForm onSubmit={handleSubmit} onCancel={cancelPage} fields={fields}></XForm>
71 95
   )
72 96
 }
73 97
 

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

@@ -88,5 +88,9 @@ export default {
88 88
       method: 'PUT',
89 89
       url: `${prefix}/customer/recommend/edit/id`,
90 90
     },
91
+    taPointsRecords: {
92
+      method: 'GET',
93
+      url: `${prefix}/mine/taPointsRecords/id`,
94
+    },
91 95
   },
92 96
 }