浏览代码

no message

leoone8322 1 年之前
父节点
当前提交
3425f4896b
共有 3 个文件被更改,包括 87 次插入84 次删除
  1. 2 2
      pages/category/category.js
  2. 84 81
      pages/index/index.js
  3. 1 1
      pages/tabBar/catalog/catalog.js

+ 2 - 2
pages/category/category.js

@@ -57,7 +57,7 @@ Page({
     util.request(api.GoodsCategory, {
         id: this.data.attribute?'-1':this.data.id,
         attribute:this.data.attribute,
-        shopId:this.data.addressInfo.shopId,
+        //shopId:this.data.addressInfo.shopId,
         city:this.data.addressInfo.city
       })
       .then( (res)=>{
@@ -130,7 +130,7 @@ Page({
         page: that.data.page,
         limit: that.data.limit,
         city:that.data.addressInfo.city,
-        shopId:that.data.addressInfo.shopId
+        //shopId:that.data.addressInfo.shopId
       })
       .then(function (res) {
         console.info(res);

+ 84 - 81
pages/index/index.js

@@ -29,7 +29,7 @@ Page({
       lng: 121.4737,
       lat: 31.23037,
       address: "上海市浦东新区祖冲之路1505弄100号3栋",
-      shopName:'',
+      shopName: '',
     },
     showModalStatus: false,
     couponsData: []
@@ -62,7 +62,7 @@ Page({
     console.info(that.data.addressInfo.shopId)
     util.request(api.IndexUrl, {
       city: that.data.addressInfo.city,
-      shopId: that.data.addressInfo.shopId
+      //shopId: that.data.addressInfo.shopId
     }).then(function (res) {
       if (res.errno === 0) {
         that.setData({
@@ -123,91 +123,93 @@ Page({
 
       //三种格式(1) rId,2   (2)g,3;rId,2 (3)g,3;rId,3;sId:10(阿姨开单分享)
       //shopId=1031;
-      if(scene.indexOf("shopId") >= 0){
-       let sceneStr= scene.split('=');
+      if (scene.indexOf("shopId") >= 0) {
+        let sceneStr = scene.split('=');
         let shopId = sceneStr[1];
-        console.log('scene:shopId='+shopId);
+        console.log('scene:shopId=' + shopId);
         // 通过shopId获取地址信息
-        app.globalData.shopId=shopId;
-        util.request(api.OrderBookGetShop,{shopId:shopId}).then(res=>{
-          if(res.errno==0){
+        app.globalData.shopId = shopId;
+        util.request(api.OrderBookGetShop, {
+          shopId: shopId
+        }).then(res => {
+          if (res.errno == 0) {
             console.log(res);
-            var addressInfo={
-              address:res.data.address,
-              lng:res.data.longitude,
-              lat:res.data.latitude,
-              shopId:res.data.shopId,
-              city:res.data.city,
-              shopName:res.data.shopName
+            var addressInfo = {
+              address: res.data.address,
+              lng: res.data.longitude,
+              lat: res.data.latitude,
+              shopId: res.data.shopId,
+              city: res.data.city,
+              shopName: res.data.shopName
             }
             wx.setStorageSync('addressInfo', addressInfo);
             console.log(addressInfo);
             that.getLocation();
 
           }
-        
-         
-        }).catch(res=>{
-          
-        }); 
-      }else{
-           
-      if (scene.indexOf("rId") >= 0 || scene.indexOf("r_userid") >= 0) { //兼容之前的r_userid
-        let value = null;
-        if (scene.indexOf(";") > 0) { //包含分号 表示是good和user两种
-          value = scene.split(";")[1];
-          //console.info(value);
-          wx.setStorageSync('r_userid', value.split(",")[1]); //获取r_userid
-          if (scene.indexOf("sId") >= 0 || scene.indexOf("shareId") >= 0) { //阿姨开单分享id  ||兼容之前的shareId
-            shareId = scene.split(";")[2].split(",")[1];
-          }
-          scene = scene.split(";")[0];
-          //console.info(scene);
 
-        } else {
-          value = scene;
-          wx.setStorageSync('r_userid', value.split(",")[1]);
 
-          // 引荐人分享
-          console.log('只有rid,进入引荐人');
-          let rId = value.split(",")[1];
-          wx.navigateTo({
-            url: '../ucenter/parter/recommend/recommend?rId=' + rId
-          });
+        }).catch(res => {
+
+        });
+      } else {
 
-          // return; //结束逻辑 不在往下进行;   
+        if (scene.indexOf("rId") >= 0 || scene.indexOf("r_userid") >= 0) { //兼容之前的r_userid
+          let value = null;
+          if (scene.indexOf(";") > 0) { //包含分号 表示是good和user两种
+            value = scene.split(";")[1];
+            //console.info(value);
+            wx.setStorageSync('r_userid', value.split(",")[1]); //获取r_userid
+            if (scene.indexOf("sId") >= 0 || scene.indexOf("shareId") >= 0) { //阿姨开单分享id  ||兼容之前的shareId
+              shareId = scene.split(";")[2].split(",")[1];
+            }
+            scene = scene.split(";")[0];
+            //console.info(scene);
+
+          } else {
+            value = scene;
+            wx.setStorageSync('r_userid', value.split(",")[1]);
+
+            // 引荐人分享
+            console.log('只有rid,进入引荐人');
+            let rId = value.split(",")[1];
+            wx.navigateTo({
+              url: '../ucenter/parter/recommend/recommend?rId=' + rId
+            });
+
+            // return; //结束逻辑 不在往下进行;   
+          }
         }
-      }
 
 
-      let info_arr = [];
-      info_arr = scene.split(',');
-      let _type = info_arr[0];
-      let id = info_arr[1];
-      console.info(_type);
+        let info_arr = [];
+        info_arr = scene.split(',');
+        let _type = info_arr[0];
+        let id = info_arr[1];
+        console.info(_type);
 
-      if (_type == 'goods' || _type == 'g') {
-        if (shareId) {
+        if (_type == 'goods' || _type == 'g') {
+          if (shareId) {
+            wx.navigateTo({
+              url: '../goods/goods?id=' + id + '&shareId=' + shareId
+            });
+          } else {
+            let rId = wx.getStorageSync('r_userid');
+            if (!rId) rId = 0;
+
+            wx.navigateTo({
+              url: '../goods/goods?id=' + id + '&rId=' + rId
+            });
+          }
+        } else if (_type == 'groupon') {
           wx.navigateTo({
-            url: '../goods/goods?id=' + id + '&shareId=' + shareId
+            url: '../goods/goods?grouponId=' + id
           });
         } else {
-          let rId = wx.getStorageSync('r_userid');
-          if (!rId) rId = 0;
-
           wx.navigateTo({
-            url: '../goods/goods?id=' + id + '&rId=' + rId
+            url: '../index/index'
           });
         }
-      } else if (_type == 'groupon') {
-        wx.navigateTo({
-          url: '../goods/goods?grouponId=' + id
-        });
-      } else {
-        wx.navigateTo({
-          url: '../index/index'
-        });
-      }
 
 
 
@@ -253,8 +255,9 @@ Page({
      * 2:未登录 取当前地理位置判断
      */
     var addressInfo = wx.getStorageSync("addressInfo");
-    if (addressInfo) {
-      console.info(addressInfo);
+    if (addressInfo) { 
+      console.info(1);
+      console.info(addressInfo.shopId==null);
       that.setData({
         addressInfo: addressInfo
       })
@@ -314,23 +317,23 @@ Page({
   onReady: function () {
     // 页面渲染完成
   },
-  onShow: function () { 
+  onShow: function () {
     //this.naviToMiniProgram();
-    if(!app.globalData.shopId){
+    if (!app.globalData.shopId) {
       this.getLocation();
     }
-   
-  }, 
-  naviToMiniProgram(){
-    let that=this;
+
+  },
+  naviToMiniProgram() {
+    let that = this;
     wx.showModal({
       title: '温馨提示',
       content: '尊敬的客户,鲸致生活小程序已迁移到【鲸致生活lifeplus】,您的相关权益也全部迁移保留,请点击确认 使用新小程序。',
-      showCancel: false,//是否显示取消按钮
-      cancelText: "取消",//默认是“取消”
-      cancelColor: '#000000',//取消文字的颜色
-      confirmText: "确认跳转",//默认是“确定”
-      confirmColor: '#3cc51f',//确定文字的颜色
+      showCancel: false, //是否显示取消按钮
+      cancelText: "取消", //默认是“取消”
+      cancelColor: '#000000', //取消文字的颜色
+      confirmText: "确认跳转", //默认是“确定”
+      confirmColor: '#3cc51f', //确定文字的颜色
       success: function (res) {
         if (res.cancel) {
           //点击取消,wx.navigateBack
@@ -350,11 +353,11 @@ Page({
           })
         }
       },
-      fail: function (res) { 
-        
+      fail: function (res) {
+
         //接口调用失败的回调函数,wx.navigateBack
       },
-      complete: function (res) { 
+      complete: function (res) {
         console.info(res)
         //接口调用结束的回调函数(调用成功、失败都会执行)
       },

+ 1 - 1
pages/tabBar/catalog/catalog.js

@@ -75,7 +75,7 @@ Page({
     let that=this;
     util.request(api.GoodsL1Category,{
       id:that.data.currentCategory.name=='热销商品'?'-1':that.data.currentCategory.id,
-      shopId:that.data.addressInfo.shopId,
+      //shopId:that.data.addressInfo.shopId,
 			isHot:that.data.currentCategory.name=='热销商品'?true:false,
 			city:that.data.addressInfo.city
     }).then(res=>{