Commit ed6b3d6a2fb55763f26ccffb241289251a4b6172
1 parent
56d99bb7
幸运大转盘
Showing
11 changed files
with
451 additions
and
57 deletions
components/my-qrcode/my-qrcode.js
0 → 100644
1 | +// pages/user/yhq/qr_code/qr_code.js | |
2 | +const { | |
3 | + barcode, | |
4 | + qrcode | |
5 | +} = require('../../utils/index.js') | |
6 | + | |
7 | +Component({ | |
8 | + data: { | |
9 | + q_show:0, | |
10 | + object:null, | |
11 | + index:0, | |
12 | + is_fw:0, | |
13 | + | |
14 | + barcode_canvas:null, | |
15 | + qrcode_canvas:null, | |
16 | + }, | |
17 | + properties: { | |
18 | + // 这里定义了innerText属性,属性值可以在组件使用时指定 | |
19 | + }, | |
20 | + ready: function () { | |
21 | + }, | |
22 | + | |
23 | + methods: { | |
24 | + //关闭 | |
25 | + close: function (e) { | |
26 | + this.setData({q_show: 0,barcode_canvas:null,qrcode_canvas:null }); | |
27 | + this.triggerEvent('close',{},{bubbles: true}); | |
28 | + }, | |
29 | + | |
30 | + //打开 | |
31 | + open:function (e) { | |
32 | + this.data.index++; | |
33 | + var list=[{index:this.data.index }]; | |
34 | + | |
35 | + this.setData({q_show: 1,object:e,barcode_canvas:list,qrcode_canvas:list,is_fw:e.is_fw }); | |
36 | + var val=e.val; | |
37 | + | |
38 | + // barcode('barcode'+this.data.index,val, 620, 160,this); | |
39 | + qrcode('qrcode'+this.data.index, val, 520, 520,this); | |
40 | + } | |
41 | + }, | |
42 | + | |
43 | + | |
44 | + | |
45 | + | |
46 | +}) | |
0 | 47 | \ No newline at end of file | ... | ... |
components/my-qrcode/my-qrcode.json
0 → 100644
components/my-qrcode/my-qrcode.wxml
0 → 100644
1 | +<view class="xc-pop-up" wx:if="{{q_show}}" catchtouchmove='true'> | |
2 | + <view class="shut"><text class="iconfont icon-close" bindtap="close"></text></view> | |
3 | + <view class="barqrcode"> | |
4 | + <canvas class="qrcode" canvas-id="qrcode{{item.index}}" wx:for="{{barcode_canvas}}"/> | |
5 | + <view class="q_code fs28">兑换码:{{object.val}}</view> | |
6 | + <view class="c-9 pdt10">请向店员出示二维码核销兑换</view> | |
7 | + <!-- <view class="c-9 fs28">有效期:{{object.now}} 至 {{object.validay}}</view> --> | |
8 | + </view> | |
9 | +</view> | |
10 | + | ... | ... |
components/my-qrcode/my-qrcode.wxss
0 → 100644
1 | +@import '../../app.wxss'; | |
2 | + | |
3 | +.xc-pop-up{ | |
4 | + position:fixed; | |
5 | + z-index:5; | |
6 | + top: 50%; | |
7 | + left: 50%; | |
8 | + transform: translate(-50%, -50%); | |
9 | +} | |
10 | + | |
11 | + | |
12 | +.xc-obscuration{ | |
13 | + position: fixed; | |
14 | + left: 0; | |
15 | + top: 0; | |
16 | + right: 0; | |
17 | + bottom: 0; | |
18 | + z-index: 11; | |
19 | + background: rgba(0,0,0,0.4); | |
20 | + width: 100%; | |
21 | + height: 100%; | |
22 | + | |
23 | + | |
24 | + | |
25 | +} | |
26 | + | |
27 | + /* Y */ | |
28 | +.xc-qr-frame{ | |
29 | + /* width:90%; | |
30 | + min-height: 696rpx; | |
31 | + background: #fff; | |
32 | + z-index: 55; | |
33 | + position: fixed; | |
34 | + top:180rpx; */ | |
35 | + /* height: auto; */ | |
36 | + /* padding-bottom:20rpx; */ | |
37 | + /* left:35rpx; */ | |
38 | + /* overflow: hidden; | |
39 | + border-radius: 16rpx; */ | |
40 | +} | |
41 | + | |
42 | +/* 二维码和条形码的边框Y */ | |
43 | +.barqrcode{ | |
44 | + background-color: white; | |
45 | + border-radius: 16rpx; | |
46 | + padding: 0 40rpx 40rpx; | |
47 | + text-align: center; | |
48 | +} | |
49 | +/* 点击条形Y */ | |
50 | +.barcode { | |
51 | + /* background-color: white; | |
52 | + border-radius: 12rpx; */ | |
53 | +} | |
54 | +canvas{ | |
55 | + width:100%; | |
56 | + height:55px; | |
57 | +display:block; | |
58 | + | |
59 | +} | |
60 | +.q_code{ | |
61 | + color: #333; | |
62 | +} | |
63 | + | |
64 | + | |
65 | +/* 二维码边框Y*/ | |
66 | +.qrcode_rim { | |
67 | + width: 550rpx; | |
68 | + height:544rpx; | |
69 | +display:flex; | |
70 | +flex-direction:column; | |
71 | +position: absolute; | |
72 | +left: 75rpx; | |
73 | +top: 5rpx; | |
74 | + | |
75 | +} | |
76 | +.qrcode{ | |
77 | + width: 520rpx; | |
78 | + height: 520rpx; | |
79 | +} | |
80 | +.r-code{ | |
81 | + /* font-size:28rpx; | |
82 | + padding-left: 25rpx; */ | |
83 | + /* margin-top: -5.5rpx; */ | |
84 | + | |
85 | +} | |
86 | + | |
87 | +.shut{ | |
88 | + color: white; | |
89 | + text-align: right; | |
90 | + padding-bottom: 30rpx; | |
91 | + position: relative; | |
92 | +} | |
93 | + | |
94 | + | |
95 | +.icon-close { | |
96 | + font-size: 48rpx; | |
97 | +} | |
98 | + | |
99 | +.shut::after { | |
100 | + content: ''; | |
101 | + width: 2rpx; | |
102 | + height: 32rpx; | |
103 | + background-color: white; | |
104 | + position: absolute; | |
105 | + bottom: 0; | |
106 | + right: 24rpx; | |
107 | +} | |
108 | + | |
109 | +.mt{ margin-top:130rpx} | |
110 | +.mts{ margin-top:70rpx} | |
111 | +.flex{ | |
112 | + display: flex; | |
113 | + justify-content:center; | |
114 | +} | |
115 | + | |
116 | +.code_show{ | |
117 | + text-align: center;position: relative; left: -20rpx; | |
118 | +} | |
119 | + | |
120 | +.c-9 { | |
121 | + color: #999; | |
122 | +} | |
0 | 123 | \ No newline at end of file | ... | ... |
packageB/pages/luckactivity/index/g_filter.wxs
0 → 100644
1 | +var g_filters = { | |
2 | + has_char:function(url,key){ | |
3 | + if(!url) return -1; | |
4 | + return url.indexOf(key); | |
5 | + }, | |
6 | + beg_time:function(beg_date){ | |
7 | + var fmt1 = beg_date.substring(0, 19); | |
8 | + var reg = getRegExp("-", "g"); | |
9 | + var fmt2 = fmt1.replace(reg, '/'); | |
10 | + var t1 = getDate(fmt2); | |
11 | + var tnow=getDate(); | |
12 | + if(t1<=tnow) return 1; | |
13 | + return 0; | |
14 | + }, | |
15 | + end_time:function(end_date){ | |
16 | + var fmt1 = end_date.substring(0, 19); | |
17 | + var reg = getRegExp("-", "g"); | |
18 | + var fmt2 = fmt1.replace(reg, '/'); | |
19 | + var t1 = getDate(fmt2); | |
20 | + var tnow=getDate(); | |
21 | + if(t1>=tnow) return 1; | |
22 | + return 0; | |
23 | + } | |
24 | +} | |
25 | +module.exports = { | |
26 | + has_char: g_filters.has_char, | |
27 | + beg_time: g_filters.beg_time, | |
28 | + end_time: g_filters.end_time, | |
29 | +} | |
0 | 30 | \ No newline at end of file | ... | ... |
packageB/pages/luckactivity/index/index.js
... | ... | @@ -93,8 +93,40 @@ Page({ |
93 | 93 | currentData: data, |
94 | 94 | }); |
95 | 95 | }); |
96 | + | |
97 | + // 获取广告 | |
98 | + app.request.promiseGet("/api/weshop/ad/page", { | |
99 | + data: { | |
100 | + pid: 1201, | |
101 | + store_id: app.globalData.setting.stoid, | |
102 | + enabled: 1 | |
103 | + } | |
104 | + }).then(res => { | |
105 | + if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length>0){ | |
106 | + var a = res.data.data.pageData; | |
107 | + var narr=[]; | |
108 | + for(var i in a){ | |
109 | + var tt = { | |
110 | + 'ad_code': os.imghost + a[i].ad_code, | |
111 | + 'media_link': '', | |
112 | + 'ad_weapplink':a[i].ad_weapplink | |
113 | + }; | |
114 | + narr.push(tt); | |
115 | + } | |
116 | + | |
117 | + self.setData({ | |
118 | + ad_data: narr, | |
119 | + }); | |
120 | + } | |
121 | + }) | |
122 | + | |
123 | + | |
96 | 124 | }; |
97 | 125 | }; |
126 | + | |
127 | + | |
128 | + | |
129 | + | |
98 | 130 | }, |
99 | 131 | |
100 | 132 | /** | ... | ... |
packageB/pages/luckactivity/index/index.wxml
1 | 1 | <wxs module="filter" src="../../../../utils/filter.wxs"></wxs> |
2 | +<wxs module="g_filter" src="g_filter.wxs"></wxs> | |
2 | 3 | <view> |
3 | - <!-- <view class="img-container"><image src="../../../images/luckDraw/weel.png" class="img" mode="aspectFit"></image></view> --> | |
4 | + <swiper class="swiper" circular="true" autoplay="true" indicator-dots="true" interval="2500" wx:if="{{ad_data}}"> | |
5 | + <block wx:for="{{ad_data}}"> | |
6 | + <swiper-item> | |
7 | + <!-- <navigator url="{{item.ad_weapplink}}" class="s1_gk_a1" wx:if="{{g_filter.has_char(item.ad_weapplink,'plugin')>=0}}"> --> | |
8 | + <navigator url="{{item.ad_weapplink}}" style="height: 100%;" hover-class="none" open-type="reLaunch"> | |
9 | + <image src="{{item.ad_code}}" class="img" bindload="imageLoad" data-index="{{index}}" mode="aspectFit" lazy-load="true"/> | |
10 | + </navigator> | |
11 | + </swiper-item> | |
12 | + </block> | |
13 | + </swiper> | |
4 | 14 | <view class="tab-title" bindtap="clickTab"> |
5 | 15 | <view class="tab-title-item {{currentIndex == index ? 'active':''}}" wx:for="{{tabArr}}" data-index="{{index}}">{{item}}</view> |
6 | 16 | </view> |
7 | 17 | <view class="tab-content"> |
8 | 18 | |
9 | - | |
10 | - <view class="tab-item" wx:for="{{list.pageData}}"> | |
11 | - <text class="iconfont icon-zhuanpan"></text> | |
12 | - <view class="desc-container"> | |
13 | - <view class=""> | |
14 | - <!-- 标题 --> | |
15 | - <view class="ellipsis-1x taj">{{item.act_name}}</view> | |
16 | - <!-- 时间 --> | |
17 | - <view class="date pdt10 pdb20" wx:if="{{currentIndex == 0}}">活动时间:{{filter.format_time(item.begindate) + ' 至 ' + filter.format_time(item.enddate)}}</view> | |
18 | - <view class="date pdt10 pdb20" wx:else>兑换时间:{{filter.format_time(item.begindate) + ' 至 ' + filter.format_time(item.enddate)}}</view> | |
19 | - </view> | |
20 | - <!-- 按钮 --> | |
21 | - <view class="btn-container"> | |
22 | - <view bindtap="goto" data-id="{{item.id}}" data-title="{{item.act_name}}" class="btn red" wx:if="{{currentIndex == 0}}">立即参与</view> | |
23 | - <view bindtap="goto" data-id="{{item.id}}" data-title="{{item.act_name}}" class="btn red" wx:else>去兑换</view> | |
19 | + <block wx:for="{{list.pageData}}"> | |
20 | + <view class="tab-item" bindtap="goto" data-id="{{item.id}}" data-title="{{item.act_name}}"> | |
21 | + <text class="iconfont icon-zhuanpan"></text> | |
22 | + <view class="desc-container"> | |
23 | + <view class=""> | |
24 | + <!-- 标题 --> | |
25 | + <view class="ellipsis-1x taj">{{item.act_name}}</view> | |
26 | + <!-- 时间 --> | |
27 | + <view class="date pdt10 pdb20" wx:if="{{currentIndex == 0}}">活动时间:{{filter.format_time(item.begindate) + ' 至 ' + filter.format_time(item.enddate)}}</view> | |
28 | + <view class="date pdt10 pdb20" wx:else>兑换时间:{{filter.format_time(item.begindate) + ' 至 ' + filter.format_time(item.enddate)}}</view> | |
29 | + </view> | |
30 | + <!-- 按钮 --> | |
31 | + <view class="btn-container"> | |
32 | + <view class="btn red" wx:if="{{currentIndex == 0}}">立即参与</view> | |
33 | + <view class="btn red" wx:else>去兑换</view> | |
34 | + </view> | |
24 | 35 | </view> |
25 | 36 | </view> |
26 | - </view> | |
37 | + </block> | |
38 | + | |
27 | 39 | |
28 | 40 | |
29 | 41 | <nodata nodataContainer="t-c" wx:if="{{list.pageData.length == 0}}"></nodata> | ... | ... |
packageB/pages/luckactivity/luckinfo/luckinfo.js
1 | 1 | const app = getApp(); |
2 | +const imghost = app.globalData.setting.imghost; | |
2 | 3 | let self = null; |
3 | 4 | |
4 | 5 | Page({ |
... | ... | @@ -13,7 +14,7 @@ Page({ |
13 | 14 | { fonts: [{ text: '积分', top: '18%', wordWrap:false, fontColor: 'transparent'}], |
14 | 15 | imgs: [ |
15 | 16 | { |
16 | - src: '../../../images/luckDraw/jf.png', | |
17 | + src: '', | |
17 | 18 | width: '135rpx', |
18 | 19 | height: '107rpx', |
19 | 20 | top: '15%', |
... | ... | @@ -23,7 +24,7 @@ Page({ |
23 | 24 | { fonts: [{ text: '优惠券', top: '18%', wordWrap:false, fontColor: 'transparent'}], |
24 | 25 | imgs: [ |
25 | 26 | { |
26 | - src: '../../../images/luckDraw/yhq.png', | |
27 | + src: '', | |
27 | 28 | width: '135rpx', |
28 | 29 | height: '107rpx', |
29 | 30 | top: '15%', |
... | ... | @@ -33,7 +34,7 @@ Page({ |
33 | 34 | { fonts: [{ text: '美容', top: '18%', wordWrap:false, fontColor: 'transparent'}], |
34 | 35 | imgs: [ |
35 | 36 | { |
36 | - src: '../../../images/luckDraw/mr1.png', | |
37 | + src: '', | |
37 | 38 | width: '135rpx', |
38 | 39 | height: '107rpx', |
39 | 40 | top: '15%', |
... | ... | @@ -44,7 +45,7 @@ Page({ |
44 | 45 | { fonts: [{ text: '积分', top: '18%', wordWrap:false, fontColor: 'transparent'}], |
45 | 46 | imgs: [ |
46 | 47 | { |
47 | - src: '../../../images/luckDraw/jf.png', | |
48 | + src: '', | |
48 | 49 | width: '135rpx', |
49 | 50 | height: '107rpx', |
50 | 51 | top: '15%', |
... | ... | @@ -54,7 +55,7 @@ Page({ |
54 | 55 | { fonts: [{ text: '优惠券', top: '18%', wordWrap:false, fontColor: 'transparent'}], |
55 | 56 | imgs: [ |
56 | 57 | { |
57 | - src: '../../../images/luckDraw/yhq.png', | |
58 | + src: '', | |
58 | 59 | width: '135rpx', |
59 | 60 | height: '107rpx', |
60 | 61 | top: '15%', |
... | ... | @@ -64,7 +65,7 @@ Page({ |
64 | 65 | { fonts: [{ text: '美容', top: '18%', wordWrap:false, fontColor: 'transparent'}], |
65 | 66 | imgs: [ |
66 | 67 | { |
67 | - src: '../../../images/luckDraw/mr1.png', | |
68 | + src: '', | |
68 | 69 | width: '135rpx', |
69 | 70 | height: '107rpx', |
70 | 71 | top: '15%', |
... | ... | @@ -86,7 +87,7 @@ Page({ |
86 | 87 | padding: '76rpx', |
87 | 88 | // background: 'pink', |
88 | 89 | imgs: [{ |
89 | - src: 'http://201442.image.myqcloud.com/201442/0/1c825ca4-f155-453c-9f85-2cb0381824fe/original', | |
90 | + src: imghost + 'miniapp/images/luckDraw/weel.png', | |
90 | 91 | width: '700rpx', |
91 | 92 | height: '700rpx', |
92 | 93 | rotate: true, |
... | ... | @@ -106,7 +107,7 @@ Page({ |
106 | 107 | // background: 'black', |
107 | 108 | // pointer: true, |
108 | 109 | imgs: [{ |
109 | - src: 'http://201442.image.myqcloud.com/201442/0/b29290ec-aeb3-40e9-9444-8f15fd9acda3/original', | |
110 | + src: imghost + 'miniapp/images/luckDraw/pointer.png', | |
110 | 111 | width: '188rpx', |
111 | 112 | height: '230rpx', |
112 | 113 | top: '-130rpx', |
... | ... | @@ -116,15 +117,19 @@ Page({ |
116 | 117 | }, |
117 | 118 | |
118 | 119 | onLoad(options) { |
120 | + // console.log('imghost', imghost); | |
119 | 121 | self = this; |
120 | 122 | this.data.options = options; |
123 | + this.setData({ | |
124 | + imghost: imghost, | |
125 | + }); | |
121 | 126 | wx.setNavigationBarTitle({ |
122 | 127 | title: options.title, |
123 | 128 | }); |
124 | 129 | app.isLogin().then(function(data) {//进入页面前已经授权登录成功 |
125 | 130 | self.setData({ |
126 | 131 | userInfo: data, |
127 | - imghost: app.globalData.setting.imghost, | |
132 | + // imghost: app.globalData.setting.imghost, | |
128 | 133 | }); |
129 | 134 | }); |
130 | 135 | }, |
... | ... | @@ -135,11 +140,11 @@ Page({ |
135 | 140 | |
136 | 141 | this.setData({ |
137 | 142 | userInfo: app.globalData.userInfo, |
138 | - imghost: app.globalData.setting.imghost, | |
143 | + // imghost: app.globalData.setting.imghost, | |
139 | 144 | isLogin: true, |
140 | 145 | }); |
141 | 146 | |
142 | - console.log('imghost', this.data.imghost); | |
147 | + // console.log('imghost', this.data.imghost); | |
143 | 148 | let user_id = app.globalData.userInfo.user_id; |
144 | 149 | let store_id = app.globalData.setting.stoid; |
145 | 150 | let id = this.data.options.id; |
... | ... | @@ -160,14 +165,14 @@ Page({ |
160 | 165 | self.data.msg = res.data.msg; |
161 | 166 | }; |
162 | 167 | |
163 | - console.log('luckInfo', res.data.data); | |
168 | + // console.log('luckInfo', res.data.data); | |
164 | 169 | let luckInfo = res.data.data; |
165 | - let imghost = self.data.imghost; | |
166 | - if(luckInfo.template_type == 1) { //获取模板 | |
170 | + // let imghost = self.data.imghost; | |
171 | + if(luckInfo.template_type != null && luckInfo.template_type == 1) { //获取模板 | |
167 | 172 | let url = `/api/weshop/marketing/marketingLuckTemplate/get/${store_id}/${luckInfo.template_id}`; |
168 | 173 | app.request.get(url, { |
169 | 174 | success: function(res) { |
170 | - console.log('prizes//////', res.data.data); | |
175 | + // console.log('prizes//////', res.data.data); | |
171 | 176 | self.setData({ |
172 | 177 | template: res.data.data, |
173 | 178 | bannerUrl: imghost + res.data.data.bannerUrl, //背景图 |
... | ... | @@ -201,8 +206,46 @@ Page({ |
201 | 206 | self.prizeLayout(award); |
202 | 207 | |
203 | 208 | }, |
204 | - | |
205 | 209 | }); |
210 | + | |
211 | + | |
212 | + //获取兑奖记录 | |
213 | + app.request.get('/api/weshop/marketing/marketingLuckRecord/page', { | |
214 | + isShowLoading: false, | |
215 | + data: { | |
216 | + store_id: app.globalData.setting.stoid, | |
217 | + user_id: app.globalData.userInfo.user_id, | |
218 | + luck_formid: this.data.options.id, | |
219 | + luck_state: 1 | |
220 | + }, | |
221 | + success: function(res) { | |
222 | + if(res.data.code == 0) { | |
223 | + self.setData({ | |
224 | + record: res.data.data.pageData, | |
225 | + }); | |
226 | + }; | |
227 | + }, | |
228 | + }); | |
229 | + | |
230 | + | |
231 | + //获取中奖人员名单 | |
232 | + app.request.get('/api/weshop/marketing/marketingLuckRecord/page', { | |
233 | + isShowLoading: false, | |
234 | + data: { | |
235 | + store_id: app.globalData.setting.stoid, | |
236 | + luck_formid: this.data.options.id, | |
237 | + luck_state: 1, | |
238 | + pageSize: 20, | |
239 | + }, | |
240 | + success: function(res) { | |
241 | + if(res.data.code == 0) { | |
242 | + self.setData({ | |
243 | + nameList: res.data.data.pageData, | |
244 | + }); | |
245 | + }; | |
246 | + }, | |
247 | + }); | |
248 | + | |
206 | 249 | }; |
207 | 250 | }; |
208 | 251 | }, |
... | ... | @@ -211,12 +254,13 @@ Page({ |
211 | 254 | prizeLayout(award) { |
212 | 255 | let prizes = []; |
213 | 256 | let length = award.length; |
214 | - let thx = {fonts: [{ text: '谢谢\n参与', top: '18%', wordWrap:false, fontColor: 'rgba(0,0,0,.5)'}]}; | |
257 | + let thx = {fonts: [{ text: '谢谢\n参与', top: '18%', wordWrap:false, fontColor: 'rgba(255,255,255,.8)'}]}; | |
215 | 258 | |
216 | 259 | if(length == 1) { |
217 | 260 | [0,2,4,6].map(function(item, index) { |
218 | 261 | prizes[item] = { |
219 | 262 | id: award[0].id, |
263 | + lbtype: award[0].lbtype, | |
220 | 264 | fonts: [{ text: award[0].luck_goods_name + ' x' + award[0].num, top: '18%', wordWrap:false, fontColor: 'transparent'}], |
221 | 265 | imgs: [ |
222 | 266 | { |
... | ... | @@ -240,6 +284,7 @@ Page({ |
240 | 284 | [0,4].map(function(item, index) { |
241 | 285 | prizes[item] = { |
242 | 286 | id: award[0].id, |
287 | + lbtype: award[0].lbtype, | |
243 | 288 | fonts: [{ text: award[0].luck_goods_name + ' x' + award[0].num, top: '18%', wordWrap:false, fontColor: 'transparent'}], |
244 | 289 | imgs: [ |
245 | 290 | { |
... | ... | @@ -255,6 +300,7 @@ Page({ |
255 | 300 | [2,6].map(function(item, index) { |
256 | 301 | prizes[item] = { |
257 | 302 | id: award[1].id, |
303 | + lbtype: award[1].lbtype, | |
258 | 304 | fonts: [{ text: award[1].luck_goods_name + ' x' + award[1].num, top: '18%', wordWrap:false, fontColor: 'transparent'}], |
259 | 305 | imgs: [ |
260 | 306 | { |
... | ... | @@ -278,6 +324,7 @@ Page({ |
278 | 324 | [0,4].map(function(item, index) { |
279 | 325 | prizes[item] = { |
280 | 326 | id: award[0].id, |
327 | + lbtype: award[0].lbtype, | |
281 | 328 | fonts: [{ text: award[0].luck_goods_name + ' x' + award[0].num, top: '18%', wordWrap:false, fontColor: 'transparent'}], |
282 | 329 | imgs: [ |
283 | 330 | { |
... | ... | @@ -293,6 +340,7 @@ Page({ |
293 | 340 | [1,5].map(function(item, index) { |
294 | 341 | prizes[item] = { |
295 | 342 | id: award[1].id, |
343 | + lbtype: award[1].lbtype, | |
296 | 344 | fonts: [{ text: award[1].luck_goods_name + ' x' + award[1].num, top: '18%', wordWrap:false, fontColor: 'transparent'}], |
297 | 345 | imgs: [ |
298 | 346 | { |
... | ... | @@ -308,6 +356,7 @@ Page({ |
308 | 356 | [2,6].map(function(item, index) { |
309 | 357 | prizes[item] = { |
310 | 358 | id: award[2].id, |
359 | + lbtype: award[2].lbtype, | |
311 | 360 | fonts: [{ text: award[2].luck_goods_name + ' x' + award[2].num, top: '18%', wordWrap:false, fontColor: 'transparent'}], |
312 | 361 | imgs: [ |
313 | 362 | { |
... | ... | @@ -332,6 +381,7 @@ Page({ |
332 | 381 | [0,2,4,6].map(function(item, index) { |
333 | 382 | prizes[item] = { |
334 | 383 | id: award[index].id, |
384 | + lbtype: award[index].lbtype, | |
335 | 385 | fonts: [{ text: award[index].luck_goods_name + ' x' + award[index].num, top: '18%', wordWrap:false, fontColor: 'transparent'}], |
336 | 386 | imgs: [ |
337 | 387 | { |
... | ... | @@ -355,6 +405,7 @@ Page({ |
355 | 405 | [0,2,3,5,6].map(function(item, index) { |
356 | 406 | prizes[item] = { |
357 | 407 | id: award[index].id, |
408 | + lbtype: award[index].lbtype, | |
358 | 409 | fonts: [{ text: award[index].luck_goods_name + ' x' + award[index].num, top: '18%', wordWrap:false, fontColor: 'transparent'}], |
359 | 410 | imgs: [ |
360 | 411 | { |
... | ... | @@ -378,6 +429,7 @@ Page({ |
378 | 429 | prizes = award.map(function(item, index) { |
379 | 430 | return { |
380 | 431 | id: item.id, |
432 | + lbtype: item.lbtype, | |
381 | 433 | fonts: [{ text: item.luck_goods_name + ' x' + item.num, top: '18%', wordWrap:false, fontColor: 'transparent'}], |
382 | 434 | imgs: [ |
383 | 435 | { |
... | ... | @@ -396,7 +448,7 @@ Page({ |
396 | 448 | this.data.thxIndexArr = [3,7]; |
397 | 449 | }; |
398 | 450 | |
399 | - console.log('prizes', prizes); | |
451 | + // console.log('prizes', prizes); | |
400 | 452 | |
401 | 453 | this.setData({ |
402 | 454 | prizes, |
... | ... | @@ -406,7 +458,7 @@ Page({ |
406 | 458 | // 根据lbtype指定奖品类别图标 |
407 | 459 | prizeSrc(lbtype) { |
408 | 460 | let src = ''; |
409 | - let imghost = this.data.imghost; | |
461 | + // let imghost = this.data.imghost; | |
410 | 462 | switch(lbtype) { |
411 | 463 | case 1: { //积分 |
412 | 464 | src = imghost + 'miniapp/images/luckDraw/jf.png'; |
... | ... | @@ -488,8 +540,8 @@ Page({ |
488 | 540 | }, |
489 | 541 | success: function(res) { |
490 | 542 | |
491 | - // console.log('开始摇奖', res.data.data.id, res.data.data); | |
492 | 543 | if(res.data.code == 0) { |
544 | + console.log('开始摇奖', res.data.data); | |
493 | 545 | self.setData({ |
494 | 546 | 'luckInfo.user_LuckNumDay': self.data.luckInfo.user_LuckNumDay - 1 |
495 | 547 | }); |
... | ... | @@ -509,7 +561,7 @@ Page({ |
509 | 561 | |
510 | 562 | |
511 | 563 | } else { |
512 | - console.log('请求出错'); | |
564 | + // console.log('请求出错'); | |
513 | 565 | let thxIndexArr = self.data.thxIndexArr; |
514 | 566 | const random = Math.random() * thxIndexArr.length >> 0; |
515 | 567 | const index = thxIndexArr[random]; |
... | ... | @@ -523,8 +575,7 @@ Page({ |
523 | 575 | }, |
524 | 576 | |
525 | 577 | fail: function() { |
526 | - | |
527 | - console.log('出错'); | |
578 | + // console.log('出错'); | |
528 | 579 | let thxIndexArr = self.data.thxIndexArr; |
529 | 580 | const random = Math.random() * thxIndexArr.length >> 0; |
530 | 581 | const index = thxIndexArr[random]; |
... | ... | @@ -549,13 +600,20 @@ Page({ |
549 | 600 | }, |
550 | 601 | end (event) { |
551 | 602 | // 中奖奖品详情 |
552 | - // console.log('zjiangla~~',event.detail.fonts[0].text.replace('\n','')); | |
603 | + // console.log('zjiangla~~',event.detail.lbtype); | |
604 | + let lbtype; | |
553 | 605 | let resultTitle = event.detail.fonts[0].text.replace('\n',''); |
606 | + if(event.detail.lbtype == 5) { | |
607 | + lbtype = 5; | |
608 | + } else { | |
609 | + lbtype = -1; | |
610 | + }; | |
554 | 611 | this.setData({ |
555 | 612 | hiddenCanvas: true, |
556 | 613 | showResult: true, |
557 | 614 | showMask: true, |
558 | - resultTitle, | |
615 | + resultTitle, | |
616 | + currentLbtype: lbtype, | |
559 | 617 | }); |
560 | 618 | }, |
561 | 619 | |
... | ... | @@ -737,6 +795,7 @@ Page({ |
737 | 795 | success: function(res) { |
738 | 796 | if(res.data.code == 0) { |
739 | 797 | let data = res.data.data; |
798 | + console.log('data!!!!', data); | |
740 | 799 | let barcode = self.selectComponent("#qrcode"); |
741 | 800 | barcode.open({val: data}); |
742 | 801 | self.setData({ |
... | ... | @@ -749,10 +808,17 @@ Page({ |
749 | 808 | }); |
750 | 809 | }, |
751 | 810 | |
752 | - closeCode() { | |
811 | + closeQr() { | |
753 | 812 | this.setData({ |
754 | 813 | hiddenCanvas: false, |
755 | 814 | showMask: false, |
756 | 815 | }); |
757 | 816 | }, |
817 | + | |
818 | + clickReceive() { | |
819 | + this.setData({ | |
820 | + showResult: false, | |
821 | + }); | |
822 | + this.showPopup(); | |
823 | + }, | |
758 | 824 | }) |
759 | 825 | \ No newline at end of file | ... | ... |
packageB/pages/luckactivity/luckinfo/luckinfo.json
packageB/pages/luckactivity/luckinfo/luckinfo.wxml
... | ... | @@ -2,6 +2,22 @@ |
2 | 2 | <wxs module="tool" src="./tool.wxs"></wxs> |
3 | 3 | <view class="luck-container" style="background: {{template.colorCode}} url({{bannerUrl}}) no-repeat;"> |
4 | 4 | <!-- <view class="luck-container" style="background: url({{ bannerUrl}}) no-repeat;"> --> |
5 | + <!-- 中奖人员 --> | |
6 | + <view class="swiper-container" wx:if="{{nameList && nameList.length != 0}}"> | |
7 | + <swiper class="swiper" autoplay="true" circular="true" vertical="true" interval="1000"> | |
8 | + <swiper-item class="swiper-item" wx:for="{{nameList}}"> | |
9 | + <view class="item"> | |
10 | + <view class="avatar-container"> | |
11 | + <image src="{{item.head_pic}}" class="img-block"></image> | |
12 | + </view> | |
13 | + <view class="flex ai_c pdr10"> | |
14 | + <view class="nickname ellipsis-1x">{{item.nickname}}</view> | |
15 | + <view style="flex-shrink: 0;">获得了"{{item.luck_goods_name}}"</view> | |
16 | + </view> | |
17 | + </view> | |
18 | + </swiper-item> | |
19 | + </swiper> | |
20 | + </view> | |
5 | 21 | <!-- 大转盘 --> |
6 | 22 | <view class="weel-container"> |
7 | 23 | <view> |
... | ... | @@ -47,10 +63,10 @@ |
47 | 63 | </view> |
48 | 64 | </view> |
49 | 65 | <!-- 活动展示 --> |
50 | - <view wx:if="{{basic.remark}}"> | |
66 | + <view wx:if="{{luckInfo.remark}}"> | |
51 | 67 | <view class="badge-container"><image src="{{imghost + 'miniapp/images/luckDraw/badge.png'}}" class="badge activity"></image></view> |
52 | 68 | <view class="bg-white br12 pd20"> |
53 | - {{basic.remark}} | |
69 | + {{luckInfo.remark}} | |
54 | 70 | <!-- 时间 --> |
55 | 71 | <!-- <view class="bdb"> |
56 | 72 | <view class=""> |
... | ... | @@ -110,7 +126,7 @@ |
110 | 126 | </view> |
111 | 127 | |
112 | 128 | <!-- 悬浮按钮 --> |
113 | -<view class="gift-container" bindtap="showPopup"><text class="iconfont icon-liwu"></text></view> | |
129 | +<view class="gift-container {{record && record.length != 0 ? 'active':''}}" bindtap="showPopup"><text class="iconfont icon-liwu"></text></view> | |
114 | 130 | |
115 | 131 | <!-- 弹窗 --> |
116 | 132 | <view class="popup-container" wx:if="{{showPopup}}"> |
... | ... | @@ -143,17 +159,18 @@ |
143 | 159 | <view class="popup"> |
144 | 160 | <view class="t-c"> |
145 | 161 | <block wx:if="{{resultTitle == '谢谢参与'}}"> |
146 | - <view class="bold c-tb">{{resultTitle}}</view> | |
162 | + <view class="bold c-tb fs40">{{resultTitle}}</view> | |
163 | + <view class="pdt10">继续加油噢~</view> | |
147 | 164 | </block> |
148 | 165 | <block wx:else> |
149 | - <view class="bold c-tb">恭喜你获得</view> | |
166 | + <view class="bold c-tb fs40">恭喜你获得</view> | |
150 | 167 | <view class="pdt10">{{resultTitle}} </view> |
151 | 168 | </block> |
152 | 169 | </view> |
153 | 170 | <view class="img-container2"><image src="{{imghost + 'miniapp/images/luckDraw/gift.png'}}" class="img"></image></view> |
154 | - <!-- <view class="flex jc-center mgt30 mgb20"> | |
155 | - <view class="btn btn2" bindtap="closeResult">再抽一次</view> | |
156 | - </view> --> | |
171 | + <view class="pdt40" wx:if="{{currentLbtype == 5}}"> | |
172 | + <view class="btn btn2" bindtap="clickReceive">立即领取</view> | |
173 | + </view> | |
157 | 174 | <!-- <view class="note">注:未领取就关闭弹窗视为主动放弃奖品。</view> --> |
158 | 175 | </view> |
159 | 176 | </view> |
... | ... | @@ -162,4 +179,4 @@ |
162 | 179 | <!-- 遮罩层 --> |
163 | 180 | <view class="mask" wx:if="{{showMask}}"></view> |
164 | 181 | |
165 | -<qrcode id="qrcode" bindtap="closeCode"></qrcode> | |
166 | 182 | \ No newline at end of file |
183 | +<qrcode id="qrcode" bind:close="closeQr"></qrcode> | |
167 | 184 | \ No newline at end of file | ... | ... |
packageB/pages/luckactivity/luckinfo/luckinfo.wxss
... | ... | @@ -268,7 +268,8 @@ page, |
268 | 268 | font-size: 26rpx; |
269 | 269 | color: white; |
270 | 270 | background-color: #ff2d4b; |
271 | - padding: 10rpx 40rpx; | |
271 | + padding: 20rpx 40rpx; | |
272 | + text-align: center; | |
272 | 273 | } |
273 | 274 | |
274 | 275 | .close-container { |
... | ... | @@ -337,12 +338,13 @@ page, |
337 | 338 | left: 50%; |
338 | 339 | transform: translate(-50%, -50%); |
339 | 340 | z-index: 999; |
341 | + width: 85%; | |
340 | 342 | } |
341 | 343 | |
342 | 344 | .popup { |
343 | 345 | background-color: white; |
344 | 346 | border-radius: 12rpx; |
345 | - padding: 40rpx; | |
347 | + padding: 60rpx; | |
346 | 348 | margin-top: 20rpx; |
347 | 349 | } |
348 | 350 | |
... | ... | @@ -353,7 +355,7 @@ page, |
353 | 355 | .img-container2 { |
354 | 356 | width: 300rpx; |
355 | 357 | height: 200rpx; |
356 | - margin: 20rpx auto 0; | |
358 | + margin: 60rpx auto 0; | |
357 | 359 | } |
358 | 360 | |
359 | 361 | .note { |
... | ... | @@ -371,4 +373,58 @@ page, |
371 | 373 | color: #bbb; |
372 | 374 | text-align: center; |
373 | 375 | font-size: 22rpx; |
374 | -} | |
375 | 376 | \ No newline at end of file |
377 | +} | |
378 | + | |
379 | +.my-qrcode { | |
380 | + /* background-color: red; */ | |
381 | +} | |
382 | + | |
383 | +.swiper-container { | |
384 | + position: absolute; | |
385 | + top: 0; | |
386 | + left: 0; | |
387 | + padding: 20rpx 10rpx; | |
388 | + width: 100%; | |
389 | + box-sizing: border-box; | |
390 | +} | |
391 | + | |
392 | +.swiper { | |
393 | + height: 60rpx; | |
394 | + color: white; | |
395 | + font-size: 26rpx; | |
396 | +} | |
397 | + | |
398 | +.swiper-item { | |
399 | + /* width: auto !important; | |
400 | + background-color: rgba(0,0,0,.4); | |
401 | + border-radius: 60rpx; */ | |
402 | + position: relative; | |
403 | +} | |
404 | + | |
405 | +.item { | |
406 | + position: absolute; | |
407 | + display: flex; | |
408 | + align-items: center; | |
409 | + border-radius: 60rpx; | |
410 | + background-color: rgba(0,0,0,.4); | |
411 | +} | |
412 | + | |
413 | +.avatar-container { | |
414 | + width: 60rpx; | |
415 | + height: 60rpx; | |
416 | + border-radius: 50%; | |
417 | + overflow: hidden; | |
418 | + flex-shrink: 0; | |
419 | +} | |
420 | + | |
421 | +.img-block { | |
422 | + width: 100%; | |
423 | + height: 100%; | |
424 | + display: block; | |
425 | +} | |
426 | + | |
427 | +.nickname { | |
428 | + color: #FFE12F; | |
429 | + padding: 0 10rpx; | |
430 | +} | |
431 | + | ... | ... |