傅行帆 5 år sedan
förälder
incheckning
0094d63638

+ 19
- 4
src/pages/building/list/add/components/base.jsx Visa fil

45
 
45
 
46
   const [poi, setPoi] = useState([])
46
   const [poi, setPoi] = useState([])
47
   const [videoImage, setVideoImage] = useState(false)
47
   const [videoImage, setVideoImage] = useState(false)
48
+  const [priceTypeList, setPriceTypeList] = useState([])
48
 
49
 
49
   // 存放所以 buildingData 基础信息
50
   // 存放所以 buildingData 基础信息
50
   const [buildingData, setBuildingData] = useState({})
51
   const [buildingData, setBuildingData] = useState({})
86
       // if (res.openingDate !== null) {
87
       // if (res.openingDate !== null) {
87
       //   res.openingDate = moment(res.openingDate)
88
       //   res.openingDate = moment(res.openingDate)
88
       // }
89
       // }
90
+      //构造下拉框
91
+      setPriceTypeList(res.buildingProjectType)
89
       if (res.receivedDate !== null) {
92
       if (res.receivedDate !== null) {
90
         res.receivedDate = moment(res.receivedDate)
93
         res.receivedDate = moment(res.receivedDate)
91
       }
94
       }
304
     return newPoi
307
     return newPoi
305
   }
308
   }
306
 
309
 
