Browse Source

首页分享bug处理

feature/3.1.0-小区合伙人
lfs3 6 years ago
parent
commit
d0435865b3
2 changed files with 153 additions and 70 deletions
  1. 103
      src/view/choose-community.vue
  2. 120
      src/view/home.vue

103
src/view/choose-community.vue

@ -1,57 +1,57 @@
<template>
<form action="javascript:return true">
<div class="container" style="background:#fff">
<div class="top f-bb-gray">
<img src="../assets/images/icon/arrow-left.png" v-on:click="goBack" />选择小区
</div>
<!--搜索和筛选-->
<div class="f-flex f-flex-justify f-mr16 f-ml15 " style="background: #EDEDED;margin-top:5px;height: 35px;">
<div class="f-flex f-mr16 f-ml15 f-ws-nowrap" @click="show = true">
<div :class="show?'f-font-13 text-blue f-mr3':'f-font-13 f-text-666 f-mr3'">
{{defaultCity}}
</div>
<div :class="show?'triangle_border_top':'triangle_border_down'">
</div>
<form action="javascript:return true">
<div class="container" style="background:#fff">
<div class="top f-bb-gray">
<img src="../assets/images/icon/arrow-left.png" v-on:click="goBack" />选择小区
</div>
<el-input type="search" style="border-left: 1px solid #c1c1c1;" placeholder="请输入小区名称" v-model="communityName" @keyup.enter.native="searchByName" @clear="clear" clearable>
<i slot="prefix" class="el-input__icon el-icon-search"></i>
</el-input>
</div>
<div class="content" style="margin-bottom: 50px;">
<div v-if="nowEstate.length > 0" style="border-bottom: 10px solid #f3f3f3;">
<div class="title">
<span class="f-ml15 f-font-14 f-text-666">当前小区</span>
</div>
<div class="f-flex f-flex-justify f-h60 f-ml15 f-mr15" style="border-bottom: 1px solid #f3f3f3;">
<div>
<div class="f-text-333 f-font-16">{{nowEstate}}</div>
<div class="f-text-666 f-font-12">{{nowAddress}}</div>
<!--搜索和筛选-->
<div class="f-flex f-flex-justify f-mr16 f-ml15 " style="background: #EDEDED;margin-top:5px;height: 35px;">
<div class="f-flex f-mr16 f-ml15 f-ws-nowrap" @click="show = true">
<div :class="show?'f-font-13 text-blue f-mr3':'f-font-13 f-text-666 f-mr3'">
{{defaultCity}}
</div>
<div :class="show?'triangle_border_top':'triangle_border_down'">
</div>
<div class="f-text-666 f-font-12 "></div>
</div>
<el-input type="search" style="border-left: 1px solid #c1c1c1;" placeholder="请输入小区名称" v-model="communityName" @keyup.enter.native="searchByName" @clear="clear" clearable>
<i slot="prefix" class="el-input__icon el-icon-search"></i>
</el-input>
</div>
<div>
<div class="title">
<span class="f-ml15 f-font-14 f-text-666">附近小区</span>
<div class="content" style="margin-bottom: 50px;">
<div v-if="nowEstate.length > 0" style="border-bottom: 10px solid #f3f3f3;">
<div class="title">
<span class="f-ml15 f-font-14 f-text-666">当前小区</span>
</div>
<div class="f-flex f-flex-justify f-h60 f-ml15 f-mr15" style="border-bottom: 1px solid #f3f3f3;">
<div>
<div class="f-text-333 f-font-16">{{nowEstate}}</div>
<div class="f-text-666 f-font-12">{{nowAddress}}</div>
</div>
<div class="f-text-666 f-font-12 "></div>
</div>
</div>
<div v-for="item in communityList" :key="item.housingEstateId" v-if="item.housingEstateId != estateId" class="f-flex f-flex-justify f-h60 f-ml15 f-mr15" style="border-bottom: 1px solid #f3f3f3;" @click="chooseCommunity(item)">
<div>
<div class="f-text-333 f-font-16">{{item.housingEstateName}}</div>
<div class="f-text-666 f-font-12">{{item.prefixAddress}}</div>
<div>
<div class="title">
<span class="f-ml15 f-font-14 f-text-666">附近小区</span>
</div>
<div v-for="item in communityList" :key="item.housingEstateId" v-if="item.housingEstateId != estateId" class="f-flex f-flex-justify f-h60 f-ml15 f-mr15" style="border-bottom: 1px solid #f3f3f3;" @click="chooseCommunity(item)">
<div>
<div class="f-text-333 f-font-16">{{item.housingEstateName}}</div>
<div class="f-text-666 f-font-12">{{item.prefixAddress}}</div>
</div>
<div class="f-text-666 f-font-12 ">距离{{item.distance}}m</div>
</div>
<div class="f-text-666 f-font-12 ">距离{{item.distance}}m</div>
</div>
<!-- 无限加载 -->
<div :class="loadMoreHide ? 'load-more-hide' : 'load-more-normal'" v-infinite-scroll="fetchCommunityList" infinite-scroll-disabled="busy" infinite-scroll-distance="10">
<span class="load-more-tips f-flex f-flex-center" v-show="!noRecords && loadMoreTips" style="padding-top:4px">没有更多了</span>
</div>
</div>
<!-- 无限加载 -->
<div :class="loadMoreHide ? 'load-more-hide' : 'load-more-normal'" v-infinite-scroll="fetchCommunityList" infinite-scroll-disabled="busy" infinite-scroll-distance="10">
<span class="load-more-tips f-flex f-flex-center" v-show="!noRecords && loadMoreTips" style="padding-top:4px">没有更多了</span>
</div>
<popup-picker :show="show" @cancel="cancel" @confirm="confirm" :data-list="addressData" :value="addressValue"></popup-picker>
<!-- Loading -->
<loading :show="showLoading" text="loading"></loading>
</div>
<popup-picker :show="show" @cancel="cancel" @confirm="confirm" :data-list="addressData" :value="addressValue"></popup-picker>
<!-- Loading -->
<loading :show="showLoading" text="loading"></loading>
</div>
</form>
</form>
</template>
<script>
import myScroll from "@/utils/scroll";
@ -163,10 +163,13 @@ export default {
this.$vux.toast.text("请选择一个小区", "middle");
return;
}
history.go(-1);
// this.$router.push({
// name: ""
// });
if (isEmpty(this.templateNo)) {
this.$router.push({
name: "首页"
});
} else {
history.go(-1);
}
},
//
confirm(list) {
@ -289,7 +292,9 @@ export default {
);
this.estateId = item.housingEstateId;
countPartner();
history.go(-1);
this.$router.push({
name: "首页"
});
} else {
this.$vux.confirm.show({
title: "选择小区",

120
src/view/home.vue

@ -149,7 +149,7 @@ import chooseCommunityApi from "../models/choose-community";
import homeApi from "../models/home-model.js";
import configs from "../configs";
import { Alert, Toast, Loading } from "vux";
import {isEmpty} from "@/common/util";
import { isEmpty } from "@/common/util";
import routerFooter from "../components/nav-bottom";
import popupPicker from "../components/popup-picker.vue";
import { countPartner } from "@/common/util";
@ -341,12 +341,12 @@ export default {
num: 1
})
.then(res => {
//
//
if (res.dataList.length > 0) {
var addreRes = res.dataList[0];
this.$vux.confirm.show({
title: "自动定位小区:",
content:addreRes.housingEstateName,
content: addreRes.housingEstateName,
cancelText: "切换地址",
onCancel: () => {
this.chooseCommunity();
@ -356,8 +356,8 @@ export default {
this.getGoodsList();
}
});
}else{
this.$vux.confirm.show({
} else {
this.$vux.confirm.show({
title: "自动定位地址:",
content:
data.userAddress.cityName +
@ -450,7 +450,7 @@ export default {
this.getCity();
}
},
getCity() {
let _this = this;
var geolocation = new BMap.Geolocation();
@ -528,22 +528,26 @@ export default {
this.defaultCommunity = estateRes.housingEstateName
? estateRes.housingEstateName
: this.defaultCommunity;
if(!isEmpty(this.estateId)){
localStorage.setItem("estate",this.estateId + "&" + this.defaultCommunity);
countPartner();
}
if (!isEmpty(this.estateId)) {
localStorage.setItem(
"estate",
this.estateId + "&" + this.defaultCommunity
);
countPartner();
}
}
},
mounted() {
mounted() {
//
// this.getdefaultAddress();
// this.getAddress();
// this.getLocation();
this.getId();
let eId = this.$route.query.estateId;
if (!isEmpty(eId) ) {
console.log("eId----" + eId + "estateId---" + this.estateId);
if (!isEmpty(eId)) {
if (!isEmpty(this.estateId)) {
//
this.showLoading = true;
return new Promise((resolve, reject) => {
chooseCommunityApi
@ -553,11 +557,50 @@ mounted() {
.then(res => {
if (isEmpty(res.response)) {
//
localStorage.removeItem("estate")
this.estateId = eId;
this.getData();
localStorage.removeItem("estate");
if (eId !== this.estateId) {
//
chooseCommunityApi
.getEstateInfo({
estateId: eId ? eId : ""
})
.then(res => {
this.showLoading = false;
if (isEmpty(res.response)) {
//
this.chooseCommunity();
} else {
//
var linkEstate = res.response;
this.$vux.confirm.show({
title: "当前小区",
content: linkEstate.housingEstateName,
confirmText: "确定",
cancelText: "切换",
onCancel: () => {
this.chooseCommunity();
},
onConfirm: () => {
this.defaultLocalEstate(linkEstate);
}
});
}
})
.catch(error => {
this.showLoading = false;
});
} else {
this.showLoading = false;
this.chooseCommunity();
}
} else {
var loclEstate = res.response;
if (eId === this.estateId) {
this.showLoading = false;
this.getGoodsList();
countPartner();
return;
}
//,
return new Promise((resolve, reject) => {
chooseCommunityApi
@ -568,7 +611,8 @@ mounted() {
this.showLoading = false;
if (isEmpty(res.response)) {
//
this.defaultLocalEstate(loclEstate);
this.getGoodsList();
countPartner();
} else {
//
var linkEstate = res.response;
@ -578,10 +622,12 @@ mounted() {
confirmText: "不切换",
cancelText: "切换",
onCancel: () => {
this.chooseCommunity();
this.defaultLocalEstate(linkEstate);
this.getGoodsList();
countPartner();
},
onConfirm: () => {
this.defaultLocalEstate(linkEstate);
this.getGoodsList();
}
});
}
@ -598,8 +644,40 @@ mounted() {
});
});
} else {
this.estateId = eId;
this.getData();
// this.estateId = eId;
// this.getData();
//
chooseCommunityApi
.getEstateInfo({
estateId: eId ? eId : ""
})
.then(res => {
this.showLoading = false;
if (isEmpty(res.response)) {
//
this.chooseCommunity();
} else {
//
var linkEstate = res.response;
this.$vux.confirm.show({
title: "当前小区",
content: linkEstate.housingEstateName,
confirmText: "确定",
cancelText: "切换",
onCancel: () => {
this.chooseCommunity();
},
onConfirm: () => {
this.defaultLocalEstate(linkEstate);
this.getGoodsList();
countPartner()
}
});
}
})
.catch(error => {
this.showLoading = false;
});
}
} else {
this.getLocation();

Loading…
Cancel
Save