Browse Source

合伙人首页,选择小区页、分享,下单,注册等处理

develop
lfs3 6 years ago
parent
commit
4df00951dc
20 changed files with 1136 additions and 484 deletions
  1. 5
      config/index.js
  2. 1
      package.json
  3. 16
      src/api/chooseCommunity.js
  4. 10
      src/api/home.js
  5. 7
      src/api/wxShare.js
  6. 8
      src/assets/styles/common/common.scss
  7. 5
      src/assets/styles/index.scss
  8. 4
      src/main.js
  9. 24
      src/models/choose-community.js
  10. 24
      src/models/home-model.js
  11. 2
      src/models/utils-model.js
  12. 51
      src/models/wxLocation.js
  13. 6
      src/models/wxShare-model.js
  14. 172
      src/models/wxShare.js
  15. 7
      src/router/index.js
  16. 20
      src/utils/scroll.js
  17. 440
      src/view/choose-community.vue
  18. 2
      src/view/goods-classify.vue
  19. 808
      src/view/home.vue
  20. 8
      src/view/order-check.vue

5
config/index.js

@ -8,7 +8,7 @@ module.exports = {
assetsRoot: path.resolve(__dirname, '../dist'),
assetsSubDirectory: 'static',
assetsPublicPath: '/',
productionSourceMap: true,
productionSourceMap: false,
// Gzip off by default as many popular static hosts such as
// Surge or Netlify already gzip all static assets for you.
// Before setting to `true`, make sure to:
@ -23,7 +23,8 @@ module.exports = {
},
dev: {
env: require('./dev.env'),
port: 8080,
host: '192.168.31.52',
port: 8081,
autoOpenBrowser: true,
assetsSubDirectory: 'static',
assetsPublicPath: '/',

1
package.json

@ -60,6 +60,7 @@
"style-loader": "^0.16.1",
"url-loader": "^0.5.9",
"vue-awesome-swiper": "^3.1.3",
"vue-infinite-scroll": "^2.0.2",
"vue-loader": "^11.1.4",
"vue-style-loader": "^2.0.0",
"webpack": "^2.7.0",

16
src/api/chooseCommunity.js

@ -0,0 +1,16 @@
export default {
getAddressInfo:{
method:"get",
url:"/mall/web/estate/addressInfo"
},
// -- 查询单个小区信息 --
getEstateInfo: {
method: 'GET',
url: '/mall/web/estate/query/estateInfo',
},
getEstateList: {
method: 'GET',
url: '/mall/web/estate/query/estateList',
},
}

10
src/api/home.js

@ -15,16 +15,16 @@ export default {
method: 'GET',
url: '/mall/web/defaultDistrict'
},
getLocation:{
method:"get",
url:"/mall/web/addressInfo"
},
countExtend:{
method:"POST",
url:"/mall/web/center/insert/data"
},
countPartner:{
method:"POST",
url:"/mall/web/center/insert/housing/data"
},
updateUniqueId:{
method:"get",
url:"/mall/web/center/update/uniqueId"
}
},
}

7
src/api/wxShare.js

@ -1,5 +1,10 @@
export default {
export default {
// -- 获取分享信息 --
getWXCheck: {
method: 'GET',
url: '/mall/web/wx/api/check',
} ,
// -- 获取分享信息 --
getShare: {
method: 'GET',

8
src/assets/styles/common/common.scss

@ -1050,7 +1050,7 @@ textarea {
height:0;
border-width:0 3.5px 3.5px;
border-style:solid;
border-color:transparent transparent #009DDF;/*灰 透明 透明 */
border-color:transparent transparent rgba(0, 186, 134, 1);/*灰 透明 透明 */
position:relative;
}
@ -1080,14 +1080,14 @@ textarea {
}
.weui-dialog__btn_primary {
color: #009DDF!important;
color: rgba(0, 186, 134, 1)!important;
}
.vux-popup-header-right {
padding-right: 15px;
color: #00A0E8!important;
color: rgba(0, 186, 134, 1)!important;
}
.dp-header .dp-item.dp-right {
color: #00A0E8!important;
color: rgba(0, 186, 134, 1)!important;
}

5
src/assets/styles/index.scss

@ -126,9 +126,6 @@ ul li {
p {
word-break: break-word;
}
.el-input {
width: auto!important;
}
.el-input--suffix .el-input__inner {
height: 28px;
line-height: 28px;
@ -137,7 +134,7 @@ p {
border-radius: 16px;
}
.el-input__icon {
line-height: 28px;
line-height: 28px!important;
}
.el-dropdown-menu {
padding: 5px 0!important;

4
src/main.js

@ -25,7 +25,9 @@ import "@/assets/styles/swiper.css";
//import wx from 'weixin-js-sdk'
//import axios from 'axios'
import "@/models/wxShare.js";
import "@/models/wxLocation.js";
import VueCookies from 'vue-cookies'
import infiniteScroll from 'vue-infinite-scroll'
Vue.config.productionTip = false;
Vue.use(WechatPlugin);
@ -34,6 +36,8 @@ Vue.use(LoadingPlugin);
Vue.use(ToastPlugin);
Vue.use(AlertPlugin);
Vue.use(VueCookies)
Vue.use(ElementUI)
Vue.use(infiniteScroll)
// Vue.use(BMap, {
// // ak 是在百度地图开发者平台申请的密钥 详见 http://lbsyun.baidu.com/apiconsole/key */
// ak: 'm8sGHZTpKuDeDAU5qs4YUWWDP1v6XZsq'

24
src/models/choose-community.js

@ -0,0 +1,24 @@
import utilsModel from "./utils-model";
import chooseCommunity from "../api/chooseCommunity";
export default {
getAddressInfo : (params) =>
utilsModel
.config(chooseCommunity.getAddressInfo)
.request({
params : params,
}),
getEstateInfo : (params) =>
utilsModel
.config(chooseCommunity.getEstateInfo)
.request({
params : params,
}),
getEstateList : (params) =>
utilsModel
.config(chooseCommunity.getEstateList)
.request({
params : params,
})
}

24
src/models/home-model.js

@ -18,19 +18,27 @@ export default {
version: "2.5.0"
}
}),
getLocation: params =>
utilsModel.config(homeApi.getLocation).request({
params: params,
// headers: {
// "x-forwarded-for": "113.65.207.218"
// }
}),
// getLocation: params =>
// utilsModel.config(homeApi.getLocation).request({
// params: params,
// // headers: {
// // "x-forwarded-for": "113.65.207.218"
// // }
// }),
countExtend: params =>
utilsModel.config(homeApi.countExtend).request({
params: params
}),
countPartner: params =>
utilsModel.config(homeApi.countPartner).request({
params: params
}),
updateUniqueId: params =>
utilsModel.config(homeApi.updateUniqueId).request({
params: params
})
}),
// getEstateInfo: params =>
// utilsModel.config(homeApi.getEstateInfo).request({
// params: params
// }),
};

2
src/models/utils-model.js

@ -102,7 +102,7 @@ const config = function(config, params) {
// console.log(newConfig)
// newConfig.headers.Authorization=params.token
//执行http接口请求
return instance(newConfig).then(successCallback, errorCallback);
return instance(newConfig).then(successCallback).catch(errorCallback);
}
};
};

