leave-unused/pages/estate/estate.vue

143 lines
3.3 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<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: function (res) {
console.log('',res)
//
this.getEstateList();
},
fail: function (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>