310
+  //组装项目类型
311
+  function getBuildingProjectTypeList(e) {
312
+    console.log(e,"项目类型------")
313
+    setPriceTypeList(e)
314
+  }
315
+
307
   function setFormMapScopeTagValue(keyType, item) {
316
   function setFormMapScopeTagValue(keyType, item) {
308
     const tag = item.data.map(t => ({ tagName: t.name, delete: true, automatic: true }))
317
     const tag = item.data.map(t => ({ tagName: t.name, delete: true, automatic: true }))
309
     switch (keyType) {
318
     switch (keyType) {
357
           <Form.Item label="项目类型">
366
           <Form.Item label="项目类型">
358
             {getFieldDecorator('buildingProjectType', {
367
             {getFieldDecorator('buildingProjectType', {
359
               rules: [{ required: true, message: '请选择项目类型' }],
368
               rules: [{ required: true, message: '请选择项目类型' }],
360
-            })(<BudildingProjectType />)}
361
-          </Form.Item>
362
-          <Form.Item label="均价" >
363
-            {getFieldDecorator('price')(<Input type="number" style={{ width: '210px' }}/>)}元/m²
369
+            })(<BudildingProjectType onChange={e => getBuildingProjectTypeList(e)}/>)}
370
+          </Form.Item>
371
+          <Form.Item label="列表展示均价" >
372
+            {/* {getFieldDecorator('price')(<Input type="number" style={{ width: '210px' }}/>)}元/m² */}
373
+            {getFieldDecorator('buildingTypeId')(
374
+              <Select placeholder="请选择项目类型的价格">
375
+                    {
376
+                      priceTypeList.map((item, _) => <Option value={item.buildingTypeId}>{item.buildingTypeName}</Option>)
377
+                    }
378
+              </Select>)}
364
           </Form.Item>
379
           </Form.Item>
365
           <Form.Item label="开盘时间" >
380
           <Form.Item label="开盘时间" >
366
             {getFieldDecorator('openingDate')(<Input placeholder="预计xxxx年xx月开盘" maxLength = "15"/>)}
381
             {getFieldDecorator('openingDate')(<Input placeholder="预计xxxx年xx月开盘" maxLength = "15"/>)}

+ 26
- 8
src/pages/building/list/add/components/buildingProjectType.jsx Visa fil

1
 import React, { useEffect, useState } from 'react'
1
 import React, { useEffect, useState } from 'react'
2
-import { Button, Radio, Icon, Form, Input, Row, Col, Modal, notification, Checkbox, InputNumber } from 'antd';
2
+import { Button, Radio, Icon, Form, Input, Row, Col, Modal, notification, Checkbox, Select, InputNumber } from 'antd';
3
 import { render } from 'react-dom';
3
 import { render } from 'react-dom';
4
 import request from '../../../../../utils/request';
4
 import request from '../../../../../utils/request';
5
 import apis from '../../../../../services/apis';
5
 import apis from '../../../../../services/apis';
28
   }
28
   }
29
 
29
 
30
   onChange(e, name) {
30
   onChange(e, name) {
31
-    // console.log(e.target.value)
31
+    // console.log(e)
32
     this.props.form.validateFieldsAndScroll((err, values) => {
32
     this.props.form.validateFieldsAndScroll((err, values) => {
33
       if (!err) {
33
       if (!err) {
34
         // console.log('Received values of form: ', values);
34
         // console.log('Received values of form: ', values);
35
-        const currentValue = e.target.value
35
+        const currentValue = name === 'marketStatus' ? e : e.target.value
36
         if (currentValue === '') {
36
         if (currentValue === '') {
37
           values[name] = null
37
           values[name] = null
38
         } else {
38
         } else {
54
     const { getFieldDecorator } = this.props.form;
54
     const { getFieldDecorator } = this.props.form;
55
 
55
 
56
     // this.props.form.setFieldsValue(this.props.type)
56
     // this.props.form.setFieldsValue(this.props.type)
57
-    console.log(this.props.type)
57
+    // console.log(this.props.type,"33333333")
58
     return (
58
     return (
59
       <>
59
       <>
60
         <Col span={11} style={{
60
         <Col span={11} style={{
66
 
66
 
67
           <p style={{ padding: '20px', borderBottom: '1px solid #eee' }}>{this.props.type.buildingTypeName || ''}  <Button type="link" style={{ position: 'absolute', right: '16px' }} icon="close" onClick={() => this.close()} /></p>
67
           <p style={{ padding: '20px', borderBottom: '1px solid #eee' }}>{this.props.type.buildingTypeName || ''}  <Button type="link" style={{ position: 'absolute', right: '16px' }} icon="close" onClick={() => this.close()} /></p>
68
 
68
 
69
-          <Form {...formItemLayout} style={{ padding: '10px 0px 10px 10px' }}>
69
+          <Form {...formItemLayout} style={{ padding: '5px 0px 5px 5px' }}>
70
             <Form.Item label="类型编号" style={{ display: 'none' }}>
70
             <Form.Item label="类型编号" style={{ display: 'none' }}>
71
               {getFieldDecorator('buildingTypeId')(<Input disabled />)}
71
               {getFieldDecorator('buildingTypeId')(<Input disabled />)}
72
             </Form.Item>
72
             </Form.Item>
73
             <Form.Item label="状态" style={{ display: 'none' }}>
73
             <Form.Item label="状态" style={{ display: 'none' }}>
74
               {getFieldDecorator('status')(<Input disabled />)}
74
               {getFieldDecorator('status')(<Input disabled />)}
75
             </Form.Item>
75
             </Form.Item>
76
-            <Form.Item label="价格">
77
-              {getFieldDecorator('price')(<Input placeholder="元/㎡" maxLength="9" onChange={e => this.onChange(e, 'price')} />)}
76
+            <Form.Item label="价格类型">
77
+                {getFieldDecorator('priceType')(
78
+                  <Radio.Group onChange={e => this.onChange(e, 'priceType')} >
79
+                    <Radio value="average">均价</Radio>
80
+                    <Radio value="total">总价</Radio>
81
+                  </Radio.Group>
82
+                )}
83
+              </Form.Item>
84
+            <Form.Item label="价格区间" help='最高价与最低价一致时,只展示一个'>
85
+              {getFieldDecorator('startPrice')(<Input placeholder="最低价" style={{width: '60px'}} maxLength="9" onChange={e => this.onChange(e, 'startPrice')} />)} --
86
+              {getFieldDecorator('endPrice')(<Input placeholder="最高价" style={{width: '60px'}} maxLength="9" onChange={e => this.onChange(e, 'endPrice')} />)}{this.props.type.priceType === "average" ? "元/㎡" : "万元/套"}
78
             </Form.Item>
87
             </Form.Item>
88
+            <Form.Item label="销售状态" >
89
+            {getFieldDecorator('marketStatus')(
90
+              <Select placeholder="销售状态" onChange={e => this.onChange(e, 'marketStatus')} >
91
+                <Option value="待售">待售</Option>
92
+                <Option value="在售">在售</Option>
93
+                <Option value="售罄">售罄</Option>
94
+              </Select>,
95
+            )}
96
+          </Form.Item>
79
             <Form.Item label="装修标准">
97
             <Form.Item label="装修标准">
80
               {getFieldDecorator('decoration')(<Input onChange={e => this.onChange(e, 'decoration')} />)}
98
               {getFieldDecorator('decoration')(<Input onChange={e => this.onChange(e, 'decoration')} />)}
81
             </Form.Item>
99
             </Form.Item>
136
     const { projectType } = this.state
154
     const { projectType } = this.state
137
     const buildingType = projectType.filter(item => checked.includes(`${item.buildingTypeId}`))
155
     const buildingType = projectType.filter(item => checked.includes(`${item.buildingTypeId}`))
138
 
156
 
139
-    const tempDate = buildingType.map(item => ({ buildingTypeId: item.buildingTypeId, buildingTypeName: item.buildingTypeName, price: null, decoration: null, rightsYear: null, status: '1' }))
157
+    const tempDate = buildingType.map(item => ({ buildingTypeId: item.buildingTypeId, buildingTypeName: item.buildingTypeName, startPrice: null,endPrice: null,priceType: "average", decoration: null, rightsYear: null, status: '1' }))
140
     const updateProjectDate = this.updateProjectType(tempDate)
158
     const updateProjectDate = this.updateProjectType(tempDate)
141
     console.log('updateProjectDate: ', updateProjectDate)
159
     console.log('updateProjectDate: ', updateProjectDate)
142
     this.setState({ data: updateProjectDate })
160
     this.setState({ data: updateProjectDate })