Browse Source

新需求

傅行帆 5 years ago
parent
commit
0094d63638

+ 19
- 4
src/pages/building/list/add/components/base.jsx View File

@@ -45,6 +45,7 @@ function AddBuilding(props) {
45 45
 
46 46
   const [poi, setPoi] = useState([])
47 47
   const [videoImage, setVideoImage] = useState(false)
48
+  const [priceTypeList, setPriceTypeList] = useState([])
48 49
 
49 50
   // 存放所以 buildingData 基础信息
50 51
   const [buildingData, setBuildingData] = useState({})
@@ -86,6 +87,8 @@ function AddBuilding(props) {
86 87
       // if (res.openingDate !== null) {
87 88
       //   res.openingDate = moment(res.openingDate)
88 89
       // }
90
+      //构造下拉框
91
+      setPriceTypeList(res.buildingProjectType)
89 92
       if (res.receivedDate !== null) {
90 93
         res.receivedDate = moment(res.receivedDate)
91 94
       }
@@ -304,6 +307,12 @@ function AddBuilding(props) {
304 307
     return newPoi
305 308
   }
306 309
 
310
+  //组装项目类型
311
+  function getBuildingProjectTypeList(e) {
312
+    console.log(e,"项目类型------")
313
+    setPriceTypeList(e)
314
+  }
315
+
307 316
   function setFormMapScopeTagValue(keyType, item) {
308 317
     const tag = item.data.map(t => ({ tagName: t.name, delete: true, automatic: true }))
309 318
     switch (keyType) {
@@ -357,10 +366,16 @@ function AddBuilding(props) {
357 366
           <Form.Item label="项目类型">
358 367
             {getFieldDecorator('buildingProjectType', {
359 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 379
           </Form.Item>
365 380
           <Form.Item label="开盘时间" >
366 381
             {getFieldDecorator('openingDate')(<Input placeholder="预计xxxx年xx月开盘" maxLength = "15"/>)}

+ 26
- 8
src/pages/building/list/add/components/buildingProjectType.jsx View File

@@ -1,5 +1,5 @@
1 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 3
 import { render } from 'react-dom';
4 4
 import request from '../../../../../utils/request';
5 5
 import apis from '../../../../../services/apis';
@@ -28,11 +28,11 @@ class TypeForm extends React.Component {
28 28
   }
29 29
 
30 30
   onChange(e, name) {
31
-    // console.log(e.target.value)
31
+    // console.log(e)
32 32
     this.props.form.validateFieldsAndScroll((err, values) => {
33 33
       if (!err) {
34 34
         // console.log('Received values of form: ', values);
35
-        const currentValue = e.target.value
35
+        const currentValue = name === 'marketStatus' ? e : e.target.value
36 36
         if (currentValue === '') {
37 37
           values[name] = null
38 38
         } else {
@@ -54,7 +54,7 @@ class TypeForm extends React.Component {
54 54
     const { getFieldDecorator } = this.props.form;
55 55
 
56 56
     // this.props.form.setFieldsValue(this.props.type)
57
-    console.log(this.props.type)
57
+    // console.log(this.props.type,"33333333")
58 58
     return (
59 59
       <>
60 60
         <Col span={11} style={{
@@ -66,16 +66,34 @@ class TypeForm extends React.Component {
66 66
 
67 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 70
             <Form.Item label="类型编号" style={{ display: 'none' }}>
71 71
               {getFieldDecorator('buildingTypeId')(<Input disabled />)}
72 72
             </Form.Item>
73 73
             <Form.Item label="状态" style={{ display: 'none' }}>
74 74
               {getFieldDecorator('status')(<Input disabled />)}
75 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 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 97
             <Form.Item label="装修标准">
80 98
               {getFieldDecorator('decoration')(<Input onChange={e => this.onChange(e, 'decoration')} />)}
81 99
             </Form.Item>
@@ -136,7 +154,7 @@ class ProjectTypeBody extends React.Component {
136 154
     const { projectType } = this.state
137 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 158
     const updateProjectDate = this.updateProjectType(tempDate)
141 159
     console.log('updateProjectDate: ', updateProjectDate)
142 160
     this.setState({ data: updateProjectDate })