diff --git a/pages/at_present/at_present.js b/pages/at_present/at_present.js
index 1430dbc..e804763 100644
--- a/pages/at_present/at_present.js
+++ b/pages/at_present/at_present.js
@@ -3,11 +3,9 @@ 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
+// var city;
+// var district;
+
/**
* 页面的初始数据
*/
@@ -15,42 +13,28 @@ Page({
data: {
resData: [],
showOrHidden: false,
-
+ showorHide: false,
+ city: '',
+ district: '',
+ cityId: '',
+ districtId: '',
+ merchantNo: '',
},
- onLoad: function (options) {
+ onLoad: function(options) {
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 });
- // }
- // });
+ key: 'C5KBZ-RISKD-INW4P-PWYQJ-QC6C7-BQBGC'
+ });
},
- onReady: function () {
+ onReady: function() {
var that = this;
wx.getLocation({
type: 'wgs84',
- success: function (res) {
+ success: function(res) {
qqmapsdk.reverseGeocoder({
- success: function (res) {
- let district = res.result.address_component.district;
- let city = res.result.address_component.city;
+ success: function(res) {
+ let district = res.result.address_component.district;
+ let city = res.result.address_component.city;
that.setData({
city,
district
@@ -60,19 +44,19 @@ Page({
method: 'PUT',
data: {
cityName: city,
- districtName:district
+ 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;
+ 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
@@ -83,15 +67,15 @@ Page({
});
wx.setStorage({
key: 'cityName',
- data:cityName,
+ data: cityName,
});
wx.setStorage({
key: 'districtId',
- data:districtId,
+ data: districtId,
});
wx.setStorage({
key: 'districtName',
- data:districtName,
+ data: districtName,
});
wx.setStorage({
key: 'merchantNo',
@@ -99,12 +83,18 @@ Page({
});
}
});
- }
+ },
+ fail: function(res) {
+ showorHide: false,
+ wx.showToast({
+ title: '加载数据失败',
+ });
+ },
});
}
})
},
- groupTaps: function (e) {
+ groupTaps: function(e) {
var that = this;
//获取本地数据
// wx.getStorage({
@@ -118,10 +108,10 @@ Page({
// // console.log(1111);
// // console.log(res.data);
// // that.setData({ merchantNo: res.data });
-
+
// // console.log(2222);
// // showOrhide:false;
-
+
// }
// });
wx.switchTab({
diff --git a/pages/at_present/at_present.wxml b/pages/at_present/at_present.wxml
index 3c07b53..d9fa344 100644
--- a/pages/at_present/at_present.wxml
+++ b/pages/at_present/at_present.wxml
@@ -4,13 +4,12 @@
{{city}}{{district}}
- {{lists}}
+
+ {{lists}}
手动切换地址
确定
切换
-
-
\ No newline at end of file
diff --git a/pages/city/city.wxml b/pages/city/city.wxml
index 70760b7..353813e 100644
--- a/pages/city/city.wxml
+++ b/pages/city/city.wxml
@@ -1,13 +1,9 @@
-
-
定位区域 {{title}}
-
已开通城市
{{citys.cityName}}
-
其他城市暂未开放,敬请期待
\ No newline at end of file
diff --git a/pages/index/index.js b/pages/index/index.js
index 6d41508..6afb29d 100644
--- a/pages/index/index.js
+++ b/pages/index/index.js
@@ -51,26 +51,18 @@ Page({
wx.getStorage({
key: 'districtName',
success: function (res) {
- console.log(111111111111111111)
- console.log(res.data)
that.setData({
districtName: 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({
@@ -88,7 +80,7 @@ Page({
if (status == 0) {
var data = res.data;
var status = data.code;
- console.log(res);
+ // console.log(res);
that.setData({
imgUrls: data.response
})
diff --git a/pages/loding/loding.js b/pages/loding/loding.js
index 58df3c5..65eda0b 100644
--- a/pages/loding/loding.js
+++ b/pages/loding/loding.js
@@ -16,15 +16,15 @@ Page({
let that = this;
qqmapsdk = new QQMapWX({
key: 'C5KBZ-RISKD-INW4P-PWYQJ-QC6C7-BQBGC'
+ //正式版 key: ' JN7BZ-MJBK5-52SIH-QOKGH-FJE5F-IWFGG'
});
wx.getStorage({
key: 'merchantNo',
success: function (res) {
console.log(res.data)
if (res.data == '') {
-
+ that.queryCartList();
} else {
- console.log(6666);
wx.switchTab({
url: '../index/index'
})
@@ -32,20 +32,14 @@ Page({
that.setData({
merchantNo: res.data
})
- console.log(222);
- // that.setData({ userName: res.data });
+ },
+ fail: function (res) {
+ console.log(res)
+ that.queryCartList();
}
});
},
- onReady: function () {
- // 页面渲染完成
- var tt = this;
- setTimeout(function () {
- tt.setData({
- hiddenLoading: true
- });
- tt.update();
- }, 2000);
+ queryCartList: function () {
wx.getSetting({
success: function (res) {
if (res.authSetting['scope.userInfo']) {
@@ -56,12 +50,10 @@ Page({
} else {
//未授权
wx.switchTab({
- url: '../city/city/',
+ url: '../city/city',
})
}
}
});
-
}
-})
- // });
\ No newline at end of file
+})
\ No newline at end of file