|
|
@@ -66,6 +66,7 @@ Page({
|
|
|
},
|
|
|
|
|
|
onLoad: function () {
|
|
|
+ console.log('load');
|
|
|
// 实例化API核心类
|
|
|
qqmapsdk = new QQMapWX({
|
|
|
key: 'D3MBZ-LQK6U-IONVC-GJDPK-C43GF-UYFOC'
|
|
|
@@ -161,32 +162,32 @@ Page({
|
|
|
wx.setStorageSync('LATITUDE', res.latitude)
|
|
|
wx.setStorageSync('LONGITUDE', res.longitude)
|
|
|
// 调用腾讯地图api获取当前位置
|
|
|
- qqmapsdk.reverseGeocoder({
|
|
|
- location: {
|
|
|
- latitude: latitude,
|
|
|
- longitude: longitude
|
|
|
- },
|
|
|
- success: function (res) {
|
|
|
- console.log(res.result, '---address_success');
|
|
|
- wx.setStorageSync('ADDRESS', res.result.address_component.street)
|
|
|
- that.setData({
|
|
|
- select_address: wx.getStorageSync('ADDRESS')
|
|
|
- })
|
|
|
- },
|
|
|
- fail: function (res) {
|
|
|
- console.log(res, '---address_err');
|
|
|
- wx.showToast({
|
|
|
- title: res + '地址信息获取失败',
|
|
|
- icon: "none"
|
|
|
- })
|
|
|
- setTimeout(() => {
|
|
|
- wx.hideToast();
|
|
|
- }, 2000)
|
|
|
- },
|
|
|
- complete: function (res) {
|
|
|
- // console.log(res, '---callback');
|
|
|
- }
|
|
|
- });
|
|
|
+ // qqmapsdk.reverseGeocoder({
|
|
|
+ // location: {
|
|
|
+ // latitude: latitude,
|
|
|
+ // longitude: longitude
|
|
|
+ // },
|
|
|
+ // success: function (res) {
|
|
|
+ // console.log(res.result, '---address_success');
|
|
|
+ // wx.setStorageSync('ADDRESS', res.result.address_component.street)
|
|
|
+ // that.setData({
|
|
|
+ // select_address: wx.getStorageSync('ADDRESS')
|
|
|
+ // })
|
|
|
+ // },
|
|
|
+ // fail: function (res) {
|
|
|
+ // console.log(res, '---address_err');
|
|
|
+ // wx.showToast({
|
|
|
+ // title: res + '地址信息获取失败',
|
|
|
+ // icon: "none"
|
|
|
+ // })
|
|
|
+ // setTimeout(() => {
|
|
|
+ // wx.hideToast();
|
|
|
+ // }, 2000)
|
|
|
+ // },
|
|
|
+ // complete: function (res) {
|
|
|
+ // // console.log(res, '---callback');
|
|
|
+ // }
|
|
|
+ // });
|
|
|
},
|
|
|
fail: function (err) {
|
|
|
wx.removeStorageSync('ADDRESS')
|
|
|
@@ -577,19 +578,24 @@ Page({
|
|
|
showShopList:true
|
|
|
})
|
|
|
}
|
|
|
- res.forEach(item=>{
|
|
|
+
|
|
|
+ for (let i = 0; i < res.length; i++) {
|
|
|
+ const item = res[i];
|
|
|
if(item.hasProduct){
|
|
|
+ console.log('==========================');
|
|
|
wx.setStorageSync('shopInfo', item)
|
|
|
// this.getaddress_transports(item.shopId)
|
|
|
this.setData({
|
|
|
shop_id: item.shopId,
|
|
|
shopName:item.shopName
|
|
|
})
|
|
|
+ this.getClassInfo(item.shopId);
|
|
|
resolve()
|
|
|
- return this.getClassInfo(item.shopId);
|
|
|
+ break; // 直接终止整个循环(输出1,2)
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
- })
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
};
|
|
|
http.request(params);
|
|
|
@@ -766,7 +772,8 @@ Page({
|
|
|
})
|
|
|
|
|
|
},
|
|
|
- getAllData() {
|
|
|
+ getAllData(type) {
|
|
|
+ console.log('=========type',type);
|
|
|
this.setData({
|
|
|
current:1,
|
|
|
shop_id: wx.getStorageSync("shopInfo").shopId,
|
|
|
@@ -780,9 +787,13 @@ Page({
|
|
|
this.getRecommended()
|
|
|
this.getRecommendeds()
|
|
|
this.getAdv()
|
|
|
- this.get_neighborShop().then(res=>{
|
|
|
+ if(type == 'refresh'){//切换店铺
|
|
|
this.getHotSalesProds()
|
|
|
- })
|
|
|
+ }else{
|
|
|
+ this.get_neighborShop().then(res=>{
|
|
|
+ this.getHotSalesProds()
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
//加载轮播图
|