房源信息模块

This commit is contained in:
gxwebsoft
2023-08-08 20:02:22 +08:00
parent 1b923e5cff
commit 93e0876e13
11 changed files with 343 additions and 146 deletions

View File

@@ -3,8 +3,8 @@
<!-- 搜索 -->
<view class="search-fix">
<view class="search">
<u-search placeholder="请输入搜索关键词" v-model="keyword" :actionStyle="actionStyle" :showAction="false"
shape="square" bgColor="#ffffff" :animation="true"></u-search>
<u-search placeholder="请输入搜索关键词" v-model="where.keywords" :actionStyle="actionStyle" :showAction="false"
shape="square" bgColor="#ffffff" :animation="true" @search="onSearch"></u-search>
</view>
</view>
<view class="search-tools">
@@ -13,15 +13,15 @@
@change="onSearch"></uni-data-select>
</view>
<view class="region">
<uni-data-select class="select-width" v-model="where.price" :localdata="price" placeholder="价格区间"
<uni-data-select class="select-width" v-model="where.priceScene" :localdata="price" placeholder="价格区间"
@change="onSearch"></uni-data-select>
</view>
<view class="region">
<uni-data-select class="select-width" v-model="where.extent" :localdata="extent" placeholder="面积"
<uni-data-select class="select-width" v-model="where.extentScene" :localdata="extent" placeholder="面积"
@change="onSearch"></uni-data-select>
</view>
<view class="region">
<uni-data-select class="select-width" v-model="where.sort" :localdata="sort" placeholder="排序"
<uni-data-select class="select-width" v-model="where.sortScene" :localdata="sort" placeholder="排序"
@change="onSearch"></uni-data-select>
</view>
</view>
@@ -35,12 +35,10 @@
<view class="info">
<view class="title">{{ item.houseTitle }}</view>
<view class="desc"><text>{{ item.extent }}|{{ item.toward }}</text></view>
<view class="price">{{ item.rent }}/</view>
<view class="price">{{ item.monthlyRent }}/</view>
</view>
</view>
</block>
<u-empty mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png" v-if="list.length == 0">
</u-empty>
<!-- <view class="item">
<image src="https://file.wsdns.cn/20230802/8bf0658596ab458d94666cbf4b1177e9.jpg" mode="widthFix">
@@ -53,6 +51,8 @@
</view> -->
</view>
<u-empty mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png" v-if="list.length == 0">
</u-empty>
</scroll-view>
</view>
</template>
@@ -61,6 +61,7 @@
import * as Util from '@/utils/util.js'
import store from '@/store'
import storage from '@/utils/storage'
import * as DictApi from '@/api/dict.js'
import * as HouseInfoApi from '@/api/house-info.js'
const menu = [{
@@ -72,42 +73,10 @@
reset: false
}
];
const region = [{
value: 0,
text: "青秀区"
},
{
value: 1,
text: "兴宁区"
}
];
const price = [{
value: 0,
text: "3000"
},
{
value: 1,
text: "4000"
}
];
const extent = [{
value: 0,
text: "200平"
},
{
value: 1,
text: "300平"
}
];
const sort = [{
value: 0,
text: "升序"
},
{
value: 1,
text: "降序"
}
];
const region = [];
const price = [];
const extent = [];
const sort = [];
const loginUserId = uni.getStorageSync('userId')
export default {
@@ -118,6 +87,8 @@
status: '加载更多',
page: 1,
where: {},
dict: null,
cityList: [],
// 控制onShow事件是否刷新订单列表
canReset: false,
disabled: false,
@@ -130,6 +101,7 @@
price,
extent,
sort,
// priceScene: null,
scrollTop: 0,
old: {
scrollTop: 0
@@ -144,6 +116,7 @@
},
onLoad() {
this.getDict()
this.list = []
this.onRefreshList()
},
@@ -169,6 +142,11 @@
const app = this
const userId = uni.getStorageSync('userId')
app.where.page = app.page
// if (app.priceScene) {
// app.where.monthlyRentStart = app.priceScene
// app.where.monthlyRentEnd = app.priceScene
// }
console.log('app: ',app.where);
return new Promise((resolve, reject) => {
HouseInfoApi.pageHouseInfo(app.where)
.then(result => {
@@ -183,11 +161,89 @@
} else {
app.canReset = false
}
console.log("app.list: ",app.list);
console.log("app.list: ", app.list);
resolve(list)
})
})
},
getDict() {
const app = this
DictApi.listDictionary().then(res => {
app.dict = res.data
app.price = res.data.price[0].map(d => {
return {
value: d,
text: d
}
})
app.extent = res.data.extent[0].map(d => {
return {
value: d,
text: d
}
})
app.sort = res.data.sort[0].map(d => {
console.log('d: ',d);
return {
value: d,
text: d
}
})
uni.request({
url: 'https://file.wsdns.cn/json/city.js',
success(res) {
res.data.map(e => {
if(e.value == '450000'){
e.children.map(city => {
if(city.value == '450100'){
app.region = city.children.map(r => {
return {
value: r.label,
text: r.label
}
})
}
})
}
});
}
})
})
},
onSearch(text) {
this.list = []
this.page = 1
console.log('extentScene: ',this.where.extentScene);
if(text == '0-100㎡'){
this.where.extentScene = '100'
}
if(text == '100-150㎡'){
this.where.extentScene = '100-150'
}
if(text == '150-200㎡'){
this.where.extentScene = '150-200'
}
if(text == '200-300㎡'){
this.where.extentScene = '200-300'
}
if(text == '300-400㎡'){
this.where.extentScene = '300-400'
}
if(text == '400-600㎡'){
this.where.extentScene = '400-600'
}
if(text == '600-1000㎡'){
this.where.extentScene = '600-1000'
}
if(text == '1000㎡以上'){
this.where.extentScene = '1000'
}
this.onRefreshList()
// this.$push('/sub_pages/member/member', this.where)
},
},
watch: {
@@ -202,7 +258,7 @@
display: flex;
.search {
width: 690rpx;
width: 710rpx;
margin: 15rpx auto;
display: flex;
justify-content: space-between;
@@ -211,14 +267,18 @@
}
.search-tools {
width: 700rpx;
width: 720rpx;
margin: auto;
display: flex;
justify-content: space-around;
font-size: 22rpx;
.region {
width: 170rpx;
width: 178rpx;
background-color: #ffffff;
* {
font-size: 22rpx;
}
}
}