From d674ed628a1f7da6598793251bd8311930f10efe Mon Sep 17 00:00:00 2001 From: shuiqing Date: Thu, 19 Jul 2018 21:02:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=B7=B3=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/at_present/at_present.js | 9 +++++++-- pages/at_present/at_present.wxml | 6 ++++-- pages/city/city.js | 25 +++++++++++++++++++++++-- pages/city/city.wxml | 2 +- pages/district/district.js | 18 +++++++++--------- pages/index/index.js | 18 +++++++++++++++++- pages/index/index.wxml | 5 ++--- pages/index/index.wxss | 5 ----- 8 files changed, 63 insertions(+), 25 deletions(-) diff --git a/pages/at_present/at_present.js b/pages/at_present/at_present.js index 63a9b76..b2ee2e0 100644 --- a/pages/at_present/at_present.js +++ b/pages/at_present/at_present.js @@ -49,8 +49,8 @@ Page({ wx.getLocation({ type: 'wgs84', success: function(res) { - // qqmapsdk.reverseGeocoder({ - qqmapsdk.search({ + qqmapsdk.reverseGeocoder({ + // qqmapsdk.search({ success: function(res) { let district = res.result.address_component.district; let city = res.result.address_component.city; @@ -117,6 +117,11 @@ Page({ }) }, + openGroup:function(e){ + wx.navigateTo({ + url: '../city/city', + }) + }, groupTaps: function(e) { var that = this; //获取本地数据 diff --git a/pages/at_present/at_present.wxml b/pages/at_present/at_present.wxml index d9fa344..5cca0a3 100644 --- a/pages/at_present/at_present.wxml +++ b/pages/at_present/at_present.wxml @@ -6,10 +6,12 @@ {{lists}} - 手动切换地址 + 手动切换地址 + 确定 - 切换 + 切换 + \ No newline at end of file diff --git a/pages/city/city.js b/pages/city/city.js index 4a088ee..9401aaf 100644 --- a/pages/city/city.js +++ b/pages/city/city.js @@ -3,9 +3,30 @@ const app = getApp() Page({ onLoad: function (options) { - this.setData({ - title: options.title + // 商家编号 + wx.getStorage({ + key: 'cityName', + success: function (res) { + that.setData({ + cityName: res.data + }) + } + }); + // 商家编号 + wx.getStorage({ + key: 'districtName', + success: function (res) { + that.setData({ + districtName: res.data + }) + } }); + // console.log(2) + // console.log(options.titles) + // console.log(1) + // this.setData({ + // titles: options.titles + // }); var that = this wx.request({ url: app.gw.hostUrl + '/mall/wxa/index/opencitylist', diff --git a/pages/city/city.wxml b/pages/city/city.wxml index 353813e..53715a4 100644 --- a/pages/city/city.wxml +++ b/pages/city/city.wxml @@ -1,5 +1,5 @@ -定位区域 {{title}} +定位区域 {{cityName}}{{districtName}} 已开通城市 diff --git a/pages/district/district.js b/pages/district/district.js index ca71e48..7226308 100644 --- a/pages/district/district.js +++ b/pages/district/district.js @@ -7,16 +7,16 @@ Page({ */ onLoad: function (options) { let that = this; - wx.getStorage({ - key: 'merchantNo', - success: function (res) { - that.setData({ - merchantNo: res.data - }) - console.log(222); + // wx.getStorage({ + // key: 'merchantNo', + // success: function (res) { + // that.setData({ + // merchantNo: res.data + // }) + // console.log(222); - } - }); + // } + // }); wx.getStorage({ key: 'districtName', success: function (res) { diff --git a/pages/index/index.js b/pages/index/index.js index 6afb29d..00e64dd 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -25,6 +25,7 @@ Page({ pageSize: 20, hasMoreData: true, img1: '/images/u40.png', + // cityId: 440100000, // typeNum: 10, // addrArray: { id: [440100000, 430426000], name: ['长沙', '深圳', '上海', '长沙', '武汉', '杭州', '北京'] }, @@ -46,6 +47,7 @@ Page({ */ onLoad: function (options) { let that = this; + //获取本地数据 // 获取地址 wx.getStorage({ @@ -60,11 +62,22 @@ Page({ wx.getStorage({ key: 'merchantNo', success: function (res) { + console.log(1) + console.log(res.data) + console.log(1) that.setData({ merchantNo: res.data }) } }); + wx.getStorage({ + key: 'cityName', + success: function (res) { + that.setData({ + cityName: res.data + }) + } + }); wx.request({ url: app.gw.hostUrl + '/mall/wxa/activity/banner', method: 'get', @@ -77,6 +90,7 @@ Page({ success: function (res) { var data = res.data; var status = data.code; + console.log(data.msg) if (status == 0) { var data = res.data; var status = data.code; @@ -86,7 +100,7 @@ Page({ }) } else { wx.showToast({ - title: data.msg, + title: data.msg, icon: 'none', duration: 3000 }); @@ -154,6 +168,7 @@ Page({ wx.showToast({ title: '加载数据失败', }); + console.log(res) }, complete: function (res) { // complete @@ -163,6 +178,7 @@ Page({ }) }, + /** * 点击去开团 */ diff --git a/pages/index/index.wxml b/pages/index/index.wxml index ad02bb7..c758aad 100644 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -2,11 +2,10 @@ - {{districtName}} + {{districtName}} - + - diff --git a/pages/index/index.wxss b/pages/index/index.wxss index 30704a1..d3520d1 100644 --- a/pages/index/index.wxss +++ b/pages/index/index.wxss @@ -10,11 +10,6 @@ } -.title_img { - width: 24%; - margin: 10rpx 10%; - display: inline-block; -} .top-left{ width: 100%; display: inline-block;