Commit 14528c084273e79f23d5bd6d72c6a3cec32c2776
Merge branch 'qa' of http://git.vipzhuang.cn/wxd/MShopWeApp
Showing
34 changed files
with
2256 additions
and
1491 deletions
app.js
app.json
components/diy_public/diy_public.js
... | ... | @@ -3,7 +3,7 @@ |
3 | 3 | // default: e |
4 | 4 | // }; |
5 | 5 | // }(require("../../utils/LoadMore3.js")), |
6 | -// n = new e.default(), | |
6 | +// n = new e.default(), | |
7 | 7 | var t = getApp(), |
8 | 8 | a = t.request, |
9 | 9 | o = t.globalData.setting, |
... | ... | @@ -47,6 +47,7 @@ Component({ |
47 | 47 | kttypeArr:['','商家','会员','阶梯'], |
48 | 48 | imgobj:{ |
49 | 49 | '1':"/miniapp/images/component/seckill.png", |
50 | + '2':"/miniapp/images/component/pingd/pingd.png", | |
50 | 51 | '6':"/miniapp/images/component/pingd/pingd.png" |
51 | 52 | }, |
52 | 53 | nav1:'/packageA/pages/goodsInfo/goodsInfo?', |
... | ... | @@ -84,13 +85,20 @@ Component({ |
84 | 85 | }, |
85 | 86 | |
86 | 87 | ready: function () { |
87 | - if (this.data.prom_type==6) { | |
88 | + if (this.data.prom_type==6) { //天天拼单 | |
88 | 89 | this.setData({ |
89 | 90 | prom_text:'已团', |
90 | 91 | nav1:'/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo?', |
91 | 92 | nav2:'/pages/goods/goodsInfo/goodsInfo?' |
92 | 93 | }) |
93 | 94 | } |
95 | + if (this.data.prom_type==2) { //团购 | |
96 | + this.setData({ | |
97 | + prom_text:'已团', | |
98 | + nav1:'/pages/goods/goodsInfo/goodsInfo?', | |
99 | + nav2:'/pages/goods/goodsInfo/goodsInfo?' | |
100 | + }) | |
101 | + } | |
94 | 102 | var g_id = this.data.object; |
95 | 103 | |
96 | 104 | this.init(g_id); |
... | ... | @@ -140,6 +148,12 @@ Component({ |
140 | 148 | +os.stoid+"&goodsidlist="+goodsidlist; |
141 | 149 | } |
142 | 150 | |
151 | + if (th.data.prom_type==2) { //团购 | |
152 | + gUrl="/api/weshop/goods/groupBuy/getGoodsList?store_id=" | |
153 | + +os.stoid+"&aidlist="+goodsidlist + "&user_id="+user_id; | |
154 | + } | |
155 | + | |
156 | + | |
143 | 157 | |
144 | 158 | app.request.promiseGet(gUrl, {}).then(res => { |
145 | 159 | |
... | ... | @@ -173,6 +187,16 @@ Component({ |
173 | 187 | user_id:user_id, |
174 | 188 | } |
175 | 189 | } |
190 | + if (this.data.prom_type==2) { //团购 | |
191 | + gUrl="/api/weshop/goods/groupBuy/page?page=1&pageSize=9" | |
192 | + req={ | |
193 | + store_id:os.stoid, | |
194 | + is_end: 0, | |
195 | + is_show: 1, | |
196 | + user_id:user_id, | |
197 | + timetype: 2, | |
198 | + } | |
199 | + } | |
176 | 200 | |
177 | 201 | getApp().request.promiseGet(gUrl, |
178 | 202 | { isShowLoading: 1, data:req } |
... | ... | @@ -389,6 +413,10 @@ Component({ |
389 | 413 | if (this.data.prom_type==6) { //天天拼单 |
390 | 414 | url="/pages/activity/pind_list/pind_list" |
391 | 415 | } |
416 | + if (this.data.prom_type==2) { //团购 | |
417 | + url="/packageC/pages/group_list/group_list"; | |
418 | + } | |
419 | + | |
392 | 420 | wx.navigateTo({ |
393 | 421 | url |
394 | 422 | }); | ... | ... |
components/diy_public/diy_public.wxml
... | ... | @@ -51,12 +51,12 @@ |
51 | 51 | <view class="new_item1_price" style="{{'padding:10rpx 10rpx;'+(object.text_align==2 ? 'justify-content:center;flex-direction:column;' :'' )}}"> |
52 | 52 | <view style="{{(object.text_style==2 ? 'font-weight: bold;':'')}}"> |
53 | 53 | <view class="clor7b"> |
54 | - <text wx:if="{{object.seconds_num}}">{{prom_text}}<text class="clor">{{aitem.buy_num}}</text>件</text> | |
54 | + <text class="{{prom_type==2 ? 'group':'' }}" wx:if="{{object.seconds_num}}">{{prom_text}}<text class="{{prom_type==2 ? '':'clor'}}">{{aitem.buy_num}}</text>件</text> | |
55 | 55 | <text wx:if="{{object.remaining_inventory}}">还剩余<text class="clor">{{aitem.status==2 ? '0' : aitem.residue}}</text>件</text> |
56 | 56 | </view> |
57 | 57 | <view class="flex" style="{{'font-size: 24rpx; ' +(object.text_align==2 ? 'justify-content:center;' :'' ) }}"> |
58 | - <view class="clor" wx:if="{{object.commodity_price}}"> | |
59 | - ¥<text class="pricefs42">{{aitem.price_n}}</text><text wx:if="{{aitem.price_xs}}">.{{aitem.price_xs}}</text> | |
58 | + <view class="clor" > | |
59 | + <text wx:if="{{object.commodity_price}}">¥<text class="pricefs42">{{aitem.price_n}}</text><text wx:if="{{aitem.price_xs}}">.{{aitem.price_xs}}</text></text> | |
60 | 60 | <text style="margin-left: 5rpx;" wx:if="{{object.wholesale_price}}" class="clor7b">¥{{aitem.shop_price || aitem.market_price}}</text> |
61 | 61 | </view> |
62 | 62 | </view> |
... | ... | @@ -97,15 +97,17 @@ |
97 | 97 | </view> |
98 | 98 | </block> |
99 | 99 | </view> |
100 | - <view class="ellipsis-2 new_item1_goods_name" style="{{'height:88rpx;font-size:24rpx; ' + (object.text_style==2 ? 'font-weight: bold;':'') + (object.text_align==2 ? 'text-align:center;' :'' )}}" wx:if="{{object.trade_name}}">{{aitem.goods_name}}</view> | |
101 | - <view class="buy_box fs24" style="{{'margin-bottom:10rpx;' +(object.text_align==2 ? ' justify-content: center;' :'' )}}" wx:if="{{prom_type==6 && (object.group_size || object.group_type)}}"> | |
100 | + <view class="ellipsis-2 new_item1_goods_name" style="{{'height:88rpx;font-size:24rpx; '+ (prom_type==2 ? 'margin-bottom:10rpx;':'') + (object.text_style==2 ? 'font-weight: bold;':'') + (object.text_align==2 ? 'text-align:center;' :'' )}}" wx:if="{{object.trade_name}}">{{aitem.goods_name}}</view> | |
101 | + <view class="buy_box fs24" style="{{'margin-bottom:10rpx;'+(object.text_align==2 ? ' justify-content: center;' :'' )}}" wx:if="{{prom_type==6 && (object.group_size || object.group_type)}}"> | |
102 | 102 | <view class="mgr10 lineh24" wx:if="{{object.group_size}}">{{aitem.ct_num}}人团</view> |
103 | 103 | <view class="lineh24" wx:if="{{object.group_type}}">{{kttypeArr[aitem.kttype]}}团</view> |
104 | 104 | </view> |
105 | - <view wx:if="{{object.seconds_num || object.remaining_inventory}}" class="new_item1_price pdlf10 clor7b" style="{{'font-size:20rpx;' + 'display:block;'+(object.text_align==2 ?'text-align:center;':'')+(object.text_style==2 ? 'font-weight: bold;':'')}}"> | |
106 | - <text wx:if="{{object.seconds_num}}">{{prom_text}}<text class="clor">{{aitem.buy_num}}</text>件</text> | |
105 | + | |
106 | + <view wx:if="{{object.seconds_num || object.remaining_inventory}}" class="new_item1_price pdlf10 clor7b" style="{{'font-size:20rpx;' + 'display:block;'+ ((!object.trade_name && prom_type==2)? 'margin-top:20rpx;':'' ) +(object.text_align==2 ?'text-align:center;':'')+(object.text_style==2 ? 'font-weight: bold;':'')}}"> | |
107 | + <text class="{{prom_type==2 ? 'group':'' }}" wx:if="{{object.seconds_num}}">{{prom_text}}<text class="{{prom_type==2 ? '':'clor'}}">{{aitem.buy_num}}</text>件</text> | |
107 | 108 | <text wx:if="{{object.remaining_inventory}}">还剩余<text class="clor">{{aitem.residue}}</text>件</text> |
108 | 109 | </view> |
110 | + | |
109 | 111 | <view class="new_item1_price pdlf10" style="{{(object.text_align==2 ? 'justify-content:center;flex-direction:column;' :'' )}}"> |
110 | 112 | <view style="{{(object.text_style==2 ? 'font-weight: bold;':'')}}"> |
111 | 113 | <view style="{{(object.text_align==2 ? 'justify-content:center;' :'' ) }}"> |
... | ... | @@ -151,7 +153,7 @@ |
151 | 153 | </view> |
152 | 154 | <view class="ellipsis-2 new_item1_goods_name " style="{{'height:88rpx;font-size:24rpx;' + (object.text_style==2 ? 'font-weight: bold;':'') + (object.text_align==2 ? 'text-align:center;' :'' )}}" wx:if="{{object.trade_name}}">{{aitem.goods_name}}</view> |
153 | 155 | <view wx:if="{{object.seconds_num || object.remaining_inventory}}" class="new_item1_price clor7b" style="{{'display:block;font-size:20rpx; '+(object.text_align==2 ?'text-align:center;':'')+(object.text_style==2 ? 'font-weight: bold;':'')}}"> |
154 | - <text wx:if="{{object.seconds_num}}">{{prom_text}}<text class="clor">{{aitem.buy_num}}</text>件</text> | |
156 | + <text wx:if="{{object.seconds_num}}">{{prom_text}}<text class="clor">{{aitem.buy_num}}</text>件</text> | |
155 | 157 | <text wx:if="{{object.remaining_inventory}}">剩<text class="clor">{{aitem.residue}}</text>件</text> |
156 | 158 | </view> |
157 | 159 | <view class="new_item1_price clor7b" style="{{(object.text_align==2 ? 'justify-content:center;flex-direction:column;' :'' )}}"> |
... | ... | @@ -202,13 +204,13 @@ |
202 | 204 | <view wx:if="{{object.group_type}}">{{kttypeArr[aitem.kttype]}}团</view> |
203 | 205 | </view> --> |
204 | 206 | <view wx:if="{{object.seconds_num || object.remaining_inventory}}" class="new_item1_price clor7b" style="{{'font-size:24rpx;'+(object.text_align==2 ?'text-align:center;':'')+(object.text_style==2 ? 'font-weight: bold;':'')}}"> |
205 | - <text wx:if="{{object.seconds_num}}">{{prom_text}}<text class="clor">{{aitem.buy_num}}</text>件</text> | |
207 | + <text class="{{prom_type==2 ? 'group':'' }}" wx:if="{{object.seconds_num}}">{{prom_text}}<text class="{{prom_type==2 ? '':'clor'}}">{{aitem.buy_num}}</text>件</text> | |
206 | 208 | <text wx:if="{{object.remaining_inventory}}">剩<text class="clor">{{aitem.residue}}</text>件</text> |
207 | 209 | </view> |
208 | 210 | <view class="new_item1_price clor7b" style="{{'width:100%;' + (object.text_align==2 ? 'justify-content:center;flex-direction:column;' :'' )}}"> |
209 | 211 | <view style="{{(object.text_style==2 ? 'font-weight: bold;':'')}}"> |
210 | 212 | <view style="{{'font-size: 24rpx; ' +(object.text_align==2 ? 'justify-content:center;' :'' ) }}"> |
211 | - <view class="clor" style="margin-right: 5rpx;" wx:if="{{object.commodity_price}}">¥<text class="pricefs42">{{aitem.price_n}}</text><text wx:if="{{aitem.price_xs}}">.{{aitem.price_xs}}</text><text style="color: #7b7b7b;margin-left: 5rpx;" wx:if="{{object.wholesale_price}}">¥{{aitem.shop_price || aitem.market_price}}</text></view> | |
213 | + <view class="clor" style="margin-right: 5rpx;" ><text wx:if="{{object.commodity_price}}">¥<text class="pricefs42">{{aitem.price_n}}</text><text wx:if="{{aitem.price_xs}}">.{{aitem.price_xs}}</text></text><text style="color: #7b7b7b;margin-left: 5rpx;" wx:if="{{object.wholesale_price}}">¥{{aitem.shop_price || aitem.market_price}}</text></view> | |
212 | 214 | |
213 | 215 | </view> |
214 | 216 | </view> |
... | ... | @@ -261,12 +263,12 @@ |
261 | 263 | <view class="new_item1_price" style="{{'padding:10rpx 10rpx;'+(object.text_align==2 ? 'justify-content:center;flex-direction:column;' :'' )}}"> |
262 | 264 | <view style="{{(object.text_style==2 ? 'font-weight: bold;':'')}}"> |
263 | 265 | <view class="clor7b"> |
264 | - <text wx:if="{{object.seconds_num}}">{{prom_text}}<text class="clor">{{aitem.buy_num}}</text>件</text> | |
266 | + <text class="{{prom_type==2 ? 'group':'' }}" wx:if="{{object.seconds_num}}">{{prom_text}}<text class="{{prom_type==2 ? '':'clor'}}">{{aitem.buy_num}}</text>件</text> | |
265 | 267 | <text wx:if="{{object.remaining_inventory}}">还剩余<text class="clor">{{aitem.status==2 ? '0' : aitem.residue}}</text>件</text> |
266 | 268 | </view> |
267 | 269 | <view class="flex" style="{{'font-size: 24rpx; ' +(object.text_align==2 ? 'justify-content:center;' :'' ) }}"> |
268 | - <view class="clor" wx:if="{{object.commodity_price}}"> | |
269 | - ¥<text class="pricefs42">{{aitem.price_n}}</text><text wx:if="{{aitem.price_xs}}">.{{aitem.price_xs}}</text> | |
270 | + <view class="clor" > | |
271 | + <text wx:if="{{object.commodity_price}}">¥<text class="pricefs42">{{aitem.price_n}}</text><text wx:if="{{aitem.price_xs}}">.{{aitem.price_xs}}</text></text> | |
270 | 272 | <text style="margin-left: 5rpx;" wx:if="{{object.wholesale_price}}" class="clor7b">¥{{aitem.shop_price || aitem.market_price}}</text> |
271 | 273 | </view> |
272 | 274 | </view> |
... | ... | @@ -297,13 +299,13 @@ |
297 | 299 | </view> |
298 | 300 | </block> |
299 | 301 | </view> |
300 | - <view class="ellipsis-2 new_item1_goods_name" style="{{'height:88rpx;font-size:24rpx; ' + (object.text_style==2 ? 'font-weight: bold;':'') + (object.text_align==2 ? 'text-align:center;' :'' )}}" wx:if="{{object.trade_name}}">{{aitem.goods_name}}</view> | |
302 | + <view class="ellipsis-2 new_item1_goods_name" style="{{'height:88rpx;font-size:24rpx; '+ (prom_type==2 ? 'margin-bottom:10rpx;':'') + (object.text_style==2 ? 'font-weight: bold;':'') + (object.text_align==2 ? 'text-align:center;' :'' )}}" wx:if="{{object.trade_name}}">{{aitem.goods_name}}</view> | |
301 | 303 | <view class="buy_box fs24" style="{{'margin-bottom:10rpx;' +(object.text_align==2 ? ' justify-content: center;' :'' )}}" wx:if="{{prom_type==6 && (object.group_size || object.group_type)}}"> |
302 | 304 | <view class="mgr10 lineh24" wx:if="{{object.group_size}}">{{aitem.ct_num}}人团</view> |
303 | 305 | <view class="lineh24" wx:if="{{object.group_type}}">{{kttypeArr[aitem.kttype]}}团</view> |
304 | 306 | </view> |
305 | 307 | <view wx:if="{{object.seconds_num || object.remaining_inventory}}" class="new_item1_price pdlf10 clor7b" style="{{'font-size:20rpx;' + 'display:block;'+(object.text_align==2 ?'text-align:center;':'')+(object.text_style==2 ? 'font-weight: bold;':'')}}"> |
306 | - <text wx:if="{{object.seconds_num}}">{{prom_text}}<text class="clor">{{aitem.buy_num}}</text>件</text> | |
308 | + <text class="{{prom_type==2 ? 'group':'' }}" wx:if="{{object.seconds_num}}">{{prom_text}}<text class="{{prom_type==2 ? '':'clor'}}">{{aitem.buy_num}}</text>件</text> | |
307 | 309 | <text wx:if="{{object.remaining_inventory}}">还剩余<text class="clor">{{aitem.residue}}</text>件</text> |
308 | 310 | </view> |
309 | 311 | <view class="new_item1_price pdlf10" style="{{(object.text_align==2 ? 'justify-content:center;flex-direction:column;' :'' )}}"> |
... | ... | @@ -339,13 +341,13 @@ |
339 | 341 | </view> |
340 | 342 | </block> |
341 | 343 | </view> |
342 | - <view class="ellipsis-2 new_item1_goods_name" style="{{'height:88rpx;font-size:24rpx; ' + (object.text_style==2 ? 'font-weight: bold;':'') + (object.text_align==2 ? 'text-align:center;' :'' )}}" wx:if="{{object.trade_name}}">{{aitem.goods_name}}</view> | |
344 | + <view class="ellipsis-2 new_item1_goods_name" style="{{'height:88rpx;font-size:24rpx; '+ (prom_type==2 ? 'margin-bottom:10rpx;':'') + (object.text_style==2 ? 'font-weight: bold;':'') + (object.text_align==2 ? 'text-align:center;' :'' )}}" wx:if="{{object.trade_name}}">{{aitem.goods_name}}</view> | |
343 | 345 | <view class="buy_box fs24" style="{{'margin-bottom:10rpx;' +(object.text_align==2 ? ' justify-content: center;' :'' )}}" wx:if="{{prom_type==6 && (object.group_size || object.group_type)}}"> |
344 | 346 | <view class="mgr10 lineh24" wx:if="{{object.group_size}}">{{aitem.ct_num}}人团</view> |
345 | 347 | <view class="lineh24" wx:if="{{object.group_type}}">{{kttypeArr[aitem.kttype]}}团</view> |
346 | 348 | </view> |
347 | 349 | <view wx:if="{{object.seconds_num || object.remaining_inventory}}" class="new_item1_price pdlf10 clor7b" style="{{'font-size:20rpx;' + 'display:block;'+(object.text_align==2 ?'text-align:center;':'')+(object.text_style==2 ? 'font-weight: bold;':'')}}"> |
348 | - <text wx:if="{{object.seconds_num}}">{{prom_text}}<text class="clor">{{aitem.buy_num}}</text>件</text> | |
350 | + <text class="{{prom_type==2 ? 'group':'' }}" wx:if="{{object.seconds_num}}">{{prom_text}}<text class="{{prom_type==2 ? '':'clor'}}">{{aitem.buy_num}}</text>件</text> | |
349 | 351 | <text wx:if="{{object.remaining_inventory}}">还剩余<text class="clor">{{aitem.residue}}</text>件</text> |
350 | 352 | </view> |
351 | 353 | <view class="new_item1_price pdlf10" style="{{(object.text_align==2 ? 'justify-content:center;flex-direction:column;' :'' )}}"> |
... | ... | @@ -438,7 +440,7 @@ |
438 | 440 | </view> |
439 | 441 | </block> |
440 | 442 | </view> |
441 | - <view class="ellipsis-2 new_item1_goods_name " style="{{'height:88rpx;font-size:24rpx;' + (object.text_style==2 ? 'font-weight: bold;':'') + (object.text_align==2 ? 'text-align:center;' :'' )}}" wx:if="{{object.trade_name}}">{{aitem.goods_name}}</view> | |
443 | + <view class="ellipsis-2 new_item1_goods_name " style="{{'height:88rpx;font-size:24rpx;' + (object.text_style==2 ? 'font-weight: bold;':'') + (object.text_align==2 ? 'text-align:center;' :'' )}}" wx:if="{{object.trade_name}}">{{aitem.goods_name}}</view> | |
442 | 444 | <view wx:if="{{object.seconds_num || object.remaining_inventory}}" class="new_item1_price clor7b" style="{{'display:block;font-size:20rpx; '+(object.text_align==2 ?'text-align:center;':'')+(object.text_style==2 ? 'font-weight: bold;':'')}}"> |
443 | 445 | <text wx:if="{{object.seconds_num}}">{{prom_text}}<text class="clor">{{aitem.buy_num}}</text>件</text> |
444 | 446 | <text wx:if="{{object.remaining_inventory}}">剩<text class="clor">{{aitem.residue}}</text>件</text> | ... | ... |
components/diy_public/diy_public.wxss
... | ... | @@ -545,4 +545,14 @@ swiper { |
545 | 545 | } |
546 | 546 | .lineh24{ |
547 | 547 | line-height: 24rpx !important; |
548 | + } | |
549 | + .group{ | |
550 | + padding: 10rpx; | |
551 | + background-color:#f23030; | |
552 | + color: #fff; | |
553 | + /* margin-top: 10rpx; */ | |
554 | + line-height: 28rpx; | |
555 | + border-radius: 10rpx; | |
556 | + margin-right: 10rpx; | |
557 | + opacity: .8; | |
548 | 558 | } |
549 | 559 | \ No newline at end of file | ... | ... |
components/diy_seckill/diy_seckill.wxml
... | ... | @@ -50,8 +50,8 @@ |
50 | 50 | <text wx:if="{{object.remaining_inventory}}">还剩余<text class="clor">{{aitem.status==2 ? '0' : aitem.residue}}</text>件</text> |
51 | 51 | </view> |
52 | 52 | <view class="flex" style="{{'font-size: 24rpx; ' +(object.text_align==2 ? 'justify-content:center;' :'' ) }}"> |
53 | - <view class="clor" wx:if="{{object.commodity_price}}"> | |
54 | - ¥<text class="pricefs42">{{aitem.price_n}}</text><text wx:if="{{aitem.price_xs}}">.{{aitem.price_xs}}</text> | |
53 | + <view class="clor" > | |
54 | + <text wx:if="{{object.commodity_price}}">¥<text class="pricefs42">{{aitem.price_n}}</text><text wx:if="{{aitem.price_xs}}">.{{aitem.price_xs}}</text></text> | |
55 | 55 | <text style="margin-left: 5rpx;" wx:if="{{object.wholesale_price}}" class="clor7b">¥{{aitem.shop_price}}</text> |
56 | 56 | </view> |
57 | 57 | </view> |
... | ... | @@ -195,7 +195,7 @@ |
195 | 195 | <view class="new_item1_price clor7b" style="{{'width:100%;' + (object.text_align==2 ? 'justify-content:center;flex-direction:column;' :'' )}}"> |
196 | 196 | <view style="{{(object.text_style==2 ? 'font-weight: bold;':'')}}"> |
197 | 197 | <view style="{{'font-size: 24rpx; ' +(object.text_align==2 ? 'justify-content:center;' :'' ) }}"> |
198 | - <view class="clor" style="margin-right: 5rpx;" wx:if="{{object.commodity_price}}">¥<text class="pricefs42">{{aitem.price_n}}</text><text wx:if="{{aitem.price_xs}}">.{{aitem.price_xs}}</text><text style="color: #7b7b7b;margin-left: 5rpx;" wx:if="{{object.wholesale_price}}">¥{{aitem.shop_price}}</text></view> | |
198 | + <view class="clor" style="margin-right: 5rpx;" ><text wx:if="{{object.commodity_price}}">¥<text class="pricefs42">{{aitem.price_n}}</text><text wx:if="{{aitem.price_xs}}">.{{aitem.price_xs}}</text></text><text style="color: #7b7b7b;margin-left: 5rpx;" wx:if="{{object.wholesale_price}}">¥{{aitem.shop_price}}</text></view> | |
199 | 199 | |
200 | 200 | </view> |
201 | 201 | </view> |
... | ... | @@ -248,8 +248,8 @@ |
248 | 248 | <text wx:if="{{object.remaining_inventory}}">还剩余<text class="clor">{{aitem.status==2 ? '0' : aitem.residue}}</text>件</text> |
249 | 249 | </view> |
250 | 250 | <view class="flex" style="{{'font-size: 24rpx; ' +(object.text_align==2 ? 'justify-content:center;' :'' ) }}"> |
251 | - <view class="clor" wx:if="{{object.commodity_price}}"> | |
252 | - ¥<text class="pricefs42">{{aitem.price_n}}</text><text wx:if="{{aitem.price_xs}}">.{{aitem.price_xs}}</text> | |
251 | + <view class="clor" > | |
252 | + <text wx:if="{{object.commodity_price}}">¥<text class="pricefs42">{{aitem.price_n}}</text><text wx:if="{{aitem.price_xs}}">.{{aitem.price_xs}}</text></text> | |
253 | 253 | <text style="margin-left: 5rpx;" wx:if="{{object.wholesale_price}}" class="clor7b">¥{{aitem.shop_price}}</text> |
254 | 254 | </view> |
255 | 255 | </view> | ... | ... |
components/store_popup/store_popup.js
components/store_popup/store_popup.wxml
... | ... | @@ -28,7 +28,7 @@ |
28 | 28 | <block wx:if="{{choice_sort_store==0}}"> |
29 | 29 | <!-- 需要for循环 --> |
30 | 30 | <block wx:if="{{is_show_sto_cat==1}}"> |
31 | - <view class="store_choose flex" wx:for="{{def_pickpu_list}}" bindtap="choose_for_store_fir" data-ind="{{index}}"> | |
31 | + <view class="store_choose flex" wx:for="{{def_pickpu_list}}" wx:key="{{index}}" bindtap="choose_for_store_fir" data-ind="{{index}}"> | |
32 | 32 | <view class="store flex-vertical"> |
33 | 33 | <!-- 需要点击事件 --> |
34 | 34 | <block wx:if="{{index==fir_pick_index}}"> |
... | ... | @@ -54,7 +54,7 @@ |
54 | 54 | </view> |
55 | 55 | </block> |
56 | 56 | <block wx:else> |
57 | - <view class="store_choose flex" wx:for="{{only_pk}}" bindtap="choose_for_store_fir" data-ind="{{index}}"> | |
57 | + <view class="store_choose flex" wx:for="{{only_pk}}" wx:key="{{index}}" bindtap="choose_for_store_fir" data-ind="{{index}}"> | |
58 | 58 | <view class="store flex-vertical"> |
59 | 59 | <!-- 需要点击事件 --> |
60 | 60 | <block wx:if="{{index==fir_pick_index}}"> |
... | ... | @@ -82,7 +82,7 @@ |
82 | 82 | </block> |
83 | 83 | <block wx:else> |
84 | 84 | <!-- 如果是点击选择门店分类后显示分类下的门店 --> |
85 | - <view class="store_choose flex" wx:for="{{sec_sto.s_arr}}" data-ind="{{index}}" bindtap="choose_for_store"> | |
85 | + <view class="store_choose flex" wx:for="{{sec_sto.s_arr}}" wx:key="{{index}}" data-ind="{{index}}" bindtap="choose_for_store"> | |
86 | 86 | <view class="store flex-vertical"> |
87 | 87 | <!-- 需要点击事件 --> |
88 | 88 | <block wx:if="{{index==sec_pick_index}}"> |
... | ... | @@ -133,7 +133,7 @@ |
133 | 133 | </view> |
134 | 134 | </view> |
135 | 135 | <view class="sort_store_list"> |
136 | - <view class="sort-store-frame" wx:for="{{all_sto}}" data-index="{{index}}" bindtap="choice_sort_store" data-region="{{item.name}}"> | |
136 | + <view class="sort-store-frame" wx:for="{{all_sto}}" wx:key="{{index}}" data-index="{{index}}" bindtap="choice_sort_store" data-region="{{item.name}}"> | |
137 | 137 | <view class="sort-store flex-vertical-between"> |
138 | 138 | <view class="fs30" di>{{item.name}}</view> |
139 | 139 | <view class="black_rights-frame"> | ... | ... |
packageA/pages/checkin/checkin.js
... | ... | @@ -254,7 +254,7 @@ Page({ |
254 | 254 | |
255 | 255 | // 如果还没签到, 可以点击签到 |
256 | 256 | if (isCheckInToday == -1) { |
257 | - | |
257 | + getnowtime = getnowtime.replace(/-/g, "/") | |
258 | 258 | var timeid = Date.parse(getnowtime)/1000; |
259 | 259 | var key = "rgqsqLYhw67sgaIQBF6dw9JK7CDKSS"; |
260 | 260 | var str = app.globalData.setting.stoid + ":" + app.globalData.user_id + ":" + timeid + ":" + key | ... | ... |
packageA/pages/goodsInfo/goodsInfo.js
... | ... | @@ -1574,7 +1574,7 @@ Page({ |
1574 | 1574 | |
1575 | 1575 | } |
1576 | 1576 | var title= th.data.data.goods_name; |
1577 | - var img=th.data.data.original_img; | |
1577 | + var img=th.data.iurl+th.data.data.image_url; | |
1578 | 1578 | if(th.data.prom_type==6){ |
1579 | 1579 | title=th.data.prom_act.share_title; |
1580 | 1580 | img=th.data.iurl+th.data.prom_act.share_imgurl; | ... | ... |
packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.js
... | ... | @@ -1151,9 +1151,7 @@ Page({ |
1151 | 1151 | |
1152 | 1152 | } |
1153 | 1153 | var title = th.data.data.goods_name; |
1154 | - var img = th.data.data.original_img; | |
1155 | - | |
1156 | - | |
1154 | + var img = th.data.iurl+th.data.data.image_url; | |
1157 | 1155 | |
1158 | 1156 | var url = "/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo?goods_id=" + th.data.gid; |
1159 | 1157 | if (getApp().globalData.user_id) { | ... | ... |
packageB/pages/luckactivity/luckinfo/luckinfo.js
... | ... | @@ -4,1406 +4,1489 @@ const app = getApp(); |
4 | 4 | let imghost = app.globalData.setting.imghost; |
5 | 5 | let self = null; |
6 | 6 | let imgDraw = { |
7 | - "width": "554px", | |
8 | - "height": "899px", | |
9 | - "background": imghost + "miniapp/images/share_bg.png", | |
10 | - "views": [ | |
11 | - { //0.头像 | |
12 | - "type": "image", | |
13 | - // "url": app.globalData.userInfo.head_pic, | |
14 | - "css": { | |
15 | - "background": "white", | |
16 | - "width": "80px", | |
17 | - "height": "80px", | |
18 | - "top": "24px", | |
19 | - "left": "40px", | |
20 | - "borderRadius": "80px", | |
21 | - } | |
22 | - }, | |
23 | - { //1.昵称 | |
24 | - "type": "text", | |
25 | - // "text": "", | |
26 | - "css": { | |
27 | - "color": "#000000", | |
28 | - "width": "400px", | |
29 | - "top": "25px", | |
30 | - "left": "140px", | |
31 | - "fontSize": "26px", | |
32 | - "maxLines": "1", | |
33 | - } | |
34 | - }, | |
35 | - { //2.强烈推荐 | |
36 | - "type": "text", | |
37 | - "text": "强烈推荐", | |
38 | - "css": { | |
39 | - "color": "#fff", | |
40 | - "background": "#FF6768", | |
41 | - "width": "105px", | |
42 | - "height": "26px", | |
43 | - "lineHeight": "26px", | |
44 | - "top": "70px", | |
45 | - "left": "140px", | |
46 | - "borderRadius": "10px", | |
47 | - "fontSize": "18px", | |
48 | - "textAlign": "center" | |
49 | - | |
50 | - } | |
51 | - }, | |
52 | - { //3.分享标题 | |
53 | - "type": "text", | |
54 | - "text": "", | |
55 | - "css": { | |
56 | - "width": "554px", | |
57 | - "padding": "20px", | |
58 | - "left": "20px", | |
59 | - "top": "160px", | |
60 | - "fontSize": "28px", | |
61 | - "textAlign": "left", | |
62 | - "maxLines": "1", | |
63 | - } | |
64 | - }, | |
65 | - { //4.分享内容 | |
66 | - "type": "text", | |
67 | - // "text": "", | |
68 | - "css": { | |
69 | - "color": "#000000", | |
70 | - "width": "554px", | |
71 | - "padding": "20px", | |
72 | - "left": "20px", | |
73 | - "top": "190px", | |
74 | - "fontSize": "26px", | |
75 | - "textAlign": "center", | |
76 | - "maxLines": "1", | |
77 | - } | |
78 | - }, | |
79 | - { //5.分享图片 | |
80 | - "type": "image", | |
81 | - "url": "/packageB/images/luckDraw/jiang.png", | |
82 | - "css": { | |
83 | - "width": "auto", | |
84 | - "height": "380px", | |
85 | - "top": "220px", | |
86 | - "left": "277px", | |
87 | - "align": "center", | |
88 | - "mode": "aspectFill", | |
89 | - } | |
90 | - }, | |
91 | - { //6 | |
92 | - "type": "image", | |
93 | - "url": "/images/share/s_gou.png", | |
94 | - "css": { | |
95 | - "width": "30px", | |
96 | - "height": "30px", | |
97 | - "top": "630px", | |
98 | - "left": "18px", | |
99 | - "rotate": "0", | |
100 | - "borderRadius": "30px", | |
101 | - } | |
102 | - }, | |
103 | - { //7 | |
104 | - "type": "text", | |
105 | - "text": "正品保障", | |
106 | - "css": { | |
107 | - "color": "red", | |
108 | - "width": "110px", | |
109 | - "top": "630px", | |
110 | - "left": "52px", | |
111 | - "fontSize": "22px", | |
112 | - } | |
113 | - }, | |
114 | - { //8 | |
115 | - "type": "image", | |
116 | - "url": "/images/share/s_gou.png", | |
117 | - "css": { | |
118 | - "width": "30px", | |
119 | - "height": "30px", | |
120 | - "top": "630px", | |
121 | - "left": "208px", | |
122 | - "borderRadius": "30px", | |
123 | - } | |
124 | - }, | |
125 | - { //9 | |
126 | - "type": "text", | |
127 | - "text": "纯实体店", | |
128 | - "css": { | |
129 | - "color": "red", | |
130 | - "width": "129px", | |
131 | - "top": "630px", | |
132 | - "left": "243px", | |
133 | - "fontSize": "22px", | |
134 | - } | |
135 | - }, | |
136 | - { //10 | |
137 | - "type": "image", | |
138 | - "url": "/images/share/s_gou.png", | |
139 | - "css": { | |
140 | - "width": "30px", | |
141 | - "height": "30px", | |
142 | - "top": "630px", | |
143 | - "left": "410px", | |
144 | - "borderRadius": "30px", | |
145 | - } | |
146 | - }, | |
147 | - { //11 | |
148 | - "type": "text", | |
149 | - "text": "官方验证", | |
150 | - "css": { | |
151 | - "color": "red", | |
152 | - "width": "121px", | |
153 | - "top": "630px", | |
154 | - "left": "450px", | |
155 | - "fontSize": "22px", | |
156 | - } | |
157 | - }, | |
158 | - { //12.横线 | |
159 | - "type": "rect", | |
160 | - "css": { | |
161 | - "color": "#eee", | |
162 | - "width": "548px", | |
163 | - "height": "1px", | |
164 | - "top": "676px", | |
165 | - "left": "277px", | |
166 | - "align": "center", | |
167 | - } | |
168 | - }, | |
169 | - { //13 | |
170 | - "type": "text", | |
171 | - "text": "特惠活动时间仅限", | |
172 | - "css": { | |
173 | - "color": "#000000", | |
174 | - "width": "245px", | |
175 | - "top": "730px", | |
176 | - "left": "28px", | |
177 | - "fontSize": "24px", | |
178 | - "textAlign": "left" | |
179 | - } | |
180 | - }, | |
181 | - { //14.时间 | |
182 | - "type": "text", | |
183 | - // "text": "", | |
184 | - "css": { | |
185 | - "width": "377px", | |
186 | - "top": "770px", | |
187 | - "left": "28px", | |
188 | - "fontSize": "24px", | |
189 | - } | |
190 | - }, | |
191 | - { //15 | |
192 | - "type": "text", | |
193 | - "text": "长按识别小程序码有惊喜哦!", | |
194 | - "css": { | |
195 | - "color": "#7c7c7c", | |
196 | - "width": "348px", | |
197 | - "top": "820px", | |
198 | - "left": "27px", | |
199 | - "fontSize": "24px", | |
200 | - } | |
201 | - }, | |
202 | - | |
203 | - { //16.码 | |
204 | - "type": "image", | |
205 | - // "url": "", | |
206 | - "css": { | |
207 | - "width": "150px", | |
208 | - "height": "150px", | |
209 | - "top": "715px", | |
210 | - "left": "380px", | |
211 | - "mode": "scaleToFill" | |
212 | - } | |
213 | - }, | |
214 | - | |
215 | - ] | |
216 | - }; | |
217 | - | |
7 | + "width": "554px", | |
8 | + "height": "899px", | |
9 | + "background": imghost + "miniapp/images/share_bg.png", | |
10 | + "views": [ | |
11 | + { //0.头像 | |
12 | + "type": "image", | |
13 | + // "url": app.globalData.userInfo.head_pic, | |
14 | + "css": { | |
15 | + "background": "white", | |
16 | + "width": "80px", | |
17 | + "height": "80px", | |
18 | + "top": "24px", | |
19 | + "left": "40px", | |
20 | + "borderRadius": "80px", | |
21 | + } | |
22 | + }, | |
23 | + { //1.昵称 | |
24 | + "type": "text", | |
25 | + // "text": "", | |
26 | + "css": { | |
27 | + "color": "#000000", | |
28 | + "width": "400px", | |
29 | + "top": "25px", | |
30 | + "left": "140px", | |
31 | + "fontSize": "26px", | |
32 | + "maxLines": "1", | |
33 | + } | |
34 | + }, | |
35 | + { //2.强烈推荐 | |
36 | + "type": "text", | |
37 | + "text": "强烈推荐", | |
38 | + "css": { | |
39 | + "color": "#fff", | |
40 | + "background": "#FF6768", | |
41 | + "width": "105px", | |
42 | + "height": "26px", | |
43 | + "lineHeight": "26px", | |
44 | + "top": "70px", | |
45 | + "left": "140px", | |
46 | + "borderRadius": "10px", | |
47 | + "fontSize": "18px", | |
48 | + "textAlign": "center" | |
49 | + | |
50 | + } | |
51 | + }, | |
52 | + { //3.分享标题 | |
53 | + "type": "text", | |
54 | + "text": "", | |
55 | + "css": { | |
56 | + "width": "554px", | |
57 | + "padding": "20px", | |
58 | + "left": "20px", | |
59 | + "top": "160px", | |
60 | + "fontSize": "28px", | |
61 | + "textAlign": "left", | |
62 | + "maxLines": "1", | |
63 | + } | |
64 | + }, | |
65 | + { //4.分享内容 | |
66 | + "type": "text", | |
67 | + // "text": "", | |
68 | + "css": { | |
69 | + "color": "#000000", | |
70 | + "width": "554px", | |
71 | + "padding": "20px", | |
72 | + "left": "20px", | |
73 | + "top": "190px", | |
74 | + "fontSize": "26px", | |
75 | + "textAlign": "center", | |
76 | + "maxLines": "1", | |
77 | + } | |
78 | + }, | |
79 | + { //5.分享图片 | |
80 | + "type": "image", | |
81 | + "url": "/packageB/images/luckDraw/jiang.png", | |
82 | + "css": { | |
83 | + "width": "auto", | |
84 | + "height": "380px", | |
85 | + "top": "220px", | |
86 | + "left": "277px", | |
87 | + "align": "center", | |
88 | + "mode": "aspectFill", | |
89 | + } | |
90 | + }, | |
91 | + { //6 | |
92 | + "type": "image", | |
93 | + "url": "/images/share/s_gou.png", | |
94 | + "css": { | |
95 | + "width": "30px", | |
96 | + "height": "30px", | |
97 | + "top": "630px", | |
98 | + "left": "18px", | |
99 | + "rotate": "0", | |
100 | + "borderRadius": "30px", | |
101 | + } | |
102 | + }, | |
103 | + { //7 | |
104 | + "type": "text", | |
105 | + "text": "正品保障", | |
106 | + "css": { | |
107 | + "color": "red", | |
108 | + "width": "110px", | |
109 | + "top": "630px", | |
110 | + "left": "52px", | |
111 | + "fontSize": "22px", | |
112 | + } | |
113 | + }, | |
114 | + { //8 | |
115 | + "type": "image", | |
116 | + "url": "/images/share/s_gou.png", | |
117 | + "css": { | |
118 | + "width": "30px", | |
119 | + "height": "30px", | |
120 | + "top": "630px", | |
121 | + "left": "208px", | |
122 | + "borderRadius": "30px", | |
123 | + } | |
124 | + }, | |
125 | + { //9 | |
126 | + "type": "text", | |
127 | + "text": "纯实体店", | |
128 | + "css": { | |
129 | + "color": "red", | |
130 | + "width": "129px", | |
131 | + "top": "630px", | |
132 | + "left": "243px", | |
133 | + "fontSize": "22px", | |
134 | + } | |
135 | + }, | |
136 | + { //10 | |
137 | + "type": "image", | |
138 | + "url": "/images/share/s_gou.png", | |
139 | + "css": { | |
140 | + "width": "30px", | |
141 | + "height": "30px", | |
142 | + "top": "630px", | |
143 | + "left": "410px", | |
144 | + "borderRadius": "30px", | |
145 | + } | |
146 | + }, | |
147 | + { //11 | |
148 | + "type": "text", | |
149 | + "text": "官方验证", | |
150 | + "css": { | |
151 | + "color": "red", | |
152 | + "width": "121px", | |
153 | + "top": "630px", | |
154 | + "left": "450px", | |
155 | + "fontSize": "22px", | |
156 | + } | |
157 | + }, | |
158 | + { //12.横线 | |
159 | + "type": "rect", | |
160 | + "css": { | |
161 | + "color": "#eee", | |
162 | + "width": "548px", | |
163 | + "height": "1px", | |
164 | + "top": "676px", | |
165 | + "left": "277px", | |
166 | + "align": "center", | |
167 | + } | |
168 | + }, | |
169 | + { //13 | |
170 | + "type": "text", | |
171 | + "text": "特惠活动时间仅限", | |
172 | + "css": { | |
173 | + "color": "#000000", | |
174 | + "width": "245px", | |
175 | + "top": "730px", | |
176 | + "left": "28px", | |
177 | + "fontSize": "24px", | |
178 | + "textAlign": "left" | |
179 | + } | |
180 | + }, | |
181 | + { //14.时间 | |
182 | + "type": "text", | |
183 | + // "text": "", | |
184 | + "css": { | |
185 | + "width": "377px", | |
186 | + "top": "770px", | |
187 | + "left": "28px", | |
188 | + "fontSize": "24px", | |
189 | + } | |
190 | + }, | |
191 | + { //15 | |
192 | + "type": "text", | |
193 | + "text": "长按识别小程序码有惊喜哦!", | |
194 | + "css": { | |
195 | + "color": "#7c7c7c", | |
196 | + "width": "348px", | |
197 | + "top": "820px", | |
198 | + "left": "27px", | |
199 | + "fontSize": "24px", | |
200 | + } | |
201 | + }, | |
202 | + | |
203 | + { //16.码 | |
204 | + "type": "image", | |
205 | + // "url": "", | |
206 | + "css": { | |
207 | + "width": "150px", | |
208 | + "height": "150px", | |
209 | + "top": "715px", | |
210 | + "left": "380px", | |
211 | + "mode": "scaleToFill" | |
212 | + } | |
213 | + }, | |
214 | + | |
215 | + ] | |
216 | +}; | |
217 | + | |
218 | 218 | |
219 | 219 | Page({ |
220 | 220 | data: { |
221 | - imgDraw: imgDraw, | |
222 | - | |
223 | - start: false, | |
224 | - list: null, | |
225 | - isLoading: false, // 检测是否已经发送请求,防止重复发送请求 | |
226 | - noMore: false, // 检测是否有更多数据,true为没有更多数据,false为还有数据 | |
227 | - pageNum: 1, // 当前页数 | |
228 | - imghost: imghost, | |
229 | - num: 3, | |
230 | - canStart: false, | |
231 | - | |
232 | - | |
221 | + imgDraw: imgDraw, | |
222 | + | |
223 | + start: false, | |
224 | + list: null, | |
225 | + isLoading: false, // 检测是否已经发送请求,防止重复发送请求 | |
226 | + noMore: false, // 检测是否有更多数据,true为没有更多数据,false为还有数据 | |
227 | + pageNum: 1, // 当前页数 | |
228 | + imghost: imghost, | |
229 | + num: 3, | |
230 | + canStart: false, | |
231 | + // store:1, | |
233 | 232 | prizes: [], |
234 | - defaultConfig: { | |
235 | - offsetDegree: 22.5, | |
236 | - }, | |
233 | + defaultConfig: { | |
234 | + offsetDegree: 22.5, | |
235 | + }, | |
237 | 236 | // defaultStyle: { |
238 | 237 | // fontColor: '#d64737', |
239 | 238 | // fontSize: '14px' |
240 | 239 | // }, |
241 | 240 | blocks: [{ |
242 | - padding: '76rpx', | |
243 | - imgs: [{ | |
244 | - src: imghost + 'miniapp/images/luckDraw/weel.png?v=3', | |
245 | - width: '700rpx', | |
246 | - height: '700rpx', | |
247 | - rotate: true, | |
248 | - }], | |
249 | - }], | |
241 | + padding: '76rpx', | |
242 | + imgs: [{ | |
243 | + src: imghost + 'miniapp/images/luckDraw/weel.png?v=3', | |
244 | + width: '700rpx', | |
245 | + height: '700rpx', | |
246 | + rotate: true, | |
247 | + }], | |
248 | + }], | |
250 | 249 | buttons: [{ |
251 | - radius: '60rpx', | |
252 | - imgs: [{ | |
253 | - src: imghost + 'miniapp/images/luckDraw/pointer.png?v=3', | |
254 | - width: '188rpx', | |
255 | - height: '230rpx', | |
256 | - top: '-130rpx', | |
257 | - }], | |
258 | - }], | |
250 | + radius: '60rpx', | |
251 | + imgs: [{ | |
252 | + src: imghost + 'miniapp/images/luckDraw/pointer.png?v=3', | |
253 | + width: '188rpx', | |
254 | + height: '230rpx', | |
255 | + top: '-130rpx', | |
256 | + }], | |
257 | + }], | |
258 | + }, | |
259 | + | |
260 | + onLoad(options) { | |
261 | + self = this; | |
262 | + let first_leader = null; | |
263 | + this.data.options = options; | |
264 | + | |
265 | + | |
266 | + wx.setNavigationBarTitle({ | |
267 | + title: options.title, | |
268 | + }); | |
269 | + | |
270 | + | |
271 | + app.isLogin().then(function (data) {//进入页面前已经授权登录成功 | |
272 | + self.setData({ | |
273 | + userInfo: data, | |
274 | + }); | |
275 | + }); | |
276 | + | |
277 | + | |
278 | + | |
279 | + //从分享的跳转过来 | |
280 | + if (options.id == undefined || options.id == null || options.id == '') { | |
281 | + var scene = decodeURIComponent(options.scene); | |
282 | + scene = scene.split('_'); | |
283 | + first_leader = scene[0]; | |
284 | + this.data.options.id = scene[1]; | |
285 | + }; | |
286 | + | |
287 | + if (first_leader) { | |
288 | + // console.log("log---", first_leader); | |
289 | + app.globalData.first_leader = first_leader; | |
290 | + //调用接口判断是不是会员 | |
291 | + app.request.promiseGet("/api/weshop/shoppingGuide/get/" + app.globalData.setting.stoid + "/" + first_leader, {}).then(res => { | |
292 | + if (res.data.code == 0) { | |
293 | + app.globalData.guide_id = res.data.data.id; | |
294 | + } | |
295 | + }) | |
296 | + }; | |
297 | + | |
259 | 298 | }, |
260 | - | |
261 | - onLoad(options) { | |
262 | - self = this; | |
263 | - let first_leader = null; | |
264 | - this.data.options = options; | |
265 | - | |
266 | - | |
267 | - wx.setNavigationBarTitle({ | |
268 | - title: options.title, | |
269 | - }); | |
270 | - | |
271 | - | |
272 | - app.isLogin().then(function(data) {//进入页面前已经授权登录成功 | |
273 | - self.setData({ | |
274 | - userInfo: data, | |
275 | - }); | |
276 | - }); | |
277 | - | |
278 | - | |
279 | - | |
280 | - //从分享的跳转过来 | |
281 | - if (options.id == undefined || options.id == null || options.id == '') { | |
282 | - var scene = decodeURIComponent(options.scene); | |
283 | - scene = scene.split('_'); | |
284 | - first_leader = scene[0]; | |
285 | - this.data.options.id = scene[1]; | |
286 | - }; | |
287 | - | |
288 | - if(first_leader) { | |
289 | - // console.log("log---", first_leader); | |
290 | - app.globalData.first_leader = first_leader; | |
291 | - //调用接口判断是不是会员 | |
292 | - app.request.promiseGet("/api/weshop/shoppingGuide/get/" + app.globalData.setting.stoid +"/" + first_leader,{}).then(res=>{ | |
293 | - if(res.data.code==0){ | |
294 | - app.globalData.guide_id = res.data.data.id; | |
295 | - } | |
296 | - }) | |
297 | - }; | |
298 | - | |
299 | - }, | |
300 | - | |
301 | - onShow() { | |
302 | - // console.log('show~~`'); | |
303 | - | |
304 | - if(app.globalData.userInfo) { | |
305 | - if(!this.data.isLogin) { | |
306 | - | |
307 | - // 下载头像 | |
308 | - let path = app.globalData.userInfo.head_pic; | |
309 | - path = path.replace("http://thirdwx.qlogo.cn", "https://wx.qlogo.cn"); | |
310 | - path = path.replace("https://thirdwx.qlogo.cn", "https://wx.qlogo.cn"); | |
311 | - wx.downloadFile({ | |
312 | - url: path, //仅为示例,并非真实的资源 | |
313 | - success (res) { | |
314 | - // 只要服务器有响应数据,就会把响应内容写入文件并进入 success 回调,业务需要自行判断是否下载到了想要的内容 | |
315 | - if (res.statusCode === 200) { | |
316 | - self.setData({ | |
317 | - 'imgDraw.views[0].url': res.tempFilePath,//头像 | |
318 | - }); | |
319 | - | |
320 | - } | |
321 | - } | |
322 | - }); | |
323 | - | |
324 | - | |
325 | - this.setData({ | |
326 | - userInfo: app.globalData.userInfo, | |
327 | - isLogin: true, | |
328 | - 'imgDraw.views[1].text': app.globalData.userInfo.nickname,//昵称 | |
329 | - }); | |
330 | - | |
331 | - | |
332 | - // console.log('imgDraw.views[1].text+++++++++', imgDraw.views[1], app.globalData.userInfo.nickname); | |
333 | - let user_id = app.globalData.userInfo.user_id; | |
334 | - let store_id = app.globalData.setting.stoid; | |
335 | - let id = this.data.options.id; | |
336 | - let url = `/api/weshop/marketing/marketingLuckForm/getLuckInfo/${store_id}/${id}/${user_id}`; | |
337 | - | |
338 | - //获取小程序码 | |
339 | - this.getMiniCode({ | |
340 | - url: app.globalData.setting.url, | |
341 | - store_id: app.globalData.setting.stoid, | |
342 | - user_id: app.globalData.userInfo.user_id, | |
343 | - id: this.data.options.id, | |
344 | - }); | |
345 | - | |
346 | - | |
347 | - app.request.get(url, { | |
348 | - success: function(res) { | |
349 | - if(res.data.code == 0) { | |
350 | - self.setData({ | |
351 | - luckInfo: res.data.data, | |
352 | - }); | |
353 | - WxParse.wxParse('content', 'html', self.data.luckInfo.remark, self); | |
354 | - | |
355 | - // 如果is_share为1,隐藏发送给朋友和分享到朋友圈功能 | |
356 | - if(!self.data.luckInfo.is_share) { | |
357 | - wx.hideShareMenu(); | |
358 | - }; | |
359 | - | |
360 | - } else { | |
361 | - wx.showToast({ | |
362 | - title: res.data.msg, | |
363 | - icon: 'none', | |
364 | - }); | |
365 | - self.data.msg = res.data.msg; | |
366 | - // self.setData({ | |
367 | - // bannerUrl: imghost + 'miniapp/images/luckDraw/bg.png?v=2', | |
368 | - // 'blocks[0].imgs[0].src': imghost + 'miniapp/images/luckDraw/weel.png?v=3', //转盘 | |
369 | - // 'buttons[0].imgs[0].src': imghost + 'miniapp/images/luckDraw/pointer.png?v=3', //指针 | |
370 | - // }); | |
371 | - | |
372 | - }; | |
373 | - | |
374 | - // console.log('luckInfo', res.data.data); | |
375 | - let luckInfo = res.data.data; | |
376 | - | |
377 | - | |
378 | - | |
379 | - self.setData({ | |
380 | - 'imgDraw.views[3].text': self.data.luckInfo.act_name,//分享标题 | |
381 | - // 'imgDraw.views[4].text': '快来一起抽奖吧,精美奖品等着你!',//分享内容 | |
382 | - 'imgDraw.views[14].text': util.formar_no_full(luckInfo.begindate) + ' 至 ' + util.formar_no_full(luckInfo.enddate),//活动时间 | |
383 | - }); | |
384 | - | |
385 | - | |
386 | - | |
387 | - let luckStyle = null; | |
388 | - | |
389 | - | |
390 | - if(luckInfo && luckInfo.template_type != null && luckInfo.template_type == 1) { //获取模板 | |
391 | - let url = `/api/weshop/marketing/marketingLuckTemplate/get/0/${luckInfo.template_id}`; | |
392 | - app.request.get(url, { | |
393 | - success: function(res) { | |
394 | - let template = null; | |
395 | - if(res.data.code == 0) { | |
396 | - template = res.data.data; | |
397 | - self.setData({ | |
398 | - template, | |
399 | - bannerUrl: imghost + template.bannerUrl, //背景图 | |
400 | - 'blocks[0].imgs[0].src': imghost + ((template&&template.wheelBaseUrl) ? template.wheelBaseUrl:'miniapp/images/luckDraw/weel.png?v=3'), | |
401 | - 'buttons[0].imgs[0].src': imghost + ((template&&template.wheelPointerUrl) ? template.wheelPointerUrl:'miniapp/images/luckDraw/pointer.png?v=3'), //指针 | |
402 | - 'imgDraw.views[3].text': template.share_title ? template.share_title:self.data.luckInfo.act_name, //分享标题 | |
403 | - 'imgDraw.views[5].url': imghost + (template&&template.share_image ? template.share_image:self.data.luckInfo.imageurl), //分享图片 | |
404 | - | |
405 | - }); | |
406 | - | |
407 | - let color = template&&template.colorCode ? template.colorCode:'#da104b'; | |
408 | - luckStyle = `background: ${color} url(${self.data.bannerUrl}) no-repeat;`; | |
409 | - self.setData({ | |
410 | - luckStyle, | |
411 | - | |
412 | - }); | |
413 | - // self.setData({ | |
414 | - // template: res.data.data, | |
415 | - // bannerUrl: imghost + res.data.data.bannerUrl, //背景图 | |
416 | - // //bannerUrl: imghost + ((res.data.data&&res.data.data.bannerUrl) ? res.data.data.bannerUrl:'miniapp/images/luckDraw/bg.png?v=2'), //背景图 | |
417 | - // 'blocks[0].imgs[0].src': imghost + res.data.data&&res.data.data.wheelBaseUrl) ? res.data.data.wheelBaseUrl:'miniapp/images/luckDraw/weel.png?v=2'), //转盘 | |
418 | - // 'buttons[0].imgs[0].src': imghost + ((res.data.data&&res.data.data.wheelPointerUrl) ? res.data.data.wheelPointerUrl:'miniapp/images/luckDraw/pointer.png?v=2'), //指针 | |
419 | - // 'imgDraw.views[3].text': (res.data.data&&res.data.data.title) ? res.data.data.title : self.data.luckInfo.act_name,//分享标题 | |
420 | - // // 'imgDraw.views[4].text': (res.data.data&&res.data.data.share_content) ? res.data.data.share_content : '快来一起抽奖吧,精美奖品等着你!',//分享内容 | |
421 | - // 'imgDraw.views[5].url': (res.data.data&&res.data.data.share_image) ? (imghost + res.data.data.share_image):(self.data.luckInfo.imageurl ? (imghost + self.data.luckInfo.imageurl):'/packpageB/images/luckDraw/jiang.png'),//分享图片 | |
422 | - // 'imgDraw.views[14].text': util.formar_no_full(self.data.luckInfo.begindate) + ' 至 ' + util.formar_no_full(self.data.luckInfo.enddate),//活动时间 | |
423 | - // }); | |
424 | - } else { | |
425 | - luckStyle = `background: #da104b url(${imghost + 'miniapp/images/luckDraw/bg.png?v=2'}) no-repeat;`; | |
426 | - self.setData({ | |
427 | - luckStyle, | |
428 | - 'imgDraw.views[5].url': self.data.luckInfo.imageurl ? (imghost + self.data.luckInfo.imageurl):'/packageB/images/luckDraw/jiang.png', //分享图片 | |
429 | - 'blocks[0].imgs[0].src': imghost + 'miniapp/images/luckDraw/weel.png?v=3', //转盘 | |
430 | - 'buttons[0].imgs[0].src': imghost + 'miniapp/images/luckDraw/pointer.png?v=3', //指针 | |
431 | - }); | |
432 | - // let color = template&&template.colorCode ? template.colorCode:'#da104b'; | |
433 | - | |
434 | - // self.setData({ | |
435 | - // luckStyle, | |
436 | - // }); | |
437 | - }; | |
438 | - | |
439 | - }, | |
440 | - }); | |
441 | - } else { | |
442 | - | |
443 | - if(luckInfo && luckInfo.imageurl) { | |
444 | - self.setData({ | |
445 | - 'imgDraw.views[5].url': imghost + self.data.luckInfo.imageurl, //分享图片 | |
446 | - }); | |
447 | - }; | |
448 | - | |
449 | - if(luckInfo && luckInfo.store_bannerUrl) { | |
450 | - self.setData({ | |
451 | - bannerUrl: imghost + luckInfo.store_bannerUrl, | |
452 | - custom: true, | |
453 | - }); | |
454 | - } else { | |
455 | - self.setData({ | |
456 | - bannerUrl: imghost + 'miniapp/images/luckDraw/bg.png?v=2', | |
457 | - custom: false, | |
458 | - }); | |
459 | - }; | |
460 | - | |
461 | - let color = self.data.custom ? '#f0f0f0':'#da104b'; | |
462 | - luckStyle = `background: ${color} url(${self.data.bannerUrl}) no-repeat;`; | |
463 | - self.setData({ | |
464 | - luckStyle, | |
465 | - 'blocks[0].imgs[0].src': imghost + 'miniapp/images/luckDraw/weel.png?v=3', //转盘 | |
466 | - 'buttons[0].imgs[0].src': imghost + 'miniapp/images/luckDraw/pointer.png?v=3', //指针 | |
467 | - }); | |
468 | - | |
469 | - }; | |
470 | - | |
471 | - | |
472 | - if(self.data.luckInfo.msgInfo) { | |
473 | - wx.showToast({ | |
474 | - title: self.data.luckInfo.msgInfo, | |
475 | - icon: 'none', | |
476 | - }); | |
477 | - }; | |
478 | - | |
479 | - }, | |
480 | - }); | |
481 | - | |
482 | - // 获取奖品展示的奖品 | |
483 | - app.request.get('/api/weshop/marketing/marketingLuckList/page', { | |
484 | - data: { | |
485 | - store_id, | |
486 | - luck_formid: id, | |
487 | - }, | |
488 | - success: function(res) { | |
489 | - | |
490 | - let award = res.data.data.pageData; | |
491 | - self.setData({ | |
492 | - award, | |
493 | - }); | |
494 | - // console.log('award', award); | |
495 | - self.prizeLayout(award); | |
496 | - | |
497 | - }, | |
498 | - }); | |
499 | - | |
500 | - | |
501 | - //获取兑奖记录 | |
502 | - app.request.get('/api/weshop/marketing/marketingLuckRecord/page', { | |
503 | - isShowLoading: false, | |
504 | - data: { | |
505 | - store_id: app.globalData.setting.stoid, | |
506 | - user_id: app.globalData.userInfo.user_id, | |
507 | - luck_formid: this.data.options.id, | |
508 | - luck_state: 1 | |
509 | - }, | |
510 | - success: function(res) { | |
511 | - if(res.data.code == 0) { | |
512 | - self.setData({ | |
513 | - record: res.data.data.pageData, | |
514 | - }); | |
515 | - } | |
516 | - }, | |
517 | - }); | |
518 | - | |
519 | - | |
520 | - //获取中奖人员名单 | |
521 | - app.request.get('/api/weshop/marketing/marketingLuckRecord/page', { | |
522 | - isShowLoading: false, | |
523 | - data: { | |
524 | - store_id: app.globalData.setting.stoid, | |
525 | - luck_formid: this.data.options.id, | |
526 | - luck_state: 1, | |
527 | - pageSize: 20, | |
528 | - }, | |
529 | - success: function(res) { | |
530 | - if(res.data.code == 0) { | |
531 | - self.setData({ | |
532 | - nameList: res.data.data.pageData, | |
533 | - }); | |
534 | - }; | |
535 | - }, | |
536 | - }); | |
537 | - | |
538 | - | |
539 | - | |
540 | - | |
541 | - }; | |
542 | - }; | |
543 | - }, | |
544 | - | |
545 | - //获取小程序码 | |
546 | - getMiniCode(objData) { | |
547 | - wx.getImageInfo({ | |
548 | - src: `${objData.url}/api/wx/open/app/user/getWeAppEwm/${objData.store_id}?sceneValue=${objData.user_id}_${objData.id}&pageValue=packageB/pages/luckactivity/luckinfo/luckinfo`, | |
549 | - success (res) { | |
550 | - if(res.code != -1) { | |
551 | - self.setData({ | |
552 | - 'imgDraw.views[16].url': res.path, | |
553 | - getMiniCode: true, | |
554 | - }); | |
555 | - }; | |
556 | - } | |
557 | - }); | |
558 | - }, | |
559 | - | |
560 | - // 设置转盘奖品布局 | |
561 | - prizeLayout(award) { | |
562 | - let prizes = []; | |
563 | - // let length = award.length; | |
564 | - if(award) { | |
565 | - var length = award.length; | |
566 | - } else { | |
567 | - wx.showToast({ | |
568 | - title: '请设置奖品', | |
569 | - icon: 'none', | |
570 | - }); | |
571 | - return; | |
572 | - }; | |
573 | - | |
574 | - let thx = {fonts: [{ text: '谢谢\n参与', top: '18%', wordWrap:false, fontColor: 'rgba(255,255,255,.6)'}]}; | |
575 | - | |
576 | - if(length == 1) { | |
577 | - [0,2,4,6].map(function(item, index) { | |
578 | - prizes[item] = { | |
579 | - id: award[0].id, | |
580 | - lbtype: award[0].lbtype, | |
581 | - fonts: [{ text: award[0].luck_goods_name + ' x' + award[0].num, top: '18%', wordWrap:false, fontColor: 'transparent'}], | |
582 | - imgs: [ | |
583 | - { | |
584 | - src: self.prizeSrc(award[0].lbtype) ? self.prizeSrc(award[0].lbtype): (imghost + 'miniapp/images/luckDraw/lb.png'), | |
585 | - width: '135rpx', | |
586 | - height: '107rpx', | |
587 | - top: '12%', | |
588 | - } | |
589 | - ], | |
590 | - }; | |
591 | - }); | |
592 | - | |
593 | - [1,3,5,7].map(function(item, index) { | |
594 | - prizes[item] = thx; | |
595 | - }); | |
596 | - | |
597 | - this.data.thxIndexArr = [1,3,5,7]; | |
598 | - }; | |
599 | - | |
600 | - if(length == 2) { | |
601 | - [0,4].map(function(item, index) { | |
602 | - prizes[item] = { | |
603 | - id: award[0].id, | |
604 | - lbtype: award[0].lbtype, | |
605 | - fonts: [{ text: award[0].luck_goods_name + ' x' + award[0].num, top: '18%', wordWrap:false, fontColor: 'transparent'}], | |
606 | - imgs: [ | |
607 | - { | |
608 | - src: self.prizeSrc(award[0].lbtype) ? self.prizeSrc(award[0].lbtype): (imghost + 'miniapp/images/luckDraw/lb.png'), | |
609 | - width: '135rpx', | |
610 | - height: '107rpx', | |
611 | - top: '12%', | |
612 | - } | |
613 | - ], | |
614 | - }; | |
615 | - }); | |
616 | - | |
617 | - [2,6].map(function(item, index) { | |
618 | - prizes[item] = { | |
619 | - id: award[1].id, | |
620 | - lbtype: award[1].lbtype, | |
621 | - fonts: [{ text: award[1].luck_goods_name + ' x' + award[1].num, top: '18%', wordWrap:false, fontColor: 'transparent'}], | |
622 | - imgs: [ | |
623 | - { | |
624 | - src: self.prizeSrc(award[1].lbtype) ? self.prizeSrc(award[1].lbtype): (imghost + 'miniapp/images/luckDraw/lb.png'), | |
625 | - width: '135rpx', | |
626 | - height: '107rpx', | |
627 | - top: '12%', | |
628 | - } | |
629 | - ], | |
630 | - }; | |
631 | - }); | |
632 | - | |
633 | - [1,3,5,7].map(function(item, index) { | |
634 | - prizes[item] = thx; | |
635 | - }); | |
636 | - this.data.thxIndexArr = [1,3,5,7]; | |
637 | - }; | |
638 | - | |
639 | - | |
640 | - if(length == 3) { | |
641 | - [0,4].map(function(item, index) { | |
642 | - prizes[item] = { | |
643 | - id: award[0].id, | |
644 | - lbtype: award[0].lbtype, | |
645 | - fonts: [{ text: award[0].luck_goods_name + ' x' + award[0].num, top: '18%', wordWrap:false, fontColor: 'transparent'}], | |
646 | - imgs: [ | |
647 | - { | |
648 | - src: self.prizeSrc(award[0].lbtype) ? self.prizeSrc(award[0].lbtype): (imghost + 'miniapp/images/luckDraw/lb.png'), | |
649 | - width: '135rpx', | |
650 | - height: '107rpx', | |
651 | - top: '12%', | |
652 | - } | |
653 | - ], | |
654 | - }; | |
655 | - }); | |
656 | - | |
657 | - [1,5].map(function(item, index) { | |
658 | - prizes[item] = { | |
659 | - id: award[1].id, | |
660 | - lbtype: award[1].lbtype, | |
661 | - fonts: [{ text: award[1].luck_goods_name + ' x' + award[1].num, top: '18%', wordWrap:false, fontColor: 'transparent'}], | |
662 | - imgs: [ | |
663 | - { | |
664 | - src: self.prizeSrc(award[1].lbtype) ? self.prizeSrc(award[1].lbtype): (imghost + 'miniapp/images/luckDraw/lb.png'), | |
665 | - width: '135rpx', | |
666 | - height: '107rpx', | |
667 | - top: '12%', | |
668 | - } | |
669 | - ], | |
670 | - }; | |
671 | - }); | |
672 | - | |
673 | - [2,6].map(function(item, index) { | |
674 | - prizes[item] = { | |
675 | - id: award[2].id, | |
676 | - lbtype: award[2].lbtype, | |
677 | - fonts: [{ text: award[2].luck_goods_name + ' x' + award[2].num, top: '18%', wordWrap:false, fontColor: 'transparent'}], | |
678 | - imgs: [ | |
679 | - { | |
680 | - src: self.prizeSrc(award[2].lbtype) ? self.prizeSrc(award[2].lbtype): (imghost + 'miniapp/images/luckDraw/lb.png'), | |
681 | - width: '135rpx', | |
682 | - height: '107rpx', | |
683 | - top: '12%', | |
684 | - } | |
685 | - ], | |
686 | - }; | |
687 | - }); | |
688 | - | |
689 | - [3,7].map(function(item, index) { | |
690 | - prizes[item] = thx; | |
691 | - }); | |
692 | - | |
693 | - this.data.thxIndexArr = [3,7]; | |
694 | - }; | |
695 | - | |
696 | - | |
697 | - if(length == 4) { | |
698 | - [0,2,4,6].map(function(item, index) { | |
699 | - prizes[item] = { | |
700 | - id: award[index].id, | |
701 | - lbtype: award[index].lbtype, | |
702 | - fonts: [{ text: award[index].luck_goods_name + ' x' + award[index].num, top: '18%', wordWrap:false, fontColor: 'transparent'}], | |
703 | - imgs: [ | |
704 | - { | |
705 | - src: self.prizeSrc(award[index].lbtype) ? self.prizeSrc(award[index].lbtype): (imghost + 'miniapp/images/luckDraw/lb.png'), | |
706 | - width: '135rpx', | |
707 | - height: '107rpx', | |
708 | - top: '12%', | |
709 | - } | |
710 | - ], | |
711 | - }; | |
712 | - }); | |
713 | - | |
714 | - [1,3,5,7].map(function(item, index) { | |
715 | - prizes[item] = thx; | |
716 | - }); | |
717 | - | |
718 | - this.data.thxIndexArr = [1,3,5,7]; | |
719 | - }; | |
720 | - | |
721 | - if(length == 5) { | |
722 | - [0,2,3,5,6].map(function(item, index) { | |
723 | - prizes[item] = { | |
724 | - id: award[index].id, | |
725 | - lbtype: award[index].lbtype, | |
726 | - fonts: [{ text: award[index].luck_goods_name + ' x' + award[index].num, top: '18%', wordWrap:false, fontColor: 'transparent'}], | |
727 | - imgs: [ | |
728 | - { | |
729 | - src: self.prizeSrc(award[index].lbtype) ? self.prizeSrc(award[index].lbtype): (imghost + 'miniapp/images/luckDraw/lb.png'), | |
730 | - width: '135rpx', | |
731 | - height: '107rpx', | |
732 | - top: '12%', | |
733 | - } | |
734 | - ], | |
735 | - }; | |
736 | - }); | |
737 | - | |
738 | - [1,4,7].map(function(item, index) { | |
739 | - prizes[item] = thx; | |
740 | - }); | |
741 | - | |
742 | - this.data.thxIndexArr = [1,4,7]; | |
743 | - }; | |
744 | - | |
745 | - if(length == 6) { | |
746 | - prizes = award.map(function(item, index) { | |
747 | - return { | |
748 | - id: item.id, | |
749 | - lbtype: item.lbtype, | |
750 | - fonts: [{ text: item.luck_goods_name + ' x' + item.num, top: '18%', wordWrap:false, fontColor: 'transparent'}], | |
751 | - imgs: [ | |
752 | - { | |
753 | - src: self.prizeSrc(item.lbtype) ? self.prizeSrc(item.lbtype): (imghost + 'miniapp/images/luckDraw/lb.png'), | |
754 | - width: '135rpx', | |
755 | - height: '107rpx', | |
756 | - top: '12%', | |
757 | - } | |
758 | - ], | |
759 | - }; | |
760 | - }); | |
761 | - | |
762 | - prizes.push(thx); | |
763 | - prizes.splice(3, 0, thx); | |
764 | - | |
765 | - this.data.thxIndexArr = [3,7]; | |
766 | - }; | |
767 | - | |
768 | - // console.log('prizes', prizes); | |
769 | - | |
770 | - this.setData({ | |
771 | - prizes, | |
772 | - }); | |
773 | - }, | |
774 | - | |
775 | - // 根据lbtype指定奖品类别图标 | |
776 | - prizeSrc(lbtype) { | |
777 | - let src = ''; | |
778 | - switch(lbtype) { | |
779 | - case 1: { //积分 | |
780 | - src = imghost + 'miniapp/images/luckDraw/jf.png'; | |
781 | - break; | |
782 | - }; | |
783 | - case 2: { //成长值 | |
784 | - src = imghost + 'miniapp/images/luckDraw/czz.png'; | |
785 | - break; | |
786 | - }; | |
787 | - case 3: { //优惠券 | |
788 | - src = imghost + 'miniapp/images/luckDraw/yhq.png'; | |
789 | - break; | |
790 | - }; | |
791 | - case 4: { //服务项目 | |
792 | - src = imghost + 'miniapp/images/luckDraw/fw.png'; | |
793 | - break; | |
794 | - }; | |
795 | - case 5: { //赠品 | |
796 | - src = imghost + 'miniapp/images/luckDraw/zp.png'; | |
797 | - break; | |
798 | - }; | |
799 | - case 6: { //礼包 | |
800 | - src = imghost + 'miniapp/images/luckDraw/lb.png'; | |
801 | - break; | |
802 | - }; | |
803 | - }; | |
804 | - return src; | |
805 | - }, | |
806 | - | |
807 | - // 获取抽奖结果匹配对应奖品在奖品列表里的所有索引号 | |
808 | - luckyIndex(arr, target) { | |
809 | - var results=[], | |
810 | - len = arr.length, | |
811 | - pos = 0; | |
812 | - while(pos < len){ | |
813 | - // pos = arr[pos].indexOf(target, pos); | |
814 | - if(arr[pos].id == target) { | |
815 | - results.push(pos);//找到就存储索引 | |
816 | - | |
817 | - }; | |
818 | - pos += 1;//并从下个位置开始搜索 | |
819 | - // if(pos === -1){//未找到就退出循环完成搜索 | |
820 | - // break; | |
821 | - // }; | |
822 | - | |
823 | - } | |
824 | - // console.log('当前奖品列表', this.data.prizes); | |
825 | - // console.log('中奖结果在当前奖品列表中的索引', results); | |
826 | - | |
827 | - return results; | |
828 | - }, | |
829 | - | |
830 | - start () { | |
831 | - // self.data.start = true; | |
832 | - if(this.data.start) return; | |
833 | - this.data.start = true; | |
834 | - | |
835 | - if(!this.data.luckInfo) { | |
836 | - wx.showToast({ | |
837 | - title: this.data.msg, | |
838 | - icon: 'none', | |
839 | - }); | |
840 | - return; | |
841 | - }; | |
842 | - | |
843 | - if(this.data.luckInfo.msgInfo) { | |
844 | - wx.showToast({ | |
845 | - title: self.data.luckInfo.msgInfo, | |
846 | - icon: 'none', | |
847 | - success: function() { | |
848 | - self.setData({ | |
849 | - start: false | |
850 | - }); | |
851 | - } | |
852 | - }); | |
853 | - return; | |
854 | - }; | |
855 | - wx.showLoading({ | |
856 | - title: '准备开始抽奖', | |
857 | - mask: true, | |
858 | - }); | |
859 | - // 获取积分 | |
860 | - app.request.promisePost('/api/weshop/marketing/marketingLuckForm/startLuckIntegral', { | |
861 | - isShowLoading: false, | |
862 | - data: { | |
863 | - storeId: app.globalData.setting.stoid, | |
864 | - userId: app.globalData.userInfo.user_id, | |
865 | - LuckId: this.data.options.id, | |
866 | - }, | |
867 | - }) | |
868 | - .then(function(res) { | |
869 | - if(res.data.code == -1) { | |
870 | - //积分不足,弹出提示 | |
871 | - wx.hideLoading(); | |
872 | - self.data.luckInfo.msgInfo = res.data.msg | |
873 | - wx.showToast({ | |
874 | - title: res.data.msg, | |
875 | - icon: 'none', | |
876 | - success: function() { | |
877 | - self.data.start = false; | |
878 | - } | |
879 | - }); | |
880 | - return; | |
881 | - }; | |
882 | - | |
883 | - if(res.data.code == 0) { | |
884 | - | |
885 | - if(self.data.luckInfo.user_LuckNumDay > 0 || self.data.luckInfo.vip_act_num == 0) { | |
886 | - // console.log('start choujiang'); | |
887 | - // let start = false; | |
888 | - if(self.data.start) { | |
889 | - // self.data.start = true; | |
890 | - // 获取抽奖组件实例 | |
891 | - const $lucky = self.selectComponent('#myLucky'); | |
892 | - // 调用play方法开始旋转 | |
893 | - $lucky.play(); | |
894 | - wx.hideLoading(); | |
895 | - // 获取抽奖结果 | |
896 | - app.request.post('/api/weshop/marketing/marketingLuckForm/startLuck', { | |
897 | - isShowLoading: false, | |
898 | - data: { | |
899 | - storeId: app.globalData.setting.stoid, | |
900 | - userId: app.globalData.userInfo.user_id, | |
901 | - LuckId: self.data.options.id, | |
902 | - }, | |
903 | - success: function(res) { | |
904 | - | |
905 | - if(res.data.code == 0) { | |
906 | - // console.log('开始摇奖', res.data.data); | |
907 | - if(self.data.luckInfo.vip_act_num != 0) { | |
908 | - self.setData({ | |
909 | - 'luckInfo.user_LuckNumDay': self.data.luckInfo.user_LuckNumDay - 1, | |
910 | - // isActive: true, | |
911 | - }); | |
912 | - }; | |
913 | - | |
914 | - self.setData({ | |
915 | - // 'luckInfo.user_LuckNumDay': self.data.luckInfo.user_LuckNumDay - 1, | |
916 | - isActive: true, | |
917 | - wow: res.data.data, | |
918 | - }); | |
919 | - // console.log('wow', self.data.wow); | |
920 | - // console.log('请求成功', res.data.data); | |
921 | - let luckyId = res.data.data.id; | |
922 | - let indexArr = self.luckyIndex(self.data.prizes, luckyId); | |
923 | - // console.log('抽奖奖品id', luckyId); | |
924 | - // console.log('奖品列表', self.data.prizes); | |
925 | - // console.log('奖品对应的索引数组', indexArr); | |
926 | - let random = Math.random() * indexArr.length >> 0; | |
927 | - // console.log('random', random); | |
928 | - let index = indexArr[random]; | |
929 | - | |
930 | - $lucky.stop(index); | |
931 | - | |
932 | - // setTimeout(() => { | |
933 | - // Promise.resolve($lucky.stop(index)).then(()=>{ | |
934 | - // self.data.start = false; | |
935 | - // }); | |
936 | - | |
937 | - // }, 2000); | |
938 | - | |
939 | - | |
940 | - //获取兑奖记录 | |
941 | - // app.request.get('/api/weshop/marketing/marketingLuckRecord/page', { | |
942 | - // isShowLoading: false, | |
943 | - // data: { | |
944 | - // store_id: app.globalData.setting.stoid, | |
945 | - // user_id: app.globalData.userInfo.user_id, | |
946 | - // luck_formid: self.data.options.id, | |
947 | - // luck_state: 1 | |
948 | - // }, | |
949 | - // success: function(res) { | |
950 | - // if(res.data.code == 0) { | |
951 | - // // console.log('res===>', res.data.data.pageData); | |
952 | - // self.setData({ | |
953 | - // record: res.data.data.pageData, | |
954 | - // }); | |
955 | - // }; | |
956 | - // }, | |
957 | - // }); | |
958 | - | |
959 | - | |
960 | - } else { | |
961 | - let thxIndexArr = self.data.thxIndexArr; | |
962 | - const random = Math.random() * thxIndexArr.length >> 0; | |
963 | - const index = thxIndexArr[random]; | |
964 | - // console.log('谢谢参与数组', thxIndexArr); | |
965 | - // console.log('请求出错产生谢谢参与的随机数', index); | |
966 | - $lucky.stop(index); | |
967 | - // setTimeout(() => { | |
968 | - // Promise.resolve($lucky.stop(index)).then(()=>{ | |
969 | - // self.data.start = false; | |
970 | - // }); | |
971 | - // }, 2000); | |
972 | - | |
973 | - | |
974 | - | |
975 | - | |
976 | - if(res.data.code == -1) { | |
977 | - wx.showToast({ | |
978 | - title: res.data.msg, | |
979 | - icon: 'none', | |
980 | - success: function() { | |
981 | - self.setData({ | |
982 | - start: false | |
983 | - }); | |
984 | - } | |
985 | - }); | |
986 | - self.data.luckInfo.msgInfo = res.data.msg; | |
987 | - return; | |
988 | - // self.data.start = true; | |
989 | - }; | |
990 | - | |
991 | - | |
992 | - if(res.data.code == -2 && self.data.luckInfo.vip_act_num != 0) { | |
993 | - self.setData({ | |
994 | - 'luckInfo.user_LuckNumDay': self.data.luckInfo.user_LuckNumDay - 1, | |
995 | - }); | |
996 | - }; | |
997 | - | |
998 | - | |
999 | - }; | |
1000 | - | |
1001 | - | |
1002 | - }, | |
1003 | - | |
1004 | - fail: function(res) { | |
1005 | - // console.log('出错'); | |
1006 | - wx.showToast({ | |
1007 | - title: '数据请求失败', | |
1008 | - icon: 'error', | |
1009 | - }); | |
1010 | - let thxIndexArr = self.data.thxIndexArr; | |
1011 | - const random = Math.random() * thxIndexArr.length >> 0; | |
1012 | - const index = thxIndexArr[random]; | |
1013 | - $lucky.stop(index); | |
1014 | - // setTimeout(() => { | |
1015 | - // Promise.resolve($lucky.stop(index)).then(()=>{ | |
1016 | - // self.data.start = false; | |
1017 | - // }); | |
1018 | - // }, 2000); | |
1019 | - }, | |
1020 | - | |
1021 | - | |
1022 | - | |
1023 | - }); | |
1024 | - | |
1025 | - } | |
1026 | - | |
1027 | - | |
1028 | - } else { | |
1029 | - wx.showToast({ | |
1030 | - title: '你今天的抽奖次数已用完啦!~', | |
1031 | - icon: 'none', | |
1032 | - success: function() { | |
1033 | - self.setData({ | |
1034 | - start: false | |
1035 | - }); | |
1036 | - } | |
1037 | - }); | |
1038 | - }; | |
1039 | - | |
1040 | - }; | |
1041 | - }); | |
1042 | - | |
1043 | - | |
1044 | - | |
1045 | - | |
1046 | - | |
299 | + | |
300 | + onShow() { | |
301 | + // console.log('show~~`'); | |
302 | + | |
303 | + if (app.globalData.userInfo) { | |
304 | + if (!this.data.isLogin) { | |
305 | + | |
306 | + // 下载头像 | |
307 | + let path = app.globalData.userInfo.head_pic; | |
308 | + path = path.replace("http://thirdwx.qlogo.cn", "https://wx.qlogo.cn"); | |
309 | + path = path.replace("https://thirdwx.qlogo.cn", "https://wx.qlogo.cn"); | |
310 | + wx.downloadFile({ | |
311 | + url: path, //仅为示例,并非真实的资源 | |
312 | + success(res) { | |
313 | + // 只要服务器有响应数据,就会把响应内容写入文件并进入 success 回调,业务需要自行判断是否下载到了想要的内容 | |
314 | + if (res.statusCode === 200) { | |
315 | + self.setData({ | |
316 | + 'imgDraw.views[0].url': res.tempFilePath,//头像 | |
317 | + }); | |
318 | + | |
319 | + } | |
320 | + } | |
321 | + }); | |
322 | + | |
323 | + | |
324 | + this.setData({ | |
325 | + userInfo: app.globalData.userInfo, | |
326 | + isLogin: true, | |
327 | + 'imgDraw.views[1].text': app.globalData.userInfo.nickname,//昵称 | |
328 | + }); | |
329 | + | |
330 | + | |
331 | + // console.log('imgDraw.views[1].text+++++++++', imgDraw.views[1], app.globalData.userInfo.nickname); | |
332 | + let user_id = app.globalData.userInfo.user_id; | |
333 | + let store_id = app.globalData.setting.stoid; | |
334 | + let id = this.data.options.id; | |
335 | + let url = `/api/weshop/marketing/marketingLuckForm/getLuckInfo/${store_id}/${id}/${user_id}`; | |
336 | + | |
337 | + //获取小程序码 | |
338 | + this.getMiniCode({ | |
339 | + url: app.globalData.setting.url, | |
340 | + store_id: app.globalData.setting.stoid, | |
341 | + user_id: app.globalData.userInfo.user_id, | |
342 | + id: this.data.options.id, | |
343 | + }); | |
344 | + | |
345 | + | |
346 | + app.request.get(url, { | |
347 | + success: function (res) { | |
348 | + if (res.data.code == 0) { | |
349 | + self.setData({ | |
350 | + luckInfo: res.data.data, | |
351 | + }); | |
352 | + WxParse.wxParse('content', 'html', self.data.luckInfo.remark, self); | |
353 | + | |
354 | + // 如果is_share为1,隐藏发送给朋友和分享到朋友圈功能 | |
355 | + if (!self.data.luckInfo.is_share) { | |
356 | + wx.hideShareMenu(); | |
357 | + }; | |
358 | + | |
359 | + } else { | |
360 | + wx.showToast({ | |
361 | + title: res.data.msg, | |
362 | + icon: 'none', | |
363 | + }); | |
364 | + self.data.msg = res.data.msg; | |
365 | + // self.setData({ | |
366 | + // bannerUrl: imghost + 'miniapp/images/luckDraw/bg.png?v=2', | |
367 | + // 'blocks[0].imgs[0].src': imghost + 'miniapp/images/luckDraw/weel.png?v=3', //转盘 | |
368 | + // 'buttons[0].imgs[0].src': imghost + 'miniapp/images/luckDraw/pointer.png?v=3', //指针 | |
369 | + // }); | |
370 | + | |
371 | + }; | |
372 | + | |
373 | + // console.log('luckInfo', res.data.data); | |
374 | + let luckInfo = res.data.data; | |
375 | + | |
376 | + | |
377 | + | |
378 | + self.setData({ | |
379 | + 'imgDraw.views[3].text': self.data.luckInfo.act_name,//分享标题 | |
380 | + // 'imgDraw.views[4].text': '快来一起抽奖吧,精美奖品等着你!',//分享内容 | |
381 | + 'imgDraw.views[14].text': util.formar_no_full(luckInfo.begindate) + ' 至 ' + util.formar_no_full(luckInfo.enddate),//活动时间 | |
382 | + }); | |
383 | + | |
384 | + | |
385 | + | |
386 | + let luckStyle = null; | |
387 | + | |
388 | + | |
389 | + if (luckInfo && luckInfo.template_type != null && luckInfo.template_type == 1) { //获取模板 | |
390 | + let url = `/api/weshop/marketing/marketingLuckTemplate/get/0/${luckInfo.template_id}`; | |
391 | + app.request.get(url, { | |
392 | + success: function (res) { | |
393 | + let template = null; | |
394 | + if (res.data.code == 0) { | |
395 | + template = res.data.data; | |
396 | + self.setData({ | |
397 | + template, | |
398 | + bannerUrl: imghost + template.bannerUrl, //背景图 | |
399 | + 'blocks[0].imgs[0].src': imghost + ((template && template.wheelBaseUrl) ? template.wheelBaseUrl : 'miniapp/images/luckDraw/weel.png?v=3'), | |
400 | + 'buttons[0].imgs[0].src': imghost + ((template && template.wheelPointerUrl) ? template.wheelPointerUrl : 'miniapp/images/luckDraw/pointer.png?v=3'), //指针 | |
401 | + 'imgDraw.views[3].text': template.share_title ? template.share_title : self.data.luckInfo.act_name, //分享标题 | |
402 | + 'imgDraw.views[5].url': imghost + (template && template.share_image ? template.share_image : self.data.luckInfo.imageurl), //分享图片 | |
403 | + | |
404 | + }); | |
405 | + | |
406 | + let color = template && template.colorCode ? template.colorCode : '#da104b'; | |
407 | + luckStyle = `background: ${color} url(${self.data.bannerUrl}) no-repeat;`; | |
408 | + self.setData({ | |
409 | + luckStyle, | |
410 | + | |
411 | + }); | |
412 | + // self.setData({ | |
413 | + // template: res.data.data, | |
414 | + // bannerUrl: imghost + res.data.data.bannerUrl, //背景图 | |
415 | + // //bannerUrl: imghost + ((res.data.data&&res.data.data.bannerUrl) ? res.data.data.bannerUrl:'miniapp/images/luckDraw/bg.png?v=2'), //背景图 | |
416 | + // 'blocks[0].imgs[0].src': imghost + res.data.data&&res.data.data.wheelBaseUrl) ? res.data.data.wheelBaseUrl:'miniapp/images/luckDraw/weel.png?v=2'), //转盘 | |
417 | + // 'buttons[0].imgs[0].src': imghost + ((res.data.data&&res.data.data.wheelPointerUrl) ? res.data.data.wheelPointerUrl:'miniapp/images/luckDraw/pointer.png?v=2'), //指针 | |
418 | + // 'imgDraw.views[3].text': (res.data.data&&res.data.data.title) ? res.data.data.title : self.data.luckInfo.act_name,//分享标题 | |
419 | + // // 'imgDraw.views[4].text': (res.data.data&&res.data.data.share_content) ? res.data.data.share_content : '快来一起抽奖吧,精美奖品等着你!',//分享内容 | |
420 | + // 'imgDraw.views[5].url': (res.data.data&&res.data.data.share_image) ? (imghost + res.data.data.share_image):(self.data.luckInfo.imageurl ? (imghost + self.data.luckInfo.imageurl):'/packpageB/images/luckDraw/jiang.png'),//分享图片 | |
421 | + // 'imgDraw.views[14].text': util.formar_no_full(self.data.luckInfo.begindate) + ' 至 ' + util.formar_no_full(self.data.luckInfo.enddate),//活动时间 | |
422 | + // }); | |
423 | + } else { | |
424 | + luckStyle = `background: #da104b url(${imghost + 'miniapp/images/luckDraw/bg.png?v=2'}) no-repeat;`; | |
425 | + self.setData({ | |
426 | + luckStyle, | |
427 | + 'imgDraw.views[5].url': self.data.luckInfo.imageurl ? (imghost + self.data.luckInfo.imageurl) : '/packageB/images/luckDraw/jiang.png', //分享图片 | |
428 | + 'blocks[0].imgs[0].src': imghost + 'miniapp/images/luckDraw/weel.png?v=3', //转盘 | |
429 | + 'buttons[0].imgs[0].src': imghost + 'miniapp/images/luckDraw/pointer.png?v=3', //指针 | |
430 | + }); | |
431 | + // let color = template&&template.colorCode ? template.colorCode:'#da104b'; | |
432 | + | |
433 | + // self.setData({ | |
434 | + // luckStyle, | |
435 | + // }); | |
436 | + }; | |
437 | + | |
438 | + }, | |
439 | + }); | |
440 | + } else { | |
441 | + | |
442 | + if (luckInfo && luckInfo.imageurl) { | |
443 | + self.setData({ | |
444 | + 'imgDraw.views[5].url': imghost + self.data.luckInfo.imageurl, //分享图片 | |
445 | + }); | |
446 | + }; | |
447 | + | |
448 | + if (luckInfo && luckInfo.store_bannerUrl) { | |
449 | + self.setData({ | |
450 | + bannerUrl: imghost + luckInfo.store_bannerUrl, | |
451 | + custom: true, | |
452 | + }); | |
453 | + } else { | |
454 | + self.setData({ | |
455 | + bannerUrl: imghost + 'miniapp/images/luckDraw/bg.png?v=2', | |
456 | + custom: false, | |
457 | + }); | |
458 | + }; | |
459 | + | |
460 | + let color = self.data.custom ? '#f0f0f0' : '#da104b'; | |
461 | + luckStyle = `background: ${color} url(${self.data.bannerUrl}) no-repeat;`; | |
462 | + self.setData({ | |
463 | + luckStyle, | |
464 | + 'blocks[0].imgs[0].src': imghost + 'miniapp/images/luckDraw/weel.png?v=3', //转盘 | |
465 | + 'buttons[0].imgs[0].src': imghost + 'miniapp/images/luckDraw/pointer.png?v=3', //指针 | |
466 | + }); | |
467 | + | |
468 | + }; | |
469 | + | |
470 | + | |
471 | + if (self.data.luckInfo.msgInfo) { | |
472 | + wx.showToast({ | |
473 | + title: self.data.luckInfo.msgInfo, | |
474 | + icon: 'none', | |
475 | + }); | |
476 | + }; | |
477 | + | |
478 | + }, | |
479 | + }); | |
480 | + | |
481 | + // 获取奖品展示的奖品 | |
482 | + app.request.get('/api/weshop/marketing/marketingLuckList/page', { | |
483 | + data: { | |
484 | + store_id, | |
485 | + luck_formid: id, | |
486 | + }, | |
487 | + success: function (res) { | |
488 | + | |
489 | + let award = res.data.data.pageData; | |
490 | + self.setData({ | |
491 | + award, | |
492 | + }); | |
493 | + // console.log('award', award); | |
494 | + self.prizeLayout(award); | |
495 | + | |
496 | + }, | |
497 | + }); | |
498 | + | |
499 | + | |
500 | + //获取兑奖记录 | |
501 | + app.request.get('/api/weshop/marketing/marketingLuckRecord/page', { | |
502 | + isShowLoading: false, | |
503 | + data: { | |
504 | + store_id: app.globalData.setting.stoid, | |
505 | + user_id: app.globalData.userInfo.user_id, | |
506 | + luck_formid: this.data.options.id, | |
507 | + luck_state: 1 | |
508 | + }, | |
509 | + success: function (res) { | |
510 | + if (res.data.code == 0) { | |
511 | + self.setData({ | |
512 | + record: res.data.data.pageData, | |
513 | + }); | |
514 | + } | |
515 | + }, | |
516 | + }); | |
517 | + | |
518 | + | |
519 | + //获取中奖人员名单 | |
520 | + app.request.get('/api/weshop/marketing/marketingLuckRecord/page', { | |
521 | + isShowLoading: false, | |
522 | + data: { | |
523 | + store_id: app.globalData.setting.stoid, | |
524 | + luck_formid: this.data.options.id, | |
525 | + luck_state: 1, | |
526 | + pageSize: 20, | |
527 | + }, | |
528 | + success: function (res) { | |
529 | + if (res.data.code == 0) { | |
530 | + self.setData({ | |
531 | + nameList: res.data.data.pageData, | |
532 | + }); | |
533 | + }; | |
534 | + }, | |
535 | + }); | |
536 | + | |
537 | + | |
538 | + | |
539 | + | |
540 | + }; | |
541 | + }; | |
542 | + }, | |
543 | + | |
544 | + //获取小程序码 | |
545 | + getMiniCode(objData) { | |
546 | + wx.getImageInfo({ | |
547 | + src: `${objData.url}/api/wx/open/app/user/getWeAppEwm/${objData.store_id}?sceneValue=${objData.user_id}_${objData.id}&pageValue=packageB/pages/luckactivity/luckinfo/luckinfo`, | |
548 | + success(res) { | |
549 | + if (res.code != -1) { | |
550 | + self.setData({ | |
551 | + 'imgDraw.views[16].url': res.path, | |
552 | + getMiniCode: true, | |
553 | + }); | |
554 | + }; | |
555 | + } | |
556 | + }); | |
557 | + }, | |
558 | + | |
559 | + // 设置转盘奖品布局 | |
560 | + prizeLayout(award) { | |
561 | + let prizes = []; | |
562 | + // let length = award.length; | |
563 | + if (award) { | |
564 | + var length = award.length; | |
565 | + } else { | |
566 | + wx.showToast({ | |
567 | + title: '请设置奖品', | |
568 | + icon: 'none', | |
569 | + }); | |
570 | + return; | |
571 | + }; | |
572 | + | |
573 | + let thx = { fonts: [{ text: '谢谢\n参与', top: '18%', wordWrap: false, fontColor: 'rgba(255,255,255,.6)' }] }; | |
574 | + | |
575 | + if (length == 1) { | |
576 | + [0, 2, 4, 6].map(function (item, index) { | |
577 | + prizes[item] = { | |
578 | + id: award[0].id, | |
579 | + lbtype: award[0].lbtype, | |
580 | + fonts: [{ text: award[0].luck_goods_name + ' x' + award[0].num, top: '18%', wordWrap: false, fontColor: 'transparent' }], | |
581 | + imgs: [ | |
582 | + { | |
583 | + src: self.prizeSrc(award[0].lbtype) ? self.prizeSrc(award[0].lbtype) : (imghost + 'miniapp/images/luckDraw/lb.png'), | |
584 | + width: '135rpx', | |
585 | + height: '107rpx', | |
586 | + top: '12%', | |
587 | + } | |
588 | + ], | |
589 | + }; | |
590 | + }); | |
591 | + | |
592 | + [1, 3, 5, 7].map(function (item, index) { | |
593 | + prizes[item] = thx; | |
594 | + }); | |
595 | + | |
596 | + this.data.thxIndexArr = [1, 3, 5, 7]; | |
597 | + }; | |
598 | + | |
599 | + if (length == 2) { | |
600 | + [0, 4].map(function (item, index) { | |
601 | + prizes[item] = { | |
602 | + id: award[0].id, | |
603 | + lbtype: award[0].lbtype, | |
604 | + fonts: [{ text: award[0].luck_goods_name + ' x' + award[0].num, top: '18%', wordWrap: false, fontColor: 'transparent' }], | |
605 | + imgs: [ | |
606 | + { | |
607 | + src: self.prizeSrc(award[0].lbtype) ? self.prizeSrc(award[0].lbtype) : (imghost + 'miniapp/images/luckDraw/lb.png'), | |
608 | + width: '135rpx', | |
609 | + height: '107rpx', | |
610 | + top: '12%', | |
611 | + } | |
612 | + ], | |
613 | + }; | |
614 | + }); | |
615 | + | |
616 | + [2, 6].map(function (item, index) { | |
617 | + prizes[item] = { | |
618 | + id: award[1].id, | |
619 | + lbtype: award[1].lbtype, | |
620 | + fonts: [{ text: award[1].luck_goods_name + ' x' + award[1].num, top: '18%', wordWrap: false, fontColor: 'transparent' }], | |
621 | + imgs: [ | |
622 | + { | |
623 | + src: self.prizeSrc(award[1].lbtype) ? self.prizeSrc(award[1].lbtype) : (imghost + 'miniapp/images/luckDraw/lb.png'), | |
624 | + width: '135rpx', | |
625 | + height: '107rpx', | |
626 | + top: '12%', | |
627 | + } | |
628 | + ], | |
629 | + }; | |
630 | + }); | |
631 | + | |
632 | + [1, 3, 5, 7].map(function (item, index) { | |
633 | + prizes[item] = thx; | |
634 | + }); | |
635 | + this.data.thxIndexArr = [1, 3, 5, 7]; | |
636 | + }; | |
637 | + | |
638 | + | |
639 | + if (length == 3) { | |
640 | + [0, 4].map(function (item, index) { | |
641 | + prizes[item] = { | |
642 | + id: award[0].id, | |
643 | + lbtype: award[0].lbtype, | |
644 | + fonts: [{ text: award[0].luck_goods_name + ' x' + award[0].num, top: '18%', wordWrap: false, fontColor: 'transparent' }], | |
645 | + imgs: [ | |
646 | + { | |
647 | + src: self.prizeSrc(award[0].lbtype) ? self.prizeSrc(award[0].lbtype) : (imghost + 'miniapp/images/luckDraw/lb.png'), | |
648 | + width: '135rpx', | |
649 | + height: '107rpx', | |
650 | + top: '12%', | |
651 | + } | |
652 | + ], | |
653 | + }; | |
654 | + }); | |
655 | + | |
656 | + [1, 5].map(function (item, index) { | |
657 | + prizes[item] = { | |
658 | + id: award[1].id, | |
659 | + lbtype: award[1].lbtype, | |
660 | + fonts: [{ text: award[1].luck_goods_name + ' x' + award[1].num, top: '18%', wordWrap: false, fontColor: 'transparent' }], | |
661 | + imgs: [ | |
662 | + { | |
663 | + src: self.prizeSrc(award[1].lbtype) ? self.prizeSrc(award[1].lbtype) : (imghost + 'miniapp/images/luckDraw/lb.png'), | |
664 | + width: '135rpx', | |
665 | + height: '107rpx', | |
666 | + top: '12%', | |
667 | + } | |
668 | + ], | |
669 | + }; | |
670 | + }); | |
671 | + | |
672 | + [2, 6].map(function (item, index) { | |
673 | + prizes[item] = { | |
674 | + id: award[2].id, | |
675 | + lbtype: award[2].lbtype, | |
676 | + fonts: [{ text: award[2].luck_goods_name + ' x' + award[2].num, top: '18%', wordWrap: false, fontColor: 'transparent' }], | |
677 | + imgs: [ | |
678 | + { | |
679 | + src: self.prizeSrc(award[2].lbtype) ? self.prizeSrc(award[2].lbtype) : (imghost + 'miniapp/images/luckDraw/lb.png'), | |
680 | + width: '135rpx', | |
681 | + height: '107rpx', | |
682 | + top: '12%', | |
683 | + } | |
684 | + ], | |
685 | + }; | |
686 | + }); | |
687 | + | |
688 | + [3, 7].map(function (item, index) { | |
689 | + prizes[item] = thx; | |
690 | + }); | |
691 | + | |
692 | + this.data.thxIndexArr = [3, 7]; | |
693 | + }; | |
694 | + | |
695 | + | |
696 | + if (length == 4) { | |
697 | + [0, 2, 4, 6].map(function (item, index) { | |
698 | + prizes[item] = { | |
699 | + id: award[index].id, | |
700 | + lbtype: award[index].lbtype, | |
701 | + fonts: [{ text: award[index].luck_goods_name + ' x' + award[index].num, top: '18%', wordWrap: false, fontColor: 'transparent' }], | |
702 | + imgs: [ | |
703 | + { | |
704 | + src: self.prizeSrc(award[index].lbtype) ? self.prizeSrc(award[index].lbtype) : (imghost + 'miniapp/images/luckDraw/lb.png'), | |
705 | + width: '135rpx', | |
706 | + height: '107rpx', | |
707 | + top: '12%', | |
708 | + } | |
709 | + ], | |
710 | + }; | |
711 | + }); | |
712 | + | |
713 | + [1, 3, 5, 7].map(function (item, index) { | |
714 | + prizes[item] = thx; | |
715 | + }); | |
716 | + | |
717 | + this.data.thxIndexArr = [1, 3, 5, 7]; | |
718 | + }; | |
719 | + | |
720 | + if (length == 5) { | |
721 | + [0, 2, 3, 5, 6].map(function (item, index) { | |
722 | + prizes[item] = { | |
723 | + id: award[index].id, | |
724 | + lbtype: award[index].lbtype, | |
725 | + fonts: [{ text: award[index].luck_goods_name + ' x' + award[index].num, top: '18%', wordWrap: false, fontColor: 'transparent' }], | |
726 | + imgs: [ | |
727 | + { | |
728 | + src: self.prizeSrc(award[index].lbtype) ? self.prizeSrc(award[index].lbtype) : (imghost + 'miniapp/images/luckDraw/lb.png'), | |
729 | + width: '135rpx', | |
730 | + height: '107rpx', | |
731 | + top: '12%', | |
732 | + } | |
733 | + ], | |
734 | + }; | |
735 | + }); | |
736 | + | |
737 | + [1, 4, 7].map(function (item, index) { | |
738 | + prizes[item] = thx; | |
739 | + }); | |
740 | + | |
741 | + this.data.thxIndexArr = [1, 4, 7]; | |
742 | + }; | |
743 | + | |
744 | + if (length == 6) { | |
745 | + prizes = award.map(function (item, index) { | |
746 | + return { | |
747 | + id: item.id, | |
748 | + lbtype: item.lbtype, | |
749 | + fonts: [{ text: item.luck_goods_name + ' x' + item.num, top: '18%', wordWrap: false, fontColor: 'transparent' }], | |
750 | + imgs: [ | |
751 | + { | |
752 | + src: self.prizeSrc(item.lbtype) ? self.prizeSrc(item.lbtype) : (imghost + 'miniapp/images/luckDraw/lb.png'), | |
753 | + width: '135rpx', | |
754 | + height: '107rpx', | |
755 | + top: '12%', | |
756 | + } | |
757 | + ], | |
758 | + }; | |
759 | + }); | |
760 | + | |
761 | + prizes.push(thx); | |
762 | + prizes.splice(3, 0, thx); | |
763 | + | |
764 | + this.data.thxIndexArr = [3, 7]; | |
765 | + }; | |
766 | + | |
767 | + // console.log('prizes', prizes); | |
768 | + | |
769 | + this.setData({ | |
770 | + prizes, | |
771 | + }); | |
772 | + }, | |
773 | + | |
774 | + // 根据lbtype指定奖品类别图标 | |
775 | + prizeSrc(lbtype) { | |
776 | + let src = ''; | |
777 | + switch (lbtype) { | |
778 | + case 1: { //积分 | |
779 | + src = imghost + 'miniapp/images/luckDraw/jf.png'; | |
780 | + break; | |
781 | + }; | |
782 | + case 2: { //成长值 | |
783 | + src = imghost + 'miniapp/images/luckDraw/czz.png'; | |
784 | + break; | |
785 | + }; | |
786 | + case 3: { //优惠券 | |
787 | + src = imghost + 'miniapp/images/luckDraw/yhq.png'; | |
788 | + break; | |
789 | + }; | |
790 | + case 4: { //服务项目 | |
791 | + src = imghost + 'miniapp/images/luckDraw/fw.png'; | |
792 | + break; | |
793 | + }; | |
794 | + case 5: { //赠品 | |
795 | + src = imghost + 'miniapp/images/luckDraw/zp.png'; | |
796 | + break; | |
797 | + }; | |
798 | + case 6: { //礼包 | |
799 | + src = imghost + 'miniapp/images/luckDraw/lb.png'; | |
800 | + break; | |
801 | + }; | |
802 | + }; | |
803 | + return src; | |
804 | + }, | |
805 | + | |
806 | + // 获取抽奖结果匹配对应奖品在奖品列表里的所有索引号 | |
807 | + luckyIndex(arr, target) { | |
808 | + var results = [], | |
809 | + len = arr.length, | |
810 | + pos = 0; | |
811 | + while (pos < len) { | |
812 | + // pos = arr[pos].indexOf(target, pos); | |
813 | + if (arr[pos].id == target) { | |
814 | + results.push(pos);//找到就存储索引 | |
815 | + | |
816 | + }; | |
817 | + pos += 1;//并从下个位置开始搜索 | |
818 | + // if(pos === -1){//未找到就退出循环完成搜索 | |
819 | + // break; | |
820 | + // }; | |
821 | + | |
822 | + } | |
823 | + // console.log('当前奖品列表', this.data.prizes); | |
824 | + // console.log('中奖结果在当前奖品列表中的索引', results); | |
825 | + | |
826 | + return results; | |
827 | + }, | |
828 | + | |
829 | + start() { | |
1047 | 830 | |
831 | + // self.data.start = true; | |
832 | + if (this.data.start) return; | |
833 | + this.data.start = true; | |
834 | + | |
835 | + if (!this.data.luckInfo) { | |
836 | + wx.showToast({ | |
837 | + title: this.data.msg, | |
838 | + icon: 'none', | |
839 | + }); | |
840 | + return; | |
841 | + }; | |
842 | + | |
843 | + if (this.data.luckInfo.msgInfo) { | |
844 | + wx.showToast({ | |
845 | + title: self.data.luckInfo.msgInfo, | |
846 | + icon: 'none', | |
847 | + success: function () { | |
848 | + self.setData({ | |
849 | + start: false | |
850 | + }); | |
851 | + } | |
852 | + }); | |
853 | + return; | |
854 | + }; | |
855 | + wx.showLoading({ | |
856 | + title: '准备开始抽奖', | |
857 | + mask: true, | |
858 | + }); | |
859 | + // 获取积分 | |
860 | + app.request.promisePost('/api/weshop/marketing/marketingLuckForm/startLuckIntegral', { | |
861 | + isShowLoading: false, | |
862 | + data: { | |
863 | + storeId: app.globalData.setting.stoid, | |
864 | + userId: app.globalData.userInfo.user_id, | |
865 | + LuckId: this.data.options.id, | |
866 | + }, | |
867 | + }) | |
868 | + .then(function (res) { | |
869 | + if (res.data.code == -1) { | |
870 | + //积分不足,弹出提示 | |
871 | + wx.hideLoading(); | |
872 | + self.data.luckInfo.msgInfo = res.data.msg | |
873 | + wx.showToast({ | |
874 | + title: res.data.msg, | |
875 | + icon: 'none', | |
876 | + success: function () { | |
877 | + self.data.start = false; | |
878 | + } | |
879 | + }); | |
880 | + return; | |
881 | + }; | |
882 | + | |
883 | + if (res.data.code == 0) { | |
884 | + | |
885 | + if (self.data.luckInfo.user_LuckNumDay > 0 || self.data.luckInfo.vip_act_num == 0) { | |
886 | + // console.log('start choujiang'); | |
887 | + // let start = false; | |
888 | + if (self.data.start) { | |
889 | + // self.data.start = true; | |
890 | + // 获取抽奖组件实例 | |
891 | + const $lucky = self.selectComponent('#myLucky'); | |
892 | + // 调用play方法开始旋转 | |
893 | + $lucky.play(); | |
894 | + wx.hideLoading(); | |
895 | + // 获取抽奖结果 | |
896 | + app.request.post('/api/weshop/marketing/marketingLuckForm/startLuck', { | |
897 | + isShowLoading: false, | |
898 | + data: { | |
899 | + storeId: app.globalData.setting.stoid, | |
900 | + userId: app.globalData.userInfo.user_id, | |
901 | + LuckId: self.data.options.id, | |
902 | + }, | |
903 | + success: function (res) { | |
904 | + | |
905 | + if (res.data.code == 0) { | |
906 | + // console.log('开始摇奖', res.data.data); | |
907 | + if (self.data.luckInfo.vip_act_num != 0) { | |
908 | + self.setData({ | |
909 | + 'luckInfo.user_LuckNumDay': self.data.luckInfo.user_LuckNumDay - 1, | |
910 | + // isActive: true, | |
911 | + }); | |
912 | + }; | |
913 | + | |
914 | + self.setData({ | |
915 | + // 'luckInfo.user_LuckNumDay': self.data.luckInfo.user_LuckNumDay - 1, | |
916 | + isActive: true, | |
917 | + wow: res.data.data, | |
918 | + }); | |
919 | + // console.log('wow', self.data.wow); | |
920 | + // console.log('请求成功', res.data.data); | |
921 | + let luckyId = res.data.data.id; | |
922 | + let indexArr = self.luckyIndex(self.data.prizes, luckyId); | |
923 | + // console.log('抽奖奖品id', luckyId); | |
924 | + // console.log('奖品列表', self.data.prizes); | |
925 | + // console.log('奖品对应的索引数组', indexArr); | |
926 | + let random = Math.random() * indexArr.length >> 0; | |
927 | + // console.log('random', random); | |
928 | + let index = indexArr[random]; | |
929 | + | |
930 | + $lucky.stop(index); | |
931 | + | |
932 | + // setTimeout(() => { | |
933 | + // Promise.resolve($lucky.stop(index)).then(()=>{ | |
934 | + // self.data.start = false; | |
935 | + // }); | |
936 | + | |
937 | + // }, 2000); | |
938 | + | |
939 | + | |
940 | + //获取兑奖记录 | |
941 | + // app.request.get('/api/weshop/marketing/marketingLuckRecord/page', { | |
942 | + // isShowLoading: false, | |
943 | + // data: { | |
944 | + // store_id: app.globalData.setting.stoid, | |
945 | + // user_id: app.globalData.userInfo.user_id, | |
946 | + // luck_formid: self.data.options.id, | |
947 | + // luck_state: 1 | |
948 | + // }, | |
949 | + // success: function(res) { | |
950 | + // if(res.data.code == 0) { | |
951 | + // // console.log('res===>', res.data.data.pageData); | |
952 | + // self.setData({ | |
953 | + // record: res.data.data.pageData, | |
954 | + // }); | |
955 | + // }; | |
956 | + // }, | |
957 | + // }); | |
958 | + | |
959 | + | |
960 | + } else { | |
961 | + let thxIndexArr = self.data.thxIndexArr; | |
962 | + const random = Math.random() * thxIndexArr.length >> 0; | |
963 | + const index = thxIndexArr[random]; | |
964 | + // console.log('谢谢参与数组', thxIndexArr); | |
965 | + // console.log('请求出错产生谢谢参与的随机数', index); | |
966 | + $lucky.stop(index); | |
967 | + // setTimeout(() => { | |
968 | + // Promise.resolve($lucky.stop(index)).then(()=>{ | |
969 | + // self.data.start = false; | |
970 | + // }); | |
971 | + // }, 2000); | |
972 | + | |
973 | + | |
974 | + | |
975 | + | |
976 | + if (res.data.code == -1) { | |
977 | + wx.showToast({ | |
978 | + title: res.data.msg, | |
979 | + icon: 'none', | |
980 | + success: function () { | |
981 | + self.setData({ | |
982 | + start: false | |
983 | + }); | |
984 | + } | |
985 | + }); | |
986 | + self.data.luckInfo.msgInfo = res.data.msg; | |
987 | + return; | |
988 | + // self.data.start = true; | |
989 | + }; | |
990 | + | |
991 | + | |
992 | + if (res.data.code == -2 && self.data.luckInfo.vip_act_num != 0) { | |
993 | + self.setData({ | |
994 | + 'luckInfo.user_LuckNumDay': self.data.luckInfo.user_LuckNumDay - 1, | |
995 | + }); | |
996 | + }; | |
997 | + | |
998 | + | |
999 | + }; | |
1000 | + | |
1001 | + | |
1002 | + }, | |
1003 | + | |
1004 | + fail: function (res) { | |
1005 | + // console.log('出错'); | |
1006 | + wx.showToast({ | |
1007 | + title: '数据请求失败', | |
1008 | + icon: 'error', | |
1009 | + }); | |
1010 | + let thxIndexArr = self.data.thxIndexArr; | |
1011 | + const random = Math.random() * thxIndexArr.length >> 0; | |
1012 | + const index = thxIndexArr[random]; | |
1013 | + $lucky.stop(index); | |
1014 | + // setTimeout(() => { | |
1015 | + // Promise.resolve($lucky.stop(index)).then(()=>{ | |
1016 | + // self.data.start = false; | |
1017 | + // }); | |
1018 | + // }, 2000); | |
1019 | + }, | |
1020 | + | |
1021 | + | |
1022 | + | |
1023 | + }); | |
1024 | + | |
1025 | + } | |
1026 | + | |
1027 | + | |
1028 | + } else { | |
1029 | + wx.showToast({ | |
1030 | + title: '你今天的抽奖次数已用完啦!~', | |
1031 | + icon: 'none', | |
1032 | + success: function () { | |
1033 | + self.setData({ | |
1034 | + start: false | |
1035 | + }); | |
1036 | + } | |
1037 | + }); | |
1038 | + }; | |
1039 | + | |
1040 | + }; | |
1041 | + }); | |
1042 | + | |
1043 | + | |
1044 | + | |
1045 | + | |
1046 | + | |
1047 | + | |
1048 | 1048 | }, |
1049 | - end (event) { | |
1049 | + end(event) { | |
1050 | 1050 | // 中奖奖品详情 |
1051 | 1051 | // console.log('抽奖结果:',event.detail); |
1052 | - let no_luck_urltype = this.data.luckInfo.no_luck_urltype; | |
1053 | - let lbtype = null; | |
1054 | - // let good_id = null; | |
1055 | - let resultTitle = event.detail.fonts[0].text.replace('\n',''); | |
1056 | - // if(event.detail.id) { | |
1057 | - // console.log('~~~~~~----++++++',event.detail.id); | |
1058 | - // good_id = event.detail.id; | |
1059 | - // }; | |
1060 | - if(event.detail.lbtype == 5) { | |
1061 | - lbtype = 5; | |
1062 | - } else { | |
1063 | - lbtype = -1; | |
1064 | - }; | |
1065 | - this.setData({ | |
1066 | - num: 3, | |
1067 | - hiddenCanvas: true, | |
1068 | - showResult: true, | |
1069 | - showMask: true, | |
1070 | - resultTitle, | |
1071 | - showPopup: false, | |
1072 | - currentLbtype: lbtype, | |
1073 | - // good_id, | |
1074 | - }); | |
1075 | - | |
1076 | - | |
1077 | - | |
1078 | - | |
1079 | - if(no_luck_urltype == 1 && resultTitle == '谢谢参与') { | |
1080 | - if(this.data.luckInfo.no_luck_weappurl) { | |
1081 | - let num = this.data.num; | |
1082 | - let url = this.data.luckInfo.no_luck_weappurl; | |
1083 | - self.timer = setInterval(function() { | |
1084 | - if(num == 0) { | |
1085 | - clearInterval(self.timer); | |
1086 | - app.goto(url); | |
1087 | - } else { | |
1088 | - self.setData({ | |
1089 | - num: --num, | |
1090 | - }); | |
1091 | - } | |
1092 | - }, 500); | |
1093 | - | |
1094 | - }; | |
1095 | - | |
1096 | - }; | |
1097 | - | |
1098 | - | |
1099 | - if(self.data.luckInfo.give_user) { | |
1100 | - if(resultTitle == '谢谢参与') { | |
1101 | - if(self.data.luckInfo.give_type == 1) { | |
1102 | - if(self.data.luckInfo.give_integral > 0) { | |
1103 | - wx.showToast({ | |
1104 | - title: `获得游戏奖励积分${self.data.luckInfo.give_integral}`, | |
1105 | - icon: 'none', | |
1106 | - }); | |
1107 | - }; | |
1108 | - } else if((self.data.luckInfo.give_type == 2)) { | |
1109 | - if(self.data.luckInfo.give_growth > 0) { | |
1110 | - wx.showToast({ | |
1111 | - title: `获得游戏奖励成长值${self.data.luckInfo.give_growth}`, | |
1112 | - icon: 'none', | |
1113 | - }); | |
1114 | - }; | |
1115 | - }; | |
1116 | - }; | |
1117 | - } else { | |
1118 | - if(self.data.luckInfo.give_type == 1) { | |
1119 | - if(self.data.luckInfo.give_integral > 0) { | |
1120 | - wx.showToast({ | |
1121 | - title: `获得游戏奖励积分${self.data.luckInfo.give_integral}`, | |
1122 | - icon: 'none', | |
1123 | - }); | |
1124 | - }; | |
1125 | - } else if((self.data.luckInfo.give_type == 2)) { | |
1126 | - if(self.data.luckInfo.give_growth > 0) { | |
1127 | - wx.showToast({ | |
1128 | - title: `获得游戏奖励成长值${self.data.luckInfo.give_growth}`, | |
1129 | - icon: 'none', | |
1130 | - }); | |
1131 | - }; | |
1132 | - }; | |
1133 | - }; | |
1134 | - | |
1135 | - | |
1052 | + let no_luck_urltype = this.data.luckInfo.no_luck_urltype; | |
1053 | + let lbtype = null; | |
1054 | + // let good_id = null; | |
1055 | + let resultTitle = event.detail.fonts[0].text.replace('\n', ''); | |
1056 | + // if(event.detail.id) { | |
1057 | + // console.log('~~~~~~----++++++',event.detail.id); | |
1058 | + // good_id = event.detail.id; | |
1059 | + // }; | |
1060 | + if (event.detail.lbtype == 5) { | |
1061 | + lbtype = 5; | |
1062 | + } else { | |
1063 | + lbtype = -1; | |
1064 | + }; | |
1065 | + this.setData({ | |
1066 | + num: 3, | |
1067 | + hiddenCanvas: true, | |
1068 | + showResult: true, | |
1069 | + showMask: true, | |
1070 | + resultTitle, | |
1071 | + showPopup: false, | |
1072 | + currentLbtype: lbtype, | |
1073 | + // good_id, | |
1074 | + }); | |
1075 | + | |
1076 | + | |
1077 | + | |
1078 | + | |
1079 | + if (no_luck_urltype == 1 && resultTitle == '谢谢参与') { | |
1080 | + if (this.data.luckInfo.no_luck_weappurl) { | |
1081 | + let num = this.data.num; | |
1082 | + let url = this.data.luckInfo.no_luck_weappurl; | |
1083 | + self.timer = setInterval(function () { | |
1084 | + if (num == 0) { | |
1085 | + clearInterval(self.timer); | |
1086 | + app.goto(url); | |
1087 | + } else { | |
1088 | + self.setData({ | |
1089 | + num: --num, | |
1090 | + }); | |
1091 | + } | |
1092 | + }, 500); | |
1093 | + | |
1094 | + }; | |
1095 | + | |
1096 | + }; | |
1097 | + | |
1098 | + | |
1099 | + if (self.data.luckInfo.give_user) { | |
1100 | + if (resultTitle == '谢谢参与') { | |
1101 | + if (self.data.luckInfo.give_type == 1) { | |
1102 | + if (self.data.luckInfo.give_integral > 0) { | |
1103 | + wx.showToast({ | |
1104 | + title: `获得游戏奖励积分${self.data.luckInfo.give_integral}`, | |
1105 | + icon: 'none', | |
1106 | + }); | |
1107 | + }; | |
1108 | + } else if ((self.data.luckInfo.give_type == 2)) { | |
1109 | + if (self.data.luckInfo.give_growth > 0) { | |
1110 | + wx.showToast({ | |
1111 | + title: `获得游戏奖励成长值${self.data.luckInfo.give_growth}`, | |
1112 | + icon: 'none', | |
1113 | + }); | |
1114 | + }; | |
1115 | + }; | |
1116 | + }; | |
1117 | + } else { | |
1118 | + if (self.data.luckInfo.give_type == 1) { | |
1119 | + if (self.data.luckInfo.give_integral > 0) { | |
1120 | + wx.showToast({ | |
1121 | + title: `获得游戏奖励积分${self.data.luckInfo.give_integral}`, | |
1122 | + icon: 'none', | |
1123 | + }); | |
1124 | + }; | |
1125 | + } else if ((self.data.luckInfo.give_type == 2)) { | |
1126 | + if (self.data.luckInfo.give_growth > 0) { | |
1127 | + wx.showToast({ | |
1128 | + title: `获得游戏奖励成长值${self.data.luckInfo.give_growth}`, | |
1129 | + icon: 'none', | |
1130 | + }); | |
1131 | + }; | |
1132 | + }; | |
1133 | + }; | |
1134 | + | |
1135 | + | |
1136 | + }, | |
1137 | + //门店回调 | |
1138 | + async callback(e) { | |
1139 | + let item = e.detail; | |
1140 | + console.log('门店信息'); | |
1141 | + console.log(item); | |
1142 | + | |
1143 | + if (item && item.pickup_id) { | |
1144 | + if (this.data.wow) { | |
1145 | + let text = 'wow.goods_pickup_id' | |
1146 | + this.setData({ | |
1147 | + [text]: item.pickup_id | |
1148 | + }) | |
1149 | + this.showQr() | |
1150 | + } else { | |
1151 | + let action_item = this.data.action_item | |
1152 | + if (!action_item.currentTarget.dataset.verify_pickup_id) { | |
1153 | + action_item.verify_pickup_id = item.pickup_id | |
1154 | + } | |
1155 | + this.showQr(action_item) | |
1156 | + } | |
1157 | + | |
1158 | + | |
1159 | + } else { | |
1160 | + wx.showToast({ | |
1161 | + title: '门店选择失败', | |
1162 | + icon: 'none', | |
1163 | + duration: 2000 | |
1164 | + }) | |
1165 | + } | |
1166 | + }, | |
1167 | + //门店选择1 | |
1168 | + select_product() { | |
1169 | + if (this.data.luckInfo.is_store==1) { | |
1170 | + this.setData({ | |
1171 | + store: 1, | |
1172 | + showResult: false, | |
1173 | + }) | |
1174 | + }else{ | |
1175 | + this.clickReceive() | |
1176 | + } | |
1177 | + }, | |
1178 | + //门店选择2 | |
1179 | + select_product2(e) { | |
1180 | + if (e.currentTarget.dataset.verify_pickup_id) { | |
1181 | + this.showQr(e) | |
1182 | + } else { | |
1183 | + if (this.data.luckInfo.is_store==1) { | |
1184 | + this.setData({ | |
1185 | + store: 1, | |
1186 | + showResult: false, | |
1187 | + showPopup: false, | |
1188 | + action_item: e, | |
1189 | + wow: '' | |
1190 | + }) | |
1191 | + }else{ | |
1192 | + this.showQr(e) | |
1193 | + } | |
1194 | + } | |
1195 | + | |
1196 | + }, | |
1197 | + showPopup() { | |
1198 | + this.setData({ | |
1199 | + list: null, | |
1200 | + pageNum: 1, | |
1201 | + noMore: false, | |
1202 | + }); | |
1203 | + this.getData(true, '/api/weshop/marketing/marketingLuckRecord/page', { | |
1204 | + store_id: app.globalData.setting.stoid, | |
1205 | + user_id: app.globalData.userInfo.user_id, | |
1206 | + luck_formid: this.data.options.id, | |
1207 | + luck_state: 1, | |
1208 | + }).then(function (res) { | |
1209 | + self.setData({ | |
1210 | + showPopup: true, | |
1211 | + showMask: true, | |
1212 | + hiddenCanvas: true, | |
1213 | + }); | |
1214 | + }); | |
1215 | + | |
1216 | + // this.setData({ | |
1217 | + // showPopup: true, | |
1218 | + // showMask: true, | |
1219 | + // hiddenCanvas: true, | |
1220 | + // 'list.pageData': this.data.record, | |
1221 | + // // record: self.data.list.pageData, | |
1222 | + // }); | |
1223 | + | |
1224 | + }, | |
1225 | + | |
1226 | + closePopup() { | |
1227 | + this.setData({ | |
1228 | + showPopup: false, | |
1229 | + showMask: false, | |
1230 | + hiddenCanvas: false, | |
1231 | + }); | |
1232 | + }, | |
1233 | + | |
1234 | + /** | |
1235 | + * 关闭中奖结果 | |
1236 | + */ | |
1237 | + closeResult() { | |
1238 | + clearInterval(this.timer); | |
1239 | + this.setData({ | |
1240 | + num: 3, | |
1241 | + showResult: false, | |
1242 | + showMask: false, | |
1243 | + hiddenCanvas: false, | |
1244 | + start: false, | |
1245 | + }); | |
1246 | + }, | |
1247 | + | |
1248 | + loadmore() { | |
1249 | + this.scrollToLower('/api/weshop/marketing/marketingLuckRecord/page', { | |
1250 | + store_id: app.globalData.setting.stoid, | |
1251 | + user_id: app.globalData.userInfo.user_id, | |
1252 | + luck_formid: this.data.options.id, | |
1253 | + luck_state: 1, | |
1254 | + }); | |
1255 | + }, | |
1256 | + | |
1257 | + | |
1258 | + /** | |
1259 | + * 请求数据 | |
1260 | + */ | |
1261 | + getData: function (isInit, url, data) { | |
1262 | + let p = app.request.promiseGet(url, { | |
1263 | + data: data, | |
1264 | + isShowLoading: true, | |
1265 | + }) | |
1266 | + .then(function (res) { | |
1267 | + if (res.data.code == 0) { | |
1268 | + | |
1269 | + self.setData({ | |
1270 | + isLoading: false | |
1271 | + }); | |
1272 | + | |
1273 | + if (isInit) {// 第一次加载 | |
1274 | + self.setData({ | |
1275 | + list: res.data.data | |
1276 | + }); | |
1277 | + } else { | |
1278 | + self.setData({ | |
1279 | + 'list.pageData': self.data.list.pageData.concat(res.data.data.pageData) | |
1280 | + }); | |
1281 | + }; | |
1282 | + | |
1283 | + if ((res.data.data.pageData.length == 0) || (res.data.data.pageSize * res.data.data.page >= res.data.data.total)) { | |
1284 | + self.setData({ | |
1285 | + noMore: true | |
1286 | + }); | |
1287 | + }; | |
1288 | + | |
1289 | + } else { | |
1290 | + self.setData({ | |
1291 | + 'list.pageData': [] | |
1292 | + }); | |
1293 | + }; | |
1294 | + | |
1295 | + }); | |
1296 | + | |
1297 | + return p; | |
1298 | + }, | |
1299 | + | |
1300 | + | |
1301 | + /** | |
1302 | + * 上拉加载 | |
1303 | + */ | |
1304 | + scrollToLower(url, requestData) { | |
1305 | + // 数据总量 | |
1306 | + let total = this.data.list.total; | |
1307 | + // 单页最大数据量 | |
1308 | + let pageSize = this.data.list.pageSize; | |
1309 | + // 如果数据总量不为0且小于或等于单页最大数据量,说明数据已全部加载,显示‘没有更多了’ | |
1310 | + if ((total != 0) && (total <= pageSize)) { | |
1311 | + this.setData({ | |
1312 | + noMore: true | |
1313 | + }); | |
1314 | + }; | |
1315 | + | |
1316 | + if (!this.data.isLoading && !this.data.noMore) { | |
1317 | + this.setData({ | |
1318 | + isLoading: true, | |
1319 | + pageNum: this.data.pageNum + 1 | |
1320 | + }); | |
1321 | + requestData.page = this.data.pageNum; | |
1322 | + this.getData(false, url, requestData); | |
1323 | + }; | |
1324 | + }, | |
1325 | + | |
1326 | + | |
1327 | + goto(e) { | |
1328 | + let url = ''; | |
1329 | + let type = e.currentTarget.dataset.type; | |
1330 | + let ordersn = null; | |
1331 | + let buyreceive_id = null; | |
1332 | + if (e.currentTarget.dataset.ordersn) { | |
1333 | + ordersn = e.currentTarget.dataset.ordersn; | |
1334 | + }; | |
1335 | + if (e.currentTarget.dataset.buyreceiveid) { | |
1336 | + buyreceive_id = e.currentTarget.dataset.buyreceiveid; | |
1337 | + }; | |
1338 | + switch (type) { | |
1339 | + case 1: { | |
1340 | + url = '/packageD/pages/user/integral/integral'; | |
1341 | + break; | |
1342 | + }; | |
1343 | + case 2: { | |
1344 | + url = '/packageE/pages/user/grow_value/grow_value'; | |
1345 | + break; | |
1346 | + }; | |
1347 | + case 3: { | |
1348 | + url = '/packageD/pages/user/coupons/coupons'; | |
1349 | + break; | |
1350 | + }; | |
1351 | + case 4: { | |
1352 | + url = '/pages/user/my_service/i_service'; | |
1353 | + break; | |
1354 | + }; | |
1355 | + case 6: { | |
1356 | + url = `/pages/giftpack/giftpacklist/giftpacklist?isBuy=0&orderSn=${ordersn}&lbId=${buyreceive_id}`; | |
1357 | + break; | |
1358 | + }; | |
1359 | + }; | |
1360 | + app.goto(url); | |
1136 | 1361 | }, |
1137 | - | |
1138 | - showPopup() { | |
1139 | - this.setData({ | |
1140 | - list: null, | |
1141 | - pageNum: 1, | |
1142 | - noMore: false, | |
1143 | - }); | |
1144 | - this.getData(true, '/api/weshop/marketing/marketingLuckRecord/page', { | |
1145 | - store_id: app.globalData.setting.stoid, | |
1146 | - user_id: app.globalData.userInfo.user_id, | |
1147 | - luck_formid: this.data.options.id, | |
1148 | - luck_state: 1, | |
1149 | - }).then(function(res) { | |
1150 | - self.setData({ | |
1151 | - showPopup: true, | |
1152 | - showMask: true, | |
1153 | - hiddenCanvas: true, | |
1154 | - }); | |
1155 | - }); | |
1156 | - | |
1157 | - // this.setData({ | |
1158 | - // showPopup: true, | |
1159 | - // showMask: true, | |
1160 | - // hiddenCanvas: true, | |
1161 | - // 'list.pageData': this.data.record, | |
1162 | - // // record: self.data.list.pageData, | |
1163 | - // }); | |
1164 | - | |
1165 | - }, | |
1166 | - | |
1167 | - closePopup() { | |
1168 | - this.setData({ | |
1169 | - showPopup: false, | |
1170 | - showMask: false, | |
1171 | - hiddenCanvas: false, | |
1172 | - }); | |
1173 | - }, | |
1174 | - | |
1175 | - /** | |
1176 | - * 关闭中奖结果 | |
1177 | - */ | |
1178 | - closeResult() { | |
1179 | - clearInterval(this.timer); | |
1180 | - this.setData({ | |
1181 | - num: 3, | |
1182 | - showResult: false, | |
1183 | - showMask: false, | |
1184 | - hiddenCanvas: false, | |
1185 | - start: false, | |
1186 | - }); | |
1187 | - }, | |
1188 | - | |
1189 | - loadmore() { | |
1190 | - this.scrollToLower('/api/weshop/marketing/marketingLuckRecord/page', { | |
1191 | - store_id: app.globalData.setting.stoid, | |
1192 | - user_id: app.globalData.userInfo.user_id, | |
1193 | - luck_formid: this.data.options.id, | |
1194 | - luck_state: 1, | |
1195 | - }); | |
1196 | - }, | |
1197 | - | |
1198 | - | |
1199 | - /** | |
1200 | - * 请求数据 | |
1201 | - */ | |
1202 | - getData: function(isInit, url, data) { | |
1203 | - let p = app.request.promiseGet(url, { | |
1204 | - data: data, | |
1205 | - isShowLoading: true, | |
1206 | - }) | |
1207 | - .then(function(res) { | |
1208 | - if(res.data.code == 0) { | |
1209 | - | |
1210 | - self.setData({ | |
1211 | - isLoading: false | |
1212 | - }); | |
1213 | - | |
1214 | - if(isInit) {// 第一次加载 | |
1215 | - self.setData({ | |
1216 | - list: res.data.data | |
1217 | - }); | |
1218 | - } else { | |
1219 | - self.setData({ | |
1220 | - 'list.pageData': self.data.list.pageData.concat(res.data.data.pageData) | |
1221 | - }); | |
1222 | - }; | |
1223 | - | |
1224 | - if((res.data.data.pageData.length == 0) || (res.data.data.pageSize * res.data.data.page >= res.data.data.total)) { | |
1225 | - self.setData({ | |
1226 | - noMore: true | |
1227 | - }); | |
1228 | - }; | |
1229 | - | |
1230 | - } else { | |
1231 | - self.setData({ | |
1232 | - 'list.pageData': [] | |
1233 | - }); | |
1234 | - }; | |
1235 | - | |
1236 | - }); | |
1237 | - | |
1238 | - return p; | |
1239 | - }, | |
1240 | - | |
1241 | - | |
1242 | - /** | |
1243 | - * 上拉加载 | |
1244 | - */ | |
1245 | - scrollToLower(url, requestData) { | |
1246 | - // 数据总量 | |
1247 | - let total = this.data.list.total; | |
1248 | - // 单页最大数据量 | |
1249 | - let pageSize = this.data.list.pageSize; | |
1250 | - // 如果数据总量不为0且小于或等于单页最大数据量,说明数据已全部加载,显示‘没有更多了’ | |
1251 | - if((total != 0)&&(total <= pageSize)) { | |
1252 | - this.setData({ | |
1253 | - noMore: true | |
1254 | - }); | |
1255 | - }; | |
1256 | - | |
1257 | - if(!this.data.isLoading && !this.data.noMore) { | |
1258 | - this.setData({ | |
1259 | - isLoading: true, | |
1260 | - pageNum: this.data.pageNum + 1 | |
1261 | - }); | |
1262 | - requestData.page = this.data.pageNum; | |
1263 | - this.getData(false, url, requestData); | |
1264 | - }; | |
1265 | - }, | |
1266 | - | |
1267 | - | |
1268 | - goto(e) { | |
1269 | - let url = ''; | |
1270 | - let type = e.currentTarget.dataset.type; | |
1271 | - let ordersn = null; | |
1272 | - let buyreceive_id = null; | |
1273 | - if(e.currentTarget.dataset.ordersn) { | |
1274 | - ordersn = e.currentTarget.dataset.ordersn; | |
1275 | - }; | |
1276 | - if(e.currentTarget.dataset.buyreceiveid) { | |
1277 | - buyreceive_id = e.currentTarget.dataset.buyreceiveid; | |
1278 | - }; | |
1279 | - switch(type) { | |
1280 | - case 1: { | |
1281 | - url = '/packageD/pages/user/integral/integral'; | |
1282 | - break; | |
1283 | - }; | |
1284 | - case 2: { | |
1285 | - url = '/packageE/pages/user/grow_value/grow_value'; | |
1286 | - break; | |
1287 | - }; | |
1288 | - case 3: { | |
1289 | - url = '/packageD/pages/user/coupons/coupons'; | |
1290 | - break; | |
1291 | - }; | |
1292 | - case 4: { | |
1293 | - url = '/pages/user/my_service/i_service'; | |
1294 | - break; | |
1295 | - }; | |
1296 | - case 6: { | |
1297 | - url = `/pages/giftpack/giftpacklist/giftpacklist?isBuy=0&orderSn=${ordersn}&lbId=${buyreceive_id}`; | |
1298 | - break; | |
1299 | - }; | |
1300 | - }; | |
1301 | - app.goto(url); | |
1302 | - }, | |
1303 | - | |
1304 | - showQr(e) { | |
1305 | - let id = null; | |
1306 | - let store_id = app.globalData.setting.stoid; | |
1307 | - if(e && e.currentTarget.dataset.id) { | |
1308 | - id = e.currentTarget.dataset.id; | |
1309 | - } else { | |
1310 | - id = this.data.wow.record_id; | |
1311 | - }; | |
1312 | - let url = `/api/weshop/marketing/marketingLuckList/updateGoodsVerifyCode/${store_id}/${id}`; | |
1313 | - // console.log('good_id', id, url); | |
1314 | - app.request.put(url, { | |
1315 | - success: function(res) { | |
1316 | - if(res.data.code == 0) { | |
1317 | - let data = res.data.data; | |
1318 | - let barcode = self.selectComponent("#qrcode"); | |
1319 | - barcode.open({val: data}); | |
1320 | - self.setData({ | |
1321 | - hiddenCanvas: true, | |
1322 | - showPopup: false, | |
1323 | - }); | |
1324 | - } else { | |
1325 | - wx.showToast({ | |
1326 | - title: res.data.msg, | |
1327 | - icon: 'none', | |
1328 | - }); | |
1329 | - }; | |
1330 | - }, | |
1331 | - | |
1332 | - }); | |
1333 | - }, | |
1334 | - | |
1335 | - closeQr() { | |
1336 | - this.setData({ | |
1337 | - hiddenCanvas: false, | |
1338 | - showMask: false, | |
1339 | - }); | |
1340 | - }, | |
1341 | - | |
1342 | - clickReceive() { | |
1343 | - this.setData({ | |
1344 | - showResult: false, | |
1345 | - }); | |
1346 | - this.showQr(); | |
1347 | - }, | |
1348 | - | |
1349 | - | |
1350 | - | |
1351 | - showPoster() { | |
1352 | - | |
1353 | - console.log('已经生成图片!!!!!!', self.data.imgPath); | |
1354 | - // console.log(Promise.resolve(this.onImgOK)); | |
1355 | - wx.showLoading({ | |
1356 | - title: '生成海报中', | |
1357 | - }); | |
1358 | - var timer; | |
1359 | - if(this.data.isImgOk && this.data.getMiniCode) { | |
1360 | - wx.hideLoading(); | |
1361 | - self.setData({ | |
1362 | - myimg: self.data.imgPath, | |
1363 | - hiddenCanvas: true, | |
1364 | - showMask: true, | |
1365 | - showPoster: true, | |
1366 | - }); | |
1367 | - } else { | |
1368 | - timer = setInterval(function() { | |
1369 | - if(self.data.isImgOk && self.data.getMiniCode) { | |
1370 | - clearInterval(timer); | |
1371 | - wx.hideLoading(); | |
1372 | - self.setData({ | |
1373 | - myimg: self.data.imgPath, | |
1374 | - hiddenCanvas: true, | |
1375 | - showMask: true, | |
1376 | - showPoster: true, | |
1377 | - }); | |
1378 | - }; | |
1379 | - }, 500); | |
1380 | - }; | |
1381 | - }, | |
1382 | - | |
1383 | - closePoster() { | |
1384 | - this.setData({ | |
1385 | - showMask: false, | |
1386 | - showPoster: false, | |
1387 | - hiddenCanvas: false, | |
1388 | - }); | |
1389 | - }, | |
1390 | - | |
1391 | - | |
1392 | - | |
1393 | - onImgOK(e) { | |
1394 | - console.log('图片绘制成功', e.detail.path); | |
1395 | - // this.setData({ | |
1396 | - // imgPath: e.detail.path, | |
1397 | - // }); | |
1398 | - if(e&&e.detail.path) { | |
1399 | - this.setData({ | |
1400 | - isImgOk: true, | |
1401 | - imgPath: e.detail.path, | |
1402 | - }); | |
1403 | - }; | |
1404 | - | |
1405 | - }, | |
1406 | - | |
1407 | - | |
1408 | - | |
1362 | + | |
1363 | + showQr(e) { | |
1364 | + let id = null; | |
1365 | + let store_id = app.globalData.setting.stoid; | |
1366 | + let goods_pickup_id = '' | |
1367 | + let off = false //是否需要携带登记的门店id | |
1368 | + | |
1369 | + if (e && e.currentTarget.dataset.id) { | |
1370 | + id = e.currentTarget.dataset.id; | |
1371 | + if (e.verify_pickup_id) { | |
1372 | + goods_pickup_id = e.verify_pickup_id; | |
1373 | + off = true | |
1374 | + } | |
1375 | + } else { | |
1376 | + id = this.data.wow.record_id; | |
1377 | + goods_pickup_id = this.data.wow.goods_pickup_id; | |
1378 | + off = true | |
1379 | + }; | |
1380 | + let url = `/api/weshop/marketing/marketingLuckList/updateGoodsVerifyCode/${store_id}/${id}`; | |
1381 | + | |
1382 | + //判断是否需要登记门店,才可以核销商品 | |
1383 | + if (this.data.luckInfo.is_store == 1 && goods_pickup_id && off) { | |
1384 | + url += `/${goods_pickup_id}` | |
1385 | + } | |
1386 | + | |
1387 | + // console.log('good_id', id, url); | |
1388 | + app.request.put(url, { | |
1389 | + success: function (res) { | |
1390 | + if (res.data.code == 0) { | |
1391 | + let data = res.data.data; | |
1392 | + let barcode = self.selectComponent("#qrcode"); | |
1393 | + barcode.open({ val: data }); | |
1394 | + self.setData({ | |
1395 | + hiddenCanvas: true, | |
1396 | + showPopup: false, | |
1397 | + }); | |
1398 | + } else { | |
1399 | + wx.showToast({ | |
1400 | + title: res.data.msg, | |
1401 | + icon: 'none', | |
1402 | + }); | |
1403 | + }; | |
1404 | + }, | |
1405 | + | |
1406 | + }); | |
1407 | + }, | |
1408 | + | |
1409 | + closeQr() { | |
1410 | + this.setData({ | |
1411 | + hiddenCanvas: false, | |
1412 | + showMask: false, | |
1413 | + }); | |
1414 | + }, | |
1415 | + | |
1416 | + clickReceive() { | |
1417 | + this.setData({ | |
1418 | + showResult: false, | |
1419 | + }); | |
1420 | + this.showQr(); | |
1421 | + }, | |
1422 | + | |
1423 | + | |
1424 | + | |
1425 | + showPoster() { | |
1426 | + | |
1427 | + console.log('已经生成图片!!!!!!', self.data.imgPath); | |
1428 | + // console.log(Promise.resolve(this.onImgOK)); | |
1429 | + wx.showLoading({ | |
1430 | + title: '生成海报中', | |
1431 | + }); | |
1432 | + var timer; | |
1433 | + if (this.data.isImgOk && this.data.getMiniCode) { | |
1434 | + wx.hideLoading(); | |
1435 | + self.setData({ | |
1436 | + myimg: self.data.imgPath, | |
1437 | + hiddenCanvas: true, | |
1438 | + showMask: true, | |
1439 | + showPoster: true, | |
1440 | + }); | |
1441 | + } else { | |
1442 | + timer = setInterval(function () { | |
1443 | + if (self.data.isImgOk && self.data.getMiniCode) { | |
1444 | + clearInterval(timer); | |
1445 | + wx.hideLoading(); | |
1446 | + self.setData({ | |
1447 | + myimg: self.data.imgPath, | |
1448 | + hiddenCanvas: true, | |
1449 | + showMask: true, | |
1450 | + showPoster: true, | |
1451 | + }); | |
1452 | + }; | |
1453 | + }, 500); | |
1454 | + }; | |
1455 | + }, | |
1456 | + | |
1457 | + closePoster() { | |
1458 | + this.setData({ | |
1459 | + showMask: false, | |
1460 | + showPoster: false, | |
1461 | + hiddenCanvas: false, | |
1462 | + }); | |
1463 | + }, | |
1464 | + //门店退出回调 | |
1465 | + closeback(){ | |
1466 | + console.log('门店关闭回调'); | |
1467 | + this.setData({ | |
1468 | + store: 0, | |
1469 | + showPopup: false, | |
1470 | + showMask: false, | |
1471 | + hiddenCanvas: false, | |
1472 | + }) | |
1473 | + }, | |
1474 | + | |
1475 | + | |
1476 | + onImgOK(e) { | |
1477 | + console.log('图片绘制成功', e.detail.path); | |
1478 | + // this.setData({ | |
1479 | + // imgPath: e.detail.path, | |
1480 | + // }); | |
1481 | + if (e && e.detail.path) { | |
1482 | + this.setData({ | |
1483 | + isImgOk: true, | |
1484 | + imgPath: e.detail.path, | |
1485 | + }); | |
1486 | + }; | |
1487 | + | |
1488 | + }, | |
1489 | + | |
1490 | + | |
1491 | + | |
1409 | 1492 | }) |
1410 | 1493 | \ No newline at end of file | ... | ... |
packageB/pages/luckactivity/luckinfo/luckinfo.json
... | ... | @@ -2,7 +2,8 @@ |
2 | 2 | "usingComponents": { |
3 | 3 | "lucky-wheel":"/packageB/miniprogram_npm/mini-luck-draw/lucky-wheel/index", |
4 | 4 | "qrcode": "/components/my-qrcode/my-qrcode", |
5 | - "nodata": "/components/nodata/nodata", | |
5 | + "nodata": "/components/nodata/nodata", | |
6 | + "store_popup":"/components/store_popup/store_popup", | |
6 | 7 | "painter": "/packageB/components/painter/painter" |
7 | 8 | }, |
8 | 9 | "enablePullDownRefresh": false, | ... | ... |
packageB/pages/luckactivity/luckinfo/luckinfo.wxml
... | ... | @@ -143,9 +143,9 @@ |
143 | 143 | <view class="fs26 xc-black3">价值:<text class="rmb">{{item.luck_goods_price}}</text></view> |
144 | 144 | <view class="flex ai_c {{item.luck_type == 5 ? 'jc_sb':'jc_fe'}} fs26 xc-black3 "> |
145 | 145 | <!-- <view style="visibility: {{item.luck_type == 5 ? 'visible':'hidden'}};">兑换状态:{{item.state == 0 ? '未兑换':'已兑换'}}</view> --> |
146 | - <!-- <view style="">兑换状态:{{item.state == 0 ? '未兑换':'已兑换'}}</view> --> | |
146 | + <!-- <view style="">兑换状态:{{item.state == 0 ? '未兑换':'已兑换'}}</view> --> | |
147 | 147 | <view class="fs24 c-a" wx:if="{{item.luck_type == 5}}">兑换截止时间:{{filter.show_default(item.changeDate, '不限')}}</view> |
148 | - <view class="btn" bindtap="{{item.luck_type == 5 ? (item.state == 0 ? 'showQr':'showQr'):'goto'}}" data-type="{{item.luck_type}}" data-id="{{item.id}}" data-ordersn="{{item.order_sn}}" data-buyreceiveid="{{item.buyreceive_id}}">{{item.luck_type == 5 ? (item.state == 1 ? '已兑换':'兑换'):'查看'}}</view> | |
148 | + <view class="btn" bindtap="{{item.luck_type == 5 ? (item.state == 0 ? 'select_product2':'select_product2'):'goto'}}" data-verify_pickup_id="{{item.verify_pickup_id}}" data-type="{{item.luck_type}}" data-id="{{item.id}}" data-ordersn="{{item.order_sn}}" data-buyreceiveid="{{item.buyreceive_id}}">{{item.luck_type == 5 ? (item.state == 1 ? '已兑换':'兑换'):'查看'}}</view> | |
149 | 149 | </view> |
150 | 150 | </view> |
151 | 151 | </view> |
... | ... | @@ -179,7 +179,7 @@ |
179 | 179 | </view> |
180 | 180 | |
181 | 181 | <view class="pdt40" wx:if="{{currentLbtype == 5}}"> |
182 | - <view class="btn btn2" bindtap="clickReceive">立即兑换</view> | |
182 | + <view class="btn btn2" bindtap="select_product">立即兑换</view> | |
183 | 183 | </view> |
184 | 184 | |
185 | 185 | |
... | ... | @@ -201,5 +201,7 @@ |
201 | 201 | |
202 | 202 | <qrcode id="qrcode" bind:close="closeQr"></qrcode> |
203 | 203 | |
204 | +<!-- 门店选择弹窗 --> | |
205 | +<store_popup store="{{store}}" bind:closeback="closeback" bind:callback="callback" ></store_popup> | |
204 | 206 | |
205 | 207 | <painter style="position: absolute;left: -9999rpx;" palette="{{imgDraw}}" bind:imgOK="onImgOK"/> |
206 | 208 | \ No newline at end of file | ... | ... |
packageC/pages/luckyGo/luckyGo_goodsInfo/buy_pt.wxml
... | ... | @@ -72,6 +72,7 @@ |
72 | 72 | </view> |
73 | 73 | </view> |
74 | 74 | <view class="no_store" wx:if="{{def_pick_store.is_no_dis}}">(配送不匹配)</view> |
75 | + <view class="no_store" wx:elif="{{def_pick_store.is_no_dis_nor && is_normal}}">(该店不可售)</view> | |
75 | 76 | <view class="no_store" wx:elif="{{is_normal && def_pick_store && def_pick_store.CanOutQty<=0 && !filters.is_virtual_gd(sele_g.is_virtual) }}">(库存不足)</view> |
76 | 77 | <view class="fs24 xc-ash-9f xc-distance-top " wx:if="{{def_pick_store && def_pick_store.pickup_name}}">地址:{{def_pick_store.fulladdress}}</view> |
77 | 78 | </view> |
... | ... | @@ -174,6 +175,10 @@ |
174 | 175 | <block wx:if="{{def_pick_store && def_pick_store.is_no_dis}}"> |
175 | 176 | <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;">配送不匹配</view> |
176 | 177 | </block> |
178 | + <block wx:elif="{{def_pick_store && def_pick_store.is_no_dis_nor}}"> | |
179 | + <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;">该店不可售</view> | |
180 | + </block> | |
181 | + | |
177 | 182 | <block wx:else> |
178 | 183 | |
179 | 184 | <!-- 根本就找不到门店 --> | ... | ... |
packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js
... | ... | @@ -842,16 +842,14 @@ Page({ |
842 | 842 | return false; |
843 | 843 | } |
844 | 844 | |
845 | - if(getApp().globalData.is_dj_pk) th.setData({has_def:1}) | |
846 | - var ee = JSON.parse(JSON.stringify(e)); | |
847 | - //--定时器推迟一下-- | |
848 | - setTimeout(function () { | |
845 | + if(getApp().globalData.is_dj_pk) th.setData({has_def:1}) | |
846 | + var ee = JSON.parse(JSON.stringify(e)); | |
847 | + | |
849 | 848 | if (th.data.fir_goods) var g_distr_type = th.data.fir_goods.distr_type; |
850 | 849 | //--如果默认门店的配送方式不对,就不能被选择,这里不控制,如果不一样,就说明配送方式不对-- |
851 | 850 | if (ee.distr_type != 0 && g_distr_type != 0 && ee.distr_type != g_distr_type) { |
852 | 851 | ee.is_no_dis = 1; |
853 | 852 | } |
854 | - | |
855 | 853 | var appd = getApp().globalData; |
856 | 854 | var w_time = setInterval(function () { |
857 | 855 | if (that.data.is_get_local_ok == 0) return false; |
... | ... | @@ -890,8 +888,8 @@ Page({ |
890 | 888 | that.set_def_storage(e); |
891 | 889 | } |
892 | 890 | } |
893 | - }, 500) | |
894 | - }, 700) | |
891 | + }, 200) | |
892 | + | |
895 | 893 | }); |
896 | 894 | }, |
897 | 895 | |
... | ... | @@ -2943,6 +2941,11 @@ Page({ |
2943 | 2941 | } |
2944 | 2942 | |
2945 | 2943 | |
2944 | + }else{ | |
2945 | + //只有是普通商品购买的时候,才要给商品赋值指定门店 | |
2946 | + if (is_normal && goodsinfo.pick_group_ids) { | |
2947 | + goodsinfo.pickup_ids = goodsinfo.pick_up_lists; | |
2948 | + } | |
2946 | 2949 | } |
2947 | 2950 | //---如果有活动,不算在一起--- |
2948 | 2951 | if (prom) { |
... | ... | @@ -2954,8 +2957,11 @@ Page({ |
2954 | 2957 | } |
2955 | 2958 | } |
2956 | 2959 | |
2957 | - | |
2958 | 2960 | var item = arrdata[i], gg = ""; |
2961 | + if (goodsinfo.goods_id != g_id && goodsinfo.pick_group_ids ) { | |
2962 | + item.pickup_ids= goodsinfo.pick_up_lists; | |
2963 | + } | |
2964 | + | |
2959 | 2965 | if (item.goods_spec == "null" || item.goods_spec == null) item.goods_spec = ""; |
2960 | 2966 | if (item.goods_color == "null" || item.goods_color == null) item.goods_color = ""; |
2961 | 2967 | |
... | ... | @@ -3003,6 +3009,15 @@ Page({ |
3003 | 3009 | var gid = e.currentTarget.dataset.gid; |
3004 | 3010 | var nor = e.currentTarget.dataset.nor; |
3005 | 3011 | |
3012 | + //在切换规格的时候,指定门店不匹配的状态要清理 | |
3013 | + if (th.data.def_pick_store && JSON.stringify(th.data.def_pick_store) != '{}'){ | |
3014 | + th.data.def_pick_store.is_no_dis_nor=0; | |
3015 | + that.setData({ | |
3016 | + def_pick_store: th.data.def_pick_store | |
3017 | + }) | |
3018 | + } | |
3019 | + | |
3020 | + | |
3006 | 3021 | var sku_g = this.data.sku_g; |
3007 | 3022 | if (nor) { |
3008 | 3023 | sku_g = this.data.sku_g_pt; |
... | ... | @@ -3179,6 +3194,7 @@ Page({ |
3179 | 3194 | |
3180 | 3195 | var timer_get = setInterval(function () { |
3181 | 3196 | if (th.data.is_get_local_ok == 0) return false; |
3197 | + if (!th.data.fir_def_store) return false; | |
3182 | 3198 | var dd = null, i = getApp().request; |
3183 | 3199 | if (!th.data.sele_g) return false; |
3184 | 3200 | |
... | ... | @@ -3221,6 +3237,42 @@ Page({ |
3221 | 3237 | |
3222 | 3238 | if (e.data.code == 0 && e.data.data && e.data.data.pageData && e.data.data.pageData.length > 0) { |
3223 | 3239 | |
3240 | + //-- 如果有指定门店的时候 -- | |
3241 | + if(th.data.sele_g.pickup_ids && th.data.is_normal){ | |
3242 | + | |
3243 | + var ok_arr=[]; | |
3244 | + for (let i in e.data.data.pageData) { | |
3245 | + let ite = e.data.data.pageData[i]; | |
3246 | + //-- 查找一下门店有没有在 -- | |
3247 | + var idx=th.data.sele_g.pickup_ids.findIndex(function (e){ | |
3248 | + return e.pickup_id==ite.pickup_id; | |
3249 | + }) | |
3250 | + if(idx>-1){ | |
3251 | + ok_arr.push(ite) | |
3252 | + } | |
3253 | + } | |
3254 | + | |
3255 | + //判断会员的默认的门店是不是匹配指定的门店 | |
3256 | + if (th.data.def_pick_store && JSON.stringify(th.data.def_pick_store) != '{}'){ | |
3257 | + //-- 查找一下门店有没有在 -- | |
3258 | + var idx1=th.data.sele_g.pickup_ids.findIndex(function (e){ | |
3259 | + return e.pickup_id==th.data.def_pick_store.pickup_id; | |
3260 | + }) | |
3261 | + | |
3262 | + if(idx1<0){ | |
3263 | + th.data.def_pick_store.is_no_dis_nor=1; | |
3264 | + that.setData({ | |
3265 | + def_pick_store: th.data.def_pick_store | |
3266 | + }) | |
3267 | + } | |
3268 | + } | |
3269 | + | |
3270 | + | |
3271 | + e.data.data.pageData=ok_arr; //数组重新赋值 | |
3272 | + e.data.data.total=ok_arr.length; //数组的长度 | |
3273 | + } | |
3274 | + | |
3275 | + | |
3224 | 3276 | var his_cate_num = 0; |
3225 | 3277 | for (let i in e.data.data.pageData) { |
3226 | 3278 | let item = e.data.data.pageData[i]; |
... | ... | @@ -3630,6 +3682,14 @@ Page({ |
3630 | 3682 | is_find_def_store = 1; |
3631 | 3683 | } |
3632 | 3684 | |
3685 | + //-- 如果库存为0就要重新赋值 -- | |
3686 | + def_pick_store.CanOutQty=Qty; | |
3687 | + th.setData({ | |
3688 | + def_pick_store | |
3689 | + }) | |
3690 | + | |
3691 | + | |
3692 | + | |
3633 | 3693 | } else { |
3634 | 3694 | th.setData({ |
3635 | 3695 | all_sto: null, |
... | ... | @@ -3662,6 +3722,13 @@ Page({ |
3662 | 3722 | th.setData({def_pick_store: th.data.fir_def_store}) |
3663 | 3723 | is_find_def_store = 1; |
3664 | 3724 | } |
3725 | + | |
3726 | + //-- 如果库存为0就要重新赋值 -- | |
3727 | + if(n_item.StorageNo ==def_pick_store.pickup_no) { | |
3728 | + def_pick_store.CanOutQty= o_plist[kk].CanOutQty; | |
3729 | + th.setData({ def_pick_store }) | |
3730 | + } | |
3731 | + | |
3665 | 3732 | } |
3666 | 3733 | break; |
3667 | 3734 | } |
... | ... | @@ -4497,14 +4564,19 @@ Page({ |
4497 | 4564 | if (ind == 1) { |
4498 | 4565 | //如果拼单的sku data是空的,就要先获取一下 |
4499 | 4566 | if (th.data.sku_g_pt) { |
4567 | + | |
4568 | + //要同步指定门店 | |
4569 | + th.set_sele_g(th.data.sku_g_pt); | |
4570 | + | |
4500 | 4571 | th.get_sto(1); |
4501 | 4572 | th.setData({ |
4502 | 4573 | is_normal: ind, |
4503 | 4574 | openSpecModal_pt: 1 |
4504 | 4575 | }); |
4505 | 4576 | } else { |
4506 | - th.get_sto(1); | |
4577 | + | |
4507 | 4578 | th.get_sku(o.stoid, th.data.data, th.data.gid, 1, function () { |
4579 | + th.get_sto(1); | |
4508 | 4580 | th.setData({ |
4509 | 4581 | is_normal: ind, |
4510 | 4582 | openSpecModal_pt: 1 |
... | ... | @@ -7240,5 +7312,17 @@ Page({ |
7240 | 7312 | }, |
7241 | 7313 | |
7242 | 7314 | |
7315 | + //要同步sele_g的指定门店,在有单独购买的时候,积分购和拼团 | |
7316 | + set_sele_g:function (sku_list){ | |
7317 | + var goods_id=this.data.sele_g.goods_id; | |
7318 | + for (var i in sku_list) { | |
7319 | + if(goods_id==sku_list[i].goods_id){ | |
7320 | + this.data.sele_g.pickup_ids=sku_list[i].pickup_ids; | |
7321 | + break; | |
7322 | + } | |
7323 | + } | |
7324 | + } | |
7325 | + | |
7326 | + | |
7243 | 7327 | |
7244 | 7328 | }); | ... | ... |
packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml
... | ... | @@ -1062,7 +1062,6 @@ |
1062 | 1062 | </view> |
1063 | 1063 | </view> |
1064 | 1064 | <block wx:if="{{prom_type == 0}}"> |
1065 | - 11111111111111 | |
1066 | 1065 | <view class="flex"> |
1067 | 1066 | <view class="spec-goods-stock">已售:{{sele_g.sales_sum}}</view> |
1068 | 1067 | <!-- 线下门店销售的时候 --> |
... | ... | @@ -1082,7 +1081,6 @@ |
1082 | 1081 | </view> |
1083 | 1082 | </block> |
1084 | 1083 | <block wx:if="{{prom_type==1}}"> |
1085 | - 555555555555 | |
1086 | 1084 | <view class="flex"> |
1087 | 1085 | <view class="spec-goods-stock" wx:if="{{prom_st>0}}"> |
1088 | 1086 | 已售:{{prom_act.buy_num+prom_act.virtual}} |
... | ... | @@ -1370,6 +1368,8 @@ |
1370 | 1368 | <view class="flex-vertical-between butttem5"> |
1371 | 1369 | <view class="flex xc-ash" style="flex-shrink:0;max-width: 62%;"> |
1372 | 1370 | <view class="fs30 xc-black3 address_name">{{item.pickup_name}}</view> |
1371 | + <text class="c-red22" wx:if="{{item.is_no_dis}}">(配送不匹配)</text> | |
1372 | + <text class="c-red22" wx:if="{{item.is_no_dis_nor && is_normal==1}}">(该店不可售)</text> | |
1373 | 1373 | </view> |
1374 | 1374 | <view> |
1375 | 1375 | <view class="distance fs24 address-val" wx:if="{{item.distance!=null}}"> |
... | ... | @@ -1396,6 +1396,8 @@ |
1396 | 1396 | <view class="flex-vertical-between "> |
1397 | 1397 | <view class="flex xc-ash"> |
1398 | 1398 | <view class="fs30 xc-black3 address_name">{{item.pickup_name}}</view> |
1399 | + <text class="c-red22" wx:if="{{item.is_no_dis}}">(配送不匹配)</text> | |
1400 | + <text class="c-red22" wx:if="{{item.is_no_dis_nor && is_normal==1}}">(该店不可售)</text> | |
1399 | 1401 | </view> |
1400 | 1402 | <view> |
1401 | 1403 | <view class="distance fs24 address-val" wx:if="{{item.distance!=null}}"> | ... | ... |
packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxss
packageE/pages/cart/cart2_pt/cart2_pt.js
packageF/pages/free_delivery/free_delivery.js
0 → 100644
1 | +// packageF/pages/free_delivery/free_delivery.js | |
2 | +var o = getApp().globalData.setting | |
3 | +const app = getApp(); | |
4 | +Page({ | |
5 | + | |
6 | + /** | |
7 | + * 页面的初始数据 | |
8 | + */ | |
9 | + data: { | |
10 | + url: o.imghost, | |
11 | + userInfo:null, | |
12 | + login_title:'暂未登录,请先登录', | |
13 | + login_name:'授权登录', | |
14 | + login_off:false, | |
15 | + hd_id:'', | |
16 | + delHeight:736, //默认窗口高度,用于对比,定位图片用 | |
17 | + delOff:false, //窗口高度对比,false 用默认定位,ture 定位调整 | |
18 | + | |
19 | + }, | |
20 | + | |
21 | + /** | |
22 | + * 生命周期函数--监听页面加载 | |
23 | + */ | |
24 | + onLoad(options) { | |
25 | + let window_info = wx.getWindowInfo() | |
26 | + if (window_info.screenHeight > this.data.delHeight) { | |
27 | + this.setData({ | |
28 | + delOff:true | |
29 | + }) | |
30 | + } | |
31 | + | |
32 | + if (options && options.id) { | |
33 | + this.setData({ | |
34 | + hd_id:options.id | |
35 | + }) | |
36 | + this.getInfo() | |
37 | + }else{ | |
38 | + wx.showToast({ | |
39 | + title: '获取活动失败', | |
40 | + icon: 'none', | |
41 | + duration: 2000, | |
42 | + mask:true | |
43 | + }) | |
44 | + setTimeout(()=>{ | |
45 | + wx.reLaunch({ | |
46 | + url: '/pages/index/index/index' | |
47 | + }) | |
48 | + },2000) | |
49 | + } | |
50 | + | |
51 | + }, | |
52 | + getInfo(){ | |
53 | + app.promiseGet(`/api/weshop/meitu/storeMeituHdlist/get/${app.globalData.setting.stoid}/${this.data.hd_id}`, {}).then(res => { | |
54 | + if (res.data.code == 0 && res.data.data && res.data.data.hd_name) { | |
55 | + wx.setNavigationBarTitle({ | |
56 | + title: res.data.data.hd_name | |
57 | + }) | |
58 | + } | |
59 | + }) | |
60 | + }, | |
61 | + /** | |
62 | + * 生命周期函数--监听页面初次渲染完成 | |
63 | + */ | |
64 | + onReady() { | |
65 | + | |
66 | + }, | |
67 | + | |
68 | + /** | |
69 | + * 生命周期函数--监听页面显示 | |
70 | + */ | |
71 | + onShow() { | |
72 | + let userInfo = getApp().globalData.userInfo; | |
73 | + this.setData({ | |
74 | + userInfo | |
75 | + }) | |
76 | + if (userInfo) { | |
77 | + this.setData({ | |
78 | + login_title:userInfo.mobile, | |
79 | + login_name:'领取会员' | |
80 | + }) | |
81 | + } | |
82 | + | |
83 | + }, | |
84 | + //--跳到绑定页面-- | |
85 | + gobindtel: function () { | |
86 | + let userInfo = this.data.userInfo | |
87 | + let login_off = this.data.login_off | |
88 | + if (userInfo) { | |
89 | + if (!login_off) { | |
90 | + this.setData({ | |
91 | + login_off:true | |
92 | + }) | |
93 | + wx.showLoading({ | |
94 | + title: '领取中', | |
95 | + mask: true, | |
96 | + }); | |
97 | + app.request.promisePost('/api/weshop/meitu/storeMeituUserlist/save', { | |
98 | + is_json: true, | |
99 | + data: { | |
100 | + store_id: app.globalData.setting.stoid, | |
101 | + user_id: app.globalData.user_id, | |
102 | + hd_id: this.data.hd_id, | |
103 | + }, | |
104 | + }).then((res)=>{ | |
105 | + if(res.data.code == 0) { | |
106 | + wx.showToast({ | |
107 | + title: res.data.msg, | |
108 | + icon: 'none', | |
109 | + duration: 2000, | |
110 | + mask:true, | |
111 | + }); | |
112 | + this.setData({ | |
113 | + login_name:'已领取' | |
114 | + }) | |
115 | + // setTimeout(()=>{ | |
116 | + // wx.reLaunch({ | |
117 | + // url: '/pages/index/index/index' | |
118 | + // }) | |
119 | + // },2000) | |
120 | + // self.getData(true, '/api/weshop/goods/page?isnewwhere=1&is_mainshow=1&isonsale=1&dis_type=1', self.data.currentQuery, false); | |
121 | + } else { | |
122 | + this.setData({ | |
123 | + login_off:false | |
124 | + }) | |
125 | + wx.showToast({ | |
126 | + title: res.data.msg, | |
127 | + icon: 'none', | |
128 | + duration: 2000, | |
129 | + mask:true, | |
130 | + }); | |
131 | + } | |
132 | + | |
133 | + }); | |
134 | + | |
135 | + | |
136 | + | |
137 | + | |
138 | + } | |
139 | + }else{ | |
140 | + wx.navigateTo({ | |
141 | + url: '/packageE/pages/togoin/togoin', | |
142 | + }) | |
143 | + } | |
144 | + }, | |
145 | + /** | |
146 | + * 生命周期函数--监听页面隐藏 | |
147 | + */ | |
148 | + onHide() { | |
149 | + | |
150 | + }, | |
151 | + | |
152 | + /** | |
153 | + * 生命周期函数--监听页面卸载 | |
154 | + */ | |
155 | + onUnload() { | |
156 | + | |
157 | + }, | |
158 | + | |
159 | + /** | |
160 | + * 页面相关事件处理函数--监听用户下拉动作 | |
161 | + */ | |
162 | + onPullDownRefresh() { | |
163 | + wx.stopPullDownRefresh() | |
164 | + }, | |
165 | + | |
166 | + /** | |
167 | + * 页面上拉触底事件的处理函数 | |
168 | + */ | |
169 | + onReachBottom() { | |
170 | + | |
171 | + }, | |
172 | + | |
173 | + /** | |
174 | + * 用户点击右上角分享 | |
175 | + */ | |
176 | + onShareAppMessage() { | |
177 | + | |
178 | + } | |
179 | +}) | |
0 | 180 | \ No newline at end of file | ... | ... |
packageF/pages/free_delivery/free_delivery.json
0 → 100644
packageF/pages/free_delivery/free_delivery.wxml
0 → 100644
1 | +<!--packageF/pages/free_delivery/free_delivery.wxml--> | |
2 | +<view class="free_delivery" style="background-image: url({{url}}miniapp/images/pink_diamond/bg.jpg);"> | |
3 | + <view class="top" > | |
4 | + <image src="{{url}}miniapp/images/pink_diamond/logo.png" style="width: 345.6rpx;height: 88rpx;"></image> | |
5 | + </view> | |
6 | + <view class="main"> | |
7 | + <view class="imageBox" > | |
8 | + <image src="{{url}}miniapp/images/pink_diamond/top1.png" style="width: 618.8rpx;height: 484.4rpx;"></image> | |
9 | + </view> | |
10 | + <view class="main_title" style="background-image: url({{url}}miniapp/images/pink_diamond/login.png);width: 618.8rpx;height: 80rpx;color: {{userInfo ? '#333' :'rgb(194, 194, 194)'}};font-weight: {{userInfo ? 'bold' :'400'}};" >{{login_title}}</view> | |
11 | + <view class="but" catchtap="gobindtel" style="background-image: url({{url}}miniapp/images/pink_diamond/login1.png);width: 618.8rpx;height: 80rpx;" >{{login_name}}</view> | |
12 | + <!-- <view wx:if="{{userInfo}}">领取会员</view> | |
13 | + <view wx:else catchtap="gobindtel">点击注册</view> --> | |
14 | + </view> | |
15 | + <view class="bottom" > | |
16 | + <image src="{{url}}miniapp/images/pink_diamond/bottom.png?v=5" style="width: 618.8rpx;height: 388.5rpx;"></image> | |
17 | + </view> | |
18 | +</view> | ... | ... |
packageF/pages/free_delivery/free_delivery.wxss
0 → 100644
1 | +/* packageF/pages/free_delivery/free_delivery.wxss */ | |
2 | + | |
3 | +.free_delivery{ | |
4 | + width: 100%; | |
5 | + min-height: 100vh; | |
6 | + padding-bottom:25.6rpx; | |
7 | + box-sizing: border-box; | |
8 | + /* display: flex; | |
9 | + flex-direction: column; | |
10 | + justify-content: space-between; */ | |
11 | + background-position: 50%; | |
12 | + background-repeat: no-repeat; | |
13 | + background-attachment: fixed; | |
14 | + background-size: 100% 100%; | |
15 | + position: relative; | |
16 | +} | |
17 | +.top{ | |
18 | + padding: 50rpx 0 0 40rpx; | |
19 | + | |
20 | + /* width: 100%; | |
21 | + height: 483rpx; | |
22 | + display: flex; | |
23 | + align-items: center; | |
24 | + justify-content: center; */ | |
25 | +} | |
26 | +.main{ | |
27 | + /* position: absolute; | |
28 | + left: 0; | |
29 | + top: 24.5%; */ | |
30 | + width: 670rpx; | |
31 | + margin: 100rpx auto 20rpx; | |
32 | + /* height: 200rpx; | |
33 | + background-color: red; */ | |
34 | + /* opacity: .5; */ | |
35 | + display: flex; | |
36 | + flex-direction: column; | |
37 | + align-items: center; | |
38 | + justify-content: center; | |
39 | + background-color: rgba(255, 255, 255, .5); | |
40 | + padding-bottom: 25.6rpx; | |
41 | + border-radius: 30rpx; | |
42 | + /* opacity: .5; */ | |
43 | + /* width: 100%; | |
44 | + flex: 1; | |
45 | + display: flex; | |
46 | + align-items: center; | |
47 | + justify-content: center; | |
48 | + | |
49 | + background-color: darkmagenta; */ | |
50 | +} | |
51 | +.main .imageBox{ | |
52 | + width: 100%; | |
53 | + height: 344.4rpx; | |
54 | + position: relative; | |
55 | + /* background-color: royalblue; */ | |
56 | +} | |
57 | +.main .imageBox image{ | |
58 | + position: absolute; | |
59 | + top: -140rpx; | |
60 | + left: 0; | |
61 | + right: 0; | |
62 | + margin: auto; | |
63 | +} | |
64 | +.main_title{ | |
65 | + margin: 25rpx 0; | |
66 | + | |
67 | +} | |
68 | +.main .main_title , .main .but{ | |
69 | + background-position: 50%; | |
70 | + background-repeat: no-repeat; | |
71 | + background-attachment: fixed; | |
72 | + background-size: 100% 100%; | |
73 | + position: relative; | |
74 | + border: 1rpx solid rgb(194, 194, 194); | |
75 | + border-radius: 5rpx; | |
76 | + overflow: hidden; | |
77 | + text-align: center; | |
78 | + line-height: 80rpx; | |
79 | +} | |
80 | +.but{ | |
81 | + font-weight: bold; | |
82 | +} | |
83 | +.bottom{ | |
84 | + width: 670rpx; | |
85 | + margin: 0 auto; | |
86 | + /* position: absolute; | |
87 | + left: 0; | |
88 | + bottom: 5%; */ | |
89 | + background-color: rgba(255, 255, 255, .5); | |
90 | + padding: 50rpx 0; | |
91 | + border-radius: 30rpx; | |
92 | + display: flex; | |
93 | + align-items: center; | |
94 | + justify-content: center; | |
95 | +} | |
96 | + | ... | ... |
pages/cart/cart/cart.js
... | ... | @@ -319,6 +319,7 @@ Page({ |
319 | 319 | }, 800) |
320 | 320 | } |
321 | 321 | }, |
322 | + | |
322 | 323 | //失效单选 |
323 | 324 | inCheck_th_item: async function (e) { |
324 | 325 | console.log('失效单选'); |
... | ... | @@ -336,6 +337,8 @@ Page({ |
336 | 337 | // this.doCheckAll(); |
337 | 338 | |
338 | 339 | }, |
340 | + | |
341 | + | |
339 | 342 | //清空失效宝贝 |
340 | 343 | delInva_all(obj = null) { |
341 | 344 | |
... | ... | @@ -3317,7 +3320,25 @@ Page({ |
3317 | 3320 | var steep = getApp().get_limit_qty(i_arr[j], act.length, 1); |
3318 | 3321 | var py_type = parseInt(i_arr[j].prom_type + ''); |
3319 | 3322 | |
3323 | + //商品只查一次。看一下有没有 | |
3324 | + var gd = null; | |
3325 | + //获取商品信息,包含线下商品ID,指定门店销售的信息 | |
3326 | + await getApp().request.promiseGet("/api/weshop/goods/get/" + oo.stoid + "/" + i_arr[j].goods_id, {}).then(res => { | |
3327 | + if (res.data.code == 0) gd = res.data.data; | |
3328 | + }) | |
3329 | + | |
3320 | 3330 | if ([0, 3, 5, 7, 10].indexOf(py_type) > -1) { |
3331 | + //如果是指定门店,就要判断 | |
3332 | + if(gd.pick_group_ids){ | |
3333 | + var idx0=gd.pick_up_lists.findIndex(function (e){ | |
3334 | + return e.pickup_id==i_arr[j].pick_id; | |
3335 | + }) | |
3336 | + if(idx0<0){ | |
3337 | + getApp().confirmBox(i_arr[j].goods_name + "的门店不可售"); | |
3338 | + wx.hideLoading(); | |
3339 | + return false; | |
3340 | + } | |
3341 | + } | |
3321 | 3342 | |
3322 | 3343 | if (mo_num > i_arr[j].goods_num) { |
3323 | 3344 | getApp().confirmBox(i_arr[j].goods_name + "的未达到起订数量"); |
... | ... | @@ -3342,16 +3363,12 @@ Page({ |
3342 | 3363 | |
3343 | 3364 | } |
3344 | 3365 | |
3345 | - | |
3346 | 3366 | //--普通商品,如果有开启线下库存的功能,要调用线下库存进行计算,赠品不要进行调用线下库存--- |
3347 | 3367 | if ((i_arr[j].prom_type == 0 || i_arr[j].prom_type == 3 || i_arr[j].prom_type == 5 || i_arr[j].prom_type == 7 || i_arr[j].prom_type == 10 || |
3348 | 3368 | i_arr[j].need_downlow_num) && th.data.sales_rules >= 2 && i_arr[j].is_gift != 1 && !i_arr[j].whsle_id) { |
3349 | - //--获取商品的线下商品ID-- | |
3350 | 3369 | |
3351 | - var gd = null; | |
3352 | - await getApp().request.promiseGet("/api/weshop/goods/get/" + oo.stoid + "/" + i_arr[j].goods_id, {}).then(res => { | |
3353 | - if (res.data.code == 0) gd = res.data.data; | |
3354 | - }) | |
3370 | + | |
3371 | + | |
3355 | 3372 | |
3356 | 3373 | //--判断商品是线下库存-- |
3357 | 3374 | var ob = {} | ... | ... |
pages/goods/goodsInfo/buy_com_pop.wxml
... | ... | @@ -57,6 +57,7 @@ |
57 | 57 | <view wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">(库存不足)</view> |
58 | 58 | <block wx:else> |
59 | 59 | <view class="no_store" wx:if="{{def_pick_store.is_no_dis}}">(配送不匹配)</view> |
60 | + <view class="no_store" wx:elif="{{def_pick_store.is_no_dis_nor && is_normal}}">(该店不可售)</view> | |
60 | 61 | <view wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && !filters.is_virtual_gd(sele_g.is_virtual) && sales_rules>=2}}"> |
61 | 62 | (库存不足) |
62 | 63 | </view> |
... | ... | @@ -112,6 +113,12 @@ |
112 | 113 | 配送不匹配 |
113 | 114 | </view> |
114 | 115 | </block> |
116 | + <block wx:elif="{{def_pick_store && def_pick_store.is_no_dis_nor && is_normal}}"> | |
117 | + <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;"> | |
118 | + 该店不可售 | |
119 | + </view> | |
120 | + </block> | |
121 | + | |
115 | 122 | <block wx:else> |
116 | 123 | <!-- 根本就找不到门店 --> |
117 | 124 | <block wx:if="{{!only_pk && !def_pickpu_list}}"> | ... | ... |
pages/goods/goodsInfo/buy_pt.wxml
... | ... | @@ -47,7 +47,7 @@ |
47 | 47 | |
48 | 48 | <view style="clear: both"></view> |
49 | 49 | <view style="margin-top: 20rpx"> |
50 | - <view class="flex-space-between address ai_end xc-width "> | |
50 | + <view class="flex-space-between address ai_end xc-width "> | |
51 | 51 | |
52 | 52 | <view class="flex" wx:if="{{def_pick_store && def_pick_store.pickup_name}}"> |
53 | 53 | <text class="fs30 xc-black3 shop_name {{def_pick_store.distance!=null?'max':''}} ">{{def_pick_store.pickup_name}}</text> |
... | ... | @@ -65,17 +65,19 @@ |
65 | 65 | |
66 | 66 | <view hidden="{{has_def && sys_switch.is_pricing_open_store}}" class="red-co fs28" bindtap="choice_store" >更多门店<text class="right-arrow"></text></view> |
67 | 67 | </view> |
68 | - <view class="no_store" wx:if="{{def_pick_store.is_no_dis}}">(配送不匹配)</view> | |
68 | +<!-- <view class="no_store" wx:if="{{def_pick_store.is_no_dis}}">(配送不匹配)</view>--> | |
69 | +<!-- <view class="no_store" wx:elif="{{def_pick_store.is_no_dis_nor && is_normal==1}}">(配送不匹配)</view>--> | |
69 | 70 | <view wx:if="{{only_pk && !only_pk.length}}">(库存不足)</view> |
70 | 71 | <block wx:else> |
71 | 72 | <view wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">(库存不足)</view> |
72 | 73 | <block wx:else> |
73 | 74 | <view class="no_store" wx:if="{{def_pick_store.is_no_dis}}">(配送不匹配)</view> |
75 | + <view class="no_store" wx:elif="{{def_pick_store.is_no_dis_nor && is_normal}}">(该店不可售)</view> | |
74 | 76 | <view wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && !filters.is_virtual_gd(sele_g.is_virtual) && sales_rules>=2 && is_normal}}">(库存不足)</view> |
75 | 77 | </block> |
76 | 78 | </block> |
77 | 79 | |
78 | - <view class="fs24 xc-ash-9f xc-distance-top "wx:if="{{def_pick_store && def_pick_store.pickup_name}}">地址:{{def_pick_store.fulladdress}}</view> | |
80 | + <view class="fs24 xc-ash-9f xc-distance-top "wx:if="{{def_pick_store && def_pick_store.pickup_name}}">地址:{{def_pick_store.fulladdress}}</view> | |
79 | 81 | </view> |
80 | 82 | <!----商品的属性项目----> |
81 | 83 | <view> |
... | ... | @@ -157,6 +159,11 @@ |
157 | 159 | <block wx:if="{{def_pick_store && def_pick_store.is_no_dis}}"> |
158 | 160 | <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;">配送不匹配</view> |
159 | 161 | </block> |
162 | + | |
163 | + <block wx:elif="{{def_pick_store && def_pick_store.is_no_dis_nor}}"> | |
164 | + <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;">该店不可售</view> | |
165 | + </block> | |
166 | + | |
160 | 167 | <block wx:else> |
161 | 168 | |
162 | 169 | <!-- 根本就找不到门店 --> | ... | ... |
pages/goods/goodsInfo/goodsInfo.js
... | ... | @@ -273,6 +273,7 @@ Page({ |
273 | 273 | cx_prom_group: [], //促销活动,用于显示和判断默认要用什么促销活动 |
274 | 274 | showFold:true, |
275 | 275 | new_share_imgurl:'', //普通商品分享图片 |
276 | + | |
276 | 277 | }, |
277 | 278 | |
278 | 279 | //------初始化加载---------- |
... | ... | @@ -298,7 +299,6 @@ Page({ |
298 | 299 | getApp().globalData.groupchat_id = t.groupchat_id |
299 | 300 | } |
300 | 301 | |
301 | - | |
302 | 302 | self = this; |
303 | 303 | //检查测肤 |
304 | 304 | getApp().check_skin_face(t, 0, gid); |
... | ... | @@ -847,17 +847,29 @@ Page({ |
847 | 847 | }); |
848 | 848 | |
849 | 849 | var ee = JSON.parse(JSON.stringify(e)); |
850 | - //--定时器推迟一下-- | |
851 | - setTimeout(function () { | |
852 | - if (th.data.fir_goods) var g_distr_type = th.data.fir_goods.distr_type; | |
853 | - //--如果默认门店的配送方式不对,就不能被选择,这里不控制,如果不一样,就说明配送方式不对-- | |
854 | - if (ee.distr_type != 0 && g_distr_type != 0 && ee.distr_type != g_distr_type) { | |
855 | - ee.is_no_dis = 1; | |
856 | - } | |
857 | 850 | |
851 | + //--定时器推迟一下-- | |
858 | 852 | var appd = getApp().globalData; |
859 | 853 | var w_time = setInterval(function () { |
860 | 854 | if (that.data.is_get_local_ok == 0) return false; |
855 | + if (!that.data.sele_g) return false; | |
856 | + | |
857 | + if (th.data.fir_goods) var g_distr_type = th.data.fir_goods.distr_type; | |
858 | + //--如果默认门店的配送方式不对,就不能被选择,这里不控制,如果不一样,就说明配送方式不对-- | |
859 | + if (ee.distr_type != 0 && g_distr_type != 0 && ee.distr_type != g_distr_type) { | |
860 | + ee.is_no_dis = 1; | |
861 | + } | |
862 | + | |
863 | + //-- 如果有指定门店的时候,pickup_ids是经过判断是不是普通商品后才会有的 -- | |
864 | + if(th.data.sele_g && th.data.sele_g.pickup_ids && th.data.prom_type==0){ | |
865 | + var idx=th.data.sele_g.pickup_ids.findIndex(function (e){ | |
866 | + return e.pickup_id==ee.pickup_id; | |
867 | + }) | |
868 | + if(idx<0){ | |
869 | + ee.is_no_dis_nor=1; | |
870 | + } | |
871 | + } | |
872 | + | |
861 | 873 | clearInterval(w_time); |
862 | 874 | var distance = null; |
863 | 875 | var e = JSON.parse(JSON.stringify(ee)); |
... | ... | @@ -900,8 +912,8 @@ Page({ |
900 | 912 | that.set_def_storage(e); |
901 | 913 | } |
902 | 914 | } |
903 | - }, 500) | |
904 | - }, 700) | |
915 | + }, 200) | |
916 | + | |
905 | 917 | }); |
906 | 918 | }, |
907 | 919 | |
... | ... | @@ -1103,6 +1115,11 @@ Page({ |
1103 | 1115 | //if (ee.data.prom_type) { |
1104 | 1116 | t.data.data.prom_type = ee.data.prom_type; |
1105 | 1117 | t.data.data.prom_id = ee.data.prom_id; |
1118 | + | |
1119 | + //只有是普通商品的时候,才要给商品赋值指定门店 | |
1120 | + if ([1, 2, 4, 6, 8, 9].indexOf(parseInt(ee.data.prom_type))<0 && t.data.data.pick_up_lists && t.data.data.pick_up_lists.length) { | |
1121 | + t.data.data.pickup_ids = t.data.data.pick_up_lists; | |
1122 | + } | |
1106 | 1123 | //} |
1107 | 1124 | ee.setData({ |
1108 | 1125 | data: t.data.data, |
... | ... | @@ -1110,12 +1127,8 @@ Page({ |
1110 | 1127 | userInfo: getApp().globalData.userInfo |
1111 | 1128 | }); |
1112 | 1129 | |
1113 | - | |
1114 | - | |
1115 | - | |
1116 | 1130 | //获取统一条形码,普通商品和优惠促销的商品 |
1117 | 1131 | if (ee.data.data.prom_type == 0 || ee.data.data.prom_type == 3 || ee.data.data.prom_type == 5 || ee.data.data.prom_type == 7 || ee.data.data.prom_type == 9 || ee.data.data.prom_type == 10) { |
1118 | - | |
1119 | 1132 | ee.get_sto(); |
1120 | 1133 | ee.get_sku(o.stoid, t.data.data, gid); |
1121 | 1134 | ee.check_has_flash(); |
... | ... | @@ -3052,8 +3065,31 @@ Page({ |
3052 | 3065 | for (var i = 0; i < arrdata.length; i++) { |
3053 | 3066 | var goodsinfo = arrdata[i], |
3054 | 3067 | prom = null; |
3068 | + | |
3055 | 3069 | if (goodsinfo.goods_id != g_id) { |
3056 | 3070 | |
3071 | + | |
3072 | + //要判断一下商品的活动是不是多活动,确定一下商品的prom_type | |
3073 | + var url = '/api/weshop/activitylist/listGoodActInfo2New'; | |
3074 | + var req_d = { | |
3075 | + "store_id": os.stoid, | |
3076 | + "goods_id": goodsinfo.goods_id, | |
3077 | + "user_id": getApp().globalData.user_id, | |
3078 | + } | |
3079 | + var ck_res=await getApp().request.promiseGet("/api/weshop/activitylist/listGoodActInfo2New", { data:req_d }); | |
3080 | + if (ck_res.data.code == 0 && ck_res.data.data && ck_res.data.data.length > 0) { | |
3081 | + var arr = ck_res.data.data; | |
3082 | + //-- 预热也要计算 -- | |
3083 | + var arr2 = arr.filter(function (e) { | |
3084 | + return e.s_time < ut.gettimestamp() || (e.warm_uptime && e.warm_uptime < ut.gettimestamp()) | |
3085 | + }) | |
3086 | + | |
3087 | + if (arr2.length == 1) { | |
3088 | + goodsinfo.prom_type = arr2[0].prom_type; | |
3089 | + goodsinfo.prom_id = arr2[0].act_id; | |
3090 | + } | |
3091 | + } | |
3092 | + | |
3057 | 3093 | switch (goodsinfo.prom_type) { |
3058 | 3094 | case 1: |
3059 | 3095 | |
... | ... | @@ -3088,20 +3124,36 @@ Page({ |
3088 | 3124 | continue; |
3089 | 3125 | } |
3090 | 3126 | |
3127 | + }else{ | |
3128 | + | |
3129 | + //只有是普通商品的时候,才要给商品赋值指定门店 | |
3130 | + if ([1, 2, 4, 6, 8, 9].indexOf(parseInt(this.data.prom_type)) <0 || is_normal) { | |
3131 | + //如果商品有设置分组 | |
3132 | + if(goodsinfo.pick_group_ids){ | |
3133 | + goodsinfo.pickup_ids = goodsinfo.pick_up_lists; | |
3134 | + } | |
3135 | + } | |
3136 | + | |
3091 | 3137 | } |
3092 | 3138 | //---如果有活动,不算在一起--- |
3093 | 3139 | if (prom) { |
3094 | - if (goodsinfo.prom_type == 1 || goodsinfo.prom_type == 6) { | |
3140 | + if ([1,2,4,6].indexOf(parseInt(goodsinfo.prom_type))>-1) { | |
3095 | 3141 | console.log(prom); |
3096 | - if (prom.is_end == 0 && prom.end_time > now && prom.start_time < now) continue; | |
3142 | + if (prom.is_end == 0 && prom.end_time > now && (prom.start_time < now || (prom.show_time && prom.show_time < now ) ) ) continue; | |
3097 | 3143 | } else { |
3098 | 3144 | continue; |
3099 | 3145 | } |
3100 | 3146 | } |
3147 | + var item = arrdata[i],gg = ""; | |
3148 | + | |
3149 | + if (goodsinfo.goods_id != g_id) { | |
3150 | + //-- 如果商品有设置分组 -- | |
3151 | + if(item.pick_group_ids){ | |
3152 | + item.pickup_ids = item.pick_up_lists; | |
3153 | + } | |
3154 | + } | |
3101 | 3155 | |
3102 | 3156 | |
3103 | - var item = arrdata[i], | |
3104 | - gg = ""; | |
3105 | 3157 | if (item.goods_spec == "null" || item.goods_spec == null) item.goods_spec = ""; |
3106 | 3158 | if (item.goods_color == "null" || item.goods_color == null) item.goods_color = ""; |
3107 | 3159 | |
... | ... | @@ -3145,8 +3197,19 @@ Page({ |
3145 | 3197 | |
3146 | 3198 | //-----------选择属性的按钮事件---------- |
3147 | 3199 | sele_spec: function (e) { |
3200 | + | |
3148 | 3201 | var that = this; |
3149 | 3202 | var th = this; |
3203 | + | |
3204 | + //在切换规格的时候,指定门店不匹配的状态要清理 | |
3205 | + if (th.data.def_pick_store && JSON.stringify(th.data.def_pick_store) != '{}'){ | |
3206 | + th.data.def_pick_store.is_no_dis_nor=0; | |
3207 | + that.setData({ | |
3208 | + def_pick_store: th.data.def_pick_store | |
3209 | + }) | |
3210 | + } | |
3211 | + | |
3212 | + | |
3150 | 3213 | var gid = e.currentTarget.dataset.gid; |
3151 | 3214 | var nor = e.currentTarget.dataset.nor; |
3152 | 3215 | var user_id = getApp().globalData.user_id; |
... | ... | @@ -3157,6 +3220,11 @@ Page({ |
3157 | 3220 | if (nor) this.data.base_nor = nor; |
3158 | 3221 | } |
3159 | 3222 | |
3223 | + //要把不匹配还原 | |
3224 | + if (th.data.def_pick_store && JSON.stringify(th.data.def_pick_store) != '{}'){ | |
3225 | + th.data.def_pick_store.is_no_dis=0; | |
3226 | + th.setData({def_pick_store:th.data.def_pick_store}) | |
3227 | + } | |
3160 | 3228 | |
3161 | 3229 | //普通商品多规格的时候,商品切换 |
3162 | 3230 | if (this.data.base_nor_prom_type) this.data.base_nor_prom_type = parseInt(this.data.base_nor_prom_type); |
... | ... | @@ -3214,7 +3282,10 @@ Page({ |
3214 | 3282 | |
3215 | 3283 | |
3216 | 3284 | |
3217 | - if (nor) that.get_sto(1); | |
3285 | + if (nor) { | |
3286 | + that.set_sele_g(sku_g) | |
3287 | + that.get_sto(1); | |
3288 | + } | |
3218 | 3289 | else that.get_sto(); |
3219 | 3290 | |
3220 | 3291 | |
... | ... | @@ -3349,13 +3420,17 @@ Page({ |
3349 | 3420 | prom = res.data.data; |
3350 | 3421 | } |
3351 | 3422 | }) |
3352 | - let times = new Date().getTime() | |
3353 | - prom.show_time_off = "" | |
3354 | - let atimes = prom.start_time * 1000 | |
3355 | 3423 | |
3356 | - if (atimes > times) { | |
3357 | - prom.show_time_off = ut.formatTime(prom.start_time) | |
3424 | + if(prom){ | |
3425 | + let times = new Date().getTime() | |
3426 | + prom.show_time_off = "" | |
3427 | + let atimes = prom.start_time * 1000 | |
3428 | + | |
3429 | + if (atimes > times) { | |
3430 | + prom.show_time_off = ut.formatTime(prom.start_time) | |
3431 | + } | |
3358 | 3432 | } |
3433 | + | |
3359 | 3434 | } |
3360 | 3435 | console.log('活动详情------------'); |
3361 | 3436 | console.log(prom); |
... | ... | @@ -3427,7 +3502,6 @@ Page({ |
3427 | 3502 | }, |
3428 | 3503 | |
3429 | 3504 | |
3430 | - | |
3431 | 3505 | //---------拿出门店分类和门店------------ |
3432 | 3506 | get_sto(e) { |
3433 | 3507 | console.log('get_sto') |
... | ... | @@ -3447,6 +3521,8 @@ Page({ |
3447 | 3521 | |
3448 | 3522 | var timer_get = setInterval(function () { |
3449 | 3523 | if (th.data.is_get_local_ok == 0) return false; |
3524 | + if (!th.data.fir_def_store) return false; | |
3525 | + | |
3450 | 3526 | var dd = null, |
3451 | 3527 | i = getApp().request; |
3452 | 3528 | if (!th.data.sele_g) return false; |
... | ... | @@ -3473,10 +3549,8 @@ Page({ |
3473 | 3549 | dd.lat = th.data.lat; |
3474 | 3550 | dd.lon = th.data.lon; |
3475 | 3551 | } |
3476 | - clearInterval(timer_get); | |
3477 | - | |
3478 | - | |
3479 | 3552 | |
3553 | + clearInterval(timer_get); | |
3480 | 3554 | |
3481 | 3555 | //如果会员是有默认的门店话 |
3482 | 3556 | if (!th.data.def_pick_store && th.data.fir_def_store && Object.keys(th.data.fir_def_store).length > 0) { |
... | ... | @@ -3495,6 +3569,42 @@ Page({ |
3495 | 3569 | |
3496 | 3570 | if (e.data.code == 0 && e.data.data && e.data.data.pageData && e.data.data.pageData.length > 0) { |
3497 | 3571 | |
3572 | + //-- 如果有指定门店的时候 -- | |
3573 | + if(th.data.sele_g.pickup_ids){ | |
3574 | + | |
3575 | + var ok_arr=[]; | |
3576 | + for (let i in e.data.data.pageData) { | |
3577 | + let ite = e.data.data.pageData[i]; | |
3578 | + //-- 查找一下门店有没有在 -- | |
3579 | + var idx=th.data.sele_g.pickup_ids.findIndex(function (e){ | |
3580 | + return e.pickup_id==ite.pickup_id; | |
3581 | + }) | |
3582 | + if(idx>-1){ | |
3583 | + ok_arr.push(ite) | |
3584 | + } | |
3585 | + } | |
3586 | + | |
3587 | + //判断会员的默认的门店是不是匹配指定的门店 | |
3588 | + if (th.data.def_pick_store && JSON.stringify(th.data.def_pick_store) != '{}'){ | |
3589 | + | |
3590 | + //-- 查找一下门店有没有在 -- | |
3591 | + var idx1=th.data.sele_g.pickup_ids.findIndex(function (e){ | |
3592 | + return e.pickup_id==th.data.def_pick_store.pickup_id; | |
3593 | + }) | |
3594 | + | |
3595 | + if(idx1<0){ | |
3596 | + th.data.def_pick_store.is_no_dis_nor=1; | |
3597 | + that.setData({ | |
3598 | + def_pick_store: th.data.def_pick_store | |
3599 | + }) | |
3600 | + } | |
3601 | + } | |
3602 | + | |
3603 | + | |
3604 | + e.data.data.pageData=ok_arr; //数组重新赋值 | |
3605 | + e.data.data.total=ok_arr.length; //数组的长度 | |
3606 | + } | |
3607 | + | |
3498 | 3608 | var his_cate_num = 0; |
3499 | 3609 | for (let i in e.data.data.pageData) { |
3500 | 3610 | let item = e.data.data.pageData[i]; |
... | ... | @@ -3543,7 +3653,8 @@ Page({ |
3543 | 3653 | }); |
3544 | 3654 | |
3545 | 3655 | //--获取线下库存,而且不是新的门店规则, 同时是普通购买的时候,或者同时不能是活动,秒杀,拼团,积分购-- |
3546 | - if (!getApp().is_virtual(th.data.sele_g) && th.data.sales_rules >= 2 && !th.data.is_newsales_rules && !th.data.sele_g.whsle_id && ([1, 2, 4, 6, 8, 9].indexOf(th.data.prom_type) == -1 || is_normal == 1)) { | |
3656 | + if (!getApp().is_virtual(th.data.sele_g) && th.data.sales_rules >= 2 && !th.data.is_newsales_rules | |
3657 | + && !th.data.sele_g.whsle_id && ([1, 2, 4, 6, 8, 9].indexOf(th.data.prom_type) == -1 || is_normal == 1)) { | |
3547 | 3658 | setTimeout(function () { |
3548 | 3659 | th.deal_pickup_dline(e); |
3549 | 3660 | }, 800) |
... | ... | @@ -3925,6 +4036,7 @@ Page({ |
3925 | 4036 | |
3926 | 4037 | var def_pick_store = th.data.def_pick_store; |
3927 | 4038 | var plist = res.data.data.pageData; |
4039 | + | |
3928 | 4040 | if (th.data.sales_rules == 3) { |
3929 | 4041 | var lock_num = 0; |
3930 | 4042 | var Qty = 0; |
... | ... | @@ -3947,6 +4059,14 @@ Page({ |
3947 | 4059 | is_find_def_store = 1; |
3948 | 4060 | } |
3949 | 4061 | |
4062 | + //-- 如果库存为0就要重新赋值 -- | |
4063 | + def_pick_store.CanOutQty=Qty; | |
4064 | + th.setData({ | |
4065 | + def_pick_store | |
4066 | + }) | |
4067 | + | |
4068 | + | |
4069 | + | |
3950 | 4070 | } else { |
3951 | 4071 | th.setData({ |
3952 | 4072 | all_sto: null, |
... | ... | @@ -3972,6 +4092,13 @@ Page({ |
3972 | 4092 | if (n_item.CanOutQty > lock_num) { |
3973 | 4093 | o_plist[kk].CanOutQty = n_item.CanOutQty - lock_num; |
3974 | 4094 | new_list.push(o_plist[kk]); |
4095 | + | |
4096 | + var ck_store=th.data.fir_def_store; | |
4097 | + if (th.data.def_pick_store && JSON.stringify(th.data.def_pick_store) != '{}'){ | |
4098 | + ck_store=th.data.def_pick_store; | |
4099 | + } | |
4100 | + | |
4101 | + | |
3975 | 4102 | //--如果找到默认门店,同时也应该判断配送方式对不对-- |
3976 | 4103 | if (th.data.fir_def_store && n_item.StorageNo == th.data.fir_def_store.pickup_no && (g_distr_type == 0 || th.data.fir_def_store.distr_type == 0 || th.data.def_pick_store.distr_type == g_distr_type)) { |
3977 | 4104 | th.data.fir_def_store.CanOutQty = n_item.CanOutQty - lock_num; |
... | ... | @@ -3981,6 +4108,13 @@ Page({ |
3981 | 4108 | }) |
3982 | 4109 | is_find_def_store = 1; |
3983 | 4110 | } |
4111 | + | |
4112 | + //-- 如果库存为0就要重新赋值 -- | |
4113 | + if(n_item.StorageNo ==def_pick_store.pickup_no) { | |
4114 | + def_pick_store.CanOutQty= o_plist[kk].CanOutQty; | |
4115 | + th.setData({ def_pick_store }) | |
4116 | + } | |
4117 | + | |
3984 | 4118 | } |
3985 | 4119 | break; |
3986 | 4120 | } |
... | ... | @@ -4932,7 +5066,7 @@ Page({ |
4932 | 5066 | }, |
4933 | 5067 | |
4934 | 5068 | //--点击弹起拼单-- |
4935 | - openSpecModel_pt: function (e) { | |
5069 | + openSpecModel_pt:function (e) { | |
4936 | 5070 | |
4937 | 5071 | this.setData({ |
4938 | 5072 | open_ind_store: 4, |
... | ... | @@ -4959,19 +5093,29 @@ Page({ |
4959 | 5093 | |
4960 | 5094 | //如果拼单的sku data是空的,就要先获取一下 |
4961 | 5095 | if (th.data.sku_g_pt) { |
5096 | + | |
5097 | + //要同步指定门店 | |
5098 | + th.set_sele_g(th.data.sku_g_pt); | |
5099 | + | |
4962 | 5100 | th.get_sto(1); |
4963 | 5101 | th.setData({ |
4964 | 5102 | is_normal: ind, |
4965 | 5103 | openSpecModal_pt: 1, |
4966 | 5104 | }); |
4967 | 5105 | } else { |
4968 | - th.get_sto(1); | |
5106 | + | |
4969 | 5107 | th.get_sku(o.stoid, th.data.data, th.data.gid, 1, function () { |
5108 | + | |
5109 | + th.get_sto(1); | |
5110 | + | |
4970 | 5111 | th.setData({ |
4971 | 5112 | is_normal: ind, |
4972 | 5113 | openSpecModal_pt: 1, |
4973 | 5114 | }); |
4974 | 5115 | }); |
5116 | + | |
5117 | + | |
5118 | + | |
4975 | 5119 | } |
4976 | 5120 | if (!th.data.sele_g.whsle_id) th.check_is_youhui(th.data.gid, 1); |
4977 | 5121 | } else { |
... | ... | @@ -7811,18 +7955,25 @@ Page({ |
7811 | 7955 | }, |
7812 | 7956 | |
7813 | 7957 | //-- 积分购普通购买 -- |
7814 | - go_pay_integral_normal: function () { | |
7958 | + go_pay_integral_normal:async function () { | |
7815 | 7959 | |
7816 | 7960 | this.data.g_buy_num = new Map(); |
7817 | 7961 | var th = this; |
7818 | 7962 | if (th.data.sku_g_pt) { |
7963 | + | |
7964 | + //要同步指定门店 | |
7965 | + th.set_sele_g(th.data.sku_g_pt); | |
7966 | + | |
7819 | 7967 | this.get_sto(1) |
7820 | 7968 | this.setData({ |
7821 | 7969 | openSpecModal_inte_normal: 1 |
7822 | 7970 | }); |
7823 | 7971 | } else { |
7824 | - th.get_sto(1); | |
7972 | + | |
7825 | 7973 | th.get_sku(o.stoid, th.data.data, th.data.gid, 1, function () { |
7974 | + | |
7975 | + th.get_sto(1); | |
7976 | + | |
7826 | 7977 | th.setData({ |
7827 | 7978 | is_normal: 1, |
7828 | 7979 | openSpecModal_inte_normal: 1 |
... | ... | @@ -8450,6 +8601,17 @@ Page({ |
8450 | 8601 | switch_cx_group: function () { |
8451 | 8602 | var pro_pop = this.selectComponent("#pro_pop"); //组件的id |
8452 | 8603 | pro_pop.set_init(0, this.data.cx_prom_group); |
8604 | + }, | |
8605 | + | |
8606 | + //要同步sele_g的指定门店,在有单独购买的时候,积分购和拼团 | |
8607 | + set_sele_g:function (sku_list){ | |
8608 | + var goods_id=this.data.sele_g.goods_id; | |
8609 | + for (var i in sku_list) { | |
8610 | + if(goods_id==sku_list[i].goods_id){ | |
8611 | + this.data.sele_g.pickup_ids=sku_list[i].pickup_ids; | |
8612 | + break; | |
8613 | + } | |
8614 | + } | |
8453 | 8615 | } |
8454 | 8616 | |
8455 | 8617 | ... | ... |
pages/goods/goodsInfo/goodsInfo.wxml
... | ... | @@ -709,6 +709,9 @@ |
709 | 709 | <view class="no_store" wx:if="{{def_pick_store && def_pick_store.is_no_dis}}"> |
710 | 710 | (配送不匹配) |
711 | 711 | </view> |
712 | + <view class="no_store" wx:elif="{{def_pick_store && def_pick_store.is_no_dis_nor && prom_type==0}}"> | |
713 | + (该店不可售) | |
714 | + </view> | |
712 | 715 | <view class="no_store" wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && sales_rules>=2 && prom_type==0 && !sele_g.whsle_id}}"> |
713 | 716 | (库存不足) |
714 | 717 | </view> |
... | ... | @@ -1322,6 +1325,7 @@ |
1322 | 1325 | <view wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">(库存不足)</view> |
1323 | 1326 | <block wx:else> |
1324 | 1327 | <view class="no_store" wx:if="{{def_pick_store.is_no_dis}}">(配送不匹配)</view> |
1328 | + <view class="no_store" wx:elif="{{def_pick_store.is_no_dis_nor}}">(该店不可售)</view> | |
1325 | 1329 | <view wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && !filters.is_virtual_gd(sele_g.is_virtual) && sales_rules>=2 && prom_type==0 &&!sele_g.whsle_id }}"> |
1326 | 1330 | (库存不足) |
1327 | 1331 | </view> |
... | ... | @@ -1378,6 +1382,9 @@ |
1378 | 1382 | <view wx:if="{{def_pick_store && def_pick_store.is_no_dis}}" class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;"> |
1379 | 1383 | 配送不匹配 |
1380 | 1384 | </view> |
1385 | + <view wx:elif="{{def_pick_store && def_pick_store.is_no_dis_nor}}" class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;"> | |
1386 | + 该店不可售 | |
1387 | + </view> | |
1381 | 1388 | <block wx:else> |
1382 | 1389 | <!-- 根本就找不到门店 --> |
1383 | 1390 | <block wx:if="{{!only_pk && !def_pickpu_list}}"> |
... | ... | @@ -1632,6 +1639,8 @@ |
1632 | 1639 | <view class="flex xc-ash"> |
1633 | 1640 | <view class="fs30 xc-black3 address_name">{{item.pickup_name}} |
1634 | 1641 | <text class="c-red22" wx:if="{{item.is_no_qyt}}">(库存不足)</text> |
1642 | + <text class="c-red22" wx:elif="{{item.is_no_dis}}">(配送不匹配)</text> | |
1643 | + <text class="c-red22" wx:elif="{{item.is_no_dis_nor}}">(该店不可售)</text> | |
1635 | 1644 | </view> |
1636 | 1645 | </view> |
1637 | 1646 | <view> |
... | ... | @@ -1659,7 +1668,9 @@ |
1659 | 1668 | <view class="flex-vertical-between "> |
1660 | 1669 | <view class="flex xc-ash"> |
1661 | 1670 | <view class="fs30 xc-black3 address_name">{{item.pickup_name}} |
1662 | - <text class="c-red22" wx:if="{{item.is_no_qyt }}">(库存不足)</text> | |
1671 | + <text class="c-red22" wx:if="{{item.is_no_dis}}">(配送不匹配)</text> | |
1672 | + <text class="c-red22" wx:elif="{{item.is_no_dis_nor}}">(该店不可售)</text> | |
1673 | + <text class="c-red22" wx:elif="{{item.is_no_qyt }}">(库存不足)</text> | |
1663 | 1674 | </view> |
1664 | 1675 | </view> |
1665 | 1676 | <view> | ... | ... |
pages/index/index/index.json
... | ... | @@ -9,7 +9,7 @@ |
9 | 9 | "searchbox":"/components/diy_searchbox/diy_searchbox", |
10 | 10 | "shopname": "/components/diy_shopname/diy_shopname", |
11 | 11 | "pingd_buy": "/components/diy_pingd_buy/diy_pingd_buy", |
12 | - "div_public": "/components/diy_public/diy_public", | |
12 | + "diy_public": "/components/diy_public/diy_public", | |
13 | 13 | "title": "/components/diy_title/diy_title", |
14 | 14 | "notice": "/components/diy_notice/diy_notice", |
15 | 15 | "voice": "/components/diy_voice/diy_voice", | ... | ... |
pages/index/index/index.wxml
... | ... | @@ -481,7 +481,7 @@ |
481 | 481 | <pingd_buy object="{{item.content}}"></pingd_buy> |
482 | 482 | </block> |
483 | 483 | <block wx:if="{{item.ename=='pingd_buyNew'}}"> |
484 | - <div_public object="{{item.content}}" prom_type="6"></div_public> | |
484 | + <diy_public object="{{item.content}}" prom_type="6"></diy_public> | |
485 | 485 | </block> |
486 | 486 | <!--秒杀--> |
487 | 487 | <block wx:if="{{item.ename=='seckill' || item.ename=='seckillNew'}}"> |
... | ... | @@ -520,6 +520,9 @@ |
520 | 520 | <block wx:if="{{item.ename=='groupbuy'}}"> |
521 | 521 | <groupbuy object="{{item.content}}"></groupbuy> |
522 | 522 | </block> |
523 | + <block wx:if="{{item.ename=='groupbuyNew'}}"> | |
524 | + <diy_public object="{{item.content}}" prom_type="2"></diy_public> | |
525 | + </block> | |
523 | 526 | <!-- 幸运购 --> |
524 | 527 | <block wx:if="{{item.ename=='luckyactivity'}}"> |
525 | 528 | <luckyGo object="{{item.content}}"></luckyGo> | ... | ... |
pages/template/index.wxml
... | ... | @@ -52,7 +52,7 @@ |
52 | 52 | <block wx:if="{{item.ename=='white'}}"> |
53 | 53 | <assist object="{{item.content}}"></assist> |
54 | 54 | </block> |
55 | - <!--图片组合--> | |
55 | + <!--图片组合--> | |
56 | 56 | <block wx:if="{{item.ename=='picMix'}}"> |
57 | 57 | <picMax object="{{item.content}}"></picMax> |
58 | 58 | </block> |
... | ... | @@ -73,7 +73,9 @@ |
73 | 73 | <block wx:if="{{item.ename=='groupbuy'}}"> |
74 | 74 | <groupbuy object="{{item.content}}"></groupbuy> |
75 | 75 | </block> |
76 | - | |
76 | + <block wx:if="{{item.ename=='groupbuyNew'}}"> | |
77 | + <diy_public object="{{item.content}}" prom_type="2"></diy_public> | |
78 | + </block> | |
77 | 79 | </view> |
78 | 80 | </block> |
79 | 81 | </view> | ... | ... |
pages/user/order_detail/order_detail.js
... | ... | @@ -24,12 +24,11 @@ Page({ |
24 | 24 | |
25 | 25 | getApp().getConfig2(function (e) { |
26 | 26 | |
27 | - | |
28 | 27 | th.setData({conf: e,sales_rules:e.sales_rules, userInfo: getApp().globalData.userInfo}); |
29 | 28 | //--- 看后台是不是有开通等级卡 --- |
30 | 29 | if(e.switch_list){ |
31 | 30 | var s_list=JSON.parse(e.switch_list); |
32 | - th.setData({sys_switch: s_list,appoint_pick_keyid:s_list.appoint_pick_keyid}); | |
31 | + th.setData({sys_switch: s_list,appoint_pick_keyid:s_list.appoint_pick_keyid}); | |
33 | 32 | var is_open_offline=s_list.is_pricing_open; |
34 | 33 | var user=getApp().globalData.userInfo; |
35 | 34 | //如果后台有开启等级价的功能 |
... | ... | @@ -450,6 +449,18 @@ Page({ |
450 | 449 | gg = res.data.data; |
451 | 450 | }) |
452 | 451 | |
452 | + //-- 要进行判断指定门店的判断优化,先做普通商品 -- | |
453 | + if([0,3,5,7,10].indexOf(parseInt(good.prom_type))>-1 && gg.pick_group_ids){ | |
454 | + var idx0=gg.pick_up_lists.findIndex(function (e){ | |
455 | + return e.pickup_id==order.pickup_id; | |
456 | + }) | |
457 | + if(idx0<0){ | |
458 | + getApp().confirmBox(gg.goods_name + "的门店不可售"); | |
459 | + th.setData({ paying: 0 }); | |
460 | + return false; | |
461 | + } | |
462 | + } | |
463 | + | |
453 | 464 | var limit = gg.viplimited; |
454 | 465 | var store_count = gg.store_count; |
455 | 466 | good.erpwareid = gg.erpwareid; | ... | ... |
pages/user/order_list/order_list.js
... | ... | @@ -745,7 +745,6 @@ Page({ |
745 | 745 | for (var i in order_goods) { |
746 | 746 | var good = order_goods[i]; |
747 | 747 | |
748 | - | |
749 | 748 | //线下取价功能已经关闭或者过期 |
750 | 749 | if (!th.data.is_open_offline && good.offline_cut > 0) { |
751 | 750 | wx.showModal({ |
... | ... | @@ -764,6 +763,18 @@ Page({ |
764 | 763 | gg = res.data.data; |
765 | 764 | }) |
766 | 765 | |
766 | + //-- 要进行判断指定门店的判断优化,先做普通商品 -- | |
767 | + if([0,3,5,7,10].indexOf(parseInt(good.prom_type))>-1 && gg.pick_group_ids){ | |
768 | + var idx0=gg.pick_up_lists.findIndex(function (e){ | |
769 | + return e.pickup_id==order.pickup_id; | |
770 | + }) | |
771 | + if(idx0<0){ | |
772 | + getApp().confirmBox(gg.goods_name + "的门店不可售"); | |
773 | + th.setData({ paying: 0 }); | |
774 | + return false; | |
775 | + } | |
776 | + } | |
777 | + | |
767 | 778 | var limit = gg.viplimited; |
768 | 779 | var store_count = gg.store_count; |
769 | 780 | good.erpwareid = gg.erpwareid; | ... | ... |
pages/user/return_goods_info/return_goods_info.js
... | ... | @@ -11,6 +11,7 @@ Page({ |
11 | 11 | resourceUrl: r.imghost, |
12 | 12 | return_goods: null, |
13 | 13 | goods: null, |
14 | + loading:0, //是不是在处理中,避免重复点击 | |
14 | 15 | }, |
15 | 16 | onLoad: function(e) { |
16 | 17 | if (e.order_id!=undefined){ |
... | ... | @@ -130,8 +131,14 @@ Page({ |
130 | 131 | }); |
131 | 132 | }, |
132 | 133 | cancelReturn: function() { |
134 | + | |
135 | + | |
133 | 136 | var e = this, |
134 | - id = this.data.return_goods.id; | |
137 | + id = this.data.return_goods.id; | |
138 | + | |
139 | + if(this.data.loading) return false; | |
140 | + this.data.loading=1; | |
141 | + | |
135 | 142 | wx.showModal({ |
136 | 143 | title: "确定取消售后服务?", |
137 | 144 | success: function(r) { |
... | ... | @@ -143,14 +150,18 @@ Page({ |
143 | 150 | remark:'客户取消' |
144 | 151 | }, |
145 | 152 | success: function(r) { |
153 | + | |
146 | 154 | if(r.data.code==0){ |
147 | 155 | getApp().showWarning('取消成功'); |
148 | 156 | setTimeout(function(){ |
149 | 157 | wx.setStorageSync("user:return_goods_list:update", !0), e.requestReturnGoods(id); |
150 | 158 | },1000) |
151 | - } | |
152 | - | |
153 | - | |
159 | + }else{ | |
160 | + | |
161 | + e.data.loading=0; | |
162 | + s.m_toast(r.data.msg); | |
163 | + } | |
164 | + | |
154 | 165 | } |
155 | 166 | }); |
156 | 167 | } | ... | ... |