123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248 |
- 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 './estateTrendRecord.scss'
- import { arrToObj } from '@utils'
- class Index extends Component {
- constructor (props) {
- super(props)
- this.state = {
- searchKey: '',
- page_size: 10,
- page: 1,
- isListEnd: false,
- isListLoading: false,
- isListEmpty: false,
- dataList: [],
- curNav: 1,
- isDShow: false,
- curObj: {},
- }
- }
- config = {
- navigationBarTitleText: '动态趋势记录',
- }
- componentWillMount () {
- Taro.$AHU(this)
- const { t } = this.$router.params
- Taro.setNavigationBarTitle({
- title: t
- })
- this.getDataList()
- }
- componentDidShow () { }
- componentDidHide () { }
- renderSearch () {
- const { searchKey } = this.state
- let placeholderText = '模糊搜索楼盘名称'
- return (
- <View>
- <AtSearchBar
- fixed={true}
- value={searchKey}
- placeholder={placeholderText}
- onChange={this.onSeachChange.bind(this)}
- onClear={this.onClearHandle.bind(this)}
- onActionClick={this.onSelectActionClick.bind(this)}
- />
- </View>
- )
- }
- onSeachChange (value) {
- this.setState({
- searchKey: value
- })
- }
- onClearHandle () {
- this.setState({
- searchKey: '',
- page: 1
- }, () => {
- this.getDataList()
- })
- }
- onSelectActionClick () {
- this.setState({
- page: 1,
- }, () => {
- this.getDataList()
- })
- }
- getDataList () {
- const { id } = this.$router.params
- let { page_size, page, dataList, isListEmpty, searchKey } = this.state
- Taro.api.other.apiestatehousedynamiclog({
- id,
- page,
- page_size,
- }).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 dictData = Taro.getStorageSync('dictData')
- const ptObj = arrToObj(dictData.product_type)
- const { dataList, isListEnd, isListLoading, isListEmpty } = this.state
- const itemsList = dataList.map((item, index) => {
- return (
- <View className="sl-item" key={index}>
- <View>
- <View className="p1">[{item.create_by}]{item.create_at}</View>
- <View className="p-one">
- <View className="po-l">价格区间:</View>
- <View className="po-r t1">{item.price_min}元-{item.price_max}元</View>
- </View>
- <View className="p-one">
- <View className="po-l">最新动态:</View>
- <View className="po-r">
- {
- item.dynamic_img
- ? <Image src={item.dynamic_img} onClick={this.previewImageHandle.bind(this, item.dynamic_img)} className="img"/>
- : ''
- }
- {item.dynamic || '未知'}
- {
- item.isMoreShow
- ? <View className="por-btn" onClick={this.moreShowHideHandle.bind(this, index)}>收起</View>
- : <View className="por-btn" onClick={this.moreShowHideHandle.bind(this, index)}>展开</View>
- }
- </View>
- </View>
- {
- item.isMoreShow
- ?
- <View className="more">
- <View className="p-one">
- <View className="po-l">现场折扣:</View>
- <View className="po-r">{item.scene_discount || '未知'}</View>
- </View>
- <View className="p-one">
- <View className="po-l">实际折扣:</View>
- <View className="po-r">{item.actual_discount || '未知'}</View>
- </View>
- <View className="p-one">
- <View className="po-l">在售楼栋:</View>
- <View className="po-r">{item.on_sale || '未知'}</View>
- </View>
- <View className="p-one">
- <View className="po-l">待售楼栋:</View>
- <View className="po-r">{item.for_sale || '未知'}</View>
- </View>
- <View className="p-one">
- <View className="po-l">推荐房源:</View>
- <View className="po-r">{item.recommend || '未知'}</View>
- </View>
- </View>
- : ''
- }
- </View>
- </View>
- )
- })
- return (
- <ScrollView
- className='l-scroll-view'
- scrollY
- scrollWithAnimation
- scrollTop="0"
- lowerThreshold="30"
- onScrollToLower={this.onScrollToLower.bind(this)}
- >
- <View className="scoped-list">
- {itemsList}
- </View>
- <ListMore isListEnd={isListEnd} isListLoading={isListLoading} isListEmpty={isListEmpty} />
- </ScrollView>
- )
- }
-
- linkUpdate (item) {
- const dictData = Taro.getStorageSync('dictData')
- const ptObj = arrToObj(dictData.product_type)
- Taro.navigateTo({
- url: `/pagesRoom/estateTrendUpdate?id=${item.id}&t=${item.house_square}㎡-${item.estate_name}[${ptObj[item.product_type]}]`
- })
- }
-
- moreShowHideHandle (index) {
- let { dataList } = this.state
- dataList[index].isMoreShow = !dataList[index].isMoreShow
- this.setState({
- dataList
- })
- }
- previewImageHandle (url) {
- const imgUrl = url
- Taro.previewImage({
- current: imgUrl,
- urls: [imgUrl]
- })
- }
- callHandle (phoneNumber) {
- Taro.makePhoneCall({
- phoneNumber
- })
- }
- render () {
- return (
- <View className="l-box">
- {this.renderList()}
- </View>
- )
- }
- }
- export default Index
|