From 17dbe3243c1f5f38366a9c4314206dc494971410 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B5=B7=E6=B4=8B=E4=B9=8B=E5=A3=B0?= Date: Fri, 27 Sep 2019 17:49:10 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E7=A7=AF=E5=88=86=E4=B8=8D=E8=B6=B3?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E6=94=B902=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index/index.js | 27 +++++++++++++++++++ .../payIntegcoupondetail/index.wxml | 2 +- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/index/index.js b/index/index.js index 6eac3bf..799f171 100644 --- a/index/index.js +++ b/index/index.js @@ -186,6 +186,7 @@ Page({ * 生命周期函数--监听页面初次渲染完成 */ onLoad: function(options) { + this.getLocation(); let that = this; let optionss; if (wx.getStorageSync('options')){ @@ -207,6 +208,32 @@ Page({ //获取条形码 // util.barcode("barcode", optionss.quancode, 510, 100); }, + /** + * 获得经纬度 + */ + getLocation() { + let that = this; + wx.getLocation({ + type: "wgs84", + success: function (res) { + console.log(res, 9999) + if (res && res.longitude && res.latitude) { + Http.post({ + url: config.api.updateLBS, + data: { + latitude: res.latitude, + longitude: res.longitude + } + }).then(res => { + console.log(res,9999) + }) + } + }, + fail: error => { + console.log(error); + } + }) + }, onShow: function() { if (typeof this.getTabBar === 'function' && this.getTabBar()) { diff --git a/pages/integralmall/payIntegcoupondetail/index.wxml b/pages/integralmall/payIntegcoupondetail/index.wxml index 3c49962..3a4a33a 100644 --- a/pages/integralmall/payIntegcoupondetail/index.wxml +++ b/pages/integralmall/payIntegcoupondetail/index.wxml @@ -35,7 +35,7 @@ - +