|
@@ -0,0 +1,699 @@
|
|
|
+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 './list.scss'
|
|
|
+import { arrToObj } from '@utils'
|
|
|
+
|
|
|
+class Index extends Component {
|
|
|
+
|
|
|
+ onShareAppMessage() {
|
|
|
+ return {
|
|
|
+ title: '来看看南昌的这些优质房源',
|
|
|
+ }
|
|
|
+ }
|
|
|
+ onShareTimeline () {
|
|
|
+ return {
|
|
|
+ title: '洪楼Plus,专注南昌本地房地产市场,让买房,更省心!',
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ 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,
|
|
|
+ productHouseList: [],
|
|
|
+ curPhObj: {},
|
|
|
+ curSortObj: {key: '默认排序',val: ["update_at","DESC"]},
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ config = {
|
|
|
+ navigationBarTitleText: '优质房源',
|
|
|
+ }
|
|
|
+
|
|
|
+ componentWillMount () {
|
|
|
+ Taro.$AHU(this)
|
|
|
+ const { estate_id, estate_name } = this.$router.params
|
|
|
+ Taro.setNavigationBarTitle({
|
|
|
+ title: estate_name
|
|
|
+ })
|
|
|
+ if (estate_id) {
|
|
|
+ this.getDataList()
|
|
|
+ Taro.api.house.admestatedetail({id: estate_id}).then(res => {
|
|
|
+ let productHouseList = []
|
|
|
+ const dictData = Taro.getStorageSync('dictData')
|
|
|
+ const ptObj = arrToObj(dictData.product_type)
|
|
|
+ const htObj = arrToObj(dictData.house_type)
|
|
|
+ const list = res.area_data || []
|
|
|
+ list.forEach(one => {
|
|
|
+ const htList = one.house_type_list || []
|
|
|
+ htList.forEach(two => {
|
|
|
+ console.log()
|
|
|
+ productHouseList.push({
|
|
|
+ key: `${ptObj[one.product_type_val]}-${htObj[two.house_type_val]}[${two.area_list.map(o => o.area + '㎡').join(',')}]`,
|
|
|
+ val: `${one.product_type_val}-${two.house_type_val}`
|
|
|
+ })
|
|
|
+ })
|
|
|
+ })
|
|
|
+ this.setState({
|
|
|
+ productHouseList
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ // 把文件删除后再写进,防止超过最大范围而无法写入
|
|
|
+ const fsm = wx.getFileSystemManager(); //文件管理器
|
|
|
+ fsm.readdir({ // 获取文件列表
|
|
|
+ dirPath: Taro.env.USER_DATA_PATH,// 当时写入的文件夹
|
|
|
+ success(res){
|
|
|
+ res.files.forEach((el) => { // 遍历文件列表里的数据
|
|
|
+ // 删除存储的垃圾数据
|
|
|
+ fsm.unlink({
|
|
|
+ filePath: `${Taro.env.USER_DATA_PATH}/${el}`, // 这里注意。文件夹也要加上,如果直接文件名的话会无法找到这个文件
|
|
|
+ fail(e){
|
|
|
+ console.log('readdir文件删除失败:',e)
|
|
|
+ }
|
|
|
+ });
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ 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()
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ searchIndex5Render () {
|
|
|
+ const { curSortObj } = this.state
|
|
|
+ const edIcon = require('@img/images/icon_g_ed.png')
|
|
|
+ const list = [
|
|
|
+ {key: '默认排序',val: ["update_at","DESC"]},
|
|
|
+ {key: '最新发布',val: ["create_at","DESC"]},
|
|
|
+ {key: '总价从低到高',val: ["price","ASC"]},
|
|
|
+ {key: '总价从高到低',val: ["price","DESC"]},
|
|
|
+ {key: '单价从低到高',val: ["unit_price","ASC"]},
|
|
|
+ {key: '单价从高到低',val: ["unit_price","DESC"]},
|
|
|
+ {key: '面积从低到高',val: ["area","ASC"]},
|
|
|
+ {key: '面积从高到低',val: ["area","DESC"]},
|
|
|
+ ]
|
|
|
+ const curItemViews = list.map(item =>{
|
|
|
+ let curClassName = "stc-op"
|
|
|
+ if (curSortObj.key === item.key) {
|
|
|
+ curClassName = "stc-op cur"
|
|
|
+ }
|
|
|
+ return (
|
|
|
+ <View className={curClassName} key={item.val} onClick={this.sortHandle.bind(this, item)}>{item.key}
|
|
|
+ <Image className="img" src={edIcon} />
|
|
|
+ </View>
|
|
|
+ )
|
|
|
+ })
|
|
|
+ return (
|
|
|
+ <View className="stc-wrap">
|
|
|
+ <View className="stc-item">
|
|
|
+ {curItemViews}
|
|
|
+ </View>
|
|
|
+ </View>
|
|
|
+ )
|
|
|
+ }
|
|
|
+ sortHandle (obj) {
|
|
|
+ if (obj === 'all') {
|
|
|
+ this.setState({
|
|
|
+ curSortObj: {},
|
|
|
+ searchText5: '',
|
|
|
+ }, () => {
|
|
|
+ this.searchComGetData()
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.setState({
|
|
|
+ curSortObj: obj,
|
|
|
+ searchText5: obj.key,
|
|
|
+ }, () => {
|
|
|
+ this.searchComGetData()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ searchIndex3Render () {
|
|
|
+ const { curPhObj, productHouseList } = this.state
|
|
|
+ const edIcon = require('@img/images/icon_g_ed.png')
|
|
|
+ const curItemViews = productHouseList.map(item =>{
|
|
|
+ let curClassName = "stc-op"
|
|
|
+ if (curPhObj.val === item.val) {
|
|
|
+ curClassName = "stc-op cur"
|
|
|
+ }
|
|
|
+ return (
|
|
|
+ <View className={curClassName} key={item.val} onClick={this.productHouseHandle.bind(this, item)}>{item.key}
|
|
|
+ <Image className="img" src={edIcon} />
|
|
|
+ </View>
|
|
|
+ )
|
|
|
+ })
|
|
|
+ let allClassName = curPhObj.val ? 'stc-op' : 'stc-op cur'
|
|
|
+ return (
|
|
|
+ <View className="stc-wrap">
|
|
|
+ <View className="stc-item">
|
|
|
+ <View className={allClassName} onClick={this.productHouseHandle.bind(this, 'all')}>不限</View>
|
|
|
+ {curItemViews}
|
|
|
+ </View>
|
|
|
+ </View>
|
|
|
+ )
|
|
|
+ }
|
|
|
+ productHouseHandle (obj) {
|
|
|
+ if (obj === 'all') {
|
|
|
+ this.setState({
|
|
|
+ curPhObj: {},
|
|
|
+ searchText3: '',
|
|
|
+ }, () => {
|
|
|
+ this.searchComGetData()
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.setState({
|
|
|
+ curPhObj: obj,
|
|
|
+ searchText3: obj.key,
|
|
|
+ }, () => {
|
|
|
+ this.searchComGetData()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ // 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
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ }
|
|
|
+ searchComGetData () {
|
|
|
+ this.setState({
|
|
|
+ page: 1,
|
|
|
+ searchIndex: -1,
|
|
|
+ }, () => {
|
|
|
+ this.getDataList()
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ 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">
|
|
|
+ <View className={(searchIndex === 3 || searchText3) ? 'stn-op col-2 cur' : 'stn-op col-2'} onClick={this.searchNavHandle.bind(this, 3)}>
|
|
|
+ <View className="stn-label">{searchText3 || '户型'}</View>
|
|
|
+ <View className="stn-sign"></View>
|
|
|
+ </View>
|
|
|
+ <View className={(searchIndex === 5 || searchText5) ? 'stn-op col-2 cur' : 'stn-op col-2'} onClick={this.searchNavHandle.bind(this, 5)}>
|
|
|
+ <View className="stn-label">{searchText5 || '更多'}</View>
|
|
|
+ <View className="stn-sign"></View>
|
|
|
+ </View>
|
|
|
+ {/* <View className={(searchIndex === 4 || searchText4) ? 'stn-op col-2 cur' : 'stn-op col-2'} 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 show2 more' : 'st-content show2' : 'st-content'}>
|
|
|
+ {
|
|
|
+ searchIndex === 3
|
|
|
+ &&
|
|
|
+ this.searchIndex3Render()
|
|
|
+ }
|
|
|
+ {
|
|
|
+ searchIndex === 5
|
|
|
+ &&
|
|
|
+ this.searchIndex5Render()
|
|
|
+ }
|
|
|
+ {/* {
|
|
|
+ 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,
|
|
|
+ curPhObj,
|
|
|
+ } = this.state
|
|
|
+ // 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 {
|
|
|
+ estateIdCur,
|
|
|
+ curPhObj,
|
|
|
+ curSortObj,
|
|
|
+ } = this.state
|
|
|
+ let apiStr = 'apieshouselist'
|
|
|
+ let params = {
|
|
|
+ page,
|
|
|
+ page_size,
|
|
|
+ title: searchKey,
|
|
|
+ estate_id: estateIdCur.join(','),
|
|
|
+ }
|
|
|
+ if (curPhObj.val) {
|
|
|
+ const phArr = curPhObj.val.split('-')
|
|
|
+ // params.product_type = phArr[0]
|
|
|
+ params.house_type = phArr[1]
|
|
|
+ }
|
|
|
+ if (curSortObj.val) {
|
|
|
+ params.order_by = JSON.stringify(curSortObj.val)
|
|
|
+ }
|
|
|
+ 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 hpV = require('@img/icon_hp_v.png')
|
|
|
+ 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 = '顶楼'
|
|
|
+ }
|
|
|
+ let houseTypeStr = '未知户型'
|
|
|
+ if (item.house_type) {
|
|
|
+ let arr = item.house_type.split('-')
|
|
|
+ houseTypeStr = `${arr[0]}室${arr[1]}厅${arr[2]}卫`
|
|
|
+ }
|
|
|
+ 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">
|
|
|
+ {
|
|
|
+ item.video
|
|
|
+ ?
|
|
|
+ <View className="vr-icon">
|
|
|
+ <Image src={hpV} className="i i1" />
|
|
|
+ </View>
|
|
|
+ : ''
|
|
|
+ }
|
|
|
+ <Image src={item.pri_image + '_xs'} className="img" />
|
|
|
+ <View className="f-t">{houseTypeStr} | {parseInt(item.area)}㎡</View>
|
|
|
+ </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">{FHstr}-{item.estate_name}</View>
|
|
|
+ <View className="lhl-sign">
|
|
|
+ {tagViews}
|
|
|
+ </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: `/pagesRoom/dtl?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}`
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ }
|
|
|
+
|
|
|
+ linkMyRoom () {
|
|
|
+ Taro.reLaunch({
|
|
|
+ url: '/pagesRoom/listMy'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ renderGoMy () {
|
|
|
+ const icon = require('@img/images/icon_my_room.png')
|
|
|
+ return (
|
|
|
+ <Image className="g-go-home" src={icon} onClick={this.linkMyRoom.bind(this)}/>
|
|
|
+ )
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ 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'}
|
|
|
+ const appUserInfo = Taro.getStorageSync('APP_userInfo')
|
|
|
+ let isSale = false
|
|
|
+ if (appUserInfo.is_sale == 1) {
|
|
|
+ isSale = true
|
|
|
+ }
|
|
|
+ return (
|
|
|
+ <View className="l-box">
|
|
|
+ { isSale ? this.renderGoMy() : '' }
|
|
|
+ {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>
|
|
|
+ )
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+export default Index
|