143 lines
3.3 KiB
Vue
143 lines
3.3 KiB
Vue
<template>
|
|
<view v-if="isLoading">
|
|
<!-- 头部 -->
|
|
<status-nav :ifReturn="false" navBarTitle="小区选择"></status-nav>
|
|
<!-- 小区列表 -->
|
|
<view class="estate-list background-white pad-zy20 border-box">
|
|
<view class="item font26 flex" @tap="choiseEstate" v-for="(item,index) in estateList" :key="index">{{item.name}}</view>
|
|
</view>
|
|
<!-- 进入主页 -->
|
|
<view class="back-idle flex" :style="{top:statusHeight+'px'}" @tap="backIdle">
|
|
<image src="/static/icon-home.png" mode="widthFix"></image>
|
|
</view>
|
|
</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, //状态栏高度
|
|
estateList:[], //商品列表
|
|
page:1, //页数
|
|
size:10, //条数
|
|
total:0, //总数
|
|
isLoading:false, //是否加载完成
|
|
}
|
|
},
|
|
onLoad() {
|
|
// 获取定位
|
|
this.getLocation();
|
|
},
|
|
onReachBottom(e) {
|
|
if(this.estateList.length<this.total){
|
|
this.page++;
|
|
// 查询商品列表
|
|
this.getEstateList();
|
|
}
|
|
},
|
|
methods: {
|
|
// 获取定位
|
|
getLocation(){
|
|
uni.getLocation({
|
|
type: 'wgs84',
|
|
geocode:true, // 设置该参数为true可直接获取经纬度及城市信息
|
|
success: (res)=> {
|
|
console.log('位置信息',res)
|
|
// 查询小区列表
|
|
this.getEstateList();
|
|
},
|
|
fail: (err)=> {
|
|
uni.showToast({
|
|
title: '获取地址失败,将导致部分功能不可用',
|
|
icon:'none'
|
|
});
|
|
}
|
|
});
|
|
},
|
|
// 查询商品列表
|
|
getEstateList(){
|
|
this.estateList = [
|
|
{id:1,name:'奥园广场一期',state:0},
|
|
{id:2,name:'奥园广场二期',state:0},
|
|
{id:3,name:'奥园广场三期',state:0},
|
|
{id:4,name:'万圣家园A区',state:0},
|
|
{id:5,name:'万圣家园B区',state:0},
|
|
{id:6,name:'万圣家园C区',state:0}
|
|
]
|
|
this.isLoading = true;
|
|
// uni.showLoading({
|
|
// title:'加载中'
|
|
// })
|
|
// let params = {
|
|
// page:this.page,
|
|
// size:this.size,
|
|
// addr_id:id
|
|
// }
|
|
// this.$requst.get('/api/spu/list',params).then(res=>{
|
|
// if(res.code == 0){
|
|
// console.log(res,'商品列表')
|
|
// this.total = res.data.total;
|
|
// let goodsArr = [];
|
|
// res.data.list.forEach(item=>{
|
|
// let obj = {
|
|
// id:item.id,
|
|
// cover:item.cover,
|
|
// name:item.name,
|
|
// price:item.price
|
|
// }
|
|
// goodsArr.push(obj)
|
|
// })
|
|
// this.goodsList = this.goodsList.concat(goodsArr);
|
|
// }
|
|
// uni.hideLoading();
|
|
// this.isLoading = true;
|
|
// })
|
|
},
|
|
|
|
// 选择小区
|
|
choiseEstate(id){
|
|
uni.reLaunch({
|
|
url:`/pages/idle/idle`
|
|
})
|
|
},
|
|
|
|
// 返回闲置
|
|
backIdle(){
|
|
uni.reLaunch({
|
|
url:`/pages/idle/idle`
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
<style scoped>
|
|
.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;
|
|
}
|
|
</style> |