51
src/models/wxLocation.js

@ -0,0 +1,51 @@
import Vue from "vue";
import wx from "weixin-js-sdk";
import axios from "axios";
import wxShareModel from "../models/wxShare-model.js";
Vue.prototype.wxLocation = function () {
wxShareModel.getWXCheck().then(response =>{
if (response.code != 0) {
return;
}
var jsApiSignConfig = response.response.jsApiSignConfig;
wx.config({
debug: false, // 开启调试模式,开发时可以开启
appId: jsApiSignConfig.appId, // 必填,公众号的唯一标识 由接口返回
timestamp: jsApiSignConfig.timestamp, // 必填,生成签名的时间戳 由接口返回
nonceStr: jsApiSignConfig.nonceStr, // 必填,生成签名的随机串 由接口返回
signature: jsApiSignConfig.signature, // 必填,签名 由接口返回
jsApiList: [
"onMenuShareAppMessage",
"onMenuShareTimeline",
"onMenuShareQQ",
"onMenuShareWeibo",
"onMenuShareQZone"
]
});
wx.ready(() => {
// 首次进入页面进会弹窗确认地理位置
if (localStorage.getItem("latitude") == null) {
wx.getLocation({
type: "gcj02", // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
success: function (res) {
localStorage.setItem("latitude", res.latitude);
localStorage.setItem("longitude", res.longitude);
},
cancel: function () {
alter("拒绝定位");
}
});
} else {
}
alert("lat:" + localStorage.getItem("latitude") + ";lng:" + localStorage.getItem("longitude"));
wx.error(function (res) {
alter("wx-js初始化: " + res);
});
});
});
}

6
src/models/wxShare-model.js

@ -9,4 +9,10 @@ export default {
.request({
params : params,
}),
getWXCheck : () =>
utilsModel
.config(wxShareApi.getWXCheck)
.request({
}),
}

172
src/models/wxShare.js

