diff --git a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js index 814fa70..d74395c 100644 --- a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js +++ b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js @@ -285,7 +285,12 @@ Page({ //------初始化加载---------- onLoad: function (t) { - if(t.group_id) { + + if(t && t.group_id) { + // wx.setStorage({ + // key: 'group_id', + // data: t.group_id, + // }); this.data.group_id = t.group_id; }; @@ -1044,7 +1049,8 @@ Page({ } }); - + + //获取单个活动已成团数量 getApp().request.get(`/api/weshop/prom/luckyTeam/getCtNum/${o.stoid}/${this.data.group_id}`, { success: function (res) { @@ -1117,10 +1123,10 @@ Page({ team_id: res.data.data.pageData[0].team_id, luckGoMembers: [], }); - wx.setStorage({ - key: 'team_id', - data: th.data.team_id, - }); + // wx.setStorage({ + // key: 'team_id', + // data: th.data.team_id, + // }); th.countDown(th.data.luckGoInfo.end_time, 0); }; @@ -1134,6 +1140,28 @@ Page({ }); + // 获取购买次数,判断是否已经超出限购 + // {store_id}/{user_id}/{aid} + let get_aid = this.data.prom_id || this.data.luckGoInfo.id; + await getApp().request.get('/api/weshop/prom/luckyOrder/countActNum/' + os.stoid + '/' + oo.user_id + '/' + get_aid, { + success: function (res) { + if(res.data.code == 0) { + console.log(oo.user_id, '判断是否超出限购,获取购买次数', res, ); + // th.setData({ + // num_joined: res.data.data, + // }); + let num_joined = res.data.data; + let group_join_num = th.data.luckGoInfo.group_join_num; + let canBuy = num_joined >= group_join_num ? false : true; + th.setData({ + canBuy, + }); + // console.log('canBuy', th.data.canBuy); + }; + }, + }); + + //获取参团成员 await getApp().request.promiseGet('/api/weshop/prom/luckyOrder/page', { data: { @@ -2376,66 +2404,92 @@ Page({ //--点击分享事件--- onShareAppMessage: function (t) { - var th = this; - var price = th.data.sele_g.shop_price; - if (th.data.prom_act) { - price = th.data.prom_act.price; + // var th = this; + // var price = th.data.sele_g.shop_price; + // if (th.data.prom_act) { + // price = th.data.prom_act.price; - } - var title = th.data.sele_g.goods_name; - var img = th.data.sele_g.original_img; - if (th.data.prom_type == 6 || th.data.prom_type == 1 || th.data.prom_type == 4) { - title = th.data.prom_act.share_title; - if (!title) title = th.data.prom_act.title; - if (th.data.prom_type == 4) title = th.data.prom_act.name; - - if (th.data.prom_act.share_imgurl) - img = th.data.iurl + th.data.prom_act.share_imgurl; - } + // } + // var title = th.data.sele_g.goods_name; + // var img = th.data.sele_g.original_img; + // if (th.data.prom_type == 6 || th.data.prom_type == 1 || th.data.prom_type == 4) { + // title = th.data.prom_act.share_title; + // if (!title) title = th.data.prom_act.title; + // if (th.data.prom_type == 4) title = th.data.prom_act.name; + + // if (th.data.prom_act.share_imgurl) + // img = th.data.iurl + th.data.prom_act.share_imgurl; + // } - var url = "/pages/goods/goodsInfo/goodsInfo?goods_id=" - + th.data.sele_g.goods_id+"&prom_type="+th.data.sele_g.prom_type+"&prom_id="+th.data.sele_g.prom_id; - if (getApp().globalData.user_id) { - url += "&first_leader=" + getApp().globalData.user_id; - } + // var url = "/pages/goods/goodsInfo/goodsInfo?goods_id=" + // + th.data.sele_g.goods_id+"&prom_type="+th.data.sele_g.prom_type+"&prom_id="+th.data.sele_g.prom_id; + // if (getApp().globalData.user_id) { + // url += "&first_leader=" + getApp().globalData.user_id; + // } - //-- 如果房间分享,且不是会员分享的 -- - if (getApp().globalData.room_id && - th.data.sele_g.goods_id == getApp().globalData.room_goods_id && - !getApp().globalData.room_user_share - ) { - url += "&room_id=" + getApp().globalData.room_id + "&room_user_share=1"; - } + // //-- 如果房间分享,且不是会员分享的 -- + // if (getApp().globalData.room_id && + // th.data.sele_g.goods_id == getApp().globalData.room_goods_id && + // !getApp().globalData.room_user_share + // ) { + // url += "&room_id=" + getApp().globalData.room_id + "&room_user_share=1"; + // } - var ob = { - title: price + "元 " + title, - path: url, - imageUrl: img, - }; - if (th.data.prom_type == 6) { - title += '\n' + th.data.prom_act.share_remark; - ob.title = title; - ob.desc = th.data.prom_act.share_remark; - } + // var ob = { + // title: price + "元 " + title, + // path: url, + // imageUrl: img, + // }; + // if (th.data.prom_type == 6) { + // title += '\n' + th.data.prom_act.share_remark; + // ob.title = title; + // ob.desc = th.data.prom_act.share_remark; + // } - //如果是积分购的时候 - if (th.data.prom_type == 4) { - var name = th.data.prom_act.name; - //-- 积分购的 -- - var pri0 = th.data.prom_act.addmoney; - var integral = th.data.prom_act.integral; - var text = ""; - if (integral) { text = integral + "积分"; } - if (pri0 && integral) { text += "+"; } - if (pri0) { text += "¥" + pri0; } - - ob.title = text + " " + name; - } + // //如果是积分购的时候 + // if (th.data.prom_type == 4) { + // var name = th.data.prom_act.name; + // //-- 积分购的 -- + // var pri0 = th.data.prom_act.addmoney; + // var integral = th.data.prom_act.integral; + // var text = ""; + // if (integral) { text = integral + "积分"; } + // if (pri0 && integral) { text += "+"; } + // if (pri0) { text += "¥" + pri0; } + + // ob.title = text + " " + name; + // } - //-- 页面不能刷新 -- - this.data.show_prew_img=1; - return ob; + // //-- 页面不能刷新 -- + // this.data.show_prew_img=1; + // return ob; + + + var img; + var pagePath = `packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo?goods_id=${this.data.sele_g.goods_id}&prom_type=9&group_id=${this.data.luckGoInfo.id}`; //当前页面url + console.log('pagePath=====xxxxxx>', pagePath); + // if (this.data.prom_act.share_imgurl) { + // img = this.data.iurl + this.data.prom_act.share_imgurl; + // } + // var img = th.data.sele_g.original_img; + var imgPath = this.data.iurl + this.data.luckGoInfo.original_img; + if (pagePath.indexOf('/') != 0) { + pagePath = '/' + pagePath; + } + // if(getApp().globalData.user_id){ + + // if(pagePath.indexOf("?")>0){ + // pagePath+="&first_leader="+getApp().globalData.user_id; + // }else{ + // pagePath+="?first_leader="+getApp().globalData.user_id; + // } + // } + return { + title: "邀您一起参加幸运购", + path: pagePath, + imageUrl: imgPath, + } }, diff --git a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml index b45faa9..ba6dfa9 100644 --- a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml +++ b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml @@ -923,8 +923,9 @@ 活动已经结束 查看详情 - 立即参团 + 立即参团 已经抢光了 + 已超限购次数 @@ -1508,7 +1509,7 @@ - +