diff --git a/pages/cart/cart.js b/pages/cart/cart.js index 409895e..dd9c824 100644 --- a/pages/cart/cart.js +++ b/pages/cart/cart.js @@ -29,6 +29,7 @@ Page({ // 页面显示 this.getCartList(); this.getCartNum(); + wx.removeStorageSync('categoryId'); }, onPullDownRefresh: function() { wx.showNavigationBarLoading() diff --git a/pages/category/index.js b/pages/category/index.js index 5511499..ff30556 100755 --- a/pages/category/index.js +++ b/pages/category/index.js @@ -88,27 +88,41 @@ Page({ }, onShow: function() { this.getChannelShowInfo(); + let id = this.data.nowId; let nowId = wx.getStorageSync('categoryId'); - this.setData({ - list: [], - allPage: 1, - allCount: 0, - size: 8, - loading: 1 - }) - if (nowId == 0 || nowId == undefined) { + if(id == 0 && nowId === 0){ + return false + } + else if (nowId == 0 && nowId === '') { + this.setData({ + list: [], + allPage: 1, + allCount: 0, + size: 8, + loading: 1 + }) this.getCurrentList(0); this.setData({ nowId: 0, currentCategory: {} }) - } else { + wx.setStorageSync('categoryId', 0) + } else if(id != nowId) { + this.setData({ + list: [], + allPage: 1, + allCount: 0, + size: 8, + loading: 1 + }) this.getCurrentList(nowId); this.getCurrentCategory(nowId); this.setData({ nowId: nowId }) + wx.setStorageSync('categoryId', nowId) } + this.getCatalog(); }, switchCate: function(e) { @@ -129,11 +143,12 @@ Page({ this.setData({ currentCategory: {} }) - wx.removeStorageSync('categoryId'); } else { + wx.setStorageSync('categoryId', id) this.getCurrentList(id); this.getCurrentCategory(id); } + wx.setStorageSync('categoryId', id) this.setData({ nowId: id }) diff --git a/pages/goods/goods.js b/pages/goods/goods.js index a318bd3..02c5a6e 100644 --- a/pages/goods/goods.js +++ b/pages/goods/goods.js @@ -115,9 +115,6 @@ Page({ }, getGoodsInfo: function() { let that = this; - wx.showLoading({ - title: '加载中...', - }); util.request(api.GoodsDetail, { id: that.data.id }).then(function(res) { @@ -147,10 +144,10 @@ Page({ productList: res.data.productList, checkedSpecPrice: res.data.info.retail_price, galleryImages: galleryImages, + loading:1 }); wx.setStorageSync('goodsImage', res.data.info.https_pic_url); } - wx.hideLoading(); }); }, clickSkuValue: function(event) { @@ -328,6 +325,8 @@ Page({ }, onShow: function() { let userInfo = wx.getStorageSync('userInfo'); + let info = wx.getSystemInfoSync(); + let sysHeight = info.windowHeight - 100; let userId = userInfo.id; if (userId > 0) { this.setData({ @@ -335,9 +334,9 @@ Page({ }); } this.setData({ - priceChecked: false + priceChecked: false, + sysHeight: sysHeight }) - this.getGoodsInfo(); this.getCartCount(); }, diff --git a/pages/goods/goods.wxml b/pages/goods/goods.wxml index b1b65eb..f679f4e 100644 --- a/pages/goods/goods.wxml +++ b/pages/goods/goods.wxml @@ -1,5 +1,5 @@ - + + + + 海风吹啊吹 \ No newline at end of file diff --git a/pages/goods/goods.wxss b/pages/goods/goods.wxss index 10bdf4b..e87b206 100644 --- a/pages/goods/goods.wxss +++ b/pages/goods/goods.wxss @@ -14,6 +14,29 @@ width: 100%; } + +.loading { + width: 100%; + height: 100%; + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; +} + +.loading .img { + width: 90rpx; + height: 90rpx; +} + +.loading .text { + margin-top: 20rpx; + width: 100%; + font-size: 24rpx; + color: #999; + text-align: center; +} + /* banner start */ .banner-wrap { diff --git a/pages/index/index.js b/pages/index/index.js index 25af9a8..8a9d216 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -87,11 +87,11 @@ Page({ }); }; let info = wx.getSystemInfoSync(); - let system = info.system; let sysHeight = info.windowHeight - 100; this.setData({ sysHeight: sysHeight - }) + }); + wx.removeStorageSync('categoryId'); }, getCartNum: function() { util.request(api.CartGoodsCount).then(function(res) { diff --git a/pages/index/index.wxml b/pages/index/index.wxml index e1f3de6..102b496 100644 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -99,5 +99,5 @@ - 努力加载中 + 海风吹啊吹 \ No newline at end of file diff --git a/pages/order-check/index.js b/pages/order-check/index.js index 9875cf4..f64c605 100755 --- a/pages/order-check/index.js +++ b/pages/order-check/index.js @@ -141,7 +141,7 @@ Page({ actualPrice: actualPrice, offlinePay:0 }, 'POST').then(res => { - console.log(res); + // console.log(res); if (res.errno === 0) { wx.removeStorageSync('orderId'); wx.setStorageSync('addressId', 0); @@ -162,7 +162,6 @@ Page({ }, offlineOrder: function (e) { let formId = e.detail.formId; - console.log(e) let offlinePay = e.currentTarget.dataset.off; if (this.data.addressId <= 0) { util.showErrorToast('请选择收货地址'); @@ -180,7 +179,6 @@ Page({ actualPrice: actualPrice, offlinePay:offlinePay }, 'POST').then(res => { - console.log(res); if (res.errno === 0) { wx.removeStorageSync('orderId'); wx.setStorageSync('addressId', 0); diff --git a/pages/share/index.js b/pages/share/index.js index 670f321..cffcb2d 100644 --- a/pages/share/index.js +++ b/pages/share/index.js @@ -60,7 +60,6 @@ Page({ id: id }).then(function(res) { if (res.errno === 0) { - // console.log(res.data); that.setData({ goods: res.data, }); diff --git a/pages/ucenter/index/index.js b/pages/ucenter/index/index.js index a8ee089..11a9743 100644 --- a/pages/ucenter/index/index.js +++ b/pages/ucenter/index/index.js @@ -76,6 +76,7 @@ Page({ userInfo: userInfo, }); this.getOrderInfo(); + wx.removeStorageSync('categoryId'); }, onPullDownRefresh: function() { diff --git a/pages/ucenter/order-list/index.js b/pages/ucenter/order-list/index.js index 37614e4..a403a3a 100644 --- a/pages/ucenter/order-list/index.js +++ b/pages/ucenter/order-list/index.js @@ -38,7 +38,6 @@ Page({ that.getOrderList(); that.getOrderInfo(); }).catch(res => { - console.log(res); util.showErrorToast(res.errmsg); }); },