|
@@ -22,6 +22,7 @@ Page({
|
|
|
size: 3,
|
|
|
list: [],
|
|
|
openAttr: false,
|
|
|
+ isMapShow: ''
|
|
|
},
|
|
|
showCouponPop() {
|
|
|
let that = this;
|
|
@@ -65,7 +66,17 @@ Page({
|
|
|
// groupBanner: res.data.groupBanner,
|
|
|
channel: res.data.channel
|
|
|
});
|
|
|
- if (that.data.hotGoods.length==0){
|
|
|
+ // console.log(that.data.hotGoods.length)
|
|
|
+ // console.log(wx.getStorageSync('storeId'))
|
|
|
+ // console.log(wx.getStorageSync('mapIndexStoreId'))
|
|
|
+ if (that.data.hotGoods.length == 0){
|
|
|
+ that.getGoodsList();
|
|
|
+ }
|
|
|
+ if (wx.getStorageSync('storeId') != wx.getStorageSync('mapIndexStoreId')){
|
|
|
+ that.setData({
|
|
|
+ hotGoods: [],
|
|
|
+ page: 1
|
|
|
+ });
|
|
|
that.getGoodsList();
|
|
|
}
|
|
|
}
|
|
@@ -103,8 +114,8 @@ Page({
|
|
|
onLoad: function (options) {
|
|
|
let that = this;
|
|
|
wx.setStorageSync("navUrl", "/pages/index/index");
|
|
|
+ // options.scene = 38;
|
|
|
if (options.scene) {
|
|
|
- console.log("has scene");
|
|
|
var scene = decodeURIComponent(options.scene);
|
|
|
console.log("scene is ", scene);
|
|
|
that.setData({
|
|
@@ -112,6 +123,7 @@ Page({
|
|
|
});
|
|
|
wx.setStorageSync('storeId', scene);
|
|
|
} else {
|
|
|
+ wx.removeStorageSync('storeId');
|
|
|
console.log("no scene");
|
|
|
}
|
|
|
},
|
|
@@ -186,6 +198,11 @@ Page({
|
|
|
},
|
|
|
success: function (wxRes) {
|
|
|
if (wxRes.data.errno === 0) {
|
|
|
+ that.setData({
|
|
|
+ isMapShow: wxRes.data.data.isMapShow
|
|
|
+ });
|
|
|
+ wx.setStorageSync('thirdPartyMerchCode', wxRes.data.data.thirdPartyMerchCode);
|
|
|
+ // console.log(that.data.isMapShow)
|
|
|
// console.log("用户信息更新成功");
|
|
|
}
|
|
|
},
|
|
@@ -206,43 +223,37 @@ Page({
|
|
|
//获取附件门店信息
|
|
|
util.getLocation((lng, lat) => {
|
|
|
wx.setStorageSync('location', JSON.stringify({ lng, lat }));
|
|
|
- util.request(api.NearbyList, { longitude: lng, latitude: lat, storeId: that.data.storeId }).then((res) => {
|
|
|
+ let storeId = wx.getStorageSync('storeId');
|
|
|
+ util.request(api.NearbyList, { longitude: lng, latitude: lat, storeId: storeId, thirdPartyMerchCode: '' }).then((res) => {
|
|
|
let nlist = res.data;
|
|
|
- // console.log(nlist);
|
|
|
- wx.removeStorageSync('nearStoreList');
|
|
|
- wx.removeStorageSync('storeId');
|
|
|
- wx.removeStorageSync('storeVo');
|
|
|
- // console.log('sasas:' + wx.getStorageSync('currentCategory'));
|
|
|
+ // wx.removeStorageSync('nearStoreList');
|
|
|
+ // wx.removeStorageSync('storeId');
|
|
|
+ // wx.removeStorageSync('storeVo');
|
|
|
+ // wx.setStorageSync('storeId', storeId);
|
|
|
if (!wx.getStorageSync('currentCategory')) {
|
|
|
wx.removeStorageSync('currentCategory');
|
|
|
}
|
|
|
if (!nlist.length) {
|
|
|
wx.removeStorageSync('nearStoreList');
|
|
|
+ wx.removeStorageSync('mapIndexStoreId');
|
|
|
} else {
|
|
|
wx.setStorageSync('nearStoreList', JSON.stringify(nlist));
|
|
|
+ wx.setStorageSync('mapIndexStoreId', nlist[0].id);
|
|
|
}
|
|
|
- if (!wx.getStorageSync('storeId')) {
|
|
|
- if (!nlist.length) {
|
|
|
- wx.removeStorageSync('storeId');
|
|
|
- wx.removeStorageSync('storeVo');
|
|
|
- that.setData({
|
|
|
- storeName: '附近暂无门店'
|
|
|
- })
|
|
|
- } else {
|
|
|
- that.setData({
|
|
|
- storeName: nlist[0].storeName,
|
|
|
- storeId: nlist[0].id
|
|
|
- })
|
|
|
- that.chooseStore(nlist[0].id, nlist[0].merchSn);
|
|
|
- wx.setStorageSync('storeVo', JSON.stringify(nlist[0]));
|
|
|
- }
|
|
|
+
|
|
|
+ if (!nlist.length) {
|
|
|
+ wx.removeStorageSync('storeId');
|
|
|
+ wx.removeStorageSync('storeVo');
|
|
|
+ that.setData({
|
|
|
+ storeName: '附近暂无门店'
|
|
|
+ })
|
|
|
} else {
|
|
|
- var storeVo = JSON.parse(wx.getStorageSync('storeVo'));
|
|
|
- that.chooseStore(storeVo.id, storeVo.merchSn);
|
|
|
that.setData({
|
|
|
- storeName: storeVo.storeName,
|
|
|
- storeId: storeVo.id
|
|
|
- });
|
|
|
+ storeName: nlist[0].storeName,
|
|
|
+ storeId: nlist[0].id
|
|
|
+ })
|
|
|
+ that.chooseStore(nlist[0].id, nlist[0].merchSn);
|
|
|
+ wx.setStorageSync('storeVo', JSON.stringify(nlist[0]));
|
|
|
}
|
|
|
})
|
|
|
});
|
|
@@ -525,7 +536,6 @@ Page({
|
|
|
},
|
|
|
|
|
|
shows: function (e) {
|
|
|
-
|
|
|
wx.redirectTo({
|
|
|
url: '/pages/images/images'
|
|
|
})
|