Commit 6f2bad0dde29f3fc1c28fce0f95ba696c7805a3a

Authored by taiyuan
1 parent 287535c6

幸运购

packageC/pages/luckyGo/luckyGo_details/luckyGo_details.js
... ... @@ -46,10 +46,16 @@ Page({
46 46  
47 47  
48 48 showRules: false,
  49 + isSuccess: false,
49 50 },
50 51 onLoad: function (t) {
51 52 // wx.setNavigationBarTitle({ title: "拼团订单",})
52 53 // console.log('options========>', t);
  54 + if(t.team_id != null && t.team_id !=undefined) {
  55 + this.setData({
  56 + team_id: t.team_id,
  57 + });
  58 + };
53 59 this.setData({
54 60 param: t,
55 61 });
... ... @@ -93,6 +99,20 @@ Page({
93 99 })
94 100 },
95 101  
  102 + onShow: function() {
  103 + this.get_team_info();
  104 + },
  105 +
  106 +
  107 +
  108 +
  109 + onUnload: function () {
  110 + // 开团成功后,清除storage里的team_id
  111 + if(this.data.luckyGoInfo.num == 0) {
  112 + wx.removeStorageSync('team_id');
  113 + };
  114 + },
  115 +
96 116 //关闭展开列表
97 117 click:function(e){
98 118 this.setData({
... ... @@ -164,116 +184,81 @@ Page({
164 184 // data: {orderSn:order_sn,storeId:os.stoid }
165 185 // })
166 186  
167   - // 幸运购成团信息
168   - await getApp().request.promiseGet("/api/weshop/prom/luckyActivity/page", {
169   - data: {
170   - store_id: o.stoid,
171   - is_end: 0,
172   - timetype: 1,
173   - id: this.data.param.group_id,
174   - }
175   - }).then(res => {
176   - var luckyGoInfo = res.data.data.pageData[0];
177   - console.log('成团信息====>', luckyGoInfo);
178   - th.setData({
179   - luckyGoInfo,
180   - });
181   - //参团成功后,保存team_id
182   - wx.setStorage({
183   - key: 'team_id',
184   - data: luckyGoInfo.team_id,
185   - })
186   - //如果team_id为0, 表示当前已开启新的一期,文字提示应改为’参团成功,本期幸运购已开团,中奖结果可点击下方查看参团列表‘
187   - //如果team_id为0,取出之前保存的team_id替换掉,请求上一期已成团的幸运购活动
188   - })
189   -
190 187  
191   - // 幸运购成团成员
192   - await getApp().request.promiseGet("/api/weshop/prom/luckyOrder/page", {
193   - data: {
194   - store_id: o.stoid,
195   - team_id: this.data.luckyGoInfo.team_id,
196   - }
197   - }).then(res => {
198   - console.log('成团成员====>', res.data.data.pageData);
199   - th.setData({
200   - luckyGoMembers: res.data.data.pageData,
201   - });
202   - })
203 188  
204 189  
205 190  
206 191 //获取order信息根据订单编号order_sn
207   - await getApp().request.promiseGet("/api/weshop/order/page", {
208   - data: { store_id: o.stoid, order_sn: order_sn,}
209   - }).then(res => {
210   - console.log('获取order信息====>', order);
211   - order = res.data.data.pageData[0];
212   - pt_prom_id = order.pt_prom_id;
213   - pt_listno = order.pt_listno;
214   - })
215   -
216   - if (this.data.payf || order.pt_status == 3) p_status = 3; //失败
217   - if (order.pt_status == 2 || order.pt_status == 4 || order.pt_status == 5)
218   - p_status = 2; //成功
219   - if (order.pt_status < 2 && !this.data.payf)
220   - p_status = 1; //正在进行
221   - if ( order.pt_status == 6) p_status = 4; //支付尾款失败
222   -
223   - //多少人参团头像
224   - // await getApp().request.promiseGet("/api/weshop/order/pagePtList", {
225   - // data: { store_id: o.stoid, pt_listno: pt_listno, }
226   - // }).then(res => {
227   - // ordertx = res.data.data.pageData;
228   - // })
229   -
230   -
231   - var min_price=0;
232   - //获取活动表的信息根据活动pt_prom_id
233   - await getApp().request.promiseGet("/api/weshop/teamlist/get/" + os.stoid + "/" + pt_prom_id, {
234   - data: { }
235   - }).then(res => {
236   - if (res.data.code==0){
237   - teamlist = res.data.data;
238   - this.setData({teamlist: teamlist});
239   - //获取当前时间,并且判断剩余时间
240   - var nt = ut.gettimestamp();
241   - teamlist.status = 0;
242   - if (nt >= teamlist.start_time) teamlist.status = 1;
243   -
244   - goods_id = res.data.data.goods_id;
245   - id = res.data.data.id;
246   - share_img = ee.data.imageurl + res.data.data.share_imgurl;
247   -
248   - //----------查看阶梯团------------
249   - if (teamlist.ct_rylist != "" && teamlist.ct_rylist != null && teamlist.ct_rylist != undefined){
250   - var ct_rylist = JSON.parse(teamlist.ct_rylist);
251   - var max=0; var pri=0;
252   - ct_rylist.forEach(function (val,ind) {
253   - if(val.rynum>max){
254   - max=val.rynum;
255   - pri = val.price;
256   - }
257   - })
258   - max_num=max;
259   - min_price=pri;
  192 + // await getApp().request.promiseGet("/api/weshop/order/page", {
  193 + // data: { store_id: o.stoid, order_sn: order_sn,}
  194 + // }).then(res => {
  195 + // console.log('获取order信息====>', order);
  196 + // order = res.data.data.pageData[0];
  197 + // pt_prom_id = order.pt_prom_id;
  198 + // pt_listno = order.pt_listno;
  199 + // })
  200 +
  201 + // if (this.data.payf || order.pt_status == 3) p_status = 3; //失败
  202 + // if (order.pt_status == 2 || order.pt_status == 4 || order.pt_status == 5)
  203 + // p_status = 2; //成功
  204 + // if (order.pt_status < 2 && !this.data.payf)
  205 + // p_status = 1; //正在进行
  206 + // if ( order.pt_status == 6) p_status = 4; //支付尾款失败
  207 +
  208 + // //多少人参团头像
  209 + // // await getApp().request.promiseGet("/api/weshop/order/pagePtList", {
  210 + // // data: { store_id: o.stoid, pt_listno: pt_listno, }
  211 + // // }).then(res => {
  212 + // // ordertx = res.data.data.pageData;
  213 + // // })
  214 +
  215 +
  216 + // var min_price=0;
  217 + // //获取活动表的信息根据活动pt_prom_id
  218 + // await getApp().request.promiseGet("/api/weshop/teamlist/get/" + os.stoid + "/" + pt_prom_id, {
  219 + // data: { }
  220 + // }).then(res => {
  221 + // if (res.data.code==0){
  222 + // teamlist = res.data.data;
  223 + // this.setData({teamlist: teamlist});
  224 + // //获取当前时间,并且判断剩余时间
  225 + // var nt = ut.gettimestamp();
  226 + // teamlist.status = 0;
  227 + // if (nt >= teamlist.start_time) teamlist.status = 1;
  228 +
  229 + // goods_id = res.data.data.goods_id;
  230 + // id = res.data.data.id;
  231 + // share_img = ee.data.imageurl + res.data.data.share_imgurl;
  232 +
  233 + // //----------查看阶梯团------------
  234 + // if (teamlist.ct_rylist != "" && teamlist.ct_rylist != null && teamlist.ct_rylist != undefined){
  235 + // var ct_rylist = JSON.parse(teamlist.ct_rylist);
  236 + // var max=0; var pri=0;
  237 + // ct_rylist.forEach(function (val,ind) {
  238 + // if(val.rynum>max){
  239 + // max=val.rynum;
  240 + // pri = val.price;
  241 + // }
  242 + // })
  243 + // max_num=max;
  244 + // min_price=pri;
260 245  
261   - }
  246 + // }
262 247  
263 248  
264   - //获取商品信息
265   - getApp().request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + goods_id, {
266   - }).then(res => {
267   - //商品地址
268   - original_img = ee.data.imageurl+ res.data.data.original_img,
269   - goods = res.data.data
  249 + // //获取商品信息
  250 + // getApp().request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + goods_id, {
  251 + // }).then(res => {
  252 + // //商品地址
  253 + // original_img = ee.data.imageurl+ res.data.data.original_img,
  254 + // goods = res.data.data
270 255  
271   - ee.setData({goods: goods,image: original_img,})
  256 + // ee.setData({goods: goods,image: original_img,})
272 257  
273   - })
  258 + // })
274 259  
275   - }
276   - })
  260 + // }
  261 + // })
277 262  
278 263  
279 264 //只装5个
... ... @@ -299,28 +284,28 @@ Page({
299 284  
300 285  
301 286 //获取活动从表信息team_id:305暂时
302   - await getApp().request.promiseGet("/api/weshop/teamgroup/page" , {
303   - data: { store_id: os.stoid, listno: pt_listno, team_id: pt_prom_id }
304   - }).then(res => {
305   - teamgroup = res.data.data.pageData[0];
306   - if (teamgroup){
307   - var buy_start_date = ut.formatTime(teamgroup.buy_start_date, "yyyy-MM-dd hh:mm:ss");
308   - teamgroup.buy_start_date=buy_start_date;
309   - }
310   - })
  287 + // await getApp().request.promiseGet("/api/weshop/teamgroup/page" , {
  288 + // data: { store_id: os.stoid, listno: pt_listno, team_id: pt_prom_id }
  289 + // }).then(res => {
  290 + // teamgroup = res.data.data.pageData[0];
  291 + // if (teamgroup){
  292 + // var buy_start_date = ut.formatTime(teamgroup.buy_start_date, "yyyy-MM-dd hh:mm:ss");
  293 + // teamgroup.buy_start_date=buy_start_date;
  294 + // }
  295 + // })
311 296  
312 297  
313   - var ct_price = 0,
314   - num_0 = ordertx.length;
315   - if (teamlist.kttype == 3){
316   - var js_data = JSON.parse(teamlist.ct_rylist);
317   - js_data.forEach(function (val,ind) {
318   - if (num_0<=val.rynum && ct_price==0){
319   - ct_price=val.price;
320   - }
321   - })
322   - if(ct_price==0) ct_price=min_price;
323   - }
  298 + // var ct_price = 0,
  299 + // num_0 = ordertx.length;
  300 + // if (teamlist.kttype == 3){
  301 + // var js_data = JSON.parse(teamlist.ct_rylist);
  302 + // js_data.forEach(function (val,ind) {
  303 + // if (num_0<=val.rynum && ct_price==0){
  304 + // ct_price=val.price;
  305 + // }
  306 + // })
  307 + // if(ct_price==0) ct_price=min_price;
  308 + // }
324 309  
325 310 //获取大家都在团信息
326 311 getApp().request.promiseGet("/api/weshop/teamlist/pageteam/1?store_id="+ os.stoid +"&is_end=0&is_show=1" , {
... ... @@ -1017,8 +1002,6 @@ Page({
1017 1002  
1018 1003  
1019 1004  
1020   - onTouchMove() {},
1021   -
1022 1005 // 显示幸运购规则
1023 1006 showRules: function() {
1024 1007 this.setData({
... ... @@ -1032,6 +1015,66 @@ Page({
1032 1015 showRules: false,
1033 1016 });
1034 1017 },
  1018 +
  1019 + async get_team_info () {
  1020 + var th = this;
  1021 + // 幸运购成团信息
  1022 + await getApp().request.promiseGet("/api/weshop/prom/luckyActivity/page", {
  1023 + data: {
  1024 + store_id: o.stoid,
  1025 + is_end: 0,
  1026 + timetype: 1,
  1027 + id: this.data.param.group_id,
  1028 + }
  1029 + }).then(res => {
  1030 + var luckyGoInfo = res.data.data.pageData[0];
  1031 + var team_id = luckyGoInfo.team_id;
  1032 + console.log('成团信息====>', luckyGoInfo);
  1033 + th.setData({
  1034 + luckyGoInfo,
  1035 + team_id,
  1036 + });
  1037 +
  1038 + //参团成功后,检查team_id
  1039 + //如果team_id为0, 表示当前已开启新的一期,文字提示应改为’参团成功,本期幸运购已开团,中奖结果可点击下方查看参团列表‘
  1040 + //如果team_id为0,取出之前保存的team_id替换掉,请求上一期已成团的幸运购活动
  1041 + if(team_id != 0) {
  1042 + wx.setStorage({
  1043 + key: 'team_id',
  1044 + data: team_id,
  1045 + });
  1046 + } else {
  1047 + // if(th.data.param.from = 'list') {
  1048 + // th.setData({
  1049 + // team_id: 0,
  1050 + // });
  1051 + // } else {
  1052 + let team_id = wx.getStorageSync('team_id');
  1053 + th.setData({
  1054 + team_id: team_id,
  1055 + isSuccess: true,
  1056 + });
  1057 + // };
  1058 +
  1059 + };
  1060 +
  1061 +
  1062 + })
  1063 +
  1064 +
  1065 + // 幸运购成团成员
  1066 + await getApp().request.promiseGet("/api/weshop/prom/luckyOrder/page", {
  1067 + data: {
  1068 + store_id: o.stoid,
  1069 + team_id: this.data.team_id,
  1070 + }
  1071 + }).then(res => {
  1072 + console.log('成团成员====>', res.data.data.pageData);
  1073 + th.setData({
  1074 + luckyGoMembers: res.data.data.pageData,
  1075 + });
  1076 + })
  1077 + },
1035 1078  
1036 1079  
1037 1080  
... ...
packageC/pages/luckyGo/luckyGo_details/luckyGo_details.wxml
... ... @@ -66,7 +66,13 @@
66 66 <!-- 阶梯团失败 -->
67 67 <!-- <view class="pdt50 pdb30 pdh20" wx:if="{{pay_f==1 || order.pt_status==3}}"> -->
68 68 <view class="pdt50 pdb30 pdh20">
69   - <view class="fs28 t-c">参团成功,还差{{filters.show_default(luckyGoInfo.group_num, '0')- filters.show_default(luckyGoInfo.num, '0')}}人即可成团,请留意成员开奖通知!</view>
  69 + <block wx:if="{{team_id != 0}}">
  70 + <view class="fs28 t-c" wx:if="{{!isSuccess}}">参团成功,还差{{filters.show_default(luckyGoInfo.group_num, '0') - filters.show_default(luckyGoInfo.num, '0')}}人即可成团,请留意成员开奖通知!</view>
  71 + <view class="fs28 t-c" wx:else>参团成功,本期幸运购已开团!</view>
  72 + </block>
  73 + <block wx:if="{{team_id == 0 && param.from}}">
  74 + <view class="fs28 t-c">组团中,还差{{filters.show_default(luckyGoInfo.group_num, '0') - filters.show_default(luckyGoInfo.num, '0')}}人即可成团!</view>
  75 + </block>
70 76 <view class="fs24 t-c c-red">未团中可获得帮团奖励</view>
71 77 <!-- <view class="xc-img-frame oh" >
72 78 <image class="img" src="{{iurl}}/miniapp/images/xc-qtshibai.png"></image>
... ... @@ -86,22 +92,21 @@
86 92 <!----//// //头像---->
87 93 <view class="flex_tou pdv30">
88 94 <view class="flex jc-center">
89   - <block wx:for="{{luckyGoMembers}}">
90   - <view class="d" wx:if="{{index <= 4}}">
91   - <image class="img-block" src='{{item.head_pic}}'></image>
92   - <!-- <span wx:if="{{item.is_pt_tz==1}}">团长</span> -->
  95 + <view class="d" wx:if="{{team_id == 0 && param.from}}">
  96 + <image class="img-block" src='{{iurl}}/miniapp/images/shafa.png'></image>
  97 + </view>
  98 + <block wx:else>
  99 + <block wx:for="{{luckyGoMembers}}">
  100 + <view class="d" wx:if="{{index <= 4}}">
  101 + <image class="img-block" src='{{item.head_pic}}'></image>
  102 + <!-- <span wx:if="{{item.is_pt_tz==1}}">团长</span> -->
  103 + </view>
  104 + </block>
  105 +
  106 + <view class="d" wx:if="{{luckyGoMembers.length > 4}}">
  107 + <image class="pictures img-block" src="{{iurl}}/miniapp/images/xc_ellipsis.png"></image>
93 108 </view>
94 109 </block>
95   -
96   - <!-- <view class="d" wx:for="{{sf_arr}}" wx:if="{{p_status!=2}}"> -->
97   - <!-- <view class="d">
98   - <image class="img-block" src='{{iurl}}/miniapp/images/shafa.png'></image>
99   - </view> -->
100   -
101   - <!-- <view class='xc-ellipsis-img flex-vertical' wx:if="{{ordertx.length>5}}"> -->
102   - <view class="d" wx:if="{{luckyGoMembers.length > 4}}">
103   - <image class="pictures img-block" src="{{iurl}}/miniapp/images/xc_ellipsis.png"></image>
104   - </view>
105 110 </view>
106 111 </view>
107 112  
... ... @@ -202,9 +207,9 @@
202 207 </view>
203 208  
204 209 <view class="f1 t-r">
205   - <view class="fs22">{{filters.format_time(item.create_time, 1)}}</view>
  210 + <view class="fs22">{{filters.format_time(item.add_time, 1)}}</view>
206 211 <view class="c-red" wx:if="{{item.team_status == 0}}">待成团</view>
207   - <view class="c-red" wx:if="{{item.team_status == 1}}">未团中</view>
  212 + <view class="c-7b" wx:if="{{item.team_status == 1}}">未团中</view>
208 213 <view class="c-red" wx:if="{{item.team_status == 2}}">已团中</view>
209 214 </view>
210 215  
... ... @@ -247,8 +252,7 @@
247 252 <view class="flex-center rel xc-linellae-frame">
248 253 <view class="xc-linellae"></view>
249 254 <view class="abs flex-center xc-recommend-frame ">
250   - <image class=" xc-recommend" src="{{iurl}}/miniapp/images/diamond.png">
251   - </image>
  255 + <image class=" xc-recommend" src="{{iurl}}/miniapp/images/diamond.png"></image>
252 256 <view class="xc-recommend-word">大家都在团</view>
253 257 </view>
254 258 </view>
... ... @@ -265,7 +269,7 @@
265 269 <view class='price flex-vertical-between'>
266 270 <view class='jgleft fs32 flex-center xc-wc'>
267 271 <view class="xc-ping xc-wc fs26 t-c">拼</view>
268   - <text class="fs20" style='height:39rpx;margin-right:5rpx;margin-left:15rpx;' >¥</text>11.00{{item.price}}
  272 + <text class="fs20" style='height:39rpx;margin-right:5rpx;margin-left:15rpx;'>¥</text>11.00{{item.price}}
269 273 </view>
270 274 <view class='jgright'>{{item.ct_num}}2
271 275 <span>人参团</span>
... ...
packageC/pages/luckyGo/luckyGo_details/luckyGo_details.wxss
... ... @@ -1023,7 +1023,7 @@ height:40rpx;
1023 1023 font-size: 26rpx;
1024 1024 position: absolute;
1025 1025 color: white;
1026   - background-color: rgba(255,103,103,.7);
  1026 + background-color: #FE6867;
1027 1027 right: 0;
1028 1028 top: 0;
1029 1029 z-index: 1;
... ...
packageC/pages/luckyGo/luckyGo_goodsInfo/buy_pt.wxml
... ... @@ -186,7 +186,7 @@
186 186 <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">库存不足</view>
187 187 </block>
188 188 <block wx:else>
189   - <view bindtap="addCart_pt" class="spec-cart-btn spec-buy" data-action="buy">立即购买</view>
  189 + <view bindtap="addCart" class="spec-cart-btn spec-buy" data-action="buy">立即购买</view>
190 190 </block>
191 191  
192 192 </block>
... ... @@ -203,7 +203,7 @@
203 203 <view class="spec-cart-btn spec-buy w100" style="background-color: #dcdcdc;color: #999;">配送不匹配</view>
204 204 </block>
205 205 <block wx:else>
206   - <view bindtap="addCart_pt" class="spec-cart-btn spec-buy w100" data-action="buy">确定</view>
  206 + <view bindtap="addCart" class="spec-cart-btn spec-buy w100" data-action="buy">确定</view>
207 207 </block>
208 208 </block>
209 209  
... ...
packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js
... ... @@ -1702,9 +1702,9 @@ Page({
1702 1702 openSpecModal_pt: 0,
1703 1703 })
1704 1704  
1705   - if (e.prom_type == 4) {
  1705 + if (e.prom_type == 9) {
1706 1706 s.set_b_now(e);
1707   - var url = "/pages/cart/cart2_inte/cart2_inte?is_bnow=1&goods_id=" + e.goods_id;
  1707 + var url = "/packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart?is_bnow=1&goods_id=" + e.goods_id;
1708 1708 getApp().goto(url);
1709 1709 } else {
1710 1710 //要判断积分购的普通购买有没有参加优惠活动
... ... @@ -1954,6 +1954,8 @@ Page({
1954 1954 })
1955 1955 return false;
1956 1956 }
  1957 +
  1958 +
1957 1959  
1958 1960 if(th.data.more_flash && open_store==1){
1959 1961 th.setData({is_pop_more:1});
... ... @@ -3727,22 +3729,20 @@ Page({
3727 3729 //--点击弹起拼单--
3728 3730 openSpecModel_pt: function (e) {
3729 3731  
3730   -
3731   - this.setData({ open_ind_store: 4, goodsInputNum: 1 });//拼团直接给4
3732   -
  3732 + this.setData({ open_ind_store: 9, goodsInputNum: 1 });
3733 3733  
3734 3734 //--先判断会员状态--
3735 3735 var user_info = getApp().globalData.userInfo;
3736   - if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
  3736 + if (user_info == null || user_info.mobile == undefined || user_info.mobile == '' || user_info.mobile == null) {
3737 3737 wx.navigateTo({
3738 3738 url: '/pages/togoin/togoin',
3739 3739 })
3740 3740 return false;
3741   - }
  3741 + };
3742 3742  
3743 3743 var th = this;
3744   - var ind = parseInt(e.currentTarget.dataset.it);
3745   - //如果是拼单活动的普通购买
  3744 + var ind = parseInt(e.currentTarget.dataset.ind);
  3745 + //ind == 1是普通购买
3746 3746 if (ind == 1) {
3747 3747 //如果拼单的sku data是空的,就要先获取一下
3748 3748 if (th.data.sku_g_pt) {
... ... @@ -3759,9 +3759,11 @@ Page({
3759 3759 openSpecModal_pt: 1
3760 3760 });
3761 3761 });
3762   - }
  3762 + };
3763 3763 th.check_is_youhui(th.data.gid, 1);
3764   - } else {
  3764 + }
  3765 +
  3766 + else {
3765 3767  
3766 3768 //拼单商品从这里进,先判断有没有买过商品,
3767 3769 getApp().request.get("/api/weshop/order/page", {
... ... @@ -4008,7 +4010,7 @@ Page({
4008 4010 buyNow_pt: function (e) {
4009 4011 s.set_b_now(e);
4010 4012 wx.navigateTo({
4011   - url: "/pages/cart/cart2_pt/cart2_pt?is_bnow=1&goods_id=" + e.goods_id,
  4013 + url: "/packageC/pages/luckyGo_cart/luckyGo_cart/luckyGo_cart?is_bnow=1&goods_id=" + e.goods_id,
4012 4014 });
4013 4015 },
4014 4016  
... ... @@ -6066,9 +6068,9 @@ Page({
6066 6068  
6067 6069 // 查看奖励
6068 6070 showReward: function() {
6069   - this.setData({
6070   - showReward: true,
6071   - });
  6071 +
  6072 + this.getPrizes(this.data.luckGoInfo.type);
  6073 +
6072 6074 },
6073 6075  
6074 6076 // 关闭奖励
... ... @@ -6078,5 +6080,108 @@ Page({
6078 6080 });
6079 6081 },
6080 6082  
  6083 +
  6084 + // 获取优惠券奖励和服务项目奖励
  6085 + getPrizes: function(type) {
  6086 + // let currentItem = this.data.list.pageData[currentItemIndex];
  6087 + // let type = type;
  6088 + let self = this;
  6089 + let app = getApp();
  6090 + // 分割type字符串
  6091 + let typeArr = this.splitStringToArr(type);
  6092 + let prizesArr = [];
  6093 + let promiseArr = [];
  6094 + typeArr.forEach(function(item) {
  6095 +
  6096 + let obj = {};
  6097 + obj.type = item;
  6098 +
  6099 + let promise = new Promise((resolve, reject) => {
  6100 + switch(item) {
  6101 + case 1: { //积分
  6102 + obj.name = '积分';
  6103 + obj.num = 'point';
  6104 + prizesArr.push(obj);
  6105 + resolve();
  6106 + break;
  6107 + };
  6108 + case 2: { //成长值
  6109 + obj.name = '成长值';
  6110 + obj.num = 'grow';
  6111 + prizesArr.push(obj);
  6112 + resolve();
  6113 + break;
  6114 + };
  6115 + case 3: { //优惠券
  6116 + app.request.promiseGet('/api/weshop/prom/luckyCoupon/page', {
  6117 + data: {
  6118 + store_id: os.stoid,
  6119 + aid: self.data.luckGoInfo.id,
  6120 + }
  6121 + }).then(res => {
  6122 + if(res.data.code == 0) {
  6123 + obj.couponList = res.data.data.pageData;
  6124 + prizesArr.push(obj);
  6125 + resolve();
  6126 + };
  6127 + });
  6128 + break;
  6129 + };
  6130 + case 4: { //服务项目
  6131 + app.request.promiseGet('/api/weshop/prom/luckyService/page', {
  6132 + data: {
  6133 + store_id: os.stoid,
  6134 + aid: self.data.luckGoInfo.id,
  6135 + }
  6136 + }).then(res => {
  6137 + if(res.data.code == 0) {
  6138 + obj.serviceList = res.data.data.pageData;
  6139 + prizesArr.push(obj);
  6140 + resolve();
  6141 + };
  6142 + });
  6143 + break;
  6144 + };
  6145 + case 5: { //预存金额
  6146 + obj.name = 'prestore_name';
  6147 + obj.num = 'prestore_money';
  6148 + prizesArr.push(obj);
  6149 + resolve();
  6150 + break;
  6151 + };
  6152 + };
  6153 + });
  6154 +
  6155 + promiseArr.push(promise);
  6156 +
  6157 +
  6158 + Promise.all(promiseArr).then(()=> {
  6159 + self.setData({
  6160 + prizesArr,
  6161 + showReward: true,
  6162 + });
  6163 + });
  6164 +
  6165 +
  6166 +
  6167 + });
  6168 +
  6169 +
  6170 +
  6171 + },
  6172 +
  6173 + // 将type字符串分割成数组
  6174 + splitStringToArr: function(typeStr) {
  6175 + var index;
  6176 + var newTypeArr = [];
  6177 + var typeStrArr = typeStr.split(',');
  6178 + typeStrArr.forEach(function(item) {
  6179 + index = parseInt(item);
  6180 + newTypeArr.push(index);
  6181 + });
  6182 + // console.log('newTypeArr', newTypeArr);
  6183 + return newTypeArr;
  6184 + },
  6185 +
6081 6186  
6082 6187 });
... ...
packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml
... ... @@ -883,13 +883,14 @@
883 883 <!-- 线上销售的时候,要判断库存量, 线下库存的时候不用判断 -->
884 884 <block wx:if="{{(sele_g.store_count>0 && sales_rules==1) || sales_rules==2 }}">
885 885 <view class="btn-container f1">
886   - <view bindtap="openSpecModel" data-ind="1" class="btn-yellow flex f1 fdc jc-center">
  886 + <view bindtap="openSpecModel_pt" data-ind="1" class="btn-yellow flex f1 fdc jc-center">
887 887 <view class="lh1"><text class="rmb lh1">{{filters.toFix(data.market_price,2)}}</text></view>
888 888 <view class="lh1 fs pdt4">单独购买</view>
889 889 </view>
890 890 <!-- data-ind="2" -->
891   - <view class="btn-red f1 flex ai-center jc-center"
892   - bindtap="addCart" data-openSpecModal_ind="{{openSpecModal_ind}}" data-action="buy">立即参团2</view>
  891 + <!-- openSpecModel_pt -->
  892 + <view class="btn-red f1 flex ai-center jc-center" bindtap="openSpecModel_pt" data-openSpecModal_ind="{{openSpecModal_ind}}" data-action="buy" data-ind="1">立即参团2</view>
  893 + <!-- <view class="btn-red f1 flex ai-center jc-center" bindtap="addCart" data-openSpecModal_ind="{{openSpecModal_ind}}" data-action="buy">立即参团</view> -->
893 894 </view>
894 895 <!-- <view bindtap="openSpecModel" data-ind="1" class="btn-buy flex fdc jc-center">
895 896 <view class="lh1"><text class="rmb lh1">189.00</text></view>
... ... @@ -1548,12 +1549,51 @@
1548 1549 <text class="iconfont icon-close fs32 c-7b" bindtap="closeReward"></text>
1549 1550 </view>
1550 1551 <view class="popup-list">
1551   - <view class="popup-list-item" wx:for="{{filters.showByType(luckGoInfo.type)}}">
1552   - <view class="img-container"><image class="img-block" src="../../../../images/bk.png"></image></view>
1553   - <view class="f1">
1554   - <view class="ellipsis-2 popup-title pdl20">{{typeArr[item-1].name == '预存金额' ? luckGoInfo.prestore_name:typeArr[item-1].name}}</view>
1555   - <view class="fs24 t-r pdt16 c-7b">数量:<text class="c-red">{{luckGoInfo[typeArr[item-1]['key']]}}</text></view>
1556   - </view>
  1552 + <view class="popup-list">
  1553 +
  1554 + <block wx:for="{{prizesArr}}">
  1555 + <!-- 优惠券奖励 -->
  1556 + <block wx:if="{{item.type == 3}}">
  1557 + <view class="popup-list-item" wx:for="{{item.couponList}}" wx:for-item="i">
  1558 + <view class="img-container"><image class="img-block" src="../../../../images/bk.png"></image></view>
  1559 + <view class="f1 pdl20">
  1560 + <view class="ellipsis-2 popup-title">优惠券-{{i.name}}</view>
  1561 + <view class="fs24 t-r pdt16 c-7b">数量:<text class="c-red">{{i.num}}</text></view>
  1562 + </view>
  1563 + </view>
  1564 + </block>
  1565 + <!-- 服务项目奖励 -->
  1566 + <block wx:elif="{{item.type == 4}}">
  1567 + <view class="popup-list-item" wx:for="{{item.serviceList}}" wx:for-item="i">
  1568 + <view class="img-container"><image class="img-block" src="../../../../images/bk.png"></image></view>
  1569 + <view class="f1 pdl20">
  1570 + <view class="ellipsis-2 popup-title">服务项目-{{i.name}}</view>
  1571 + <view class="fs24 t-r pdt16 c-7b">数量:<text class="c-red">{{i.num}}</text></view>
  1572 + </view>
  1573 + </view>
  1574 + </block>
  1575 + <!-- 预存金额 -->
  1576 + <block wx:elif="{{item.type == 5}}">
  1577 + <view class="popup-list-item">
  1578 + <view class="img-container"><image class="img-block" src="../../../../images/bk.png"></image></view>
  1579 + <view class="f1 pdl20">
  1580 + <view class="ellipsis-2 popup-title">{{luckGoInfo[item.name]}}</view>
  1581 + <view class="fs24 t-r pdt16 c-7b">金额:<text class="c-red">{{filters.div100(luckGoInfo[item.num])}}</text></view>
  1582 + </view>
  1583 + </view>
  1584 + </block>
  1585 + <!-- 其他奖励 -->
  1586 + <block wx:else>
  1587 + <view class="popup-list-item">
  1588 + <view class="img-container"><image class="img-block" src="../../../../images/bk.png"></image></view>
  1589 + <view class="f1 pdl20">
  1590 + <view class="ellipsis-2 popup-title">{{item.name}}</view>
  1591 + <view class="fs24 t-r pdt16 c-7b">数量:<text class="c-red">{{luckGoInfo[item.num]}}</text></view>
  1592 + </view>
  1593 + </view>
  1594 + </block>
  1595 + </block>
  1596 +
1557 1597 </view>
1558 1598  
1559 1599 </view>
... ...
packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxss
... ... @@ -1130,8 +1130,8 @@ left:31rpx;}
1130 1130 }
1131 1131 /* 评价的用户边框 */
1132 1132 .middle-user-frame{
1133   - height: 65rpx;
1134   - overflow: hidden;
  1133 + /* height: 65rpx;
  1134 + overflow: hidden; */
1135 1135 }
1136 1136 .middle-user{
1137 1137 height: 25;
... ...
packageC/pages/luckyGo/luckyGo_list/luckyGo_list.js
... ... @@ -17,20 +17,20 @@ let self = null;
17 17  
18 18 Page({
19 19 data: {
20   - wu:false,
21   - imageurl: os.imghost,//有礼派图片地址,
22   - iurl: os.imghost,//有礼派图片地址,
23   - pt_state:0,
24   - order : null,//订单数据
25   - currentTab: 0,
26   - current:0,
27   - ordertx:[],//头像
28   - baseUrl: "/api/weshop/order/page?1=1",
29   - resourceUrl: e.globalData.setting.resourceUrl,
30   - currentPage: 1,
31   - requestData: null,
32   - original_img:null,
33   - timer:null,
  20 + // wu:false,
  21 + // imageurl: os.imghost,//有礼派图片地址,
  22 + // iurl: os.imghost,//有礼派图片地址,
  23 + // pt_state:0,
  24 + // order : null,//订单数据
  25 + // currentTab: 0,
  26 + // current:0,
  27 + // ordertx:[],//头像
  28 + // baseUrl: "/api/weshop/order/page?1=1",
  29 + // resourceUrl: e.globalData.setting.resourceUrl,
  30 + // currentPage: 1,
  31 + // requestData: null,
  32 + // original_img:null,
  33 + // timer:null,
34 34  
35 35  
36 36  
... ... @@ -44,6 +44,24 @@ Page({
44 44 noMore: false, // 检测是否有更多数据,true为没有更多数据,false为还有数据
45 45 pageNum: 1, // 当前页数
46 46 showReward: false,
  47 + prizesArr: [],
  48 +
  49 + typeArr: [{
  50 + key: 'point',
  51 + name: '积分',
  52 + },{
  53 + key: 'grow',
  54 + name: '成长值',
  55 + },{
  56 + key: 'point',
  57 + name: '优惠券',
  58 + },{
  59 + key: 'prestore_name',
  60 + name: '项目服务',
  61 + },{
  62 + key: 'prestore_money',
  63 + name: '预存金额',
  64 + }],
47 65 },
48 66  
49 67 onLoad: function () {
... ... @@ -219,10 +237,29 @@ Page({
219 237 },
220 238  
221 239 //查看奖励
222   - showReward: function() {
  240 + showReward: function(e) {
223 241 this.setData({
224   - showReward: true,
  242 + // showReward: true,
  243 + currentItemIndex: e.target.dataset.index,
  244 + currentItemAid: e.target.dataset.aid,
225 245 });
  246 + this.getPrizes(this.data.currentItemIndex);
  247 +
  248 + // Promise.resolve(this.getPrizes(this.data.currentItemIndex))
  249 + // .then((data)=> {
  250 + // // self.setData({
  251 + // // prizesArr: data,
  252 + // // showReward: true,
  253 + // // });
  254 + // console.dir(data);
  255 + // setTimeout(function() {
  256 + // self.setData({
  257 + // prizesArr: data,
  258 + // showReward: true,
  259 + // },3000);
  260 + // });
  261 +
  262 + // });
226 263 },
227 264  
228 265 //关闭奖励
... ... @@ -233,6 +270,113 @@ Page({
233 270 },
234 271  
235 272  
  273 + // 获取优惠券奖励和服务项目奖励
  274 + getPrizes: function(currentItemIndex) {
  275 + let currentItem = this.data.list.pageData[currentItemIndex];
  276 + let type = currentItem.type;
  277 +
  278 + // 分割type字符串
  279 + let typeArr = this.splitStringToArr(type);
  280 + let prizesArr = [];
  281 + let promiseArr = [];
  282 + typeArr.forEach(function(item) {
  283 +
  284 + let obj = {};
  285 + obj.type = item;
  286 +
  287 + let promise = new Promise((resolve, reject) => {
  288 + switch(item) {
  289 + case 1: { //积分
  290 + obj.name = '积分';
  291 + obj.num = 'point';
  292 + prizesArr.push(obj);
  293 + resolve();
  294 + break;
  295 + };
  296 + case 2: { //成长值
  297 + obj.name = '成长值';
  298 + obj.num = 'grow';
  299 + prizesArr.push(obj);
  300 + resolve();
  301 + break;
  302 + };
  303 + case 3: { //优惠券
  304 + app.request.promiseGet('/api/weshop/prom/luckyCoupon/page', {
  305 + data: {
  306 + store_id: os.stoid,
  307 + aid: self.data.currentItemAid,
  308 + }
  309 + }).then(res => {
  310 + if(res.data.code == 0) {
  311 + obj.couponList = res.data.data.pageData;
  312 + prizesArr.push(obj);
  313 + resolve();
  314 + };
  315 + });
  316 + break;
  317 + };
  318 + case 4: { //服务项目
  319 + app.request.promiseGet('/api/weshop/prom/luckyService/page', {
  320 + data: {
  321 + store_id: os.stoid,
  322 + aid: self.data.currentItemAid,
  323 + }
  324 + }).then(res => {
  325 + if(res.data.code == 0) {
  326 + obj.serviceList = res.data.data.pageData;
  327 + prizesArr.push(obj);
  328 + resolve();
  329 + };
  330 + });
  331 + break;
  332 + };
  333 + case 5: { //预存金额
  334 + obj.name = 'prestore_name';
  335 + obj.num = 'prestore_money';
  336 + prizesArr.push(obj);
  337 + resolve();
  338 + break;
  339 + };
  340 + };
  341 + });
  342 +
  343 + promiseArr.push(promise);
  344 +
  345 +
  346 + Promise.all(promiseArr).then(()=> {
  347 + self.setData({
  348 + prizesArr,
  349 + showReward: true,
  350 + });
  351 + });
  352 +
  353 +
  354 +
  355 + });
  356 +
  357 +
  358 +
  359 +
  360 +
  361 +
  362 +
  363 +
  364 + },
  365 +
  366 + // 将type字符串分割成数组
  367 + splitStringToArr: function(typeStr) {
  368 + var index;
  369 + var newTypeArr = [];
  370 + var typeStrArr = typeStr.split(',');
  371 + typeStrArr.forEach(function(item) {
  372 + index = parseInt(item);
  373 + newTypeArr.push(index);
  374 + });
  375 + // console.log('newTypeArr', newTypeArr);
  376 + return newTypeArr;
  377 + },
  378 +
  379 +
236 380  
237 381  
238 382  
... ...
packageC/pages/luckyGo/luckyGo_list/luckyGo_list.wxml
... ... @@ -31,9 +31,11 @@
31 31 <view>共1件,实付金额:<text class="rmb">{{item.user_money}}</text></view>
32 32 <view class="flex">
33 33 <view class="btn gray" bindtap="go" data-url="/packageC/pages/luckyGo/luckyGo_order/luckyGo_order?order_id={{item.order_id}}&team_status={{item.team_status}}">查看订单</view>
34   - <view class="btn c-red mgl20" wx:if="{{item.team_status == 0}}" bindtap="go" data-url="/packageC/pages/luckyGo/luckyGo_details/luckyGo_details?group_id={{item.aid}}&goods_id={{item.goods_id}}&goods_name={{item.goods_name}}">邀请好友</view>
  34 + <view class="btn c-red mgl20" wx:if="{{item.team_status == 0}}" bindtap="go" data-url="/packageC/pages/luckyGo/luckyGo_details/luckyGo_details?group_id={{item.aid}}&goods_id={{item.goods_id}}&goods_name={{item.goods_name}}&team_id={{item.team_id}}&&from=list">邀请好友</view>
  35 +
  36 + <!-- type=1&ordersn=" + data.data + "&group_id=" + th.data.param.group_id + "&goods_id=" + th.data.param.goods_id + "&goods_name=" -->
35 37 <!-- "&group_id=" + th.data.param.group_id + "&goods_id=" + th.data.param.goods_id + "&goods_name=" + th.data.bn_goods.goods_name -->
36   - <view class="btn c-red mgl20" wx:if="{{item.team_status == 2}}" bindtap="showReward">查看奖励</view>
  38 + <view class="btn c-red mgl20" wx:if="{{item.team_status == 2}}" bindtap="showReward" data-index="{{index}}" data-aid="{{item.aid}}">查看奖励</view>
37 39 </view>
38 40 </view>
39 41 </view>
... ... @@ -50,18 +52,56 @@
50 52 <text class="iconfont icon-close fs32 c-7b" bindtap="closeReward"></text>
51 53 </view>
52 54 <view class="popup-list">
53   - <view class="popup-list-item" wx:for="{{filters.showByType(luckGoInfo.type)}}">
54   - <view class="img-container"><image class="img-block" src="../../../../images/bk.png"></image></view>
55   - <view class="f1">
56   - <view class="ellipsis-2 popup-title pdl20">{{typeArr[item-1].name}}</view>
57   - <view class="fs24 t-r pdt16 c-7b">数量:<text class="c-red">{{luckGoInfo[typeArr[item-1]['key']]}}</text></view>
58   - </view>
59   - </view>
60 55  
  56 + <block wx:for="{{prizesArr}}">
  57 + <!-- 优惠券奖励 -->
  58 + <block wx:if="{{item.type == 3}}">
  59 + <view class="popup-list-item" wx:for="{{item.couponList}}" wx:for-item="i">
  60 + <view class="img-container"><image class="img-block" src="../../../../images/bk.png"></image></view>
  61 + <view class="f1">
  62 + <view class="ellipsis-2 popup-title">优惠券-{{i.name}}</view>
  63 + <view class="fs24 t-r pdt16 c-7b">数量:<text class="c-red">{{i.num}}</text></view>
  64 + </view>
  65 + </view>
  66 + </block>
  67 + <!-- 服务项目奖励 -->
  68 + <block wx:elif="{{item.type == 4}}">
  69 + <view class="popup-list-item" wx:for="{{item.serviceList}}" wx:for-item="i">
  70 + <view class="img-container"><image class="img-block" src="../../../../images/bk.png"></image></view>
  71 + <view class="f1">
  72 + <view class="ellipsis-2 popup-title">服务项目-{{i.name}}</view>
  73 + <view class="fs24 t-r pdt16 c-7b">数量:<text class="c-red">{{i.num}}</text></view>
  74 + </view>
  75 + </view>
  76 + </block>
  77 + <!-- 预存金额 -->
  78 + <block wx:elif="{{item.type == 5}}">
  79 + <view class="popup-list-item">
  80 + <view class="img-container"><image class="img-block" src="../../../../images/bk.png"></image></view>
  81 + <view class="f1">
  82 + <view class="ellipsis-2 popup-title">{{list.pageData[currentItemIndex][item.name]}}</view>
  83 + <view class="fs24 t-r pdt16 c-7b">金额:<text class="c-red">{{filters.div100(list.pageData[currentItemIndex][item.num])}}</text></view>
  84 + </view>
  85 + </view>
  86 + </block>
  87 + <!-- 其他奖励 -->
  88 + <block wx:else>
  89 + <view class="popup-list-item">
  90 + <view class="img-container"><image class="img-block" src="../../../../images/bk.png"></image></view>
  91 + <view class="f1">
  92 + <view class="ellipsis-2 popup-title">{{item.name}}</view>
  93 + <view class="fs24 t-r pdt16 c-7b">数量:<text class="c-red">{{list.pageData[currentItemIndex][item.num]}}</text></view>
  94 + </view>
  95 + </view>
  96 + </block>
  97 + </block>
  98 +
61 99 </view>
62 100 </view>
63 101 </view>
64 102  
  103 + <!-- <view class="fs24 t-r pdt16 c-7b">数量:<text class="c-red">{{list.pageData[currentItemIndex][typeArr[item-1]['key']]}}</text></view> -->
  104 +
65 105  
66 106  
67 107 <view class="no-more" hidden="{{!noMore}}" wx:if="{{list.pageData.length !== 0}}">—— 已经到底啦 ——</view>
... ...
packageC/pages/luckyGo/luckyGo_list/luckyGo_list.wxss
... ... @@ -127,7 +127,10 @@ page {
127 127 color: #AF481D;
128 128 }
129 129  
130   -
  130 +.popup-list {
  131 + max-height: 700rpx;
  132 + overflow-y: auto;
  133 +}
131 134  
132 135 .popup-list-item {
133 136 display: flex;
... ...