diff --git a/app.json b/app.json index 22cb676..80dacf0 100644 --- a/app.json +++ b/app.json @@ -1,6 +1,10 @@ { "pages": [ + + "pages/loding/loding", "pages/at_present/at_present", + "pages/city/city", + "pages/district/district", "pages/index/index", "pages/mall/mall", "pages/jz/jz", diff --git a/images/u40.png b/images/u40.png new file mode 100644 index 0000000..f740d3a Binary files /dev/null and b/images/u40.png differ diff --git a/libs/qqmap-wx-jssdk.js b/libs/qqmap-wx-jssdk.js new file mode 100644 index 0000000..4d53c58 --- /dev/null +++ b/libs/qqmap-wx-jssdk.js @@ -0,0 +1,462 @@ +/** + * 微信小程序JavaScriptSDK + * + * @version 1.0 + * @date 2017-01-10 + * @author jaysonzhou@tencent.com + */ + +var ERROR_CONF = { + KEY_ERR: 311, + KEY_ERR_MSG: 'key格式错误', + PARAM_ERR: 310, + PARAM_ERR_MSG: '请求参数信息有误', + SYSTEM_ERR: 600, + SYSTEM_ERR_MSG: '系统错误', + WX_ERR_CODE: 1000, + WX_OK_CODE: 200 +}; +var BASE_URL = 'https://apis.map.qq.com/ws/'; +var URL_SEARCH = BASE_URL + 'place/v1/search'; +var URL_SUGGESTION = BASE_URL + 'place/v1/suggestion'; +var URL_GET_GEOCODER = BASE_URL + 'geocoder/v1/'; +var URL_CITY_LIST = BASE_URL + 'district/v1/list'; +var URL_AREA_LIST = BASE_URL + 'district/v1/getchildren'; +var URL_DISTANCE = BASE_URL + 'distance/v1/'; +var Utils = { + /** + * 得到终点query字符串 + * @param {Array|String} 检索数据 + */ + location2query(data) { + if (typeof data == 'string') { + return data; + } + var query = ''; + for (var i = 0; i < data.length; i++) { + var d = data[i]; + if (!!query) { + query += ';'; + } + if (d.location) { + query = query + d.location.lat + ',' + d.location.lng; + } + if (d.latitude && d.longitude) { + query = query + d.latitude + ',' + d.longitude; + } + } + return query; + }, + + /** + * 使用微信接口进行定位 + */ + getWXLocation(success, fail, complete) { + wx.getLocation({ + type: 'gcj02', + success: success, + fail: fail, + complete: complete + }); + }, + + /** + * 获取location参数 + */ + getLocationParam(location) { + if (typeof location == 'string') { + var locationArr = location.split(','); + if (locationArr.length === 2) { + location = { + latitude: location.split(',')[0], + longitude: location.split(',')[1] + }; + } else { + location = {}; + } + } + return location; + }, + + /** + * 回调函数默认处理 + */ + polyfillParam(param) { + param.success = param.success || function () { }; + param.fail = param.fail || function () { }; + param.complete = param.complete || function () { }; + }, + + /** + * 验证param对应的key值是否为空 + * + * @param {Object} param 接口参数 + * @param {String} key 对应参数的key + */ + checkParamKeyEmpty(param, key) { + if (!param[key]) { + var errconf = this.buildErrorConfig(ERROR_CONF.PARAM_ERR, ERROR_CONF.PARAM_ERR_MSG + key +'参数格式有误'); + param.fail(errconf); + param.complete(errconf); + return true; + } + return false; + }, + + /** + * 验证参数中是否存在检索词keyword + * + * @param {Object} param 接口参数 + */ + checkKeyword(param){ + return !this.checkParamKeyEmpty(param, 'keyword'); + }, + + /** + * 验证location值 + * + * @param {Object} param 接口参数 + */ + checkLocation(param) { + var location = this.getLocationParam(param.location); + if (!location || !location.latitude || !location.longitude) { + var errconf = this.buildErrorConfig(ERROR_CONF.PARAM_ERR, ERROR_CONF.PARAM_ERR_MSG + ' location参数格式有误') + param.fail(errconf); + param.complete(errconf); + return false; + } + return true; + }, + + /** + * 构造错误数据结构 + * @param {Number} errCode 错误码 + * @param {Number} errMsg 错误描述 + */ + buildErrorConfig(errCode, errMsg) { + return { + status: errCode, + message: errMsg + }; + }, + + /** + * 构造微信请求参数,公共属性处理 + * + * @param {Object} param 接口参数 + * @param {Object} param 配置项 + */ + buildWxRequestConfig(param, options) { + var that = this; + options.header = { "content-type": "application/json" }; + options.method = 'GET'; + options.success = function (res) { + var data = res.data; + if (data.status === 0) { + param.success(data); + } else { + param.fail(data); + } + }; + options.fail = function (res) { + res.statusCode = ERROR_CONF.WX_ERR_CODE; + param.fail(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, result.errMsg)); + }; + options.complete = function (res) { + var statusCode = +res.statusCode; + switch(statusCode) { + case ERROR_CONF.WX_ERR_CODE: { + param.complete(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg)); + break; + } + case ERROR_CONF.WX_OK_CODE: { + var data = res.data; + if (data.status === 0) { + param.complete(data); + } else { + param.complete(that.buildErrorConfig(data.status, data.message)); + } + break; + } + default:{ + param.complete(that.buildErrorConfig(ERROR_CONF.SYSTEM_ERR, ERROR_CONF.SYSTEM_ERR_MSG)); + } + + } + } + return options; + }, + + /** + * 处理用户参数是否传入坐标进行不同的处理 + */ + locationProcess(param, locationsuccess, locationfail, locationcomplete) { + var that = this; + locationfail = locationfail || function (res) { + res.statusCode = ERROR_CONF.WX_ERR_CODE; + param.fail(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg)); + }; + locationcomplete = locationcomplete || function (res) { + if (res.statusCode == ERROR_CONF.WX_ERR_CODE) { + param.complete(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg)); + } + }; + if (!param.location) { + that.getWXLocation(locationsuccess, locationfail, locationcomplete); + } else if (that.checkLocation(param)) { + var location = Utils.getLocationParam(param.location); + locationsuccess(location); + } + } +} + + +class QQMapWX { + + /** + * 构造函数 + * + * @param {Object} options 接口参数,key 为必选参数 + */ + constructor(options) { + if (!options.key) { + throw Error('key值不能为空'); + } + this.key = options.key; + } + + /** + * POI周边检索 + * + * @param {Object} options 接口参数对象 + * + * 参数对象结构可以参考 + * @see http://lbs.qq.com/webservice_v1/guide-search.html + */ + search(options) { + var that = this; + options = options || {}; + + Utils.polyfillParam(options); + + if (!Utils.checkKeyword(options)) { + return; + } + + var requestParam = { + keyword: options.keyword, + orderby: options.orderby || '_distance', + page_size: options.page_size || 10, + page_index: options.page_index || 1, + output: 'json', + key: that.key + }; + + if (options.address_format) { + requestParam.address_format = options.address_format; + } + + if (options.filter) { + requestParam.filter = options.filter; + } + + var distance = options.distance || "1000"; + var auto_extend = options.auto_extend || 1; + + var locationsuccess = function (result) { + requestParam.boundary = "nearby(" + result.latitude + "," + result.longitude + "," + distance + "," + auto_extend +")"; + wx.request(Utils.buildWxRequestConfig(options, { + url: URL_SEARCH, + data: requestParam + })); + } + Utils.locationProcess(options, locationsuccess); + } + + /** + * sug模糊检索 + * + * @param {Object} options 接口参数对象 + * + * 参数对象结构可以参考 + * http://lbs.qq.com/webservice_v1/guide-suggestion.html + */ + getSuggestion(options) { + var that = this; + options = options || {}; + Utils.polyfillParam(options); + + if (!Utils.checkKeyword(options)) { + return; + } + + var requestParam = { + keyword: options.keyword, + region: options.region || '全国', + region_fix: options.region_fix || 0, + policy: options.policy || 0, + output: 'json', + key: that.key + }; + wx.request(Utils.buildWxRequestConfig(options, { + url: URL_SUGGESTION, + data: requestParam + })); + } + + /** + * 逆地址解析 + * + * @param {Object} options 接口参数对象 + * + * 请求参数结构可以参考 + * http://lbs.qq.com/webservice_v1/guide-gcoder.html + */ + reverseGeocoder(options) { + var that = this; + options = options || {}; + Utils.polyfillParam(options); + var requestParam = { + coord_type: options.coord_type || 5, + get_poi: options.get_poi || 0, + output: 'json', + key: that.key + }; + if (options.poi_options) { + requestParam.poi_options = options.poi_options + } + + var locationsuccess = function (result) { + requestParam.location = result.latitude + ',' + result.longitude; + wx.request(Utils.buildWxRequestConfig(options, { + url: URL_GET_GEOCODER, + data: requestParam + })); + }; + Utils.locationProcess(options, locationsuccess); + } + + /** + * 地址解析 + * + * @param {Object} options 接口参数对象 + * + * 请求参数结构可以参考 + * http://lbs.qq.com/webservice_v1/guide-geocoder.html + */ + geocoder(options) { + var that = this; + options = options || {}; + Utils.polyfillParam(options); + + if (Utils.checkParamKeyEmpty(options, 'address')) { + return; + } + + var requestParam = { + address: options.address, + output: 'json', + key: that.key + }; + + wx.request(Utils.buildWxRequestConfig(options, { + url: URL_GET_GEOCODER, + data: requestParam + })); + } + + + /** + * 获取城市列表 + * + * @param {Object} options 接口参数对象 + * + * 请求参数结构可以参考 + * http://lbs.qq.com/webservice_v1/guide-region.html + */ + getCityList(options) { + var that = this; + options = options || {}; + Utils.polyfillParam(options); + var requestParam = { + output: 'json', + key: that.key + }; + + wx.request(Utils.buildWxRequestConfig(options, { + url: URL_CITY_LIST, + data: requestParam + })); + } + + /** + * 获取对应城市ID的区县列表 + * + * @param {Object} options 接口参数对象 + * + * 请求参数结构可以参考 + * http://lbs.qq.com/webservice_v1/guide-region.html + */ + getDistrictByCityId(options) { + var that = this; + options = options || {}; + Utils.polyfillParam(options); + + if (Utils.checkParamKeyEmpty(options, 'id')) { + return; + } + + var requestParam = { + id: options.id || '', + output: 'json', + key: that.key + }; + + wx.request(Utils.buildWxRequestConfig(options, { + url: URL_AREA_LIST, + data: requestParam + })); + } + + /** + * 用于单起点到多终点的路线距离(非直线距离)计算: + * 支持两种距离计算方式:步行和驾车。 + * 起点到终点最大限制直线距离10公里。 + * + * @param {Object} options 接口参数对象 + * + * 请求参数结构可以参考 + * http://lbs.qq.com/webservice_v1/guide-distance.html + */ + calculateDistance(options) { + var that = this; + options = options || {}; + Utils.polyfillParam(options); + + if (Utils.checkParamKeyEmpty(options, 'to')) { + return; + } + + var requestParam = { + mode: options.mode || 'walking', + to: Utils.location2query(options.to), + output: 'json', + key: that.key + }; + + var locationsuccess = function (result) { + requestParam.from = result.latitude + ',' + result.longitude; + wx.request(Utils.buildWxRequestConfig(options, { + url: URL_DISTANCE, + data: requestParam + })); + } + if (options.from) { + options.location = options.from; + } + + Utils.locationProcess(options, locationsuccess); + } +} + +module.exports = QQMapWX; \ No newline at end of file diff --git a/pages/activity_detail/activity_detail.wxml b/pages/activity_detail/activity_detail.wxml index 3dea652..de827d6 100644 --- a/pages/activity_detail/activity_detail.wxml +++ b/pages/activity_detail/activity_detail.wxml @@ -79,7 +79,7 @@ - {{buttomText}} + {{buttomText}} ¥{{activityDetail.participantPrice / 100}} diff --git a/pages/at_present/at_present.js b/pages/at_present/at_present.js index 41662c3..1248674 100644 --- a/pages/at_present/at_present.js +++ b/pages/at_present/at_present.js @@ -1,42 +1,131 @@ -// pages/demo/demo.js +//获取应用实例 +const app = getApp() +var QQMapWX = require('../../libs/qqmap-wx-jssdk.js'); +var util = require("../../utils/util.js"); +var qqmapsdk; +var city; +var district; +// var cityId; +// var districtId; +// var merchantNo +/** + * 页面的初始数据 + */ Page({ - /** - * 页面的初始数据 - */ - data: {}, - // 引入腾讯地图文件js - // var QQMapWX = require('../../libs/qqmap-wx-jssdk.js'), - // var qqmapsdk + data: { + resData: [], + showOrHidden: false, + + }, onLoad: function (options) { - this.getLocation(); + let that = this;  + qqmapsdk = new QQMapWX({ + key: 'C5KBZ-RISKD-INW4P-PWYQJ-QC6C7-BQBGC' + }); + // wx.getStorage({ + // key: 'merchantNo', + // success: function (res) { + // console.log(res.data) + // if (res.data == '') { + // console.log(1111); + // } else { + // console.log(6666); + // wx.switchTab({ + // url: '../index/index' + // }) + // } + // that.setData({ + // merchantNo: res.data + // }) + // console.log(222); + // // that.setData({ userName: res.data }); + // } + // }); }, - getLocation() { + onReady: function () { var that = this; wx.getLocation({ - type: "wgs84", + type: 'wgs84', success: function (res) { - var locationString = res.latitude + "," + res.longitude; - wx.request({ - url: "https://apis.map.qq.com/ws/geocoder/v1/", - data: { - key: "C5KBZ-RISKD-INW4P-PWYQJ-QC6C7-BQBGC", - location: locationString - }, - method: "GET", + qqmapsdk.reverseGeocoder({ success: function (res) { - console.log("用户位置信息", res.data, that); - var district = res.data.result.ad_info.district; - var city = res.data.result.ad_info.city - console.log(city); - console.log(district); + let district = res.result.address_component.district; + let city = res.result.address_component.city; that.setData({ city, district }); + wx.request({ + url: app.gw.hostUrl + '/mall/wxa/index/OpenCity', + method: 'PUT', + data: { + cityName: city, + districtName:district + }, + header: { + 'Content-Type': 'application/x-www-form-urlencoded' + }, + success: function (res) { + // 打印对应想得到的数据 + console.log(res) + var cityId = res.data.response[0].cityId; + var cityName = res.data.response[0].cityName; + var districtId = res.data.response[0].districtId; + var districtName = res.data.response[0].districtName; + var merchantNo = res.data.response[0].merchantNo; + var lists = res.data.msg + that.setData({ + lists + }); + wx.setStorage({ + key: 'cityId', + data: cityId, + }); + wx.setStorage({ + key: 'cityName', + data:cityName, + }); + wx.setStorage({ + key: 'districtId', + data:districtId, + }); + wx.setStorage({ + key: 'districtName', + data:districtName, + }); + wx.setStorage({ + key: 'merchantNo', + data: merchantNo, + }); + } + }); } }); } - }); - } -}); - + }) + }, + groupTaps: function (e) { + var that = this; + //获取本地数据 + // wx.getStorage({ + // key: 'merchantNo', + // success: function (res) { + // if (res.data ==''){ + // console.log(1111); + // }else{ + // console.log(888); + // } + // // console.log(1111); + // // console.log(res.data); + // // that.setData({ merchantNo: res.data }); + + // // console.log(2222); + // // showOrhide:false; + + // } + // }); + wx.switchTab({ + // url: '../index/index' + }) + }, +}) \ No newline at end of file diff --git a/pages/at_present/at_present.wxml b/pages/at_present/at_present.wxml index 8b94e70..3c07b53 100644 --- a/pages/at_present/at_present.wxml +++ b/pages/at_present/at_present.wxml @@ -1,15 +1,16 @@ 当前定位地址: - {{city}}{{district}} - 此区/县暂未开放,敬请期待 - 手动切换地址 - - - 确定 - 切换 - + + {{city}}{{district}} - - + {{lists}} + 手动切换地址 + + 确定 + 切换 + + + + \ No newline at end of file diff --git a/pages/at_present/at_present.wxss b/pages/at_present/at_present.wxss index c924c30..7d24ae7 100644 --- a/pages/at_present/at_present.wxss +++ b/pages/at_present/at_present.wxss @@ -32,13 +32,29 @@ padding-bottom: 30rpx; } .choice{ width: 100%; + border-top:1px solid #ccc; + height:100rpx; +line-height:100rpx; + } + .confirm_left{ - width: 50%; - display: inline-block; +width:49%; +display:inline-block; +color:#1E90FF; +border-right:1px solid #ccc; } .confirm_right{ width: 50%; display: inline-block; - padding-bottom: 30rpx; + /* padding-bottom: 30rpx; */ + color: #1E90FF; +} + +.hide { + display: none; +} + +.show { + display: block; } \ No newline at end of file diff --git a/pages/city/city.js b/pages/city/city.js new file mode 100644 index 0000000..725a22b --- /dev/null +++ b/pages/city/city.js @@ -0,0 +1,41 @@ + +//获取应用实例 +const app = getApp() +Page({ + onLoad: function (options) { + // this.setData({ + // title: options.title + // }); + var that = this + wx.request({ + url: app.gw.hostUrl + '/mall/wxa/index/opencitylist', + data: { cityName: 'cityName' }, + method: 'GET', + header: { + 'Content-Type': 'application/x-www-form-urlencoded' + }, + success: function (res) { + console.log(res.data) + var citys = res.data; + console.log(citys); + that.setData({ + citys + }); + }, + fail: function () { + // fail + }, + }) + }, + openGroup: function (e) { + // console.log(e.currentTarget.dataset.item) + wx.setStorage({ + key: 'cityId', + data: e.currentTarget.dataset.item, + }); + wx.navigateTo({ + url: '../district/district?cityId=' + e.currentTarget.dataset.item, + }) + + }, +}) \ No newline at end of file diff --git a/pages/city/city.json b/pages/city/city.json new file mode 100644 index 0000000..60e5793 --- /dev/null +++ b/pages/city/city.json @@ -0,0 +1,5 @@ +{ + "navigationBarTitleText": "选择城市", + "enablePullDownRefresh": true, + "backgroundColor": "#F7F7F7" +} \ No newline at end of file diff --git a/pages/city/city.wxml b/pages/city/city.wxml new file mode 100644 index 0000000..70760b7 --- /dev/null +++ b/pages/city/city.wxml @@ -0,0 +1,13 @@ + + + +定位区域 {{title}} + + +已开通城市 + + {{citys.cityName}} + + + +其他城市暂未开放,敬请期待 \ No newline at end of file diff --git a/pages/city/city.wxss b/pages/city/city.wxss new file mode 100644 index 0000000..c1e85a9 --- /dev/null +++ b/pages/city/city.wxss @@ -0,0 +1,37 @@ +.top{ + background-color: #ccc; + height: 100rpx; + width: 100%; + margin-top: 20rpx; + line-height:100rpx; + +} +.top_area{ +margin-left: 30rpx; +margin-right: 70rpx; +color:#666; + +} +.top_site{ + text-align: center; + color: #1E90FF; +} +.top_hint{ + color: #666; + padding-left:30rpx; + height: 100rpx; + line-height: 100rpx; + border-bottom:1px solid #DEDEDE; +} +.top_city{ + height: 80rpx; + line-height: 80rpx; + border-bottom:1px solid #DEDEDE; + padding-left:100rpx; +} +.presenting{ + font-size: 30rpx; +height: 180rpx; +line-height: 180rpx; +text-align: center; +} \ No newline at end of file diff --git a/pages/district/district.js b/pages/district/district.js new file mode 100644 index 0000000..04ebd26 --- /dev/null +++ b/pages/district/district.js @@ -0,0 +1,68 @@ +//获取应用实例 +const app = getApp() +var cityId +Page({ + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + cityId = options.cityId; + + // console.log(cityId); + // let str = e.currentTarget.dataset.item; + let that = this; + console.log(cityId); + wx.request({ + url: app.gw.hostUrl + '/mall/wxa/index/opendistictlist', + method: 'get', + data: { + cityId: cityId, + }, + header: { + 'Content-Type': 'application/x-www-form-urlencoded' + }, + success: function (res) { + + var districts = res.data; + console.log(districts) + that.setData({ + districts + }); + }, + fail: function (res) { + wx.showToast({ + title: '加载数据失败', + }); + }, + }) + }, + openGroup: function (e) { + wx.setStorage({ + key: 'cityId', + data: e.currentTarget.dataset.item.cityId, + }); + wx.setStorage({ + key: 'cityName', + data: e.currentTarget.dataset.item.cityName, + }); + wx.setStorage({ + key: 'districtId', + data: e.currentTarget.dataset.item.districtId, + }); + wx.setStorage({ + key: 'districtName', + data: e.currentTarget.dataset.item.districtName, + }); + wx.setStorage({ + key: 'merchantNo', + data: e.currentTarget.dataset.item.merchantNo, + }); + wx.switchTab({ + url: '../index/index' + }) + }, + + +}) \ No newline at end of file diff --git a/pages/district/district.json b/pages/district/district.json new file mode 100644 index 0000000..fd0941d --- /dev/null +++ b/pages/district/district.json @@ -0,0 +1,5 @@ +{ + "navigationBarTitleText": "选择区/县", + "enablePullDownRefresh": true, + "backgroundColor": "#F7F7F7" +} \ No newline at end of file diff --git a/pages/district/district.wxml b/pages/district/district.wxml new file mode 100644 index 0000000..8339f16 --- /dev/null +++ b/pages/district/district.wxml @@ -0,0 +1,6 @@ +已开通区/县 + + + {{districts.districtName}} + +其他区/县暂未开放,敬请期待 \ No newline at end of file diff --git a/pages/district/district.wxss b/pages/district/district.wxss new file mode 100644 index 0000000..905b6d7 --- /dev/null +++ b/pages/district/district.wxss @@ -0,0 +1,28 @@ +.top{ + background-color: #ccc; + height: 100rpx; + width: 100%; + margin-top: 20rpx; + line-height:100rpx; + +} + +.top_hint{ + color: #666; + padding-left:30rpx; + height: 100rpx; + line-height: 100rpx; + border-bottom:1px solid #DEDEDE; +} +.top_city{ + height: 80rpx; + line-height: 80rpx; + border-bottom:1px solid #DEDEDE; + padding-left:100rpx; +} +.presenting{ + font-size: 30rpx; +height: 180rpx; +line-height: 180rpx; +text-align: center; +} \ No newline at end of file diff --git a/pages/index/index.js b/pages/index/index.js index 67f63c9..efd36b1 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -11,6 +11,7 @@ Page({ interval: 5000, duration: 1000, imgUrls: [], + merchantNo:'', // bannerImage: '/images/activity_banner.png', menu_list:[ { name: '拼团', disabled:false, className:'green_button'}, @@ -23,11 +24,12 @@ Page({ pageNum: 1, pageSize: 20, hasMoreData: true, - img1: '/images/title-icon.png', - cityId: 440100000, - typeNum: 10, - addrArray: { id: [440100000, 430426000], name: ['长沙', '深圳', '上海', '长沙', '武汉', '杭州', '北京'] }, + img1: '/images/u40.png', + // cityId: 440100000, + // typeNum: 10, + // addrArray: { id: [440100000, 430426000], name: ['长沙', '深圳', '上海', '长沙', '武汉', '杭州', '北京'] }, addrIndex: 0, + cityName:'', }, /** * 城市选择 @@ -44,11 +46,38 @@ Page({ */ onLoad: function (options) { let that = this; + // //获取本地数据 + // // 获取地址 + // wx.getStorage({ + // key: 'cityName', + // success: function (res) { + // console.log(111111111111111111) + // console.log(res.data) + // that.setData({ + // cityName: res.data + // }) + // console.log(222222222222222222) + + // // that.setData({ userName: res.data }); + // } + // }); + // // 商家编号 + // wx.getStorage({ + // key: 'merchantNo', + // success: function (res) { + // console.log(6666666666666666666666) + // console.log(res.data) + // that.setData({ + // merchantNo: res.data + // }) + // console.log(888888888888888888888888) + // } + // }); wx.request({ url: app.gw.hostUrl + '/mall/wxa/activity/banner', method: 'get', data: { - merchantNo: 'SH180331153109966163' + merchantNo: that.merchantNo }, header: { 'Content-Type': 'application/x-www-form-urlencoded' @@ -88,7 +117,7 @@ Page({ url: app.gw.hostUrl + '/mall/wxa/activity/list', method: 'get', data: { - merchantNo: 'SH180331153109966163', + merchantNo: that.merchantNo, // selectedCityId: that.data.addrArray.id[that.data.addrIndex] == undefined ? 0 : that.data.addrArray.id[that.data.addrIndex], pageNum: that.data.pageNum, pageSize: that.data.pageSize @@ -162,7 +191,26 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function () { - + let that = this; + //获取本地数据 + // 获取地址 + wx.getStorage({ + key: 'cityName', + success: function (res) { + that.setData({ + cityName: res.data + }) + } + }); + // 商家编号 + wx.getStorage({ + key: 'merchantNo', + success: function (res) { + that.setData({ + merchantNo: res.data + }) + } + }); }, /** diff --git a/pages/index/index.wxml b/pages/index/index.wxml index 5c33d43..71a599f 100644 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -2,15 +2,13 @@ - - {{addrArray.name[0]}} + {{cityName}} + + - - + + + diff --git a/pages/index/index.wxss b/pages/index/index.wxss index 18cb7cb..30704a1 100644 --- a/pages/index/index.wxss +++ b/pages/index/index.wxss @@ -6,25 +6,36 @@ .header { width: 100%; - background-color: #26ae76; + background-color: #21BE8D; } + .title_img { width: 24%; margin: 10rpx 10%; display: inline-block; } +.top-left{ + width: 100%; + display: inline-block; + vertical-align: super; + text-align: center; -.top-left, .top-right { +} +.imgs{ + width: 20rpx; + margin-right:10rpx; +} + /* .top-right { width: 28%; display: inline-block; vertical-align: super; -} +} */ .address { font-size: 30rpx; color: #fff; - margin-left: 44rpx; + /* margin-left: 44rpx; */ } .middle { diff --git a/pages/loding/loding.js b/pages/loding/loding.js new file mode 100644 index 0000000..2095b98 --- /dev/null +++ b/pages/loding/loding.js @@ -0,0 +1,92 @@ +// pages/demo/demo.js +var QQMapWX = require('../../libs/qqmap-wx-jssdk.js'); + +var util = require("../../utils/util.js"); + +var qqmapsdk; +/** + * 页面的初始数据 + */ +Page({ + data: { + hiddenLoading: false, + resData: [] + }, + onLoad: function (options) {   // 实例化腾讯地图API核心类 + let that = this;  + qqmapsdk = new QQMapWX({ + key: 'C5KBZ-RISKD-INW4P-PWYQJ-QC6C7-BQBGC' + }); + wx.getStorage({ + key: 'merchantNo', + success: function (res) { + console.log(res.data) + if (res.data == '') { + console.log(1111); + // 页面渲染完成 + var tt = this; + setTimeout(function () { + tt.setData({ + hiddenLoading: true + }); + tt.update(); + }, 2000); + wx.getSetting({ + success: function (res) { + if (res.authSetting['scope.userInfo']) { + //授权了 + wx.navigateTo({ + url: '../at_present/at_present', + }) + } else { + //未授权 + wx.navigateTo({ + url: '../city/city/?1', + }) + } + } + }); + + } else { + console.log(6666); + wx.switchTab({ + url: '../index/index' + }) + } + that.setData({ + merchantNo: res.data + }) + console.log(222); + // that.setData({ userName: res.data }); + } + }); + + }, + + onReady: function () { + // // 页面渲染完成 + // var tt = this; + // setTimeout(function () { + // tt.setData({ + // hiddenLoading: true + // }); + // tt.update(); + // }, 2000); + // wx.getSetting({ + // success: function (res) { + // if (res.authSetting['scope.userInfo']) { + // //授权了 + // wx.navigateTo({ + // url: '../at_present/at_present', + // }) + // } else { + // //未授权 + // wx.navigateTo({ + // url: '../city/city/?1', + // }) + // } + // } + // }); + + }, +}) \ No newline at end of file diff --git a/pages/loding/loding.json b/pages/loding/loding.json new file mode 100644 index 0000000..077404a --- /dev/null +++ b/pages/loding/loding.json @@ -0,0 +1,3 @@ +{ + +} \ No newline at end of file diff --git a/pages/loding/loding.wxml b/pages/loding/loding.wxml new file mode 100644 index 0000000..0277891 --- /dev/null +++ b/pages/loding/loding.wxml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/pages/loding/loding.wxss b/pages/loding/loding.wxss new file mode 100644 index 0000000..e69de29 diff --git a/pages/order/order.wxml b/pages/order/order.wxml index 6e67572..f0d59dd 100644 --- a/pages/order/order.wxml +++ b/pages/order/order.wxml @@ -13,7 +13,7 @@ - + 未付款