Browse Source

fix[litemall-wx,renard-wx]: 调整逻辑,修复收货地址删除仍然可以访问的问题

Junling Bu 6 years ago
parent
commit
edd0353694
2 changed files with 38 additions and 48 deletions
  1. 19 24
      litemall-wx/pages/checkout/checkout.js
  2. 19 24
      renard-wx/pages/shopping/checkout/checkout.js

+ 19 - 24
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) {
-        this.setData({
-          'grouponLinkId': grouponLinkId
-        });
+      if (grouponLinkId === "") {
+        grouponLinkId = 0;
       }
+
+      this.setData({
+        cartId: cartId,
+        addressId: addressId,
+        couponId: couponId,
+        grouponRulesId: grouponRulesId,
+        grouponLinkId: grouponLinkId
+      });
+
     } catch (e) {
       // Do something when catch error
       console.log(e);

+ 19 - 24
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) {
-        this.setData({
-          'grouponLinkId': grouponLinkId
-        });
+      if (grouponLinkId === "") {
+        grouponLinkId = 0;
       }
+
+      this.setData({
+        cartId: cartId,
+        addressId: addressId,
+        couponId: couponId,
+        grouponRulesId: grouponRulesId,
+        grouponLinkId: grouponLinkId
+      });
+      
     } catch (e) {
       // Do something when catch error
       console.log(e);