|
@@ -26,10 +26,12 @@ class Index extends Component {
|
|
|
addr1: '',
|
|
|
addr2: '',
|
|
|
addr3: '',
|
|
|
- remark: '',
|
|
|
- house_cert: '',
|
|
|
- formObj: {},
|
|
|
- imgArr: [],
|
|
|
+ pri_image: '',
|
|
|
+ formObj: {
|
|
|
+ house_type: '1室1厅1卫',
|
|
|
+ hide_status: '1',
|
|
|
+ },
|
|
|
+ imgArr: []
|
|
|
}
|
|
|
}
|
|
|
config = {
|
|
@@ -40,29 +42,102 @@ class Index extends Component {
|
|
|
Taro.$AHU(this)
|
|
|
}
|
|
|
|
|
|
- commentChange (remark) {
|
|
|
- this.setState({
|
|
|
- remark
|
|
|
- })
|
|
|
+ componentDidMount() {
|
|
|
+ const {id} = this.$router.params
|
|
|
+ if (id) {
|
|
|
+ Taro.api.room.apieshousedetail({id}).then(res => {
|
|
|
+ let cObj = res || {}
|
|
|
+ // console.log(cObj)
|
|
|
+ const addr = cObj.house_no.split('-')
|
|
|
+ Taro.setNavigationBarTitle({
|
|
|
+ title: cObj.sale_user.sale_name + '-编辑房源'
|
|
|
+ })
|
|
|
+ this.setState({
|
|
|
+ formObj: {
|
|
|
+ id: cObj.id,
|
|
|
+ house_type: cObj.house_type || '1室1厅1卫',
|
|
|
+ hide_status: cObj.hide_status || '1',
|
|
|
+ estate_id: cObj.estate_id || '',
|
|
|
+ estate_name: cObj.estate_name || '',
|
|
|
+ title: cObj.title || '',
|
|
|
+ house_no: cObj.house_no || '',
|
|
|
+ delivery_at: cObj.delivery_at || '',
|
|
|
+ price: cObj.price || '',
|
|
|
+ area: cObj.area || '',
|
|
|
+ full_year: cObj.full_year || '',
|
|
|
+ floor: cObj.floor || '',
|
|
|
+ storeys: cObj.storeys || '',
|
|
|
+ is_dec: cObj.is_dec || '',
|
|
|
+ is_elevator: cObj.is_elevator || '',
|
|
|
+ owner: cObj.owner || '',
|
|
|
+ owner_phone: cObj.owner_phone || '',
|
|
|
+ introduce: cObj.introduce || '',
|
|
|
+ remarked: cObj.remarked || '',
|
|
|
+ },
|
|
|
+ pri_image: cObj.pri_image || '',
|
|
|
+ imgArr: (cObj.images && cObj.images.length > 0) ? cObj.images.split(',') : [],
|
|
|
+ addr1: addr[0],
|
|
|
+ addr2: addr[1],
|
|
|
+ addr3: addr[2],
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
saveHandle () {
|
|
|
- const { remark, formObj, imgArr, house_cert } = this.state
|
|
|
- if (formObj.price && formObj.phone && house_cert) {
|
|
|
- Taro.api.base.apiuserhouseadd({
|
|
|
- phone: formObj.phone,
|
|
|
- price: formObj.price,
|
|
|
- house_cert: house_cert,
|
|
|
- remark: remark,
|
|
|
- images: imgArr.join(','),
|
|
|
- }).then(res => {
|
|
|
- this.setState({
|
|
|
- remark: '',
|
|
|
- house_cert: '',
|
|
|
- formObj: {},
|
|
|
- imgArr: [],
|
|
|
- })
|
|
|
- Taro.$msgConfirm('上传成功~我们审核通过后将展现在洪楼房源系统', () => {
|
|
|
+ const { formObj, imgArr, pri_image, addr1, addr2, addr3 } = this.state
|
|
|
+ let house_no = ''
|
|
|
+ if (addr1 && addr2 && addr3) {
|
|
|
+ house_no = `${addr1}-${addr2}-${addr3}`
|
|
|
+ } else {
|
|
|
+ Taro.$msg('请输入楼栋单号房间号')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // console.log(formObj.estate_id, formObj.title, pri_image)
|
|
|
+ let apiStr = 'apieshouseadd'
|
|
|
+ let params = {
|
|
|
+ estate_id: formObj.estate_id,
|
|
|
+ title: formObj.title,
|
|
|
+ house_no,
|
|
|
+ delivery_at: formObj.delivery_at,
|
|
|
+ house_type: formObj.house_type,
|
|
|
+ price: formObj.price,
|
|
|
+ area: formObj.area,
|
|
|
+ full_year: formObj.full_year,
|
|
|
+ floor: formObj.floor,
|
|
|
+ storeys: formObj.storeys,
|
|
|
+ is_dec: formObj.is_dec,
|
|
|
+ is_elevator: formObj.is_elevator,
|
|
|
+ owner: formObj.owner,
|
|
|
+ owner_phone: formObj.owner_phone,
|
|
|
+ introduce: formObj.introduce,
|
|
|
+ remarked: formObj.remarked,
|
|
|
+ hide_status: formObj.hide_status,
|
|
|
+ pri_image: pri_image,
|
|
|
+ images: imgArr.join(','),
|
|
|
+ }
|
|
|
+ if (formObj.id) {
|
|
|
+ apiStr = 'apieshouseedit'
|
|
|
+ params.id = formObj.id
|
|
|
+ }
|
|
|
+ if (formObj.estate_id && formObj.title && pri_image) {
|
|
|
+ Taro.api.room[apiStr](params).then(res => {
|
|
|
+ if (!formObj.id) {
|
|
|
+ this.setState({
|
|
|
+ pri_image: '',
|
|
|
+ formObj: {
|
|
|
+ house_type: '1室1厅1卫',
|
|
|
+ hide_status: '1',
|
|
|
+ },
|
|
|
+ imgArr: [],
|
|
|
+ addr1: '',
|
|
|
+ addr2: '',
|
|
|
+ addr3: '',
|
|
|
+ })
|
|
|
+ }
|
|
|
+ Taro.$msgConfirm('操作成功', () => {
|
|
|
Taro.navigateBack({
|
|
|
delta: 1
|
|
|
})
|
|
@@ -73,7 +148,7 @@ class Index extends Component {
|
|
|
})
|
|
|
})
|
|
|
} else {
|
|
|
- Taro.$msg('联系人手机号,价格,和房产证图片必填')
|
|
|
+ Taro.$msg('楼盘、标题、封面图必填')
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -88,7 +163,7 @@ class Index extends Component {
|
|
|
addHouseCertImg () {
|
|
|
this.uploadComImg((curImg) => {
|
|
|
this.setState({
|
|
|
- house_cert: curImg,
|
|
|
+ pri_image: curImg,
|
|
|
})
|
|
|
})
|
|
|
}
|
|
@@ -107,7 +182,7 @@ class Index extends Component {
|
|
|
const that = this
|
|
|
Taro.chooseImage({
|
|
|
count: 1, // 默认9
|
|
|
- sizeType: ['original', 'compressed'],
|
|
|
+ sizeType: ['compressed'], // original
|
|
|
sourceType: ['album', 'camera'],
|
|
|
success: function (res) {
|
|
|
const tempFilePaths = res.tempFilePaths
|
|
@@ -149,15 +224,18 @@ class Index extends Component {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
renderAddr () {
|
|
|
const { addr1, addr2, addr3 } = this.state
|
|
|
return (
|
|
|
<View className="scoped-addr-box">
|
|
|
- <Input type="number" value={addr1} onInput={this.changeAddrInput.bind(this, 'addr1')} className="i" />
|
|
|
+ <Input type="number" value={addr1} onInput={this.changeAddrInput.bind(this, 'addr1')} className="i" placeholder="__" />
|
|
|
<View className='t'>栋座</View>
|
|
|
- <Input type="number" value={addr2} onInput={this.changeAddrInput.bind(this, 'addr2')} className="i" />
|
|
|
+ <Input type="number" value={addr2} onInput={this.changeAddrInput.bind(this, 'addr2')} className="i" placeholder="__" />
|
|
|
<View className='t'>单元</View>
|
|
|
- <Input type="number" value={addr3} onInput={this.changeAddrInput.bind(this, 'addr3')} className="i" />
|
|
|
+ <Input type="number" value={addr3} onInput={this.changeAddrInput.bind(this, 'addr3')} className="i" placeholder="__" />
|
|
|
<View className='t'>室号</View>
|
|
|
</View>
|
|
|
)
|
|
@@ -168,15 +246,35 @@ class Index extends Component {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+ renderFloorHeight () {
|
|
|
+ const { formObj } = this.state
|
|
|
+ return (
|
|
|
+ <View className='scoped-floor-height-box'>
|
|
|
+ <Input type="number" value={formObj.floor} onInput={this.changeFormObjInput.bind(this, 'floor')} className="i" placeholder="所在楼层" />
|
|
|
+ <View className='t'>/</View>
|
|
|
+ <Input type="number" value={formObj.storeys} onInput={this.changeFormObjInput.bind(this, 'storeys')} className="i" placeholder="总楼层" />
|
|
|
+ <View className='t'>层</View>
|
|
|
+ </View>
|
|
|
+ )
|
|
|
+ }
|
|
|
+ changeFormObjInput (str, e) {
|
|
|
+ let { formObj } = this.state
|
|
|
+ formObj[str] = e.detail.value
|
|
|
+ this.setState({
|
|
|
+ formObj
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
render () {
|
|
|
- const { remark, formObj, imgArr, house_cert } = this.state
|
|
|
+ const { formObj, imgArr, pri_image } = this.state
|
|
|
const dictData = Taro.getStorageSync('dictData')
|
|
|
const roomDecMoreOptions = {arr: dictData.room_dec}
|
|
|
const houseRoomYearMoreOptions = {arr: dictData.house_room_year}
|
|
|
const yesnoMoreOptions = {arr: [...dictData.sys_yesno]}
|
|
|
+ const hideStatusoMoreOptions = {arr: [...dictData.hide_status]}
|
|
|
const addIcon = require('@img/icon_upload_img.png')
|
|
|
const closeIcon = require('@img/icon_g_close.png')
|
|
|
const imgItems = imgArr.map((src, index) => {
|
|
@@ -187,7 +285,7 @@ class Index extends Component {
|
|
|
</View>
|
|
|
)
|
|
|
})
|
|
|
- const moreEstateOptions = {
|
|
|
+ let moreEstateOptions = {
|
|
|
api: 'house.admestatelist',
|
|
|
opKey: 'estate_name',
|
|
|
opVal: 'id',
|
|
@@ -196,10 +294,16 @@ class Index extends Component {
|
|
|
return (
|
|
|
<View className="l-box">
|
|
|
<View className="l-floor-pos2">
|
|
|
+ {
|
|
|
+ formObj.estate_name
|
|
|
+ ?
|
|
|
+ <View className='scoped-estate-name'>{formObj.estate_name}[只读]</View>
|
|
|
+ : ''
|
|
|
+ }
|
|
|
<LFormGroup
|
|
|
val={formObj.estate_id}
|
|
|
valStr="estate_id"
|
|
|
- keyStr="关联楼盘(必填)"
|
|
|
+ keyStr="选楼盘(必填)"
|
|
|
keyStr2="请选择"
|
|
|
typeStr="radio"
|
|
|
moreOptions={moreEstateOptions}
|
|
@@ -207,16 +311,29 @@ class Index extends Component {
|
|
|
/>
|
|
|
</View>
|
|
|
<View className="l-floor-pos2">
|
|
|
+ <LFormGroup
|
|
|
+ val={formObj.title}
|
|
|
+ valStr="title"
|
|
|
+ keyStr="标题(必填)"
|
|
|
+ keyStr2="请总结概括该房源特色"
|
|
|
+ bc={this.baseFormChange.bind(this)}
|
|
|
+ />
|
|
|
+ </View>
|
|
|
+ <View className="l-floor-pos2">
|
|
|
+ <LFormGroup
|
|
|
+ val={formObj.house_no}
|
|
|
+ valStr="house_no"
|
|
|
+ keyStr="地址"
|
|
|
+ />
|
|
|
{this.renderAddr()}
|
|
|
</View>
|
|
|
<View className="l-floor-pos2">
|
|
|
<LFormGroup
|
|
|
- val={formObj.xxxxxxxxxx}
|
|
|
- valStr="xxxxxxxxxx"
|
|
|
- keyStr="楼层层高"
|
|
|
- keyStr2="请输入"
|
|
|
- bc={this.baseFormChange.bind(this)}
|
|
|
+ val={formObj.floor}
|
|
|
+ valStr="floor"
|
|
|
+ keyStr="楼层"
|
|
|
/>
|
|
|
+ {this.renderFloorHeight()}
|
|
|
</View>
|
|
|
<View className="l-floor-pos2">
|
|
|
<LFormGroup
|
|
@@ -231,7 +348,7 @@ class Index extends Component {
|
|
|
<LFormGroup
|
|
|
val={formObj.area}
|
|
|
valStr="area"
|
|
|
- keyStr="建筑面积(必填)"
|
|
|
+ keyStr="建筑面积"
|
|
|
keyStr2="请输入"
|
|
|
typeStr="inputFont"
|
|
|
inputFont="㎡"
|
|
@@ -242,7 +359,7 @@ class Index extends Component {
|
|
|
<LFormGroup
|
|
|
val={formObj.price}
|
|
|
valStr="price"
|
|
|
- keyStr="总价(必填)"
|
|
|
+ keyStr="房屋总价"
|
|
|
keyStr2="请输入"
|
|
|
typeStr="inputFont"
|
|
|
inputFont="万"
|
|
@@ -260,8 +377,8 @@ class Index extends Component {
|
|
|
</View>
|
|
|
<View className="l-floor-pos2">
|
|
|
<LFormGroup
|
|
|
- val={formObj.phone}
|
|
|
- valStr="phone"
|
|
|
+ val={formObj.owner_phone}
|
|
|
+ valStr="owner_phone"
|
|
|
keyStr="业主电话"
|
|
|
keyStr2="请输入"
|
|
|
bc={this.baseFormChange.bind(this)}
|
|
@@ -280,8 +397,8 @@ class Index extends Component {
|
|
|
</View>
|
|
|
<View className="l-floor-pos2">
|
|
|
<LFormGroup
|
|
|
- val={formObj.how_many_year}
|
|
|
- valStr="how_many_year"
|
|
|
+ val={formObj.full_year}
|
|
|
+ valStr="full_year"
|
|
|
keyStr="满几年"
|
|
|
keyStr2="请选择"
|
|
|
typeStr="select"
|
|
@@ -291,8 +408,8 @@ class Index extends Component {
|
|
|
</View>
|
|
|
<View className="l-floor-pos2">
|
|
|
<LFormGroup
|
|
|
- val={formObj.xxxxxxxxxxxxxxxx}
|
|
|
- valStr="xxxxxxxxxxxxxxxx"
|
|
|
+ val={formObj.is_elevator}
|
|
|
+ valStr="is_elevator"
|
|
|
keyStr="有电梯"
|
|
|
keyStr2="请选择"
|
|
|
typeStr="select"
|
|
@@ -302,8 +419,8 @@ class Index extends Component {
|
|
|
</View>
|
|
|
<View className="l-floor-pos2">
|
|
|
<LFormGroup
|
|
|
- val={formObj.xxxxxxxxxxxxxxxxx}
|
|
|
- valStr="xxxxxxxxxxxxxxxxx"
|
|
|
+ val={formObj.delivery_at}
|
|
|
+ valStr="delivery_at"
|
|
|
keyStr="交房时间"
|
|
|
keyStr2="请选择"
|
|
|
dateFields="month"
|
|
@@ -311,16 +428,26 @@ class Index extends Component {
|
|
|
bc={this.baseFormChange.bind(this)}
|
|
|
/>
|
|
|
</View>
|
|
|
-
|
|
|
+ <View className="l-floor-pos2">
|
|
|
+ <LFormGroup
|
|
|
+ val={formObj.hide_status}
|
|
|
+ valStr="hide_status"
|
|
|
+ keyStr="显示隐藏"
|
|
|
+ keyStr2="请选择"
|
|
|
+ typeStr="select"
|
|
|
+ moreOptions={hideStatusoMoreOptions}
|
|
|
+ bc={this.baseFormChange.bind(this)}
|
|
|
+ />
|
|
|
+ </View>
|
|
|
|
|
|
<View className="scoped-box">
|
|
|
- <View className="sb-title">房产证图片(必填)</View>
|
|
|
+ <View className="sb-title">封面主图片(必填)</View>
|
|
|
<View className="scoped-img">
|
|
|
{
|
|
|
- house_cert
|
|
|
+ pri_image
|
|
|
?
|
|
|
<View className="si-op" onClick={this.addHouseCertImg.bind(this)}>
|
|
|
- <Image src={house_cert} className="img"/>
|
|
|
+ <Image src={pri_image} className="img"/>
|
|
|
</View>
|
|
|
:
|
|
|
<View className="si-op" onClick={this.addHouseCertImg.bind(this)}>
|
|
@@ -347,13 +474,23 @@ class Index extends Component {
|
|
|
<View className="scoped-box">
|
|
|
<View className="sb-title">更多对外描述</View>
|
|
|
<AtTextarea
|
|
|
- value={remark}
|
|
|
- onChange={this.commentChange.bind(this)}
|
|
|
+ value={formObj.introduce}
|
|
|
+ onChange={this.baseFormChange.bind(this, 'introduce')}
|
|
|
maxLength={300}
|
|
|
height={200}
|
|
|
placeholder='更多需要补充的描述,对外公开(300字以内)'
|
|
|
/>
|
|
|
</View>
|
|
|
+ <View className="scoped-box">
|
|
|
+ <View className="sb-title">内部备注</View>
|
|
|
+ <AtTextarea
|
|
|
+ value={formObj.remarked}
|
|
|
+ onChange={this.baseFormChange.bind(this, 'remarked')}
|
|
|
+ maxLength={300}
|
|
|
+ height={200}
|
|
|
+ placeholder='仅编辑查看,房源内部备注信息(300字以内)'
|
|
|
+ />
|
|
|
+ </View>
|
|
|
<View className="l-floor-footer t2">
|
|
|
<View className="lff-flex">
|
|
|
<View className="lff-btn full" onClick={this.saveHandle.bind(this)}>提交</View>
|