Browse Source

分享商品对应处理

feature/3.1.0-小区合伙人
lfs3 6 years ago
parent
commit
4ebde40ed7
3 changed files with 80 additions and 19 deletions
  1. 6
      src/models/choose-community.js
  2. 92
      src/view/choose-community.vue
  3. 1
      src/view/home.vue

6
src/models/choose-community.js

@ -18,6 +18,12 @@ export default {
getEstateList : (params) =>
utilsModel
.config(chooseCommunity.getEstateList)
.request({
params : params,
}),
getGoodsTemlate : (params) =>
utilsModel
.config(chooseCommunity.getGoodsTemlate)
.request({
params : params,
})

92
src/view/choose-community.vue

@ -12,7 +12,7 @@
<div :class="show?'triangle_border_top':'triangle_border_down'">
</div>
</div>
<el-input style="border-left: 1px solid #c1c1c1;" placeholder="请输入小区名称" v-model="communityName" @keyup.enter.native="searchByName" @clear="clear" clearable>
<el-input 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>
@ -59,6 +59,8 @@ import { Alert, Toast, Loading } from "vux";
import popupPicker from "../components/popup-picker.vue";
import chooseCommunity from "../api/chooseCommunity";
import { countPartner } from "@/common/util";
import { isEmpty } from "@/common/util";
import { exists } from "fs";
export default {
components: {
Toast,
@ -69,6 +71,7 @@ export default {
data() {
return {
show: false,
templateNo: this.$route.query.templateNo || "",
defaultCity: "天河区",
districtId: "440106000", //id
provinceId: "",
@ -159,10 +162,10 @@ export default {
this.$vux.toast.text("请选择一个小区", "middle");
return;
}
history.go(-1)
// this.$router.push({
// name: ""
// });
history.go(-1);
// this.$router.push({
// name: ""
// });
},
//
confirm(list) {
@ -204,7 +207,7 @@ export default {
this.show = false;
},
clear() {
console.log("communityName11:"+this.communityName)
console.log("communityName11:" + this.communityName);
//
this.showFlag = false;
this.communityName = "";
@ -213,7 +216,7 @@ export default {
this.loadMoreHide = false;
this.loadMoreTips = false;
this.communityList = [];
this.fetchCommunityList();
},
searchByName(event) {
@ -277,17 +280,68 @@ export default {
item.cityId + "&" + item.cityName,
item.districtId + "&" + item.districtName + "&" + item.merchantNo
];
localStorage.setItem("cityName", addressValue.slice());
localStorage.setItem(
"estate",
item.housingEstateId + "&" + item.housingEstateName
);
this.estateId = item.housingEstateId;
countPartner();
history.go(-1)
// this.$router.push({
// name: ""
// });
if (isEmpty(this.templateNo)) {
localStorage.setItem("cityName", addressValue.slice());
localStorage.setItem(
"estate",
item.housingEstateId + "&" + item.housingEstateName
);
this.estateId = item.housingEstateId;
countPartner();
history.go(-1);
} else {
this.$vux.confirm.show({
title: "选择小区",
content: "确定选择" + item.housingEstateName,
confirmText: "确定",
cancelText: "取消",
onCancel: () => {},
onConfirm: () => {
this.estateId = item.housingEstateId;
chooseCommunityApi
.getGoodsTemlate({
templateNo: this.templateNo,
housingEstateId: this.estateId ? this.estateId : ""
})
.then(res => {
this.showLoading = false;
if (res.code === 0) {
localStorage.setItem("cityName", addressValue.slice());
localStorage.setItem(
"estate",
item.housingEstateId + "&" + item.housingEstateName
);
countPartner();
//
window.location.href =
"/mall/web/vgoods/detail/" + res.response.goodsNo;
} else {
this.$vux.confirm.show({
title: "无服务",
content: item.housingEstateName + "暂无提供此商品服务",
confirmText: "确定",
onConfirm: () => {
localStorage.setItem("cityName", addressValue.slice());
localStorage.setItem(
"estate",
item.housingEstateId + "&" + item.housingEstateName
);
this.$router.push({
name: "首页"
});
}
});
}
})
.catch(error => {
this.showLoading = false;
});
}
});
}
// this.$router.push({
// name: ""
// });
},
ShareWenXin() {
var merchantNo = this.merchantNo;
@ -310,7 +364,7 @@ export default {
});
});
},
getTime(time) {
let date = new Date(time);
let year = date.getFullYear();

1
src/view/home.vue

@ -553,6 +553,7 @@ mounted() {
.then(res => {
if (isEmpty(res.response)) {
//
localStorage.removeItem("estate")
this.estateId = eId;
this.getData();
} else {

Loading…
Cancel
Save