Browse Source

房源模块修改完善

liujq temp20230202 2 years ago
parent
commit
5bf1d89a23
2 changed files with 132 additions and 40 deletions
  1. 101 18
      src/pagesMore/center/uploadRoom2.jsx
  2. 31 22
      src/pagesRoom/dtl.jsx

+ 101 - 18
src/pagesMore/center/uploadRoom2.jsx

@@ -32,6 +32,8 @@ class Index extends Component {
       hType1: '',
       hType2: '',
       hType3: '',
+      sRate1: '',
+      sRate2: '',
       formObj: {
         hide_status: '1',
       },
@@ -54,8 +56,9 @@ class Index extends Component {
       Taro.api.room.apieshousedetail({id}).then(res => {
         let cObj = res || {}
         // console.log(cObj)
-        const addr = cObj.house_no.split('-')
-        const hType = cObj.house_type.split('-')
+        const addr = cObj.house_no ? cObj.house_no.split('-') : []
+        const hType = cObj.house_type ? cObj.house_type.split('-') : []
+        const sRate = cObj.stairs_rate ? cObj.stairs_rate.split('-') : []
         Taro.setNavigationBarTitle({
           title: cObj.sale_user.sale_name + '-编辑房源'
         })
@@ -81,6 +84,8 @@ class Index extends Component {
             remarked: cObj.remarked || '',
             pri_image: cObj.pri_image || '',
             house_img: cObj.house_img || '',
+            position: cObj.position || '',
+            floor_price: cObj.floor_price || '',
           },
           imgArr: (cObj.images && cObj.images.length > 0) ? cObj.images.split(',') : [],
           addr1: addr[0],
@@ -89,6 +94,8 @@ class Index extends Component {
           hType1: hType[0],
           hType2: hType[1],
           hType3: hType[2],
+          sRate1: sRate[0],
+          sRate2: sRate[1],
         })
       })
     }
