Commit 6e929dd3cd9456136d4e284917d02849a35fc4ca
1 parent
f2bd08ce
商品详情转发
Showing
2 changed files
with
116 additions
and
61 deletions
packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js
@@ -285,7 +285,12 @@ Page({ | @@ -285,7 +285,12 @@ Page({ | ||
285 | //------初始化加载---------- | 285 | //------初始化加载---------- |
286 | onLoad: function (t) { | 286 | onLoad: function (t) { |
287 | 287 | ||
288 | - if(t.group_id) { | 288 | + |
289 | + if(t && t.group_id) { | ||
290 | + // wx.setStorage({ | ||
291 | + // key: 'group_id', | ||
292 | + // data: t.group_id, | ||
293 | + // }); | ||
289 | this.data.group_id = t.group_id; | 294 | this.data.group_id = t.group_id; |
290 | }; | 295 | }; |
291 | 296 | ||
@@ -1044,7 +1049,8 @@ Page({ | @@ -1044,7 +1049,8 @@ Page({ | ||
1044 | } | 1049 | } |
1045 | }); | 1050 | }); |
1046 | 1051 | ||
1047 | - | 1052 | + |
1053 | + | ||
1048 | //获取单个活动已成团数量 | 1054 | //获取单个活动已成团数量 |
1049 | getApp().request.get(`/api/weshop/prom/luckyTeam/getCtNum/${o.stoid}/${this.data.group_id}`, { | 1055 | getApp().request.get(`/api/weshop/prom/luckyTeam/getCtNum/${o.stoid}/${this.data.group_id}`, { |
1050 | success: function (res) { | 1056 | success: function (res) { |
@@ -1117,10 +1123,10 @@ Page({ | @@ -1117,10 +1123,10 @@ Page({ | ||
1117 | team_id: res.data.data.pageData[0].team_id, | 1123 | team_id: res.data.data.pageData[0].team_id, |
1118 | luckGoMembers: [], | 1124 | luckGoMembers: [], |
1119 | }); | 1125 | }); |
1120 | - wx.setStorage({ | ||
1121 | - key: 'team_id', | ||
1122 | - data: th.data.team_id, | ||
1123 | - }); | 1126 | + // wx.setStorage({ |
1127 | + // key: 'team_id', | ||
1128 | + // data: th.data.team_id, | ||
1129 | + // }); | ||
1124 | th.countDown(th.data.luckGoInfo.end_time, 0); | 1130 | th.countDown(th.data.luckGoInfo.end_time, 0); |
1125 | }; | 1131 | }; |
1126 | 1132 | ||
@@ -1134,6 +1140,28 @@ Page({ | @@ -1134,6 +1140,28 @@ Page({ | ||
1134 | }); | 1140 | }); |
1135 | 1141 | ||
1136 | 1142 | ||
1143 | + // 获取购买次数,判断是否已经超出限购 | ||
1144 | + // {store_id}/{user_id}/{aid} | ||
1145 | + let get_aid = this.data.prom_id || this.data.luckGoInfo.id; | ||
1146 | + await getApp().request.get('/api/weshop/prom/luckyOrder/countActNum/' + os.stoid + '/' + oo.user_id + '/' + get_aid, { | ||
1147 | + success: function (res) { | ||
1148 | + if(res.data.code == 0) { | ||
1149 | + console.log(oo.user_id, '判断是否超出限购,获取购买次数', res, ); | ||
1150 | + // th.setData({ | ||
1151 | + // num_joined: res.data.data, | ||
1152 | + // }); | ||
1153 | + let num_joined = res.data.data; | ||
1154 | + let group_join_num = th.data.luckGoInfo.group_join_num; | ||
1155 | + let canBuy = num_joined >= group_join_num ? false : true; | ||
1156 | + th.setData({ | ||
1157 | + canBuy, | ||
1158 | + }); | ||
1159 | + // console.log('canBuy', th.data.canBuy); | ||
1160 | + }; | ||
1161 | + }, | ||
1162 | + }); | ||
1163 | + | ||
1164 | + | ||
1137 | //获取参团成员 | 1165 | //获取参团成员 |
1138 | await getApp().request.promiseGet('/api/weshop/prom/luckyOrder/page', { | 1166 | await getApp().request.promiseGet('/api/weshop/prom/luckyOrder/page', { |
1139 | data: { | 1167 | data: { |
@@ -2376,66 +2404,92 @@ Page({ | @@ -2376,66 +2404,92 @@ Page({ | ||
2376 | //--点击分享事件--- | 2404 | //--点击分享事件--- |
2377 | onShareAppMessage: function (t) { | 2405 | onShareAppMessage: function (t) { |
2378 | 2406 | ||
2379 | - var th = this; | ||
2380 | - var price = th.data.sele_g.shop_price; | ||
2381 | - if (th.data.prom_act) { | ||
2382 | - price = th.data.prom_act.price; | 2407 | + // var th = this; |
2408 | + // var price = th.data.sele_g.shop_price; | ||
2409 | + // if (th.data.prom_act) { | ||
2410 | + // price = th.data.prom_act.price; | ||
2383 | 2411 | ||
2384 | - } | ||
2385 | - var title = th.data.sele_g.goods_name; | ||
2386 | - var img = th.data.sele_g.original_img; | ||
2387 | - if (th.data.prom_type == 6 || th.data.prom_type == 1 || th.data.prom_type == 4) { | ||
2388 | - title = th.data.prom_act.share_title; | ||
2389 | - if (!title) title = th.data.prom_act.title; | ||
2390 | - if (th.data.prom_type == 4) title = th.data.prom_act.name; | ||
2391 | - | ||
2392 | - if (th.data.prom_act.share_imgurl) | ||
2393 | - img = th.data.iurl + th.data.prom_act.share_imgurl; | ||
2394 | - } | 2412 | + // } |
2413 | + // var title = th.data.sele_g.goods_name; | ||
2414 | + // var img = th.data.sele_g.original_img; | ||
2415 | + // if (th.data.prom_type == 6 || th.data.prom_type == 1 || th.data.prom_type == 4) { | ||
2416 | + // title = th.data.prom_act.share_title; | ||
2417 | + // if (!title) title = th.data.prom_act.title; | ||
2418 | + // if (th.data.prom_type == 4) title = th.data.prom_act.name; | ||
2419 | + | ||
2420 | + // if (th.data.prom_act.share_imgurl) | ||
2421 | + // img = th.data.iurl + th.data.prom_act.share_imgurl; | ||
2422 | + // } | ||
2395 | 2423 | ||
2396 | 2424 | ||
2397 | - var url = "/pages/goods/goodsInfo/goodsInfo?goods_id=" | ||
2398 | - + th.data.sele_g.goods_id+"&prom_type="+th.data.sele_g.prom_type+"&prom_id="+th.data.sele_g.prom_id; | ||
2399 | - if (getApp().globalData.user_id) { | ||
2400 | - url += "&first_leader=" + getApp().globalData.user_id; | ||
2401 | - } | 2425 | + // var url = "/pages/goods/goodsInfo/goodsInfo?goods_id=" |
2426 | + // + th.data.sele_g.goods_id+"&prom_type="+th.data.sele_g.prom_type+"&prom_id="+th.data.sele_g.prom_id; | ||
2427 | + // if (getApp().globalData.user_id) { | ||
2428 | + // url += "&first_leader=" + getApp().globalData.user_id; | ||
2429 | + // } | ||
2402 | 2430 | ||
2403 | - //-- 如果房间分享,且不是会员分享的 -- | ||
2404 | - if (getApp().globalData.room_id && | ||
2405 | - th.data.sele_g.goods_id == getApp().globalData.room_goods_id && | ||
2406 | - !getApp().globalData.room_user_share | ||
2407 | - ) { | ||
2408 | - url += "&room_id=" + getApp().globalData.room_id + "&room_user_share=1"; | ||
2409 | - } | 2431 | + // //-- 如果房间分享,且不是会员分享的 -- |
2432 | + // if (getApp().globalData.room_id && | ||
2433 | + // th.data.sele_g.goods_id == getApp().globalData.room_goods_id && | ||
2434 | + // !getApp().globalData.room_user_share | ||
2435 | + // ) { | ||
2436 | + // url += "&room_id=" + getApp().globalData.room_id + "&room_user_share=1"; | ||
2437 | + // } | ||
2410 | 2438 | ||
2411 | - var ob = { | ||
2412 | - title: price + "元 " + title, | ||
2413 | - path: url, | ||
2414 | - imageUrl: img, | ||
2415 | - }; | ||
2416 | - if (th.data.prom_type == 6) { | ||
2417 | - title += '\n' + th.data.prom_act.share_remark; | ||
2418 | - ob.title = title; | ||
2419 | - ob.desc = th.data.prom_act.share_remark; | ||
2420 | - } | 2439 | + // var ob = { |
2440 | + // title: price + "元 " + title, | ||
2441 | + // path: url, | ||
2442 | + // imageUrl: img, | ||
2443 | + // }; | ||
2444 | + // if (th.data.prom_type == 6) { | ||
2445 | + // title += '\n' + th.data.prom_act.share_remark; | ||
2446 | + // ob.title = title; | ||
2447 | + // ob.desc = th.data.prom_act.share_remark; | ||
2448 | + // } | ||
2421 | 2449 | ||
2422 | - //如果是积分购的时候 | ||
2423 | - if (th.data.prom_type == 4) { | ||
2424 | - var name = th.data.prom_act.name; | ||
2425 | - //-- 积分购的 -- | ||
2426 | - var pri0 = th.data.prom_act.addmoney; | ||
2427 | - var integral = th.data.prom_act.integral; | ||
2428 | - var text = ""; | ||
2429 | - if (integral) { text = integral + "积分"; } | ||
2430 | - if (pri0 && integral) { text += "+"; } | ||
2431 | - if (pri0) { text += "¥" + pri0; } | ||
2432 | - | ||
2433 | - ob.title = text + " " + name; | ||
2434 | - } | 2450 | + // //如果是积分购的时候 |
2451 | + // if (th.data.prom_type == 4) { | ||
2452 | + // var name = th.data.prom_act.name; | ||
2453 | + // //-- 积分购的 -- | ||
2454 | + // var pri0 = th.data.prom_act.addmoney; | ||
2455 | + // var integral = th.data.prom_act.integral; | ||
2456 | + // var text = ""; | ||
2457 | + // if (integral) { text = integral + "积分"; } | ||
2458 | + // if (pri0 && integral) { text += "+"; } | ||
2459 | + // if (pri0) { text += "¥" + pri0; } | ||
2460 | + | ||
2461 | + // ob.title = text + " " + name; | ||
2462 | + // } | ||
2435 | 2463 | ||
2436 | - //-- 页面不能刷新 -- | ||
2437 | - this.data.show_prew_img=1; | ||
2438 | - return ob; | 2464 | + // //-- 页面不能刷新 -- |
2465 | + // this.data.show_prew_img=1; | ||
2466 | + // return ob; | ||
2467 | + | ||
2468 | + | ||
2469 | + var img; | ||
2470 | + 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 | ||
2471 | + console.log('pagePath=====xxxxxx>', pagePath); | ||
2472 | + // if (this.data.prom_act.share_imgurl) { | ||
2473 | + // img = this.data.iurl + this.data.prom_act.share_imgurl; | ||
2474 | + // } | ||
2475 | + // var img = th.data.sele_g.original_img; | ||
2476 | + var imgPath = this.data.iurl + this.data.luckGoInfo.original_img; | ||
2477 | + if (pagePath.indexOf('/') != 0) { | ||
2478 | + pagePath = '/' + pagePath; | ||
2479 | + } | ||
2480 | + // if(getApp().globalData.user_id){ | ||
2481 | + | ||
2482 | + // if(pagePath.indexOf("?")>0){ | ||
2483 | + // pagePath+="&first_leader="+getApp().globalData.user_id; | ||
2484 | + // }else{ | ||
2485 | + // pagePath+="?first_leader="+getApp().globalData.user_id; | ||
2486 | + // } | ||
2487 | + // } | ||
2488 | + return { | ||
2489 | + title: "邀您一起参加幸运购", | ||
2490 | + path: pagePath, | ||
2491 | + imageUrl: imgPath, | ||
2492 | + } | ||
2439 | 2493 | ||
2440 | }, | 2494 | }, |
2441 | 2495 |
packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml
@@ -923,8 +923,9 @@ | @@ -923,8 +923,9 @@ | ||
923 | <view class="xc-ash-b f1 flex ai-center jc-center white fs26" wx:if="{{isTimeUp}}">活动已经结束</view> | 923 | <view class="xc-ash-b f1 flex ai-center jc-center white fs26" wx:if="{{isTimeUp}}">活动已经结束</view> |
924 | <block wx:else> | 924 | <block wx:else> |
925 | <view class="btn-red f1 flex ai-center jc-center" bindtap="go" data-it="0" data-url="/packageC/pages/luckyGo/luckyGo_details/luckyGo_details?group_id={{luckGoInfo.id}}&goods_id={{luckGoInfo.goods_id}}&goods_name={{data.goods_name}}&team_id={{buyInfo.team_id}}&&from=list" wx:if="{{showDetails}}">查看详情</view> | 925 | <view class="btn-red f1 flex ai-center jc-center" bindtap="go" data-it="0" data-url="/packageC/pages/luckyGo/luckyGo_details/luckyGo_details?group_id={{luckGoInfo.id}}&goods_id={{luckGoInfo.goods_id}}&goods_name={{data.goods_name}}&team_id={{buyInfo.team_id}}&&from=list" wx:if="{{showDetails}}">查看详情</view> |
926 | - <view class="btn-red f1 flex ai-center jc-center" bindtap="openSpecModel_pt" data-it="0" wx:elif="{{!showDetails && surplus != 0}}">立即参团</view> | 926 | + <view class="btn-red f1 flex ai-center jc-center" bindtap="openSpecModel_pt" data-it="0" wx:elif="{{!showDetails && surplus != 0 && canBuy}}">立即参团</view> |
927 | <view class="f1 flex ai-center jc-center xc-ash-b fs26 white" wx:elif="{{!showDetails && surplus == 0}}">已经抢光了</view> | 927 | <view class="f1 flex ai-center jc-center xc-ash-b fs26 white" wx:elif="{{!showDetails && surplus == 0}}">已经抢光了</view> |
928 | + <view class="f1 flex ai-center jc-center xc-ash-b fs26 white" wx:elif="{{!showDetails && surplus != 0 && !canBuy}}">已超限购次数</view> | ||
928 | </block> | 929 | </block> |
929 | 930 | ||
930 | <!-- <view class="btn-red f1 flex ai-center jc-center" wx:else>已经抢光</view> --> | 931 | <!-- <view class="btn-red f1 flex ai-center jc-center" wx:else>已经抢光</view> --> |
@@ -1508,7 +1509,7 @@ | @@ -1508,7 +1509,7 @@ | ||
1508 | <canvas canvas-id='share' style='width:750rpx;height:1217rpx;background-color:white;' wx:if='{{!canvasHidden}}'></canvas> | 1509 | <canvas canvas-id='share' style='width:750rpx;height:1217rpx;background-color:white;' wx:if='{{!canvasHidden}}'></canvas> |
1509 | <warn id="warn"></warn> | 1510 | <warn id="warn"></warn> |
1510 | <!-- 分享控件,底部弹出 --> | 1511 | <!-- 分享控件,底部弹出 --> |
1511 | -<share id="share_button" bind:send="send" bind:cancel="cancel" bind:share_img="saveImageToPhotosAlbum" wx:if="{{share_hidden}}"></share> | 1512 | +<share id="share_button" bind:send="onShareAppMessage" bind:cancel="cancel" bind:share_img="saveImageToPhotosAlbum" wx:if="{{share_hidden}}"></share> |
1512 | <view wx:if="{{showPoster}}"> | 1513 | <view wx:if="{{showPoster}}"> |
1513 | <view class="mask" catchtap="closePoster"></view> | 1514 | <view class="mask" catchtap="closePoster"></view> |
1514 | <view class="poster-container"> | 1515 | <view class="poster-container"> |