From c0419603bd8282ff42ee3ad7a34519f9253d6f25 Mon Sep 17 00:00:00 2001 From: lfs3 Date: Wed, 28 Aug 2019 14:46:23 +0800 Subject: [PATCH 01/18] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=99=BE=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/view/home.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/view/home.vue b/src/view/home.vue index f108703..0350483 100644 --- a/src/view/home.vue +++ b/src/view/home.vue @@ -539,7 +539,7 @@ mounted() { // this.getLocation(); this.getId(); let eId = this.$route.query.estateId; - + this.wxLocation({}); if (!isEmpty(eId) ) { if (!isEmpty(this.estateId)) { this.showLoading = true; From 1d38bab5837fba2ef90ee4e01fde424c1781e3cc Mon Sep 17 00:00:00 2001 From: lfs3 Date: Wed, 28 Aug 2019 14:54:07 +0800 Subject: [PATCH 02/18] =?UTF-8?q?=E6=89=93=E5=8D=B0=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/models/wxLocation.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/models/wxLocation.js b/src/models/wxLocation.js index 9976dda..ef34fc1 100644 --- a/src/models/wxLocation.js +++ b/src/models/wxLocation.js @@ -37,6 +37,7 @@ Vue.prototype.wxLocation = function () { type: "gcj02", // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02' success: function (res) { console.log('res:'+res); + alert('res:'+res); localStorage.setItem("latitude", res.latitude); localStorage.setItem("longitude", res.longitude); $.ajax({ From 4640d998678213ae6623de814b8a794b395455e7 Mon Sep 17 00:00:00 2001 From: lfs3 Date: Wed, 28 Aug 2019 14:59:33 +0800 Subject: [PATCH 03/18] =?UTF-8?q?=E6=89=93=E5=8D=B0=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/models/wxLocation.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/models/wxLocation.js b/src/models/wxLocation.js index ef34fc1..a44daa9 100644 --- a/src/models/wxLocation.js +++ b/src/models/wxLocation.js @@ -32,7 +32,7 @@ Vue.prototype.wxLocation = function () { }); wx.ready(() => { // 首次进入页面进会弹窗确认地理位置 - if (localStorage.getItem("latitude") == null) { + // if (localStorage.getItem("latitude") == null) { wx.getLocation({ type: "gcj02", // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02' success: function (res) { @@ -55,10 +55,10 @@ Vue.prototype.wxLocation = function () { alert("拒绝定位"); } }); - } else { + // } else { - } - alert("lat:" + localStorage.getItem("latitude") + ";lng:" + localStorage.getItem("longitude")); + // } + // alert("lat:" + localStorage.getItem("latitude") + ";lng:" + localStorage.getItem("longitude")); wx.error(function (res) { alert("wx-js初始化: " + res); }); From db3bd9f510a1ac4e3b8c908bf34fc3c4fcbcc619 Mon Sep 17 00:00:00 2001 From: lfs3 Date: Wed, 28 Aug 2019 15:08:17 +0800 Subject: [PATCH 04/18] =?UTF-8?q?=E6=89=93=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/models/wxLocation.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/models/wxLocation.js b/src/models/wxLocation.js index a44daa9..29fa4ce 100644 --- a/src/models/wxLocation.js +++ b/src/models/wxLocation.js @@ -37,7 +37,7 @@ Vue.prototype.wxLocation = function () { type: "gcj02", // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02' success: function (res) { console.log('res:'+res); - alert('res:'+res); + alert('res.latitude:'+res.latitude+'------res.longitude:'+res.longitude); localStorage.setItem("latitude", res.latitude); localStorage.setItem("longitude", res.longitude); $.ajax({ @@ -46,8 +46,7 @@ Vue.prototype.wxLocation = function () { dataType: "jsonp", jsonp: "callback", success: function (data) { - console.log('data:'+data); - alert('data:'+data); + alert('data.result:'+data.result); } }); }, From 4eb6b3896fd9fb3e92f9d7dcd2b356f5242f75a7 Mon Sep 17 00:00:00 2001 From: lfs3 Date: Wed, 28 Aug 2019 15:12:25 +0800 Subject: [PATCH 05/18] =?UTF-8?q?=E6=89=93=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/models/wxLocation.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/models/wxLocation.js b/src/models/wxLocation.js index 29fa4ce..d543d26 100644 --- a/src/models/wxLocation.js +++ b/src/models/wxLocation.js @@ -46,7 +46,7 @@ Vue.prototype.wxLocation = function () { dataType: "jsonp", jsonp: "callback", success: function (data) { - alert('data.result:'+data.result); + alert('data.result.location.lng:'+data.result.location.lng + '-----data.result.location.lat:'+data.result.location.lat); } }); }, From b8528e1f82b1dd542ef7addeb5ddac59b67d1afd Mon Sep 17 00:00:00 2001 From: lfs3 Date: Wed, 28 Aug 2019 15:46:04 +0800 Subject: [PATCH 06/18] =?UTF-8?q?=E5=8F=96=E6=B6=88=E6=89=93=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/models/wxLocation.js | 59 ++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/src/models/wxLocation.js b/src/models/wxLocation.js index d543d26..fe14bfd 100644 --- a/src/models/wxLocation.js +++ b/src/models/wxLocation.js @@ -6,7 +6,7 @@ import wxShareModel from "../models/wxShare-model.js"; import BMap from "BMap"; Vue.prototype.wxLocation = function () { - wxShareModel.getWXCheck().then(response =>{ + wxShareModel.getWXCheck().then(response => { if (response.code != 0) { return; } @@ -32,37 +32,38 @@ Vue.prototype.wxLocation = function () { }); wx.ready(() => { // 首次进入页面进会弹窗确认地理位置 - // if (localStorage.getItem("latitude") == null) { - wx.getLocation({ - type: "gcj02", // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02' - success: function (res) { - console.log('res:'+res); - alert('res.latitude:'+res.latitude+'------res.longitude:'+res.longitude); - localStorage.setItem("latitude", res.latitude); - localStorage.setItem("longitude", res.longitude); - $.ajax({ - url: 'http://api.map.baidu.com/geocoder/v2/?ak=a79bFu054xIbE23jlynkSXX20F9yGD4G&callback=renderReverse&location=' + res.latitude + ',' + res.longitude + '&output=json&pois=1', - type: "get", - dataType: "jsonp", - jsonp: "callback", - success: function (data) { - alert('data.result.location.lng:'+data.result.location.lng + '-----data.result.location.lat:'+data.result.location.lat); - } - }); - }, - cancel: function () { - alert("拒绝定位"); - } - }); - // } else { - - // } + if (localStorage.getItem("latitude") == null) { + wx.getLocation({ + type: "gcj02", // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02' + success: function (res) { + console.log('res:' + res); + // alert('res.latitude:' + res.latitude + '------res.longitude:' + res.longitude); + localStorage.setItem("latitude", res.latitude); + localStorage.setItem("longitude", res.longitude); + $.ajax({ + url: 'http://api.map.baidu.com/geocoder/v2/?ak=a79bFu054xIbE23jlynkSXX20F9yGD4G&callback=renderReverse&location=' + res.latitude + ',' + res.longitude + '&output=json&pois=1', + type: "get", + dataType: "jsonp", + jsonp: "callback", + success: function (data) { + // alert('data.result.location.lng:' + data.result.location.lng + '-----data.result.location.lat:' + data.result.location.lat); + localStorage.setItem("latitude", data.result.location.lat); + localStorage.setItem("longitude", data.result.location.lng); + } + }); + }, + cancel: function () { + alert("拒绝定位"); + } + }); + } else { + + } // alert("lat:" + localStorage.getItem("latitude") + ";lng:" + localStorage.getItem("longitude")); wx.error(function (res) { alert("wx-js初始化: " + res); }); }); }); - - } - \ No newline at end of file + +} From 305d905f1efbc832b4a72894124e324c6a87e25b Mon Sep 17 00:00:00 2001 From: lfs3 Date: Wed, 28 Aug 2019 18:18:25 +0800 Subject: [PATCH 07/18] =?UTF-8?q?=E5=B0=8F=E5=8C=BA=E6=B5=8F=E8=A7=88?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/util.js | 168 +++++++++++++++++++++++----------- src/view/choose-community.vue | 30 +++--- src/view/home.vue | 4 +- 3 files changed, 129 insertions(+), 73 deletions(-) diff --git a/src/common/util.js b/src/common/util.js index af8a178..666753d 100644 --- a/src/common/util.js +++ b/src/common/util.js @@ -1,69 +1,131 @@ /** * Created by jerry on 2017/4/14. */ +import homeApi from "../models/home-model.js"; var SIGN_REGEXP = /([yMdhsm])(\1*)/g var DEFAULT_PATTERN = 'yyyy-MM-dd' -function padding (s, len) { - let l = len - (s + '').length - for (var i = 0; i < l; i++) { s = '0' + s } - return s +function padding(s, len) { + let l = len - (s + '').length + for (var i = 0; i < l; i++) { s = '0' + s } + return s }; export default { - getQueryStringByName: function (name) { - var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i') - var r = window.location.search.substr(1).match(reg) - var context = '' - if (r != null) { context = r[2] } - reg = null - r = null - return context === null || context === '' || context === 'undefined' ? '' : context - }, - formatDate: { - - format: function (date, pattern) { - pattern = pattern || DEFAULT_PATTERN - return pattern.replace(SIGN_REGEXP, function ($0) { - switch ($0.charAt(0)) { - case 'y': return padding(date.getFullYear(), $0.length) - case 'M': return padding(date.getMonth() + 1, $0.length) - case 'd': return padding(date.getDate(), $0.length) - case 'w': return date.getDay() + 1 - case 'h': return padding(date.getHours(), $0.length) - case 'm': return padding(date.getMinutes(), $0.length) - case 's': return padding(date.getSeconds(), $0.length) - } - }) + getQueryStringByName: function (name) { + var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i') + var r = window.location.search.substr(1).match(reg) + var context = '' + if (r != null) { context = r[2] } + reg = null + r = null + return context === null || context === '' || context === 'undefined' ? '' : context }, - parse: function (dateString, pattern) { - var matchs1 = pattern.match(SIGN_REGEXP) - var matchs2 = dateString.match(/(\d)+/g) - if (matchs1.length === matchs2.length) { - var _date = new Date(1970, 0, 1) - for (var i = 0; i < matchs1.length; i++) { - var _int = parseInt(matchs2[i]) - var sign = matchs1[i] - switch (sign.charAt(0)) { - case 'y': _date.setFullYear(_int); break - case 'M': _date.setMonth(_int - 1); break - case 'd': _date.setDate(_int); break - case 'h': _date.setHours(_int); break - case 'm': _date.setMinutes(_int); break - case 's': _date.setSeconds(_int); break - } + formatDate: { + + format: function (date, pattern) { + pattern = pattern || DEFAULT_PATTERN + return pattern.replace(SIGN_REGEXP, function ($0) { + switch ($0.charAt(0)) { + case 'y': return padding(date.getFullYear(), $0.length) + case 'M': return padding(date.getMonth() + 1, $0.length) + case 'd': return padding(date.getDate(), $0.length) + case 'w': return date.getDay() + 1 + case 'h': return padding(date.getHours(), $0.length) + case 'm': return padding(date.getMinutes(), $0.length) + case 's': return padding(date.getSeconds(), $0.length) + } + }) + }, + parse: function (dateString, pattern) { + var matchs1 = pattern.match(SIGN_REGEXP) + var matchs2 = dateString.match(/(\d)+/g) + if (matchs1.length === matchs2.length) { + var _date = new Date(1970, 0, 1) + for (var i = 0; i < matchs1.length; i++) { + var _int = parseInt(matchs2[i]) + var sign = matchs1[i] + switch (sign.charAt(0)) { + case 'y': _date.setFullYear(_int); break + case 'M': _date.setMonth(_int - 1); break + case 'd': _date.setDate(_int); break + case 'h': _date.setHours(_int); break + case 'm': _date.setMinutes(_int); break + case 's': _date.setSeconds(_int); break + } + } + return _date + } + return null } - return _date - } - return null - } - }, + }, }; export function isEmpty(val) { return ( - val === undefined || - val === null || - val === "undefined" || - val === "") + val === undefined || + val === null || + val === "undefined" || + val === "") +} + +export function countPartner() { + + var estateId = ""; + let estateStr = localStorage.getItem("estate") || ""; + if (!estateStr) { + } else { + let estateArr = estateStr.split("&"); + estateId = estateArr[0]; + } + + if(estateId !== ""){ + let keyStr = "1hjz_open_housing_log_" + estateId + let open_housing = localStorage.getItem(keyStr) || ""; + + if (!open_housing) { + return new Promise((resolve, reject) => { + var params = { + buryingPointType: 0, + housingEstateId: estateId, + timeStr: getTime(Date.now()) + }; + homeApi.countPartner(params).then(res => { + localStorage.setItem(keyStr, getTime(Date.now())) + resolve(); + }); + }); + }else{ + if(open_housing !== getTime(Date.now())){ + return new Promise((resolve, reject) => { + var params = { + buryingPointType: 0, + housingEstateId: estateId, + timeStr: getTime(Date.now()) + }; + homeApi.countPartner(params).then(res => { + localStorage.setItem(keyStr, getTime(Date.now())) + resolve(); + }); + }); + } + } + } + + +} + +export function getTime(time) { + let date = new Date(time); + let year = date.getFullYear(); + let month = checkTime(date.getMonth() + 1); + let day = checkTime(date.getDate()); + let str = year + "-" + month + "-" + day; + return str; +} +export function checkTime(i) { + if (i < 10) { + i = "0" + i; + } + return i; } diff --git a/src/view/choose-community.vue b/src/view/choose-community.vue index 4e79329..5acdb63 100644 --- a/src/view/choose-community.vue +++ b/src/view/choose-community.vue @@ -58,6 +58,7 @@ 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"; +import { countPartner } from "@/common/util"; export default { components: { Toast, @@ -158,9 +159,10 @@ export default { this.$vux.toast.text("请选择一个小区", "middle"); return; } - this.$router.push({ - name: "首页" - }); + history.go(-1) + // this.$router.push({ + // name: "首页" + // }); }, //确定时保存记录 confirm(list) { @@ -281,10 +283,11 @@ export default { item.housingEstateId + "&" + item.housingEstateName ); this.estateId = item.housingEstateId; - this.countPartner(); - this.$router.push({ - name: "首页" - }); + countPartner(); + history.go(-1) + // this.$router.push({ + // name: "首页" + // }); }, ShareWenXin() { var merchantNo = this.merchantNo; @@ -307,18 +310,7 @@ export default { }); }); }, - 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(); diff --git a/src/view/home.vue b/src/view/home.vue index 0350483..81f0a0b 100644 --- a/src/view/home.vue +++ b/src/view/home.vue @@ -152,6 +152,7 @@ import { Alert, Toast, Loading } from "vux"; import {isEmpty} from "@/common/util"; import routerFooter from "../components/nav-bottom"; import popupPicker from "../components/popup-picker.vue"; +import { countPartner } from "@/common/util"; import Qs from "qs"; //引入BMap import BMap from "BMap"; @@ -382,6 +383,7 @@ export default { }); } else if (data.userAddress.type == 0) { this.getGoodsList(); + countPartner(); } else if (data.userAddress.type == -1) { // this.state = -1; this.$vux.alert.show({ @@ -528,6 +530,7 @@ export default { : this.defaultCommunity; if(!isEmpty(this.estateId)){ localStorage.setItem("estate",this.estateId + "&" + this.defaultCommunity); + countPartner(); } } @@ -539,7 +542,6 @@ mounted() { // this.getLocation(); this.getId(); let eId = this.$route.query.estateId; - this.wxLocation({}); if (!isEmpty(eId) ) { if (!isEmpty(this.estateId)) { this.showLoading = true; From 4ebde40ed73130c4b3d08ed7f208517e3201f2a6 Mon Sep 17 00:00:00 2001 From: lfs3 Date: Fri, 30 Aug 2019 20:50:49 +0800 Subject: [PATCH 08/18] =?UTF-8?q?=E5=88=86=E4=BA=AB=E5=95=86=E5=93=81?= =?UTF-8?q?=E5=AF=B9=E5=BA=94=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/models/choose-community.js | 6 +++ src/view/choose-community.vue | 92 +++++++++++++++++++++++++++------- src/view/home.vue | 1 + 3 files changed, 80 insertions(+), 19 deletions(-) diff --git a/src/models/choose-community.js b/src/models/choose-community.js index 86de4b9..f1b3bae 100644 --- a/src/models/choose-community.js +++ b/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, }) diff --git a/src/view/choose-community.vue b/src/view/choose-community.vue index 5acdb63..6e2c86f 100644 --- a/src/view/choose-community.vue +++ b/src/view/choose-community.vue @@ -12,7 +12,7 @@
- + @@ -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(); diff --git a/src/view/home.vue b/src/view/home.vue index 81f0a0b..f8073c4 100644 --- a/src/view/home.vue +++ b/src/view/home.vue @@ -553,6 +553,7 @@ mounted() { .then(res => { if (isEmpty(res.response)) { //本地小区无效 + localStorage.removeItem("estate") this.estateId = eId; this.getData(); } else { From cab3403f3eb90ce765a95f71fccfe4bb3baceb87 Mon Sep 17 00:00:00 2001 From: lfs3 Date: Fri, 30 Aug 2019 22:23:21 +0800 Subject: [PATCH 09/18] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=A4=9A=E4=BD=99?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/view/choose-community.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/src/view/choose-community.vue b/src/view/choose-community.vue index 6e2c86f..fd5d994 100644 --- a/src/view/choose-community.vue +++ b/src/view/choose-community.vue @@ -60,7 +60,6 @@ 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, From 059528844db3bd9d8d17107e9aaf2cc47bdac39b Mon Sep 17 00:00:00 2001 From: lfs3 Date: Sat, 31 Aug 2019 13:52:54 +0800 Subject: [PATCH 10/18] =?UTF-8?q?iPhone=E9=94=AE=E7=9B=98=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/view/choose-community.vue | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/view/choose-community.vue b/src/view/choose-community.vue index fd5d994..36db093 100644 --- a/src/view/choose-community.vue +++ b/src/view/choose-community.vue @@ -1,4 +1,5 @@ From df20ce9e2dd31aac8c6e456b37d0183cfc0990f0 Mon Sep 17 00:00:00 2001 From: lfs3 Date: Fri, 6 Sep 2019 16:07:35 +0800 Subject: [PATCH 16/18] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=A4=9A=E4=BD=99?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/view/home.vue | 133 +++++++++++++++++++++++++++++----------------- 1 file changed, 84 insertions(+), 49 deletions(-) diff --git a/src/view/home.vue b/src/view/home.vue index 3d5618b..4a96437 100644 --- a/src/view/home.vue +++ b/src/view/home.vue @@ -425,7 +425,6 @@ export default { this.chooseCommunity(); }, getLocation() { - // let get = async () => { //判断是否在微信环境下操作 var ua = window.navigator.userAgent.toLowerCase(); //通过正则表达式匹配ua中是否含有MicroMessenger字符串 @@ -436,21 +435,10 @@ export default { this.getId(); this.getAddressInfo(); }); - // this.getData().then(result => { - // this.wxLocation({}) - // }); } else { // TODO 非微信环境用百度api this.getCity(); } - // }; - // return get(); - }, - getWXLocation() { - let get = async () => { - await this.wxLocation({}); - }; - return get(); }, getCity() { let _this = this; @@ -458,47 +446,94 @@ export default { geolocation.getCurrentPosition(function(r) { if (this.getStatus() == BMAP_STATUS_SUCCESS) { - // if(r.accuracy==null){ + var lat = r.point.lat; + var lng = r.point.lng; + const pointBak = new BMap.Point(lng, lat); + const convertor = new BMap.Convertor(); + convertor.translate([pointBak], 1, 5, function(resPoint) { + if (resPoint && resPoint.points && resPoint.points.length > 0) { + console.log("resPoint:"+resPoint.points[0]); + lng = resPoint.points[0].lng; + lat = resPoint.points[0].lat; + } + const point = new BMap.Point(lng, lat); + const geo = new BMap.Geocoder(); + geo.getLocation(point, res => { + if (res.addressComponents) { + const result = res.addressComponents; + const location = { + creditLongitude: point.lng, // 经度 + creditLatitude: point.lat, // 纬度 + 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 + ); + _this.getId(); + _this.getAddressInfo(); + } + }); + }); // 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.lng, // 经度 - creditLatitude: r.point.lat, // 纬度 - 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 - ); - _this.getId(); - _this.getAddressInfo(); - } - }); + // 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.lng, // 经度 + // creditLatitude: r.point.lat, // 纬度 + // 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 + // ); + // _this.getId(); + // _this.getAddressInfo(); + // } + // }); // } } }); From 288b19565662bb0f4507a723f2290795d5ff691a Mon Sep 17 00:00:00 2001 From: lfs3 Date: Thu, 12 Sep 2019 18:15:52 +0800 Subject: [PATCH 17/18] =?UTF-8?q?=E4=B8=8B=E5=8D=95=E5=8A=A0=E6=95=B0?= =?UTF-8?q?=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/view/order-check.vue | 64 +++++++++++++++++++++++++--------------- 1 file changed, 40 insertions(+), 24 deletions(-) diff --git a/src/view/order-check.vue b/src/view/order-check.vue index 33aecc3..910f3a5 100644 --- a/src/view/order-check.vue +++ b/src/view/order-check.vue @@ -14,10 +14,17 @@
-
{{info.goodsName}}
+
+
{{info.goodsName}}
+
¥{{info.totalPrice?info.totalPrice/100:''}}
+
{{info.shortDesc}}
-
¥{{info.totalPrice?info.totalPrice/100:''}}
+
+ +
+ +
{{item.labelText}} @@ -93,6 +100,7 @@