@@ -97,7 +104,7 @@ class Index extends Component {
 
 
   saveHandle () {
-    const { formObj, imgArr, addr1, addr2, addr3, hType1, hType2, hType3 } = this.state
+    const { formObj, imgArr, addr1, addr2, addr3, hType1, hType2, hType3, sRate1, sRate2 } = this.state
     let house_no = ''
     if (addr1 && addr2 && addr3) {
       house_no = `${addr1}-${addr2}-${addr3}`
@@ -109,6 +116,11 @@ class Index extends Component {
     if (hType1 && hType2 && hType3) {
       house_type = `${hType1}-${hType2}-${hType3}`
     }
+    let stairs_rate = ''
+    if (sRate1 && sRate2) {
+      stairs_rate = `${sRate1}-${sRate1}`
+    }
+    
     // console.log(formObj.estate_id, formObj.title, formObj.pri_image)
     let apiStr = 'apieshouseadd'
     let params = {
@@ -117,6 +129,7 @@ class Index extends Component {
       house_no,
       delivery_at: formObj.delivery_at,
       house_type,
+      stairs_rate,
       price: formObj.price,
       area: formObj.area,
       full_year: formObj.full_year,
@@ -131,6 +144,8 @@ class Index extends Component {
       hide_status: formObj.hide_status,
       pri_image: formObj.pri_image,
       house_img: formObj.house_img,
+      position: formObj.position,
+      floor_price: formObj.floor_price,
       images: imgArr.join(','),
     }
     if (formObj.id) {
@@ -164,14 +179,14 @@ class Index extends Component {
     })
   }
 
-  dealImgHandle (key) {
+  dealImgHandle (key, moreStr) {
     this.uploadComImg((val) => {
       let { formObj } = this.state
       formObj[key] = val
       this.setState({
         formObj
       })
-    })
+    }, 1, moreStr)
   }
 
   addImg () {
@@ -181,9 +196,9 @@ class Index extends Component {
       this.setState({
         imgArr
       })
-    }, 2)
+    }, 9)
   }
-  uploadComImg (bc, count) {
+  uploadComImg (bc, count, moreStr) {
     const that = this
     Taro.chooseImage({
       count: count ? count : 1, // 默认9
@@ -194,7 +209,7 @@ class Index extends Component {
         if (tempFilePaths.length > 0) {
           let imgBcArr = []
           tempFilePaths.forEach((p, i) => {
-            that.diyUploadFile(p).then(url => {
+            that.diyUploadFile(p, moreStr).then(url => {
               imgBcArr.push(url)
               if (bc && imgBcArr.length === tempFilePaths.length) {
                 bc(imgBcArr)
@@ -205,11 +220,13 @@ class Index extends Component {
       }
     })
   }
-  diyUploadFile (filePath) {
+  diyUploadFile (filePath, moreStr) {
     return new Promise((resolve, reject) => {
       let token = Taro.getStorageSync('APP_token')
+      let url = `https://api.honglouplus.com/api/upload/cloudpir`
+      if (moreStr === 'noSign') url = `https://api.honglouplus.com/api/upload/cloud`
       Taro.uploadFile({
-        url: `https://api.honglouplus.com/api/upload/cloudpir`,
+        url,
         filePath,
         name: 'upload',
         formData: {
@@ -282,7 +299,19 @@ class Index extends Component {
       [str]: e.detail.value
     })
   }
+  
 
+  renderStairsRate () {
+    const { sRate1, sRate2 } = this.state
+    return (
+      <View className='scoped-floor-height-box'>
+        <Input type="number" value={sRate1} onInput={this.changeAddrInput.bind(this, 'sRate1')}  className="i" placeholder="__" />
+        <View className='t'>梯</View>
+        <Input type="number" value={sRate2} onInput={this.changeAddrInput.bind(this, 'sRate2')}  className="i" placeholder="__" />
+        <View className='t'>户</View>
+      </View>
+    )
+  }
   renderFloorHeight () {
     const { formObj } = this.state
     return (
@@ -376,6 +405,7 @@ class Index extends Component {
     const houseRoomYearMoreOptions = {arr: dictData.house_room_year}
     const yesnoMoreOptions = {arr: [...dictData.sys_yesno]}
     const hideStatusoMoreOptions = {arr: [...dictData.hide_status]}
+    const roomPositionMoreOptions = {arr: [...dictData.room_position]}
     const addIcon = require('@img/icon_upload_img.png')
     const closeIcon = require('@img/icon_g_close.png')
     const imgItems = imgArr.map((src, index) => {
@@ -396,11 +426,33 @@ class Index extends Component {
     return (
       <View className="l-box">
         {/* {this.renderCutImg()} */}
-        <View className="l-floor-pos2">
+        {
+          formObj.estate_name
+          ?
+          <View className="l-floor-pos2">
+            <Navigator url={`/pagesHouse/indexDtl?id=${formObj.estate_id}`} className='scoped-estate-name'>{formObj.estate_name}{'>'}</Navigator>
+            <LFormGroup
+              val={formObj.estate_id}
+              valStr="estate_id"
+              keyStr="当前楼盘"
+            />
+          </View>
+          :
+          <LFormGroup
+            val={formObj.estate_id}
+            valStr="estate_id"
+            keyStr="选楼盘(必填)"
+            keyStr2="请选择"
+            typeStr="radio"
+            moreOptions={moreEstateOptions}
+            bc={this.baseFormChange.bind(this)}
+          />
+        }
+        {/* <View className="l-floor-pos2">
           {
             formObj.estate_name
             ?
-            <Navigator url={`/pagesHouse/indexDtl?id=${formObj.estate_id}`} className='scoped-estate-name'>{formObj.estate_name}[只读]</Navigator>
+            <View className='scoped-estate-name'>{formObj.estate_name}[{formObj.estate_id}]</View>
             : ''
           }
           <LFormGroup
@@ -412,7 +464,7 @@ class Index extends Component {
             moreOptions={moreEstateOptions}
             bc={this.baseFormChange.bind(this)}
           />
-        </View>
+        </View> */}
         <View className="l-floor-pos2">
           <LFormGroup
             val={formObj.title}
@@ -426,7 +478,7 @@ class Index extends Component {
           <LFormGroup
             val={formObj.house_no}
             valStr="house_no"
-            keyStr="地址"
+            keyStr="地址(必填)"
           />
           {this.renderAddr()}
         </View>
@@ -446,11 +498,19 @@ class Index extends Component {
           />
           {this.renderFloorHeight()}
         </View>
+        <View className="l-floor-pos2">
+          <LFormGroup
+            val={formObj.stairs_rate}
+            valStr="stairs_rate"
+            keyStr="梯户比"
+          />
+          {this.renderStairsRate()}
+        </View>
         <View className="l-floor-pos2">
           <LFormGroup
             val={formObj.area}
             valStr="area"
-            keyStr="建筑面积"
+            keyStr="房屋面积"
             keyStr2="请输入"
             typeStr="inputFont"
             inputFont="㎡"
@@ -468,6 +528,18 @@ class Index extends Component {
             bc={this.baseFormChange.bind(this)}
           />
         </View>
+        <View className="l-floor-pos2">
+          <LFormGroup
+            val={formObj.floor_price}
+            valStr="floor_price"
+            keyStr="实际底价"
+            keyStr2="请输入"
+            typeStr="inputFont"
+            inputFont="万"
+            bc={this.baseFormChange.bind(this)}
+          />
+        </View>
+        
         <View className="l-floor-pos2">
           <LFormGroup
             val={formObj.owner}
@@ -541,6 +613,17 @@ class Index extends Component {
             bc={this.baseFormChange.bind(this)}
           />
         </View>
+        <View className="l-floor-pos2">
+          <LFormGroup
+            val={formObj.position}
+            valStr="position"
+            keyStr="户型方位"
+            keyStr2="请选择"
+            typeStr="select"
+            moreOptions={roomPositionMoreOptions}
+            bc={this.baseFormChange.bind(this)}
+          />
+        </View>
         <View className='scoped-has-right'>
           <View className="scoped-box">
             <View className="sb-title">封面主图片(必填)</View>
@@ -575,11 +658,11 @@ class Index extends Component {
               {
                 formObj.house_img
                 ?
-                <View className="si-op" onClick={this.dealImgHandle.bind(this, 'house_img')}>
-                  <Image src={formObj.house_img + '_plus'} className="img"/>
+                <View className="si-op" onClick={this.dealImgHandle.bind(this, 'house_img', 'noSign')}>
+                  <Image src={formObj.house_img} className="img"/>
                 </View>
                 :
-                <View className="si-op" onClick={this.dealImgHandle.bind(this, 'house_img')}>
+                <View className="si-op" onClick={this.dealImgHandle.bind(this, 'house_img', 'noSign')}>
                   <Image src={addIcon} className="img"/>
                 </View>
               }

+ 31 - 22
src/pagesRoom/dtl.jsx

@@ -101,9 +101,9 @@ class Index extends Component {
     })
   }
   previewImage2Handle (cur, arr) {
-    const current = `${cur}`
+    const current = `${cur}_plus`
     const urls = arr.map(item => {
-      return `${item.img_url}`
+      return `${item.img_url}_plus`
     })
     Taro.previewImage({
       current,
@@ -138,11 +138,10 @@ class Index extends Component {
   
   renderMain () {
     const dictData = Taro.getStorageSync('dictData')
-    const htObj = arrToObj(dictData.house_type)
-    const ptObj = arrToObj(dictData.product_type)
     const atObj = arrToObj(dictData.area_type)
     const hryObj = arrToObj(dictData.house_room_year)
     const roomDecObj = arrToObj(dictData.room_dec)
+    const yesnoObj = arrToObj(dictData.sys_yesno)
     const { curObj } = this.state
     const tagArr = curObj.custom_tag ? curObj.custom_tag.split(',') : []
     const moreImg = require('./img/dtl/bg_estate.png')
@@ -158,6 +157,12 @@ class Index extends Component {
     }
     if (FH === 1) FHstr = '一楼'
     if (FH === H) FHstr = '顶楼'
+
+    let houseTypeStr = '未知'
+    if (curObj.house_type) {
+      let arr = curObj.house_type.split('-')
+      houseTypeStr = `${arr[0]}室${arr[1]}厅${arr[2]}卫`
+    }
     return (
       <View className="scoped-main">
         {this.renderQrcode()}
@@ -180,20 +185,24 @@ class Index extends Component {
             <View className="v">{parseInt(curObj.price * 10000 / curObj.area)}元/㎡</View>
             <View className="k">单价</View>
           </View>
-          {/* <View className="op">
-            <View className="v"></View>
-            <View className="k">户型</View>
-          </View> */}
           <View className="op">
             <View className="v">{curObj.area}㎡</View>
             <View className="k">建筑面积</View>
           </View>
         </View>
         <View className="sm-op">
+          <View className="op">
+            <View className="k">预约:</View>
+            <View className="v">房东底价?朝向梯户比?<View onClick={this.countHandle.bind(this, 'chat')} className="s">【免费咨询】</View></View>
+          </View>
+          <View className="op">
+            <View className="k">楼盘:</View>
+            <View className="v">{curObj.estate_name}<View onClick={this.dtlLink.bind(this)}  className="s">查看该楼盘</View></View>
+          </View>
           <View className="op" onClick={this.houseImgHandle.bind(this)}>
             <View className="k">户型:</View>
-            <View className="v">{htObj[curObj.house_type]}
-              <View className="s">点击查看户型</View>
+            <View className="v">{houseTypeStr}
+              <View className="s">查看户型</View>
             </View>
           </View>
           <View className="op">
@@ -212,18 +221,18 @@ class Index extends Component {
             <View className="k">装修状态:</View>
             <View className="v">{roomDecObj[curObj.is_dec]}</View>
           </View>
-          <View className="op full">
-            <View className="k">楼盘名称:</View>
-            <View className="v">{curObj.estate_name}</View>
+          <View className="op">
+            <View className="k">交房时间:</View>
+            <View className="v">{curObj.delivery_at}</View>
           </View>
-          <Navigator url={`/pagesHouse/indexDtlAround?id=${curObj.estate_id}&name=${curObj.estate_name}`} className="op full">
-            <View className="k">房源地址:</View>
-            <View className="v">{curObj.address} <View className="s">查看周边配套</View></View>
-          </Navigator>
           <View className="op">
-            <View className="k">区域:</View>
-            <View className="v">{atObj[curObj.area_type]}</View>
+            <View className="k">是否电梯:</View>
+            <View className="v">{yesnoObj[curObj.is_elevator]}</View>
           </View>
+          <Navigator url={`/pagesHouse/indexDtlAround?id=${curObj.estate_id}&name=${curObj.estate_name}`} className="op">
+            <View className="k">区域:</View>
+            <View className="v">{atObj[curObj.area_type]}<View className="s">查看周边配套</View></View>
+          </Navigator>
           <View className="op">
             <View className="k">录入时间:</View>
             <View className="v">{curObj.create_at ? curObj.create_at.substring(0, 10) : ''}</View>
@@ -261,7 +270,7 @@ class Index extends Component {
         </View>
         <View className="do-content" onClick={this.houseImgHandle.bind(this)}>
           <View className="scoped-img">
-            <Image src={curObj.house_img + '_xs'} className="img"/>
+            <Image src={curObj.house_img} className="img"/>
             <View className="tips">
               <View className="bg"></View>
               <View className="t">查看大图</View>
@@ -273,8 +282,8 @@ class Index extends Component {
   }
   houseImgHandle () {
     const { curObj } = this.state
-    const current = `${curObj.house_img}_plus`
-    const urls = [`${curObj.house_img}_plus`]
+    const current = `${curObj.house_img}`
+    const urls = [`${curObj.house_img}`]
     Taro.previewImage({
       current,
       urls