1
0
Просмотр исходного кода

Merge branch 'master' of hyq/kmall-pt into master

黄亚琴 6 лет назад
Родитель
Сommit
170f973f84
2 измененных файлов с 27 добавлено и 13 удалено
  1. 22 10
      wx-mall/pages/index/index.js
  2. 5 3
      wx-mall/pages/ucenter/footprint/footprint.js

+ 22 - 10
wx-mall/pages/index/index.js

@@ -280,6 +280,8 @@ Page({
         if (that.scanType == 'QR_CODE') {//二维码
           that.substrValue = that.value.substring(0, 5);
           that.value = that.value.substring(5, that.value.length);
+          var goodId = that.value.substring(18, that.value.length);
+
           if (that.substrValue != 'emato') {//../goods/goods?id=
             wx.showModal({
               title: '',
@@ -294,17 +296,27 @@ Page({
               }
             });
           } else {
-            // 跳转页面
-            wx.navigateTo({
-              url: that.value,
-              success: function (e) {
-                console.log('跳转成功');
-              },
-              fail: function (e) {
-                console.log('跳转失败');
-              }
-            })
 
+            util.request(api.GoodsDetail, { id: goodId, referrer: '' }).then(function (res) {
+              if (res.errno === 0) {
+                // 跳转页面
+                wx.navigateTo({
+                  url: that.value,
+                  success: function (e) {
+                    console.log('跳转成功');
+                  },
+                  fail: function (e) {
+                    console.log('跳转失败');
+                  }
+                })
+              } else {
+                wx.showModal({
+                  title: '扫描结果',
+                  content: '商品不存在',
+                  showCancel: false
+                });
+              }
+            });
           }
         }else{//其他码
           //弹框显示结果

+ 5 - 3
wx-mall/pages/ucenter/footprint/footprint.js

@@ -13,9 +13,11 @@ Page({
     let that = this;
     util.request(api.FootprintList).then(function (res) {
       if (res.errno === 0) {
-        that.setData({
-          footprintList: res.data.data
-        });
+        if (res.data.data) {
+          that.setData({
+            footprintList: res.data.data
+          });
+        }
       }
     });
   },