diff --git a/litemall-wx/pages/checkout/checkout.js b/litemall-wx/pages/checkout/checkout.js index 79c3e82e..5444d163 100644 --- a/litemall-wx/pages/checkout/checkout.js +++ b/litemall-wx/pages/checkout/checkout.js @@ -79,39 +79,34 @@ Page({ }); try { var cartId = wx.getStorageSync('cartId'); - if (cartId) { - this.setData({ - 'cartId': cartId - }); + if (cartId === "") { + cartId = 0; } - var addressId = wx.getStorageSync('addressId'); - if (addressId) { - this.setData({ - 'addressId': addressId - }); + if (addressId === "") { + addressId = 0; } - var couponId = wx.getStorageSync('couponId'); - if (couponId) { - this.setData({ - 'couponId': couponId - }); + if (couponId === "") { + couponId = 0; } - var grouponRulesId = wx.getStorageSync('grouponRulesId'); - if (grouponRulesId) { - this.setData({ - 'grouponRulesId': grouponRulesId - }); + if (grouponRulesId === "") { + grouponRulesId = 0; + } + var grouponLinkId = wx.getStorageSync('grouponLinkId'); + if (grouponLinkId === "") { + grouponLinkId = 0; } - var grouponLinkId = wx.getStorageSync('grouponLinkId'); - if (grouponLinkId) { - this.setData({ - 'grouponLinkId': grouponLinkId - }); - } + this.setData({ + cartId: cartId, + addressId: addressId, + couponId: couponId, + grouponRulesId: grouponRulesId, + grouponLinkId: grouponLinkId + }); + } catch (e) { // Do something when catch error console.log(e); diff --git a/renard-wx/pages/shopping/checkout/checkout.js b/renard-wx/pages/shopping/checkout/checkout.js index 9f4cb071..65a149aa 100644 --- a/renard-wx/pages/shopping/checkout/checkout.js +++ b/renard-wx/pages/shopping/checkout/checkout.js @@ -68,39 +68,34 @@ Page({ }); try { var cartId = wx.getStorageSync('cartId'); - if (cartId) { - this.setData({ - 'cartId': cartId - }); + if (cartId === "") { + cartId = 0; } - var addressId = wx.getStorageSync('addressId'); - if (addressId) { - this.setData({ - 'addressId': addressId - }); + if (addressId === "") { + addressId = 0; } - var couponId = wx.getStorageSync('couponId'); - if (couponId) { - this.setData({ - 'couponId': couponId - }); + if (couponId === "") { + couponId = 0; } - var grouponRulesId = wx.getStorageSync('grouponRulesId'); - if (grouponRulesId) { - this.setData({ - 'grouponRulesId': grouponRulesId - }); + if (grouponRulesId === "") { + grouponRulesId = 0; + } + var grouponLinkId = wx.getStorageSync('grouponLinkId'); + if (grouponLinkId === "") { + grouponLinkId = 0; } - var grouponLinkId = wx.getStorageSync('grouponLinkId'); - if (grouponLinkId) { - this.setData({ - 'grouponLinkId': grouponLinkId - }); - } + this.setData({ + cartId: cartId, + addressId: addressId, + couponId: couponId, + grouponRulesId: grouponRulesId, + grouponLinkId: grouponLinkId + }); + } catch (e) { // Do something when catch error console.log(e);