Showing
7 changed files
with
237 additions
and
7 deletions
1 | +// page/subPackage/pages/zeroSell/components/action-bar.js | ||
2 | + | ||
3 | +import ZeroSellService from '../../service/zero-sell'; | ||
4 | +import CommonService from '../../service/common'; | ||
5 | + | ||
6 | +const event = global.event; | ||
7 | + | ||
8 | +var app = getApp(); | ||
9 | + | ||
10 | +Component({ | ||
11 | + /** | ||
12 | + * 组件的属性列表 | ||
13 | + */ | ||
14 | + properties: { | ||
15 | + status: { | ||
16 | + type: Number, | ||
17 | + value: 1, | ||
18 | + }, | ||
19 | + num: { | ||
20 | + type: Number, | ||
21 | + value: 0, | ||
22 | + }, | ||
23 | + shareUid: { | ||
24 | + type: Number, | ||
25 | + value: 0, | ||
26 | + }, | ||
27 | + actPrizeId: { | ||
28 | + type: Number, | ||
29 | + value: 0, | ||
30 | + }, | ||
31 | + copyText: { | ||
32 | + type: String, | ||
33 | + value: '', | ||
34 | + }, | ||
35 | + text: { | ||
36 | + type: String, | ||
37 | + value: '', | ||
38 | + }, | ||
39 | + type: { | ||
40 | + type: Number, | ||
41 | + value: 0, | ||
42 | + }, | ||
43 | + }, | ||
44 | + | ||
45 | + /** | ||
46 | + * 组件的初始数据 | ||
47 | + */ | ||
48 | + data: { | ||
49 | + show: false, | ||
50 | + code: '', | ||
51 | + error: false, | ||
52 | + fellow: false, | ||
53 | + }, | ||
54 | + | ||
55 | + ready() { | ||
56 | + this.service = new ZeroSellService(); | ||
57 | + this.commonService = new CommonService(); | ||
58 | + }, | ||
59 | + | ||
60 | + /** | ||
61 | + * 组件的方法列表 | ||
62 | + */ | ||
63 | + methods: { | ||
64 | + fetchCode() { | ||
65 | + wx.showLoading({ | ||
66 | + mask: true, | ||
67 | + }); | ||
68 | + event.emit('user-is-login', { | ||
69 | + logged: this.logged.bind(this), | ||
70 | + loginSuccess: function() {}, | ||
71 | + }); | ||
72 | + }, | ||
73 | + logged(userInfo) { | ||
74 | + this.service | ||
75 | + .fetchCode({ | ||
76 | + shareUid: this.properties.shareUid, | ||
77 | + uid: app.getUid(), | ||
78 | + actPrizeId: this.properties.actPrizeId, | ||
79 | + userThumb: userInfo.avatarUrl, | ||
80 | + userName: userInfo.nickName, | ||
81 | + }) | ||
82 | + .then(result => { | ||
83 | + wx.hideLoading(); | ||
84 | + if (result.code === 200) { | ||
85 | + this.setData({ | ||
86 | + show: true, | ||
87 | + code: result.data.prizeCode, | ||
88 | + }); | ||
89 | + this.triggerEvent('gaincodesuccess', this.properties.actPrizeId); | ||
90 | + } else { | ||
91 | + this.setData({ | ||
92 | + error: true, | ||
93 | + errorText: result.message, | ||
94 | + }); | ||
95 | + } | ||
96 | + }); | ||
97 | + }, | ||
98 | + goShare() { | ||
99 | + this.triggerEvent('share'); | ||
100 | + this.setData({ | ||
101 | + show: false, | ||
102 | + error: false, | ||
103 | + fellow: false, | ||
104 | + }); | ||
105 | + }, | ||
106 | + | ||
107 | + hadJoinToShare() { | ||
108 | + this.goShare(); | ||
109 | + this.triggerEvent('getcode'); | ||
110 | + }, | ||
111 | + | ||
112 | + goMyList() { | ||
113 | + wx.reLaunch({ | ||
114 | + url: '/pages/zeroSell/index?tabIndex=3&reload=0', | ||
115 | + }); | ||
116 | + }, | ||
117 | + | ||
118 | + goList() { | ||
119 | + wx.navigateTo({ | ||
120 | + url: '/pages/zeroSell/index?reload=0', | ||
121 | + }); | ||
122 | + }, | ||
123 | + | ||
124 | + cancelFellow() { | ||
125 | + this.setData({ | ||
126 | + fellow: false, | ||
127 | + }); | ||
128 | + }, | ||
129 | + | ||
130 | + cancelAlert() { | ||
131 | + this.setData({ | ||
132 | + show: false, | ||
133 | + error: false, | ||
134 | + }); | ||
135 | + | ||
136 | + this.triggerEvent('getcode'); | ||
137 | + }, | ||
138 | + | ||
139 | + openFellowAlert() { | ||
140 | + this.setData({ | ||
141 | + fellow: true, | ||
142 | + }); | ||
143 | + }, | ||
144 | + | ||
145 | + hiddenAlert(e) { | ||
146 | + this.setData({ | ||
147 | + show: false, | ||
148 | + error: false, | ||
149 | + fellow: false, | ||
150 | + }); | ||
151 | + this.triggerEvent('getcode'); | ||
152 | + }, | ||
153 | + | ||
154 | + submitFormId(e) { | ||
155 | + return this.commonService.addWechatFormId({ | ||
156 | + formId: e.detail.formId, | ||
157 | + uid: app.getUid() || 0, | ||
158 | + openId: app.getOpenID() || '', | ||
159 | + miniapp_type: app.getMiniappType(), | ||
160 | + }); | ||
161 | + }, | ||
162 | + }, | ||
163 | +}); |
1 | +<!-- page/subPackage/pages/zeroSell/components/action-bar.wxml --> | ||
2 | +<view class="action-bar"> | ||
3 | + <block wx:if="{{status === 1}}"> | ||
4 | + <view class="action-item over">即将开始</view> | ||
5 | + </block> | ||
6 | + <block wx:elif="{{status === 2}}"> | ||
7 | + <form bindsubmit='submitFormId' report-submit='true' class="action-item"> | ||
8 | + <button class="action-item confirm" style="border-radius: unset;" form-type="submit" bindtap="fetchCode"> | ||
9 | + 参加抽奖 | ||
10 | + </button> | ||
11 | + </form> | ||
12 | + </block> | ||
13 | + <block wx:elif="{{status === 3}}"> | ||
14 | + <view class="action-item ok" bindtap="goShare">邀请好友参加,增加中奖率</view> | ||
15 | + </block> | ||
16 | + <block wx:elif="{{status === 4}}"> | ||
17 | + <view class="action-item confirm" bindtap="goMyList">我的抽奖码({{num}})</view> | ||
18 | + </block> | ||
19 | + <block wx:elif="{{status === 5}}"> | ||
20 | + <view class="action-item confirm" bindtap="goMyList">我的抽奖码({{num}})</view> | ||
21 | + <view class="action-item ok" bindtap="openFellowAlert">查看开奖结果</view> | ||
22 | + </block> | ||
23 | + <block wx:elif="{{status === 6}}"> | ||
24 | + <view class="action-item over">活动已结束</view> | ||
25 | + </block> | ||
26 | + <block wx:elif="{{status === 7}}"> | ||
27 | + <block wx:if="{{num > 0}}"> | ||
28 | + <view class="action-item confirm" bindtap="goMyList">我的抽奖码({{num}})</view> | ||
29 | + </block> | ||
30 | + <block wx:else> | ||
31 | + <view class="action-item over">活动已结束</view> | ||
32 | + </block> | ||
33 | + </block> | ||
34 | +</view> | ||
35 | +<new-lucky-alert wx:if="{{show}}" bindhiddenalert="hiddenAlert"> | ||
36 | + <view class="code-alert"> | ||
37 | + <text class="code-title">参加抽奖成功</text> | ||
38 | + <view class="code-bg"> | ||
39 | + <view class="title">你的抽奖码是</view> | ||
40 | + <view class="code">{{code}}</view> | ||
41 | + </view> | ||
42 | + <form bindsubmit='submitFormId' report-submit='true'> | ||
43 | + <button class="share" form-type="submit" bindtap="hadJoinToShare">分享一下,中奖概率立马double</button> | ||
44 | + </form> | ||
45 | + <view class="share-desc">1个好友参加=1个抽奖码=中奖几率UP!</view> | ||
46 | + </view> | ||
47 | +</new-lucky-alert> | ||
48 | +<zero-alert wx:if="{{error}}"> | ||
49 | + <view class="error-alert"> | ||
50 | + <view class="error-title">OOPS</view> | ||
51 | + <view class="error-content">{{errorText}}</view> | ||
52 | + </view> | ||
53 | + <view class="foot"> | ||
54 | + <view class="foot-item" bindtap="cancelAlert">确定</view> | ||
55 | + </view> | ||
56 | +</zero-alert> | ||
57 | +<fellow-alert show="{{fellow}}" bindok="cancelFellow" copyText="{{copyText}}" type="{{type}}" text="{{text}}"></fellow-alert> |
@@ -9,7 +9,7 @@ | @@ -9,7 +9,7 @@ | ||
9 | "avatars": "./components/avatar-swiper", | 9 | "avatars": "./components/avatar-swiper", |
10 | "help": "./components/help", | 10 | "help": "./components/help", |
11 | "fellow-bar": "./components/fellow-bar", | 11 | "fellow-bar": "./components/fellow-bar", |
12 | - "action-bar": "./components/action-bar", | 12 | + "action-bar": "./components/yohoodLottery/action-bar", |
13 | "zero-alert": "./components/alert", | 13 | "zero-alert": "./components/alert", |
14 | "group-recommend": "./components/group-recommend" | 14 | "group-recommend": "./components/group-recommend" |
15 | } | 15 | } |
@@ -46,14 +46,11 @@ | @@ -46,14 +46,11 @@ | ||
46 | <action-bar wx:if="{{isLogin}}" status="{{actionStatus}}" num="{{myPrizeCount}}" share-uid="{{shareUid}}" act-prize-id="{{actPrizeId}}" bindgetcode="changeActionStatus" bindshare="share" copyText="{{lottery.miniappCopy}}" text="{{lottery.miniappTip}}" bindgaincodesuccess="reportSuccess" type="{{lottery.miniappType}}"></action-bar> | 46 | <action-bar wx:if="{{isLogin}}" status="{{actionStatus}}" num="{{myPrizeCount}}" share-uid="{{shareUid}}" act-prize-id="{{actPrizeId}}" bindgetcode="changeActionStatus" bindshare="share" copyText="{{lottery.miniappCopy}}" text="{{lottery.miniappTip}}" bindgaincodesuccess="reportSuccess" type="{{lottery.miniappType}}"></action-bar> |
47 | <block wx:else> | 47 | <block wx:else> |
48 | <view class="action-bar2"> | 48 | <view class="action-bar2"> |
49 | - <view class="action-item action-list" bindtap="goList"> | ||
50 | - <image class="action-image" src="./images/list_icon@2x.png"></image> | ||
51 | - </view> | ||
52 | <block wx:if="{{product.status === 1}}"> | 49 | <block wx:if="{{product.status === 1}}"> |
53 | <button class="action-item over" bindtap="goLogin">即将开始</button> | 50 | <button class="action-item over" bindtap="goLogin">即将开始</button> |
54 | </block> | 51 | </block> |
55 | <block wx:if="{{product.status === 2}}"> | 52 | <block wx:if="{{product.status === 2}}"> |
56 | - <button class="action-item confirm" bindtap="goLogin">0元参加抽奖</button> | 53 | + <button class="action-item confirm" bindtap="goLogin">参加抽奖</button> |
57 | </block> | 54 | </block> |
58 | <block wx:if="{{product.status === 3}}"> | 55 | <block wx:if="{{product.status === 3}}"> |
59 | <button class="action-item over" bindtap="goLogin">待开奖</button> | 56 | <button class="action-item over" bindtap="goLogin">待开奖</button> |
@@ -33,7 +33,7 @@ | @@ -33,7 +33,7 @@ | ||
33 | "list": [] | 33 | "list": [] |
34 | }, | 34 | }, |
35 | "miniprogram": { | 35 | "miniprogram": { |
36 | - "current": 6, | 36 | + "current": 5, |
37 | "list": [ | 37 | "list": [ |
38 | { | 38 | { |
39 | "id": 0, | 39 | "id": 0, |
@@ -74,7 +74,7 @@ | @@ -74,7 +74,7 @@ | ||
74 | "id": 5, | 74 | "id": 5, |
75 | "name": "YOLUCK DETAIL", | 75 | "name": "YOLUCK DETAIL", |
76 | "pathName": "pages/zeroSell/detail", | 76 | "pathName": "pages/zeroSell/detail", |
77 | - "query": "actPrizeId=16", | 77 | + "query": "actPrizeId=224", |
78 | "scene": null | 78 | "scene": null |
79 | }, | 79 | }, |
80 | { | 80 | { |
-
Please register or login to post a comment