@ -7,15 +7,12 @@ import homeApi from "../models/home-model.js";
Vue.prototype.wxShare = function (params) {
var params = params || {};
wxShareModel.getShare(params).then(response => {
wxShareModel.getWXCheck().then(response =>{
if (response.code != 0) {
return;
}
var jsApiSignConfig = response.response.jsApiSignConfig;
var shareConfig = response.response.shareConfig;
var couponNo = response.response.couponNo
wx.config({
debug: false, // 开启调试模式,开发时可以开启
appId: jsApiSignConfig.appId, // 必填,公众号的唯一标识 由接口返回
@ -30,82 +27,103 @@ wxShareModel.getShare(params).then(response => {
"onMenuShareQZone"
]
});
var urlParams = '';
let uuniqueId = this.$cookies.get('1hjz_mall_unique_id')
if (couponNo !== undefined && couponNo !== null && couponNo !== "") {
urlParams = '?batchNo=' + couponNo
}
if (uuniqueId !== undefined && uuniqueId !== null && uuniqueId !== "") {
if (urlParams.length > 0) {
urlParams += '&uniqueId=' + uuniqueId
} else {
urlParams = '?uniqueId=' + uuniqueId
wxShareModel.getShare(params).then(response => {
if (response.code != 0) {
return;
}
}
wx.ready(() => {
//获取“分享给朋友”按钮点击状态及自定义分享内容接口
wx.onMenuShareAppMessage({
// 分享给朋友
title: shareConfig.title, // 分享标题
desc: shareConfig.desc, // 分享描述
link: shareConfig.url + urlParams, // 分享链接 默认以当前链接
imgUrl: shareConfig.img, // 分享图标
success: function (res) {}
});
//转发到朋友圈
wx.onMenuShareTimeline({
title: shareConfig.title, // 分享标题
desc: shareConfig.desc, // 分享描述
link: shareConfig.url + urlParams, // 分享链接 默认以当前链接
imgUrl: shareConfig.img, // 分享图标
success: function (res) {}
});
//微信分享qq
wx.onMenuShareQQ({
title: shareConfig.title, // 分享标题
desc: shareConfig.desc, // 分享描述
link: shareConfig.url + urlParams, // 分享链接 默认以当前链接
imgUrl: shareConfig.img, // 分享图标
success: function (res) {}
});
//获取“分享到腾讯微博”按钮点击状态及自定义分享内容接口
wx.onMenuShareWeibo({
title: shareConfig.title, // 分享标题
desc: shareConfig.desc, // 分享描述
link: shareConfig.url + urlParams, // 分享链接 默认以当前链接
imgUrl: shareConfig.img, // 分享图标
success: function (res) {}
});
//获取“分享到QQ空间”按钮点击状态及自定义分享内容接口(即将废弃)
wx.onMenuShareQZone({
title: shareConfig.title, // 分享标题
desc: shareConfig.desc, // 分享描述
link: shareConfig.url + urlParams, // 分享链接 默认以当前链接
imgUrl: shareConfig.img, // 分享图标
success: function (res) {}
});
// 首次进入页面进会弹窗确认地理位置
if (localStorage.getItem("latitude") == null) {
wx.getLocation({
type: "gcj02", // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
success: function (res) {
localStorage.setItem("latitude", res.latitude);
localStorage.setItem("longitude", res.longitude);
},
cancel: function () {
alter("拒绝定位");
var shareConfig = response.response.shareConfig;
var couponNo = response.response.couponNo
var urlParams = '';
let uuniqueId = this.$cookies.get('1hjz_mall_unique_id')
if (couponNo !== undefined && couponNo !== null && couponNo !== "") {
urlParams = '?batchNo=' + couponNo
}
if (uuniqueId !== undefined && uuniqueId !== null && uuniqueId !== "") {
if (urlParams.length > 0) {
urlParams += '&uniqueId=' + uuniqueId
} else {
urlParams = '?uniqueId=' + uuniqueId
}
}
let estateStr = localStorage.getItem("estate") || "";
if(estateStr && estateStr.length > 0){
let estateArr = estateStr.split("&");
let estateId = estateArr[0];
if (estateId !== undefined && estateId !== null && estateId !== "") {
if (urlParams.length > 0) {
urlParams += '&estateId=' + estateId
} else {
urlParams = '?estateId=' + estateId
}
});
} else {
}
}
alert("lat:" + localStorage.getItem("latitude") + ";lng:" + localStorage.getItem("longitude"));
wx.error(function (res) {
alter("wx-js初始化: " + res);
wx.ready(() => {
//获取“分享给朋友”按钮点击状态及自定义分享内容接口
wx.onMenuShareAppMessage({
// 分享给朋友
title: shareConfig.title, // 分享标题
desc: shareConfig.desc, // 分享描述
link: shareConfig.url + urlParams, // 分享链接 默认以当前链接
imgUrl: shareConfig.img, // 分享图标
success: function (res) {}
});
//转发到朋友圈
wx.onMenuShareTimeline({
title: shareConfig.title, // 分享标题
desc: shareConfig.desc, // 分享描述
link: shareConfig.url + urlParams, // 分享链接 默认以当前链接
imgUrl: shareConfig.img, // 分享图标
success: function (res) {}
});
//微信分享qq
wx.onMenuShareQQ({
title: shareConfig.title, // 分享标题
desc: shareConfig.desc, // 分享描述
link: shareConfig.url + urlParams, // 分享链接 默认以当前链接
imgUrl: shareConfig.img, // 分享图标
success: function (res) {}
});
//获取“分享到腾讯微博”按钮点击状态及自定义分享内容接口
wx.onMenuShareWeibo({
title: shareConfig.title, // 分享标题
desc: shareConfig.desc, // 分享描述
link: shareConfig.url + urlParams, // 分享链接 默认以当前链接
imgUrl: shareConfig.img, // 分享图标
success: function (res) {}
});
//获取“分享到QQ空间”按钮点击状态及自定义分享内容接口(即将废弃)
wx.onMenuShareQZone({
title: shareConfig.title, // 分享标题
desc: shareConfig.desc, // 分享描述
link: shareConfig.url + urlParams, // 分享链接 默认以当前链接
imgUrl: shareConfig.img, // 分享图标
success: function (res) {}
});
// 首次进入页面进会弹窗确认地理位置
if (localStorage.getItem("latitude") == null) {
wx.getLocation({
type: "gcj02", // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
success: function (res) {
localStorage.setItem("latitude", res.latitude);
localStorage.setItem("longitude", res.longitude);
},
cancel: function () {
alter("拒绝定位");
}
});
} else {
}
// alert("lat:" + localStorage.getItem("latitude") + ";lng:" + localStorage.getItem("longitude"));
wx.error(function (res) {
alter("wx-js初始化: " + res);
});
});
});
});
}

7
src/router/index.js

@ -11,6 +11,7 @@ const putMoneySuccess = resolve =>
const serviceEvaluationStatus = resolve =>
require(["@/view/service-evaluation-status"], resolve);
const home = resolve => require(["@/view/home"], resolve);
const chooseCommnity = resolve => require(["@/view/choose-community"], resolve);
const poster = resolve => require(["@/view/poster"], resolve);
const demo = resolve => require(["@/view/demo"], resolve);
const goodsClassify = resolve => require(["@/view/goods-classify"], resolve);
@ -56,6 +57,11 @@ let router = new Router({
name: "首页",
component: home
},
{
path: "/choose-community",
name: "选择小区",
component: chooseCommnity
},
{
path: "/poster",
name: "分销海报",
@ -94,6 +100,7 @@ let router = new Router({
path: "/demo",
component: resolve => require(["@/view/demo.vue"], resolve)
}
]
});

20
src/utils/scroll.js

@ -0,0 +1,20 @@
/**
* 本文件用于 keep-alive的页面返回离开前的位置使用
* 未知 Vue-Router scrollBehavior 记录有误所以使用手动记录位置
*/
var myScroll = {
activated() {
console.log("pageNum---pages:"+this.pageNum,this.pages)
if (this.pageNum < this.pages) this.busy = false
this.$nextTick(function() {
const position = this.$route.meta.savedPosition // 返回页面取出来
window.scroll(0, position)
})
},
deactivated() {
this.busy = true
}
}
export default myScroll

440
src/view/choose-community.vue

@ -1,19 +1,427 @@
<template>
<div class="container goods">
<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 f-h40">
<el-input placeholder="请输入小区名称" type="search" v-model="form.customerName" @keyup.enter.native="searchByName" @clear="clear" clearable>
<i slot="prefix" class="el-input__icon el-icon-search"></i>
</el-input>
<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>
</div>
<div class="content">
<el-input style="border-left: 1px solid #c1c1c1;" placeholder="请输入小区名称" type="search" 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>
<div class="f-text-666 f-font-12 "></div>
</div>
</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>
<!-- 无限加载 -->
<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>
<popup-picker :show="show" @cancel="cancel" @confirm="confirm" :data-list="addressData" :value="addressValue"></popup-picker>
<!-- Loading -->
<loading :show="showLoading" text="loading"></loading>
</div>
</template>
<script>
import myScroll from "@/utils/scroll";
import chooseCommunityApi from "../models/choose-community";
import homeApi from "../models/home-model.js";
import { Alert, Toast, Loading } from "vux";
import popupPicker from "../components/popup-picker.vue";
import chooseCommunity from "../api/chooseCommunity";
export default {
components: {
Toast,
Loading,
Alert,
"popup-picker": popupPicker
},
data() {
return {
show: false,
defaultCity: "天河区",
districtId: "440106000", //id
provinceId: "",
cityId: "",
estateId: "",
nowEstate: "",
nowAddress: "",
lat: -1,
lng: -1,
addressData: [],
addressValue: [
"440000000&广东省",
"440100000&广州市",
"440106000&天河区&2"
],
communityName: "",
communityList: [],
pageSize: 10,
pageNum: 1,
isRequesting: false,
loadMoreHide: false,
loadMoreTips: false,
loadingShow: false, //
busy: false, //
noRecords: false, //
noRecordsText: "没有当前城市的小区数据",
showLoading: false
};
},
beforeRouteLeave(to, from, next) {
from.meta.keepAlive = false;
next();
},
mixins: [myScroll],
methods: {
getCity() {
let _this = this;
var geolocation = new BMap.Geolocation();
geolocation.getCurrentPosition(function(r) {
if (this.getStatus() == BMAP_STATUS_SUCCESS) {
// if(r.accuracy==null){
// alert('');
// //
// return;
// }else{
const myGeo = new BMap.Geocoder();
myGeo.getLocation(new BMap.Point(r.point.lng, r.point.lat), data => {
if (data.addressComponents) {
const result = data.addressComponents;
const location = {
creditLongitude: r.point.lat, //
creditLatitude: r.point.lng, //
creditProvince: result.province || "", //
creditCity: result.city || "", //
creditArea: result.district || "", //
creditStreet:
(result.street || "") + (result.streetNumber || "") //
};
_this.location = location;
localStorage.setItem("latitude", location.creditLatitude);
localStorage.setItem("longitude", location.creditLongitude);
// alert(
// "-" +
// location.creditProvince +
// ";-" +
// location.creditCity +
// ";-" +
// location.creditArea +
// ";-" +
// location.creditStreet +
// ";lat-" +
// location.creditLatitude +
// ";lng-" +
// location.creditLongitude
// );
}
});
// }
}
});
},
//
goBack() {
// history.go(-1)
let estateStr = localStorage.getItem("estate") || "";
if (!estateStr || estateStr.length == 0) {
this.$vux.toast.text("请选择一个小区", "middle");
return;
}
this.$router.push({
name: "首页"
});
},
//
confirm(list) {
console.log("list:" + list);
let arr = list[2].split("&") || "";
this.districtId = arr[0];
this.defaultCity = arr[1];
this.addressValue = list.slice();
// localStorage.setItem("cityName", list);
this.show = false;
this.pageNum = 1;
this.communityName = "";
this.fetchCommunityList();
},
cancel() {
let str = localStorage.getItem("cityName") || "";
//
if (!str) {
this.defaultCity = "天河区";
//
this.merchantNo = 2;
//id
this.districtId = "440106000";
this.addressValue = [
"440000000&广东省",
"440100000&广州市",
"440106000&天河区&2"
];
this.fetchCommunityList();
}
this.show = false;
},
clear() {
//
this.showFlag = false;
this.communityName = "";
this.busy = false;
this.pageNum++;
this.loadMoreHide = false;
this.loadMoreTips = false;
this.communityList = [];
this.fetchCommunityList();
},
searchByName(event) {
this.showFlag = false;
if (event.keyCode === 13) {
event.preventDefault(); //
this.fetchCommunityList();
}
},
fetchCommunityList() {
if (this.isRequesting || this.loadMoreHide) {
return;
}
this.isRequesting = true;
//this.busy = true;
var _this = this;
return new Promise((resolve, reject) => {
var params = {
pageNo: this.pageNum,
pageSize: this.pageSize,
districtId: this.districtId,
estateName: this.communityName,
draw: 0,
lat: this.lat,
lng: this.lng
};
chooseCommunityApi.getEstateList(params).then(res => {
_this.showLoading = false;
_this.isRequesting = false;
if (res.code == 0) {
_this.communityList = _this.communityList.concat(res.dataList);
if (!_this.communityList.length) _this.noRecords = true;
</div>
<!-- Loading -->
<loading :show="showLoading" text="loading"></loading>
</div>
</template>
if (_this.pageSize > res.dataList.length) {
_this.busy = true; //
_this.loadMoreHide = true;
_this.loadMoreTips = true;
} else {
_this.busy = false;
_this.pageNum++;
_this.loadMoreHide = false;
_this.loadMoreTips = false;
}
// this.communityList = res.dataList;
} else {
this.$vux.toast.text(res.msg, "middle");
}
resolve();
});
});
},
chooseCommunity(item) {
var addressValue = [
item.provinceId + "&" + item.provinceName,
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;
this.countPartner();
this.$router.push({
name: "首页"
});
},
ShareWenXin() {
var merchantNo = this.merchantNo;
this.wxShare({
merchantNo: merchantNo,
source: 0,
url: encodeURIComponent(location.href),
shareUrl: encodeURIComponent("http://" + location.host + "/v2/home")
});
},
countExtend() {
return new Promise((resolve, reject) => {
var params = {
buryingPointType: 0,
salesmanUniqueIdentity: this.uniqueId,
timeStr: this.getTime(Date.now())
};
homeApi.countExtend(params).then(res => {
resolve();
});
});
},
countPartner() {
return new Promise((resolve, reject) => {
var params = {
buryingPointType: 0,
housingEstateId: this.estateId,
timeStr: this.getTime(Date.now())
};
homeApi.countPartner(params).then(res => {
resolve();
});
});
},
getTime(time) {
let date = new Date(time);
let year = date.getFullYear();
let month = this.checkTime(date.getMonth() + 1);
let day = this.checkTime(date.getDate());
let str = year + "-" + month + "-" + day;
return str;
},
checkTime(i) {
if (i < 10) {
i = "0" + i;
}
return i;
},
getAddressInfo() {
this.getId();
this.showLoading = true;
return new Promise((resolve, reject) => {
chooseCommunityApi
.getAddressInfo({
cityId: this.cityId ? this.cityId : "",
estateId: this.estateId ? this.estateId : "",
lat: this.lat,
lng: this.lng
})
.then(res => {
if (res.response.allAddress && res.response.userAddress) {
this.addressData = res.response.allAddress;
this.flag = true;
this.fetchCommunityList();
resolve();
}
this.showLoading = false;
})
.catch(error => {
this.showLoading = false;
});
});
},
getId() {
let str = localStorage.getItem("cityName") || "";
let estateStr = localStorage.getItem("estate") || "";
this.lat = localStorage.getItem("latitude") || -1;
this.lng = localStorage.getItem("longitude") || -1;
// this.lng = 23.127191
// this.lat = 113.355747
if (!str) {
} else {
let arr = str.split(",");
this.addressValue = arr;
this.provinceId = arr[0].split("&")[0];
this.cityId = arr[1].split("&")[0];
let cityNameArr = arr[2].split("&");
this.districtId = cityNameArr[0];
this.defaultCity = cityNameArr[1];
this.merchantNo = cityNameArr[2];
this.nowAddress =
arr[0].split("&")[1] + arr[1].split("&")[1] + cityNameArr[1];
}
if (!estateStr) {
} else {
let estateArr = estateStr.split("&");
this.estateId = estateArr[0];
this.nowEstate = estateArr[1];
}
let eId = this.$route.query.estateId;
if (eId !== undefined && eId !== null && eId !== "") {
this.estateId = eId;
}
}
},
mounted() {
//
var ua = window.navigator.userAgent.toLowerCase();
//uaMicroMessenger
let _this = this;
if (ua.match(/MicroMessenger/i) == "micromessenger") {
//
this.wxLocation({});
} else {
// TODO api
this.getCity();
}
this.getAddressInfo();
}
};
</script>
<style lang="scss" scoped>
.container {
background-color: #fff;
.top {
position: relative;
width: 100%;
height: 0.9rem;
line-height: 0.9rem;
text-align: center;
font-size: 0.36rem;
color: #249e6c;
img {
position: absolute;
width: 0.2rem;
height: 0.35rem;
top: 50%;
left: 0.4rem;
margin-top: -0.17rem;
}
}
.content {
width: 100%;
background: #fff;
-webkit-overflow-scrolling: touch;
.title {
margin-top: 10px;
line-height: 35px;
height: 35px;
width: 100%;
border-bottom: 1px solid #f3f3f3;
}
}
}
</style>

2
src/view/goods-classify.vue

@ -17,7 +17,7 @@
</div>
<div class="right" ref="foodWrapper">
<div>
<div v-if="goodsList.length != 0" v-for="(item,index) in goodsList" :key="index" class="food-list-hook">
<div v-for="(item,index) in goodsList" :key="index" class="food-list-hook">
<p class="title">{{item.combinationName}}</p>
<div class="f-relative f-all-1px" v-for="(goods,k) in item.goodsList" :key="k">
<a style="display:block" :href="'/mall/web/vgoods/detail/' + goods.goodsNo ">

808
src/view/home.vue

@ -3,9 +3,9 @@
<div class="home" style="height: auto;">
<div style="height: 0.9rem;"></div>
<div ref="header" class="page-top" id="top-nav">
<i class="position" @click="show = true">
<i class="position" @click="chooseCommunity()">
<img src="../assets/images/icon/position.png" />
{{defaultCity}}
{{defaultCommunity}}
</i>
<i class="logo">
<img src="../assets/images/icon/logo.png" />
@ -19,23 +19,14 @@
<div class="banner" v-if="bannerImgList.length > 0">
<swiper :options="swiperOption" ref="mySwiper">
<swiper-slide v-for="(item,index) in bannerImgList" :key="index">
<a
:href="item.linkUrl ? item.linkUrl: 'javascript:void(0)' "
class="swiper-img"
:style="{backgroundImage:'url('+item.imgUrl+')'}"
></a>
<a :href="item.linkUrl ? item.linkUrl: 'javascript:void(0)' " class="swiper-img" :style="{backgroundImage:'url('+item.imgUrl+')'}"></a>
</swiper-slide>
</swiper>
<div class="swiper-pagination"></div>
</div>
<!-- TODO: 对应换hot new 图标 -->
<div class="service f-flex" v-if="iconList.length != 0">
<div
class="item"
v-for="(item,index) in iconList"
:key="index"
v-on:click="goods(item.combinationNo)"
>
<div class="item" v-for="(item,index) in iconList" :key="index" v-on:click="goods(item.combinationNo)">
<a href="javascript:void(0)" class="f-relative f-inb">
<img :src="imghost + item.icon" class="icon" />
<img src="../assets/images/icon/hot.png" class="hot" v-if="item.label == '2'" />
@ -91,17 +82,12 @@
<!--商品列表-->
<div class="new-card-box" style="padding-top: 0.3rem;">
<div
class="new-card"
v-if="item.goodsList.length > 0"
v-for="(item,index) in goodsList"
:key="index"
>
<div class="new-card" v-if="item.goodsList.length > 0" v-for="(item,index) in goodsList" :key="index">
<div class="new-card-top">
<img :src=" imghost + item.image" />
</div>
<ul class="card-list">
<li v-for="item1 in item.goodsList">
<li v-for="item1 in item.goodsList" :key="item1.goodsNo">
<a :href="'/mall/web/vgoods/detail/' + item1.goodsNo ">
<div class="left">
<a :href="'/mall/web/vgoods/detail/' + item1.goodsNo">
@ -115,11 +101,7 @@
<h3>{{item1.name}}</h3>
<div class="text">{{item1.shortDesc}}</div>
<div class="card-name">
<i
:style="{marginRight:(i+1)==item1.labelList.length?'0':'0.1rem'}"
v-if="label.labelText"
v-for="(label,i) in item1.labelList"
>{{label.labelText}}</i>
<i :style="{marginRight:(i+1)==item1.labelList.length?'0':'0.1rem'}" v-if="label.labelText" v-for="(label,i) in item1.labelList">{{label.labelText}}</i>
</div>
<div class="btn-box">
<!--originalPrice原价price优惠价 -->
@ -128,10 +110,7 @@
<em>{{item1.price ? item1.price/100:item1.originalPrice/100}}</em>
</span>
<span
class="original-price"
v-if="item1.price&&item1.price!=item1.originalPrice"
>
<span class="original-price" v-if="item1.price&&item1.price!=item1.originalPrice">
<em>{{ item1.originalPrice/100}}</em>
</span>
</div>
@ -148,13 +127,13 @@
<div class="page-bottom">
<routerFooter></routerFooter>
</div>
<popup-picker
<!-- <popup-picker
:show="show"
@cancel="cancel"
@confirm="confirm"
:data-list="addressData"
:value="addressValue"
></popup-picker>
></popup-picker> -->
<div class="Loading-box">
<loading v-model="showLoading" text="loading"></loading>
</div>
@ -166,366 +145,465 @@
</template>
<script>
import chooseCommunityApi from "../models/choose-community";
import homeApi from "../models/home-model.js";
import configs from "../configs";
import { Alert, Toast, Loading } from "vux";
import routerFooter from "../components/nav-bottom";
import popupPicker from "../components/popup-picker.vue";
import Qs from 'qs';
import Qs from "qs";
//BMap
import BMap from 'BMap';
import BMap from "BMap";
var locationUrl = configs.locationUrl;
export default {
components: {
Toast,
routerFooter,
Loading,
Alert,
"popup-picker": popupPicker
components: {
Toast,
routerFooter,
Loading,
Alert,
"popup-picker": popupPicker
},
data() {
return {
show: false,
location: {},
uniqueId: "",
defaultCity: "天河区", //
defaultCommunity: "请选择小区",
merchantNo: 2, //
districtId: "440106000", //id
addressData: [],
addressValue: [
"440000000&广东省",
"440100000&广州市",
"440106000&天河区&2"
],
bannerImgList: [], //
activityImgList: [], // 广
iconList: [], //
promotionImgList: {}, //
goodsList: [],
swiperOption: {
autoplay: {
disableOnInteraction: false
},
speed: 1000,
pagination: {
el: ".swiper-pagination"
}
},
showLoading: false,
searchBarFixed: false,
provinceId: "",
cityId: "",
estateId: "",
lat: -1,
lng: -1,
alertShow: false,
address: "",
flag: false,
state: 0
};
},
watch: {
$route(to, from) {
// this.getCityName();
}
},
methods: {
// //
// confirm(list) {
// let arr = list[2].split("&") || "";
// this.districtId = arr[0];
// this.merchantNo = arr[2];
// this.getGoodsList(); //
// this.defaultCity = arr[1];
// this.addressValue = list.slice();
// localStorage.setItem("cityName", list);
// this.show = false;
// },
//
getGoodsList() {
return new Promise((resolve, reject) => {
var params = {
merchantNo: this.merchantNo,
selectedDistrictId: this.districtId
};
homeApi.getGoods(params).then(res => {
this.showLoading = false;
this.state = 0;
if (res.code == 0) {
this.bannerImgList = res.response.bannerImgList;
this.activityImgList = res.response.activityImgList || [];
this.iconList = res.response.iconList || [];
this.promotionImgList = res.response.promotionImgList[0] || {};
let list = res.response.goodsList;
for (let i = 0; i < list.length; i++) {
for (let y = 0; y < list[i].goodsList.length; y++) {
list[i].goodsList[y].labelList = list[i].goodsList[y].smallLabel
? JSON.parse(list[i].goodsList[y].smallLabel)
: "";
}
}
this.goodsList = list.slice();
} else {
this.$vux.toast.text(res.msg, "middle");
}
resolve();
});
});
},
data() {
return {
show: false,
location:{},
uniqueId:'',
defaultCity: "天河区", //
defaultCommunity:"",
merchantNo: 2, //
districtId: "440106000", //id
addressData: [],
addressValue: [
"440000000&广东省",
"440100000&广州市",
"440106000&天河区&2"
],
bannerImgList: [], //
activityImgList: [], // 广
iconList: [], //
promotionImgList: {}, //
goodsList: [],
swiperOption: {
autoplay: {
disableOnInteraction: false
},
speed: 1000,
pagination: {
el: ".swiper-pagination"
}
},
showLoading: false,
searchBarFixed: false,
provinceId: "",
cityId: "",
alertShow: false,
address: "",
flag: false,
state: 0
ShareWenXin() {
var merchantNo = this.merchantNo;
this.wxShare({
merchantNo: merchantNo,
uniqueId: this.uniqueId,
source: 0,
url: encodeURIComponent(location.href.split("#")[0].split("?")[0])
});
},
countExtend() {
return new Promise((resolve, reject) => {
var params = {
buryingPointType: 0,
salesmanUniqueIdentity: this.uniqueId,
timeStr: this.getTime(Date.now())
};
homeApi.countExtend(params).then(res => {
resolve();
});
});
},
getTime(time) {
let date = new Date(time);
let year = date.getFullYear();
let month = this.checkTime(date.getMonth() + 1);
let day = this.checkTime(date.getDate());
let str = year + "-" + month + "-" + day;
return str;
},
watch: {
$route(to, from) {
// this.getCityName();
checkTime(i) {
if (i < 10) {
i = "0" + i;
}
return i;
},
//
goods(c_no) {
this.$router.push({
name: "商品分类",
params: {
no: this.merchantNo,
id: this.districtId,
c_no: c_no
}
});
},
methods: {
//
confirm(list) {
let arr = list[2].split("&") || "";
this.districtId = arr[0];
this.merchantNo = arr[2];
this.getGoodsList(); //
this.defaultCity = arr[1];
this.addressValue = list.slice();
localStorage.setItem("cityName", list);
this.show = false;
},
//
getGoodsList() {
return new Promise((resolve, reject) => {
var params = {
merchantNo: this.merchantNo,
selectedDistrictId: this.districtId
};
homeApi.getGoods(params).then(res => {
this.showLoading = false;
this.state = 0;
if (res.code == 0) {
this.bannerImgList = res.response.bannerImgList;
this.activityImgList =
res.response.activityImgList || [];
this.iconList = res.response.iconList || [];
this.promotionImgList =
res.response.promotionImgList[0] || {};
let list = res.response.goodsList;
for (let i = 0; i < list.length; i++) {
for (let y = 0; y < list[i].goodsList.length; y++) {
list[i].goodsList[y].labelList = list[i]
.goodsList[y].smallLabel
? JSON.parse(
list[i].goodsList[y].smallLabel
)
: "";
}
}
this.goodsList = list.slice();
} else {
this.$vux.toast.text(res.msg, "middle");
}
resolve();
//
chooseCommunity() {
this.$router.push({
name: "选择小区"
});
},
getAddressInfo() {
this.showLoading = true;
return new Promise((resolve, reject) => {
chooseCommunityApi
.getAddressInfo({
cityId: this.cityId ? this.cityId : "",
estateId: this.estateId ? this.estateId : "",
lat: this.lat,
lng: this.lng
})
.then(res => {
if (res.response.allAddress && res.response.userAddress) {
this.addressData = res.response.allAddress;
this.flag = true;
let data = res.response;
//type:1-0-1-2-
if (data.userAddress.type == 1) {
this.address =
data.userAddress.cityName +
(data.userAddress.districtName
? data.userAddress.districtName
: "");
this.alertShow = true;
} else if (data.userAddress.type == 2) {
this.$vux.confirm.show({
title: "自动定位地址:",
content:
data.userAddress.cityName +
(data.userAddress.districtName
? data.userAddress.districtName
: ""),
cancelText: "切换地址",
onCancel: () => {
this.chooseCommunity();
},
onConfirm: () => {
this.defaultLocalEstate(data.estateInfo);
this.getGoodsList();
}
});
});
},
cancel() {
let str = localStorage.getItem("cityName") || "";
//
if (
!str &&
(this.state == -1 || this.state == 2 || this.state == 1)
) {
this.defaultCity = "天河区";
//
this.merchantNo = 2;
//id
this.districtId = "440106000";
this.addressValue = [
"440000000&广东省",
"440100000&广州市",
"440106000&天河区&2"
];
} else if (data.userAddress.type == 0) {
this.getGoodsList();
} else if (this.state == 2 || this.state == 1) {
this.getGoodsList();
}
this.show = false;
},
ShareWenXin() {
var merchantNo = this.merchantNo;
this.wxShare({
merchantNo: merchantNo,
uniqueId:this.uniqueId,
source: 0,
url: encodeURIComponent(location.href.split('#')[0].split('?')[0])
});
},
countExtend() {
return new Promise((resolve, reject) => {
var params = {
buryingPointType: 0,
salesmanUniqueIdentity: this.uniqueId,
timeStr: this.getTime(Date.now())
};
homeApi.countExtend(params).then(res => {
resolve();
} else if (data.userAddress.type == -1) {
// this.state = -1;
this.$vux.alert.show({
title: "自动定位失败",
onHide: () => {
// this.show = true;
this.chooseCommunity();
}
});
});
},
getTime(time) {
let date = new Date(time);
let year = date.getFullYear();
let month = this.checkTime(date.getMonth() + 1);
let day = this.checkTime(date.getDate());
let str =
year + "-" + month + "-" + day;
return str;
},
checkTime(i) {
if (i < 10) {
i = "0" + i;
}
return i;
},
//
goods(c_no) {
this.$router.push({
name: "商品分类",
params: {
no: this.merchantNo,
id: this.districtId,
c_no: c_no
}
});
},
getLocation() {
this.getId();
this.showLoading = true;
return new Promise((resolve, reject) => {
homeApi
.getLocation({
cityId: this.cityId ? this.cityId : ""
})
.then(res => {
if (res.response.allAddress && res.response.userAddress) {
this.addressData = res.response.allAddress;
this.flag = true;
let data = res.response;
if (data.userAddress.type == 1) {
this.address =
data.userAddress.cityName +
(data.userAddress.districtName
? data.userAddress.districtName
: "");
this.alertShow = true;
} else if (data.userAddress.type == 2) {
this.$vux.confirm.show({
title: "自动定位地址:",
content:
data.userAddress.cityName +
(data.userAddress.districtName
? data.userAddress.districtName
: ""),
cancelText: "切换地址",
onCancel: () => {
this.show = true;
this.state = 2;
},
onConfirm: () => {
this.provinceId = data.userAddress
.provinceId
? data.userAddress.provinceId
: this.provinceId;
this.cityId = data.userAddress.cityId
? data.userAddress.cityId
: this.cityId;
this.districtId = data.userAddress
.districtId
? data.userAddress.districtId
: this.districtId;
this.defaultCity = data.userAddress
.districtName
? data.userAddress.districtName
: this.defaultCity;
this.merchantNo =
data.userAddress.merchantNo;
this.addressValue = [
this.provinceId +
"&" +
data.userAddress.provinceName,
this.cityId +
"&" +
data.userAddress.cityName,
this.districtId +
"&" +
data.userAddress.districtName +
"&" +
data.userAddress.merchantNo
];
localStorage.setItem(
"cityName",
this.addressValue.slice()
);
this.getGoodsList();
}
});
} else if (data.userAddress.type == 0) {
this.getGoodsList();
} else if (data.userAddress.type == -1) {
this.state = -1;
this.$vux.alert.show({
title: "自动定位失败",
onHide: () => {
this.show = true;
}
});
}
resolve();
}
this.showLoading = false;
});
});
},
getId() {
let str = localStorage.getItem("cityName") || "";
if (!str) {
} else {
let arr = str.split(",");
this.addressValue = arr;
this.provinceId = arr[0].split("&")[0];
this.cityId = arr[1].split("&")[0];
let cityNameArr = arr[2].split("&");
this.districtId = cityNameArr[0];
this.defaultCity = cityNameArr[1];
this.merchantNo = cityNameArr[2];
}
resolve();
}
},
getData() {
let get = async () => {
await this.getLocation();
// await this.getGoodsList();
};
return get();
},
alertHide() {
this.state = 1;
this.show = true;
},
getCity(){
let _this = this
var geolocation = new BMap.Geolocation();
geolocation.getCurrentPosition(function(r) {
if (this.getStatus() == BMAP_STATUS_SUCCESS) {
// if(r.accuracy==null){
// alert('');
// //
// return;
// }else{
const myGeo = new BMap.Geocoder()
myGeo.getLocation(new BMap.Point(r.point.lng, r.point.lat), data => {
if (data.addressComponents) {
const result = data.addressComponents
const location = {
creditLongitude: r.point.lat, //
creditLatitude: r.point.lng, //
creditProvince: result.province || '', //
creditCity: result.city || '', //
creditArea: result.district || '', //
creditStreet: (result.street || '') + (result.streetNumber || '') //
}
_this.location = location;
alert("省-"+location.creditProvince+";市-"+location.creditCity+";区-"+location.creditArea+";街道-"+location.creditStreet+";lat-"+location.creditLatitude+";lng-"+location.creditLongitude);
}
})
// }
}
})
},
this.showLoading = false;
});
});
},
getId() {
let str = localStorage.getItem("cityName") || "";
let estateStr = localStorage.getItem("estate") || "";
this.lat = localStorage.getItem("latitude") || -1;
this.lng = localStorage.getItem("longitude") || -1;
// this.lng = 23.127191
// this.lat = 113.355747
if (!str) {
} else {
let arr = str.split(",");
this.addressValue = arr;
this.provinceId = arr[0].split("&")[0];
this.cityId = arr[1].split("&")[0];
let cityNameArr = arr[2].split("&");
this.districtId = cityNameArr[0];
this.defaultCity = cityNameArr[1];
// this.merchantNo = cityNameArr[2];
this.merchantNo = 2;
}
if (!estateStr) {
} else {
let estateArr = estateStr.split("&");
this.estateId = estateArr[0];
this.defaultCommunity = estateArr[1];
}
},
mounted() {
//
// this.getdefaultAddress();
// this.getAddress();
// this.getLocation();
getData() {
let get = async () => {
await this.getAddressInfo();
// await this.getGoodsList();
};
return get();
},
alertHide() {
this.state = 1;
this.chooseCommunity();
},
getLocation() {
//
var ua = window.navigator.userAgent.toLowerCase();
//uaMicroMessenger
let _this = this;
if (ua.match(/MicroMessenger/i) == "micromessenger") {
//
this.wxLocation({});
} else {
// TODO api
// this.getCity();
this.getData();
var uuniqueId = Qs.parse(location.search.substring(1)).uniqueId
if(uuniqueId !== undefined && uuniqueId !== null && uuniqueId !== ""){
this.uniqueId = uuniqueId
this.getCity();
}
},
isEmpty(val) {
return (
typeof val === undefined ||
val === "undefined" ||
val === null ||
val === ""
);
},
getCity() {
let _this = this;
var geolocation = new BMap.Geolocation();
geolocation.getCurrentPosition(function(r) {
if (this.getStatus() == BMAP_STATUS_SUCCESS) {
// if(r.accuracy==null){
// alert('');
// //
// return;
// }else{
const myGeo = new BMap.Geocoder();
myGeo.getLocation(new BMap.Point(r.point.lng, r.point.lat), data => {
if (data.addressComponents) {
const result = data.addressComponents;
const location = {
creditLongitude: r.point.lat, //
creditLatitude: r.point.lng, //
creditProvince: result.province || "", //
creditCity: result.city || "", //
creditArea: result.district || "", //
creditStreet:
(result.street || "") + (result.streetNumber || "") //
};
_this.location = location;
localStorage.setItem("latitude", location.creditLatitude);
localStorage.setItem("longitude", location.creditLongitude);
_this.lat = location.creditLatitude;
_this.lng = location.creditLongitude;
// alert(
// "-" +
// location.creditProvince +
// ";-" +
// location.creditCity +
// ";-" +
// location.creditArea +
// ";-" +
// location.creditStreet +
// ";lat-" +
// location.creditLatitude +
// ";lng-" +
// location.creditLongitude
// );
}
});
// }
}
});
},
defaultLocalEstate(estateRes) {
this.provinceId = estateRes.provinceId
? estateRes.provinceId
: this.provinceId;
this.cityId = estateRes.cityId ? estateRes.cityId : this.cityId;
this.districtId = estateRes.districtId
? estateRes.districtId
: this.districtId;
this.defaultCity = estateRes.districtName
? estateRes.districtName
: this.defaultCity;
this.merchantNo = estateRes.merchantNo;
this.addressValue = [
this.provinceId + "&" + estateRes.provinceName,
this.cityId + "&" + estateRes.cityName,
this.districtId +
"&" +
estateRes.districtName +
"&" +
estateRes.merchantNo
];
localStorage.setItem("cityName", this.addressValue.slice());
this.estateId = estateRes.housingEstateId
? estateRes.housingEstateId
: this.estateId;
this.defaultCommunity = estateRes.housingEstateName
? estateRes.housingEstateName
: this.defaultCommunity;
localStorage.setItem(
"estate",
this.estateId + "&" + this.defaultCommunity
);
}
},
mounted() {
//
// this.getdefaultAddress();
// this.getAddress();
// this.getLocation();
this.getId();
let eId = this.$route.query.estateId;
if (!this.isEmpty(eId)) {
if (!this.isEmpty(this.estateId)) {
this.showLoading = true;
return new Promise((resolve, reject) => {
var params = {
salesmanUniqueIdentity: this.uniqueId,
};
homeApi.updateUniqueId(params).then(res => {
this.showLoading = false;
if (res.code == 0) {
this.uniqueId=this.$cookies.get('1hjz_mall_unique_id')
if(this.uniqueId !== undefined && this.uniqueId !== null && this.uniqueId !== ""){
this.countExtend();
}
this.ShareWenXin();
} else {
this.$vux.toast.text(res.msg, "middle");
}
resolve();
chooseCommunityApi
.getEstateInfo({
estateId: this.estateId ? this.estateId : ""
})
.then(res => {
if (this.isEmpty(res.response)) {
//
this.estateId = eId;
this.getData();
} else {
var loclEstate = res.response;
//,
return new Promise((resolve, reject) => {
chooseCommunityApi
.getEstateInfo({
estateId: eId ? eId : ""
})
.then(res => {
this.showLoading = false;
if (this.isEmpty(res.response)) {
//
this.defaultLocalEstate(loclEstate);
} 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;
});
});
}
this.showLoading = false;
})
.catch(error => {
this.showLoading = false;
});
});
} else {
this.estateId = eId;
this.getData();
}
} else {
this.getLocation();
this.getData();
}
var uuniqueId = this.$route.query.uniqueId;
if (!this.isEmpty(uuniqueId)) {
this.uniqueId = uuniqueId;
}
}
return new Promise((resolve, reject) => {
var params = {
salesmanUniqueIdentity: this.uniqueId
};
homeApi.updateUniqueId(params).then(res => {
this.showLoading = false;
if (res.code == 0) {
this.uniqueId = this.$cookies.get("1hjz_mall_unique_id");
if (
this.uniqueId !== undefined &&
this.uniqueId !== null &&
this.uniqueId !== ""
) {
this.countExtend();
}
this.ShareWenXin();
} else {
this.$vux.toast.text(res.msg, "middle");
}
resolve();
});
});
}
};
</script>
<style lang="scss">

8
src/view/order-check.vue

@ -243,6 +243,13 @@ export default {
let goodsVersion =
this.getParam("goodsVersion") ||
sessionStorage.getItem("goodsVersion");
var estateId="";
let estateStr = localStorage.getItem("estate") || "";
if (!estateStr) {
} else {
let estateArr = estateStr.split("&");
estateId = estateArr[0];
}
let promise = new Promise((resolve, reject) => {
orderApi
.addOrder(
@ -251,6 +258,7 @@ export default {
couponNo: couponNo,
goodsVersion: goodsVersion,
salesmanUniqueIdentity:this.$cookies.get('1hjz_mall_unique_id'),
housingEstateId:estateId,
remark: this.info.text
})
)

Loading…
Cancel
Save