230320a303 5 bulan lalu
induk
melakukan
b75b69eea8

+ 1 - 0
src/app.jsx

@@ -142,6 +142,7 @@ class App extends Component {
           'list2',
           'listMy',
           'listed',
+          'listed2',
           'rentlist',
           'rentdtl',
           'rentUpload',

+ 11 - 4
src/pagesHouse/indexDtl.jsx

@@ -394,10 +394,17 @@ class Index extends Component {
         {
           curObj.estate_tag === '二手'
           ?
-          <Navigator url={'/pagesMore/comment/list?id=' + curId + '&name=' + curObj.estate_name} className="de-op">
-            <Image className="i" src={icon7} />
-            <View className="t">楼盘评论</View>
-          </Navigator>
+            userInfo.is_sale == 1
+            ?
+            <Navigator url={'/pagesRoom/listed2?estate_id=' + curId + '&estate_name=' + curObj.estate_name} className="de-op">
+              <Image className="i" src={icon7} />
+              <View className="t">最近成交</View>
+            </Navigator>
+            :
+            <Navigator url={'/pagesMore/comment/list?id=' + curId + '&name=' + curObj.estate_name} className="de-op">
+              <Image className="i" src={icon7} />
+              <View className="t">楼盘评论</View>
+            </Navigator>
           :
           <Navigator url={`/pagesPlan/apply2?eId=${curId}&eName=${curObj.estate_name}`} className="de-op">
             <Image className="i" src={icon7} />

+ 1 - 1
src/pagesMore/center/index.jsx

@@ -231,7 +231,7 @@ class Index extends Component {
             </Navigator>
             <Navigator url="/pagesRoom/listed" className="entry-op">
               <Image src={icon4} className="entry-icon"></Image>
-              <View className="entry-text">洪楼已售房源</View>
+              <View className="entry-text">已售房源</View>
               <View className="entry-right">
                 <Image src={iconSign} className="sign"></Image>
               </View>

+ 5 - 4
src/pagesRoom/listed.jsx

@@ -43,7 +43,7 @@ class Index extends Component {
   }
 
   config = {
-    navigationBarTitleText: '优质房源',
+    navigationBarTitleText: '已售房源',
   }
 
   componentWillMount () {
@@ -574,7 +574,8 @@ class Index extends Component {
             </View>
             <View className="lhl-p3">{item.floor}/{item.storeys}-{item.estate_name}</View>
             <View className="lhl-sign">
-              {tagViews}
+              {/* {tagViews} */}
+              <View className="s">最后更新:{item.update_at}</View>
             </View>
           </View>
         </View>
@@ -636,11 +637,11 @@ class Index extends Component {
           :
           <MultiSelect val={estateIdCur} moreOptions={estateMoreOptions} isShow={isEstateShow} initUpdate="no" bc={this.dealMSPopup.bind(this)} close={this.closeMSPopup.bind(this)}/>
         }
-        <View className="l-floor-footer">
+        {/* <View className="l-floor-footer">
             <View className="lff-flex">
               <View className="lff-btn full" onClick={this.addHandle.bind(this)}>添加已成交房源</View>
             </View>
-          </View>
+          </View> */}
       </View>
     )
   }

+ 2 - 1
src/pagesRoom/listed.scss

@@ -6,7 +6,8 @@
   padding-bottom: 120px;
 }
 .l-scroll-view {
-  height: calc(100vh - 84px - 90px - 120px);
+  // height: calc(100vh - 84px - 90px - 120px);
+  height: calc(100vh - 84px - 90px);
   box-sizing: border-box;
 }
 .scoped-fixed {

+ 650 - 0
src/pagesRoom/listed2.jsx

@@ -0,0 +1,650 @@
+import Taro, { Component } from '@tarojs/taro'
+import { View, Image, Text, Navigator } from '@tarojs/components'
+
+import { AtSearchBar } from 'taro-ui'
+import ListMore from '@/c/pageDataList/listMore'
+import MultiSelect from '@/c/lform/MultiSelect'
+import './listed2.scss'
+import { arrToObj } from '@utils'
+
+class Index extends Component {
+
+  constructor (props) {
+    super(props)
+    const { estate_id } = this.$router.params
+    let estateIdCur = []
+    if (estate_id) estateIdCur = [estate_id]
+    this.state = {
+      searchKey: '',
+      page_size: 10,
+      page: 1,
+      isListEnd: false,
+      isListLoading: false,
+      isListEmpty: false,
+      dataList: [],
+      curNav: 1,
+      isDShow: false,
+      curObj: {},
+      searchIndex: -1,
+      searchText1: '',
+      searchText5: '',
+      searchText3: '',
+      searchText4: '',
+      searchText5: '',
+      curPos: 'area_type',
+      curAreaType: [],
+      curProductTypeName: [],
+      curHouseTypeRange: [],
+      houseAreaCur: [],
+      productTypeCur: [],
+      isEstateShow: false,
+      estateIdCur,
+    }
+  }
+
+  config = {
+    navigationBarTitleText: '已售房源',
+  }
+
+  componentWillMount () {
+    Taro.$AHU(this)
+    const { estate_id } = this.$router.params
+    if (estate_id) {
+      this.getDataList()
+    }
+  }
+
+  componentDidShow () { }
+
+  componentDidHide () { }
+
+  renderSearch () {
+    const { searchKey } = this.state
+    return (
+      <AtSearchBar
+        value={searchKey}
+        fixed={true}
+        placeholder="请输入房源关键字"
+        onChange={this.onSeachChange.bind(this)}
+        onActionClick={this.onSelectActionClick.bind(this)}
+        onClear={this.onClearHandle.bind(this)}
+      />
+    )
+  }
+  onSeachChange (value) {
+    this.setState({
+      searchKey: value
+    })
+  }
+  onClearHandle () {
+    this.setState({
+      searchKey: '',
+      page: 1
+    }, () => {
+      this.getDataList()
+    })
+  }
+  onSelectActionClick () {
+    this.setState({
+      page: 1,
+    }, () => {
+      this.getDataList()
+    })
+  }
+
+  searchIndex1Render () {
+    const { curPos, curAreaType } = this.state
+    const dictData = Taro.getStorageSync('dictData')
+    const areaTypeViews = dictData.area_type.map(item =>{
+      let curClassName = "op"
+      curAreaType.forEach(curVal =>{
+        if (curVal === item.val) {
+          curClassName = "op cur"
+        }
+      })
+      return (
+        <View className={curClassName} key={item.val} onClick={this.areaTypeHandle.bind(this, item)}>{item.key}</View>
+      )
+    })
+    let areaTypeAllClassName = curAreaType.length === 0 ? 'op cur' : 'op'
+    return (
+      <View className="stc-wrap">
+        {/* <View className="stc-item">
+          <View className={curPos === 'area_type' ? 'stc-op cur' : 'stc-op'}  onClick={this.posHandle.bind(this, 'area_type')}>区域</View>
+        </View> */}
+        {
+          curPos === 'area_type'
+          &&
+          <View className="stc-pane">
+            <View className={areaTypeAllClassName} onClick={this.areaTypeHandle.bind(this, 'all')}>不限</View>
+            {areaTypeViews}
+          </View>
+        }
+      </View>
+    )
+  }
+  posHandle (str) {
+    this.setState({
+      curPos: str,
+      curAreaType: [],
+    })
+  }
+  areaTypeHandle (curOp) {
+    if (curOp === 'all') {
+      this.setState({
+        curAreaType: []
+      })
+    } else {
+      let { curAreaType } = this.state
+      let ed = false
+      let curI = 0
+      curAreaType.forEach((item, index) => {
+        if (curOp.val === item) {
+          ed = true
+          curI = index
+        }
+      })
+      if (ed) {
+        curAreaType.splice(curI, 1)
+      } else {
+        curAreaType.push(curOp.val)
+      }
+      this.setState({
+        curAreaType
+      })
+    }
+  }
+
+
+
+  searchIndex3Render () {
+    const { curHouseTypeRange } = this.state
+    const dictData = Taro.getStorageSync('dictData')
+    const edIcon = require('@img/images/icon_g_ed.png')
+    const rangeViews = dictData.house_type.map(item =>{
+      let curClassName = "stc-op"
+      curHouseTypeRange.forEach(curVal =>{
+        if (curVal === item.val) {
+          curClassName = "stc-op cur"
+        }
+      })
+      return (
+        <View className={curClassName} key={item.val} onClick={this.houseTypeRangeHandle.bind(this, item)}>{item.key}
+          <Image className="img" src={edIcon} />
+        </View>
+      )
+    })
+    let allClassName = curHouseTypeRange.length === 0 ? 'stc-op cur' : 'stc-op'
+    return (
+      <View className="stc-wrap">
+        <View className="stc-item">
+          <View className={allClassName} onClick={this.houseTypeRangeHandle.bind(this, 'all')}>不限</View>
+          {rangeViews}
+        </View>
+      </View>
+    )
+  }
+  houseTypeRangeHandle (curOp) {
+    if (curOp === 'all') {
+      this.setState({
+        curHouseTypeRange: []
+      })
+    } else {
+      let { curHouseTypeRange } = this.state
+      let ed = false
+      let curI = 0
+      curHouseTypeRange.forEach((item, index) => {
+        if (curOp.val === item) {
+          ed = true
+          curI = index
+        }
+      })
+      if (ed) {
+        curHouseTypeRange.splice(curI, 1)
+      } else {
+        curHouseTypeRange.push(curOp.val)
+      }
+      this.setState({
+        curHouseTypeRange
+      })
+    }
+  }
+
+
+  searchIndex4Render () {
+    const dictData = Taro.getStorageSync('dictData')
+    // 房屋面积
+    const { houseAreaCur } = this.state
+    const house_area = dictData.house_area || []
+    const houseAreaViews = house_area.map(item =>{
+      let curClassName = "mp-op"
+      houseAreaCur.forEach(curVal =>{
+        if (curVal === item.val) {
+          curClassName = "mp-op cur"
+        }
+      })
+      return (
+        <View className={curClassName} key={item.val} onClick={this.comSelectHandle.bind(this, item, 'houseAreaCur')}>{item.key}</View>
+      )
+    })
+    const houseAreaAllClassName = houseAreaCur.length === 0 ? 'mp-op cur' : 'mp-op'
+    // 产品类型
+    const { productTypeCur } = this.state
+    const product_type = dictData.product_type || []
+    const productTypeViews = product_type.map(item =>{
+      let curClassName = "mp-op"
+      productTypeCur.forEach(curVal =>{
+        if (curVal === item.val) {
+          curClassName = "mp-op cur"
+        }
+      })
+      return (
+        <View className={curClassName} key={item.val} onClick={this.comSelectHandle.bind(this, item, 'productTypeCur')}>{item.key}</View>
+      )
+    })
+    const productTypeAllClassName = productTypeCur.length === 0 ? 'mp-op cur' : 'mp-op'
+    return (
+      <View className="more-pane">
+        <View className="mp-item">
+          <View className="mp-title">房源面积</View>
+          <View className="mp-content">
+            <View className={houseAreaAllClassName} onClick={this.comSelectHandle.bind(this, 'all', 'houseAreaCur')}>不限</View>
+            {houseAreaViews}
+          </View>
+        </View>
+        <View className="mp-item">
+          <View className="mp-title">产品类型</View>
+          <View className="mp-content">
+            <View className={productTypeAllClassName} onClick={this.comSelectHandle.bind(this, 'all', 'productTypeCur')}>不限</View>
+            {productTypeViews}
+          </View>
+        </View>
+      </View>
+    )
+  }
+  comSelectHandle (curOp, str) {
+    if (curOp === 'all') {
+      this.setState({
+        [str]: []
+      })
+    } else {
+      const state = this.state
+      let curStr = state[str]
+      let ed = false
+      let curI = 0
+      curStr.forEach((item, index) => {
+        if (curOp.val === item) {
+          ed = true
+          curI = index
+        }
+      })
+      if (ed) {
+        curStr.splice(curI, 1)
+      } else {
+        curStr.push(curOp.val)
+      }
+      this.setState({
+        [str]: curStr
+      })
+    }
+  }
+
+
+  renderTop () {
+    const { searchIndex, searchText1, searchText5, searchText3, searchText4 } = this.state
+    const { estate_name } = this.$router.params
+    return (
+      <View className="l-search-top t2">
+        <View className="st-nav">
+          {
+            estate_name
+            ?
+            <View className="stn-op col-3 cur">
+              <View className="stn-label t2">{estate_name}</View>
+            </View>
+            :
+            <View className={(searchIndex === 5 || searchText5) ? 'stn-op col-4 cur' : 'stn-op col-4'} onClick={this.searchNavHandle.bind(this, 5)}>
+              <View className="stn-label">{searchText5 || '楼盘'}</View>
+              <View className="stn-sign"></View>
+            </View>
+          }
+          <View className={(searchIndex === 1 || searchText1) ? 'stn-op col-4 cur' : 'stn-op col-4'} onClick={this.searchNavHandle.bind(this, 1)}>
+            <View className="stn-label">{searchText1 || '区域'}</View>
+            <View className="stn-sign"></View>
+          </View>
+          <View className={(searchIndex === 3 || searchText3) ? 'stn-op col-4 cur' : 'stn-op col-4'} onClick={this.searchNavHandle.bind(this, 3)}>
+            <View className="stn-label">{searchText3 || '户型'}</View>
+            <View className="stn-sign"></View>
+          </View>
+          <View className={(searchIndex === 4 || searchText4) ? 'stn-op col-4 cur' : 'stn-op col-4'} onClick={this.searchNavHandle.bind(this, 4)}>
+            <View className="stn-label">{searchText4 || '更多'}</View>
+            <View className="stn-sign"></View>
+          </View>
+        </View>
+        <View className={searchIndex > 0 ? searchIndex === 4 ? 'st-content show more' : 'st-content show' : 'st-content'}>
+          {
+            searchIndex === 1
+            &&
+            this.searchIndex1Render()
+          }
+          {
+            searchIndex === 3
+            &&
+            this.searchIndex3Render()
+          }
+          {
+            searchIndex === 4
+            &&
+            this.searchIndex4Render()
+          }
+          <View className="l-floor-footer t2">
+            <View className="lff-flex">
+              <View className="lff-btn t3" onClick={this.resetHandle.bind(this)} >重置</View>
+              <View className="lff-btn" onClick={this.saveHandle.bind(this)}>搜索</View>
+            </View>
+          </View>
+        </View>
+      </View>
+    )
+  }
+  searchNavHandle (index) {
+    if (index === 5) {
+      this.openMSPopup()
+      return
+    }
+    let { searchIndex } = this.state
+    searchIndex = index === searchIndex ? -1 : index
+    this.setState({
+      searchIndex
+    })
+  }
+  resetHandle () {
+    const { searchIndex } = this.state
+    if (searchIndex === 1) {
+      this.setState({
+        searchText1: '',
+        curPos: 'area_type',
+      })
+    }
+    if (searchIndex === 3) {
+      this.setState({
+        searchText3: '',
+        curHouseTypeRange: [],
+      })
+    }
+    if (searchIndex === 4) {
+      this.setState({
+        searchText4: '',
+        houseAreaCur: [],
+        productTypeCur: [],
+      })
+    }
+  }
+  saveHandle () {
+    const dictData = Taro.getStorageSync('dictData')
+    const {
+      searchIndex,
+      curAreaType,
+      curHouseTypeRange,
+      houseAreaCur,
+      productTypeCur,
+    } = this.state
+    if (searchIndex === 1) {
+      let tagArr = []
+      curAreaType.forEach(v => {
+        tagArr.push(arrToObj(dictData.area_type)[v])
+      })
+      if (tagArr) {
+        this.setState({
+          searchText1: tagArr.join(',')
+        })
+      }
+    }
+    if (searchIndex === 3) {
+      let tagArr = []
+      curHouseTypeRange.forEach(v => {
+        tagArr.push(arrToObj(dictData.house_type)[v])
+      })
+      if (tagArr) {
+        this.setState({
+          searchText3: tagArr.join(',')
+        })
+      }
+    }
+    if (searchIndex === 4) {
+      let tagArr = []
+      houseAreaCur.forEach(v => {
+        tagArr.push(arrToObj(dictData.house_area)[v])
+      })
+      productTypeCur.forEach(v => {
+        tagArr.push(arrToObj(dictData.product_type)[v])
+      })
+      if (tagArr) {
+        this.setState({
+          searchText4: tagArr.join(',')
+        })
+      }
+    }
+    this.setState({
+      page: 1,
+      searchIndex: -1,
+    }, () => {
+      this.getDataList()
+    })
+  }
+
+
+
+
+
+  openMSPopup (e) {
+    this.setState({
+      isEstateShow: true,
+      searchIndex: -1,
+    })
+  }
+  dealMSPopup (curVal, curCheckedArr) {
+    this.closeMSPopup()
+    if (curVal && curCheckedArr) {
+      const nameArr = curCheckedArr.map(item =>{
+        return item.estate_name
+      })
+      this.setState({
+        estateIdCur: curVal,
+        searchText5: nameArr.join(','),
+        page: 1,
+      }, () => {
+        this.getDataList()
+      })
+    } else {
+      this.setState({
+        estateIdCur: [],
+        searchText5: '',
+      })
+    }
+  }
+  closeMSPopup () {
+    this.setState({
+      isEstateShow: false,
+    })
+  }
+
+
+
+
+
+
+
+  getDataList () {
+    let { page_size, page, dataList, isListEmpty } = this.state
+    const { searchKey } = this.state
+    const {
+      curAreaType,
+      curHouseTypeRange,
+      houseAreaCur,
+      productTypeCur,
+      estateIdCur,
+    } = this.state
+    let apiStr = 'apieshousesoldlist'
+    let params = {
+      page,
+      page_size,
+      title: searchKey,
+      area_type: curAreaType.join(','),
+      house_type: curHouseTypeRange.join(','),
+      house_area: houseAreaCur.join(','),
+      product_type: productTypeCur.join(','),
+      estate_id: estateIdCur.join(','),
+      is_sold: 1,
+    }
+    Taro.api.room[apiStr](params).then(res => {
+      const curData = res.list || []
+      let isListEnd = false
+      if (curData.length > 0) {
+        if (page === 1) {
+          dataList = curData
+        } else {
+          dataList = dataList.concat(curData)
+        }
+        if (curData.length === page_size && res.total !== curData.length) {
+          isListEnd = false
+        } else {
+          isListEnd = true
+        }
+      }
+      if (curData.length === 0 && page === 1) {
+        isListEmpty = true
+        dataList = []
+      } else {
+        isListEmpty = false
+      }
+      this.setState({
+        dataList,
+        isListEnd,
+        isListEmpty,
+        isListLoading: false
+      })
+    })
+  }
+  onScrollToLower (e) {
+    let { isListEnd, isListLoading, page } = this.state
+    if (!isListEnd && !isListLoading) {
+      page++
+      this.setState({
+        page,
+        isListLoading: true
+      }, () => {
+        this.getDataList()
+      })
+    }
+  }
+
+  renderList () {
+    const { dataList, isListEnd, isListLoading, isListEmpty } = this.state
+    const itemsList = dataList.map((item, index) => {
+      let FHstr = '未知楼层'
+      if (item.floor) {
+        const FH = Number(item.floor) || 1
+        const H = Number(item.storeys) || 1
+        if (FH > H * 0.6666) {
+          FHstr = '中高层'
+        } else if (FH > H * 0.33333) {
+          FHstr = '中楼层'
+        } else {
+          FHstr = '中低层'
+        }
+        if (FH === 1) FHstr = '低层'
+        if (FH === H) FHstr = '高层'
+      }
+      const cTagStr = item.custom_tag || ''
+      const tagViews = cTagStr.split(',').map((tag, tagIndex) => {
+        return (
+          <View className="s" key={tagIndex}>{tag}</View>
+        )
+      })
+      return (
+        <View className="lhl-item col-1" key={index} onClick={this.linkHandle.bind(this, item)}>
+          <View className="lhl-img">
+            <Image src={item.pri_image + '_xs'} className="img" />
+          </View>
+          <View className="lhl-info">
+            <View className="lhl-p1">{item.title}</View>
+            <View className="lhl-p2">{item.price}万
+              <View className="sub">单价:{parseInt(item.price * 10000 / item.area)}元/平</View>
+            </View>
+            <View className="lhl-p3">{item.floor}/{item.storeys}-{item.estate_name}</View>
+            <View className="lhl-sign">
+              {/* {tagViews} */}
+              <View className="s">最后更新:{item.update_at}</View>
+            </View>
+          </View>
+        </View>
+      )
+    })
+    return (
+      <ScrollView
+        className='l-scroll-view'
+        scrollY
+        scrollWithAnimation
+        scrollTop="0"
+        lowerThreshold="30"
+        onScrollToLower={this.onScrollToLower.bind(this)}
+      >
+        <View className="l-house-list">
+          {itemsList}
+        </View>
+        <ListMore isListEnd={isListEnd} isListLoading={isListLoading} isListEmpty={isListEmpty} />
+      </ScrollView>
+    )
+  }
+
+
+  linkHandle (item) {
+    Taro.navigateTo({
+      url: `/pagesMore/center/uploadRoomHl?id=${item.id}`
+    })
+    // const appUserInfo = Taro.getStorageSync('APP_userInfo')
+    // if (appUserInfo.is_sale == 1) {
+    //   Taro.navigateTo({
+    //     url: `/pagesMore/center/uploadRoom2?id=${item.id}`
+    //   })
+    // } else {
+    //   Taro.navigateTo({
+    //     url: `/pagesRoom/dtl?id=${item.id}`
+    //   })
+    // }
+  }
+
+  addHandle () {
+    Taro.navigateTo({
+      url: `/pagesMore/center/uploadRoomHl`
+    })
+  }
+
+  render () {
+    const { estateIdCur, isEstateShow } = this.state
+    const { estate_id } = this.$router.params
+    const estateMoreOptions = {skey: 'estate_name', api: `room.apiestatehouselist`, opKey: 'estate_name', opVal: 'estate_id'}
+    return (
+      <View className="l-box">
+        {this.renderSearch()}
+        {/* {this.renderTop()} */}
+        {this.renderList()}
+        {
+          estate_id
+          ?
+          ''
+          :
+          <MultiSelect val={estateIdCur} moreOptions={estateMoreOptions} isShow={isEstateShow} initUpdate="no" bc={this.dealMSPopup.bind(this)} close={this.closeMSPopup.bind(this)}/>
+        }
+        {/* <View className="l-floor-footer">
+            <View className="lff-flex">
+              <View className="lff-btn full" onClick={this.addHandle.bind(this)}>添加已成交房源</View>
+            </View>
+          </View> */}
+      </View>
+    )
+  }
+}
+
+export default Index

+ 25 - 0
src/pagesRoom/listed2.scss

@@ -0,0 +1,25 @@
+@import '@css/mixin.scss';
+@import '@css/house-list.scss';
+@import '@css/search-top.scss';
+.l-box {
+  padding-top: calc(84px);
+  padding-bottom: 120px;
+}
+.l-scroll-view {
+  height: calc(100vh - 84px);
+  box-sizing: border-box;
+}
+.scoped-fixed {
+  position: fixed;
+  top: 0;
+  left: 0;
+  right: 0;
+  z-index: 99;
+  background-color: #fff;
+}
+
+
+.lhl-info {
+  width: 300px;
+}
+