2022-10-14 05:38:26 +00:00
|
|
|
<template>
|
2022-10-14 06:49:07 +00:00
|
|
|
<view v-if="isLoading">
|
2022-10-14 05:38:26 +00:00
|
|
|
<!-- 头部 -->
|
2022-10-14 06:49:07 +00:00
|
|
|
<status-nav :ifReturn="false" navBarTitle="小区选择"></status-nav>
|
|
|
|
<!-- 小区列表 -->
|
|
|
|
<view class="estate-list background-white pad-zy20 border-box">
|
2022-10-20 13:07:14 +00:00
|
|
|
<view class="item font26 flex" @tap="choiseEstate(item.id,item.name)" v-for="(item,index) in estateList" :key="index">{{item.name}}</view>
|
2022-10-14 06:49:07 +00:00
|
|
|
</view>
|
|
|
|
<!-- 进入主页 -->
|
|
|
|
<view class="back-idle flex" :style="{top:statusHeight+'px'}" @tap="backIdle">
|
|
|
|
<image src="/static/icon-home.png" mode="widthFix"></image>
|
|
|
|
</view>
|
2022-10-14 05:38:26 +00:00
|
|
|
</view>
|
|
|
|
</template>
|
|
|
|
<script>
|
|
|
|
import goodList from '@/components/goods-list/goods-list.vue';
|
|
|
|
import tabbar from '@/components/tabbar/tabbar';
|
|
|
|
export default {
|
|
|
|
components:{
|
|
|
|
goodList,
|
|
|
|
tabbar
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
statusHeight:uni.getSystemInfoSync().statusBarHeight, //状态栏高度
|
2022-10-14 06:49:07 +00:00
|
|
|
estateList:[], //商品列表
|
2022-10-20 13:07:14 +00:00
|
|
|
keyword:'', //关键词
|
2022-10-14 05:38:26 +00:00
|
|
|
page:1, //页数
|
|
|
|
size:10, //条数
|
|
|
|
total:0, //总数
|
|
|
|
isLoading:false, //是否加载完成
|
2022-11-02 06:15:55 +00:00
|
|
|
estate:1, //1:闲置进入,2:车位进入,3:房屋进入
|
2022-10-14 05:38:26 +00:00
|
|
|
}
|
|
|
|
},
|
2022-10-20 13:07:14 +00:00
|
|
|
onLoad(op) {
|
|
|
|
if(op.estate) this.estate = op.estate;
|
|
|
|
// 查询小区列表
|
|
|
|
this.getEstateList();
|
2022-10-14 05:38:26 +00:00
|
|
|
},
|
|
|
|
onReachBottom(e) {
|
2022-10-14 06:49:07 +00:00
|
|
|
if(this.estateList.length<this.total){
|
2022-10-14 05:38:26 +00:00
|
|
|
this.page++;
|
|
|
|
// 查询商品列表
|
2022-10-14 06:49:07 +00:00
|
|
|
this.getEstateList();
|
2022-10-14 05:38:26 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
2022-10-14 07:24:56 +00:00
|
|
|
// 获取定位
|
|
|
|
getLocation(){
|
|
|
|
uni.getLocation({
|
|
|
|
type: 'wgs84',
|
|
|
|
geocode:true, // 设置该参数为true可直接获取经纬度及城市信息
|
2022-10-14 07:27:26 +00:00
|
|
|
success: (res)=> {
|
2022-10-14 07:24:56 +00:00
|
|
|
console.log('位置信息',res)
|
|
|
|
},
|
2022-10-14 07:27:26 +00:00
|
|
|
fail: (err)=> {
|
2022-10-14 07:24:56 +00:00
|
|
|
uni.showToast({
|
|
|
|
title: '获取地址失败,将导致部分功能不可用',
|
|
|
|
icon:'none'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
2022-10-20 13:07:14 +00:00
|
|
|
|
|
|
|
// 查询小区列表
|
2022-10-14 06:49:07 +00:00
|
|
|
getEstateList(){
|
2022-10-20 13:07:14 +00:00
|
|
|
uni.showLoading({
|
|
|
|
title:'加载中'
|
|
|
|
})
|
|
|
|
let params = {
|
|
|
|
page:this.page,
|
|
|
|
size:this.size
|
|
|
|
}
|
|
|
|
if(this.page==1) this.estateList = [];
|
|
|
|
this.$requst.get('/api/v1/goods/area',params).then(res=>{
|
|
|
|
if(res.code == 0){
|
|
|
|
console.log(res,'小区列表')
|
|
|
|
this.total = res.data.total;
|
|
|
|
let estateArr = [];
|
|
|
|
res.data.list.forEach(item=>{
|
|
|
|
let obj = {
|
|
|
|
id:item.id,
|
|
|
|
name:item.title,
|
|
|
|
}
|
|
|
|
estateArr.push(obj)
|
|
|
|
})
|
|
|
|
this.estateList = this.estateList.concat(estateArr);
|
|
|
|
}
|
|
|
|
uni.hideLoading();
|
|
|
|
this.isLoading = true;
|
|
|
|
})
|
2022-10-14 05:38:26 +00:00
|
|
|
},
|
|
|
|
|
2022-10-14 06:49:07 +00:00
|
|
|
// 选择小区
|
2022-10-20 13:07:14 +00:00
|
|
|
choiseEstate(id,name){
|
|
|
|
// 缓存小区信息
|
|
|
|
uni.setStorageSync('area_id',id);
|
|
|
|
uni.setStorageSync('area_name',name);
|
|
|
|
if(this.estate == 1){
|
|
|
|
uni.reLaunch({
|
|
|
|
url:`/pages/idle/idle`
|
|
|
|
})
|
|
|
|
}
|
2022-10-14 05:38:26 +00:00
|
|
|
},
|
2022-10-14 06:49:07 +00:00
|
|
|
|
|
|
|
// 返回闲置
|
|
|
|
backIdle(){
|
2022-10-20 13:07:14 +00:00
|
|
|
if(!uni.getStorageSync('area_id')||!uni.getStorageSync('area_name')){
|
|
|
|
uni.setStorageSync('area_id',this.estateList[0].id);
|
|
|
|
uni.setStorageSync('area_name',this.estateList[0].name);
|
|
|
|
}
|
2022-10-14 06:49:07 +00:00
|
|
|
uni.reLaunch({
|
|
|
|
url:`/pages/idle/idle`
|
|
|
|
})
|
|
|
|
}
|
2022-10-14 05:38:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
<style scoped>
|
2022-10-14 06:49:07 +00:00
|
|
|
.estate-list .item{
|
|
|
|
justify-content: space-between;
|
|
|
|
align-items: center;
|
|
|
|
height: 80rpx;
|
|
|
|
border-bottom: 2rpx solid #f4f5f6;
|
|
|
|
}
|
|
|
|
.estate-list .item:last-child{
|
|
|
|
border-bottom: 0;
|
|
|
|
}
|
|
|
|
.back-idle{
|
|
|
|
display: flex;
|
|
|
|
justify-content: flex-start;
|
|
|
|
align-items: center;
|
|
|
|
width: 60rpx;
|
|
|
|
height: 100rpx;
|
|
|
|
position: fixed;
|
|
|
|
left: 20rpx;
|
|
|
|
z-index: 999;
|
|
|
|
}
|
|
|
|
.back-idle>image{
|
|
|
|
width: 48rpx;
|
|
|
|
height: 48rpx;
|
2022-10-14 05:38:26 +00:00
|
|
|
}
|
|
|
|
</style>
|