diff --git a/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.js b/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.js index aa7d00f..c415f00 100644 --- a/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.js +++ b/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.js @@ -203,7 +203,6 @@ Page({ onLoad: function (t) { self = this; this.setData({options: t,}); - var ee = this, that = ee, th = ee, gid = t.goods_id, first_leader = t.first_leader; @@ -241,17 +240,28 @@ Page({ if (gid == undefined || gid == null || gid == "") { var gid_str = decodeURIComponent(t.scene); gid_str = gid_str.split("_"); - gid = gid_str[0]; + gid = parseInt(gid_str[0]); + that.data.options.goods_id=gid; + + if (gid_str.length > 1) { first_leader = gid_str[1]; } //-- 如果有room_id的获取 -- if (gid_str.length > 2 && gid_str[2]) { - room_id = gid_str[2]; + room_id = parseInt(gid_str[2]); room_user_share = 1; + + that.data.options.room_id=room_id; + that.data.options.prom_type= parseInt(gid_str[3]); + that.data.options.prom_id=parseInt(gid_str[4]); } + + this.setData({options: that.data.options}); + } + //-- 如果有房间号 -- if (room_id) { getApp().globalData.room_id = room_id; @@ -261,10 +271,7 @@ Page({ getApp().globalData.room_user_share = room_user_share; } - - ee.setData({gid: gid}); - if (first_leader) { getApp().globalData.first_leader = first_leader; //调用接口判断是不是会员 @@ -1145,10 +1152,7 @@ Page({ } var title = th.data.data.goods_name; var img = th.data.data.original_img; - if (th.data.prom_type == 6) { - title = th.data.prom_act.share_title; - img = th.data.iurl + th.data.prom_act.share_imgurl; - } + var url = "/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo?goods_id=" + th.data.gid; @@ -1163,6 +1167,12 @@ Page({ url += "&room_id=" + getApp().globalData.room_id + "&room_user_share=1"; } + //如果是拼团的时候 + if (th.data.prom_type == 6) { + title = th.data.prom_act.share_title; + img = th.data.iurl + th.data.prom_act.share_imgurl; + url += "&prom_id="+th.data.prom_id+"&prom_type=6"; + } var ob = { title: price + "元 " + title, @@ -1537,13 +1547,22 @@ Page({ var user_id = getApp().globalData.user_id ? getApp().globalData.user_id : 0; if (user_id > 0) { scene += "_" + user_id; + }else{ + scene += "_0"; } + //-- 如果不是会员分享过来的要分享给别人 -- if (getApp().globalData.room_id && th.data.data.goods_id == getApp().globalData.room_goods_id && !getApp().globalData.room_user_share) { //固定房间是第3个字符 - if (!user_id) scene += "_0"; scene += "_" + getApp().globalData.room_id; + }else{ + scene += "_0"; } + + scene += "_6"; + scene += "_"+this.data.prom_act.id ; + + ///二微码 var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + os.stoid + "?sceneValue=" + scene + "&pageValue=packageA/pages/serviceCard_pd/goodsInfo/goodsInfo"; @@ -2742,14 +2761,13 @@ Page({ } else { throw (res); } - ; }).catch(err => { + }); } - ; } - ; + }); }, @@ -2819,15 +2837,26 @@ Page({ th.countDown(endTime) }, 1000); }, - get_normal(gid) { - this.setData({ - prom_type: 0, - isshow: 1, - }); - this.get_sku(os.stoid, this.data.data, gid); - this.get_sto(); - //this.check_is_youhui(gid, 1); - this.data.is_normal = 1; + + get_normal(gid,txt) { + // this.setData({ + // prom_type: 0, + // isshow: 1, + // }); + // this.get_sku(os.stoid, this.data.data, gid); + // this.get_sto(); + // //this.check_is_youhui(gid, 1); + // this.data.is_normal = 1; + if(txt) { + wx.showToast({ + title: txt, + icon: 'none' + }); + } + setTimeout(() => { + getApp().goto('/pages/index/index/index'); + },2000) + }, //获取redis中的数量 async getactLen() { @@ -2866,24 +2895,24 @@ Page({ os.stoid + "/" + prom_id, { success: async function (t) { if (t.data.code != 0) { - ee.get_normal(gid); + ee.get_normal(gid,'未找到活动'); return false; } //----已经结束----- if (t.data.data.is_end == 1) { - ee.get_normal(gid); + ee.get_normal(gid,'活动已经结束'); return false; } //----已经过期----- var now = ut.gettimestamp(); if (t.data.data.end_time < now) { - ee.get_normal(gid); + ee.get_normal(gid,'活动已经结束'); return false; } /*-- 还没有开始预热的也不显示 --*/ if (t.data.data.show_time > now) { - ee.get_normal(gid); + ee.get_normal(gid,'活动还未开始'); return false; } @@ -2895,13 +2924,12 @@ Page({ }); wx.showToast({ title: '此商品暂时没有拼单活动', - icon: 'none', - success(){ - setTimeout(() => { - wx.navigateBack() - }, 2000) - } + icon: 'none' }); + + setTimeout(() => { + getApp().goto('/pages/index/index/index'); + },2000) return false } @@ -2923,7 +2951,16 @@ Page({ } }) if (!flag) { - ee.get_normal(gid); + //ee.get_normal(gid); + + wx.showToast({ + title: '会员无权限参与此活动', + icon: 'none' + }); + setTimeout(() => { + getApp().goto('/pages/index/index/index'); + },2000) + return false; }