正在显示
6 个修改的文件
包含
165 行增加
和
24 行删除
@@ -36,6 +36,28 @@ Page({ | @@ -36,6 +36,28 @@ Page({ | ||
36 | */ | 36 | */ |
37 | onLoad: function(options) { | 37 | onLoad: function(options) { |
38 | this.cardInfo() | 38 | this.cardInfo() |
39 | + wx.getSetting({ | ||
40 | + success: (res) => { | ||
41 | + console.log(res) | ||
42 | + if (res.authSetting['scope.userInfo'] == undefined) { | ||
43 | + wx.navigateTo({ | ||
44 | + url: '/pages/start/start', | ||
45 | + }) | ||
46 | + } | ||
47 | + | ||
48 | + // console.log(res) | ||
49 | + // console.log('是否授权', res.authSetting['scope.userInfo'] !== undefined); | ||
50 | + // this.setData({ | ||
51 | + // weixinLogin: res.authSetting['scope.userInfo'] !== undefined | ||
52 | + // }) | ||
53 | + }, | ||
54 | + fail: (res) => { | ||
55 | + console.log(res) | ||
56 | + wx.navigateTo({ | ||
57 | + url: '/pages/start/start', | ||
58 | + }) | ||
59 | + } | ||
60 | + }) | ||
39 | }, | 61 | }, |
40 | 62 | ||
41 | /** | 63 | /** |
1 | // pages/groupBuy/groupBuy.js | 1 | // pages/groupBuy/groupBuy.js |
2 | const app = getApp() | 2 | const app = getApp() |
3 | - const time=require('../../../utils/util.js'); | 3 | + const time = require('../../../utils/util.js'); |
4 | + | ||
4 | Page({ | 5 | Page({ |
5 | 6 | ||
6 | /** | 7 | /** |
@@ -13,7 +14,13 @@ | @@ -13,7 +14,13 @@ | ||
13 | groupList: [], | 14 | groupList: [], |
14 | recordList: [], | 15 | recordList: [], |
15 | pay_info: [], | 16 | pay_info: [], |
16 | - is_agree: false | 17 | + is_agree: false, |
18 | + countDownList: [], | ||
19 | + actEndTimeList: [], | ||
20 | + goodsList: [{ | ||
21 | + actEndTime: '' | ||
22 | + }] | ||
23 | + | ||
17 | }, | 24 | }, |
18 | 25 | ||
19 | //tab切换 | 26 | //tab切换 |
@@ -62,10 +69,15 @@ | @@ -62,10 +69,15 @@ | ||
62 | 69 | ||
63 | // 长按复制 | 70 | // 长按复制 |
64 | copy: function(e) { | 71 | copy: function(e) { |
72 | + console.log(e) | ||
73 | + var index=e.currentTarget.dataset.index | ||
74 | + var recordList = this.data.recordList | ||
75 | + var chargenum = recordList[index].redeem_code | ||
65 | var that = this; | 76 | var that = this; |
66 | wx.setClipboardData({ | 77 | wx.setClipboardData({ |
67 | - data: that.data.chargenum, | 78 | + data: chargenum, |
68 | success: function(res) { | 79 | success: function(res) { |
80 | + console.log(res) | ||
69 | wx.showToast({ | 81 | wx.showToast({ |
70 | title: '复制成功', | 82 | title: '复制成功', |
71 | }); | 83 | }); |
@@ -73,6 +85,7 @@ | @@ -73,6 +85,7 @@ | ||
73 | }); | 85 | }); |
74 | }, | 86 | }, |
75 | 87 | ||
88 | + | ||
76 | //参与的组团 | 89 | //参与的组团 |
77 | takeGroup() { | 90 | takeGroup() { |
78 | let url = '/portal/Group/group_list' | 91 | let url = '/portal/Group/group_list' |
@@ -83,9 +96,18 @@ | @@ -83,9 +96,18 @@ | ||
83 | "XX-Token": wx.getStorageSync('token') | 96 | "XX-Token": wx.getStorageSync('token') |
84 | } | 97 | } |
85 | app.post(url, params, header).then((res) => { | 98 | app.post(url, params, header).then((res) => { |
86 | - console.log(res) | 99 | + var groupList = res.list |
100 | + var goodsList = this.data.goodsList | ||
101 | + console.log(groupList.length) | ||
102 | + for (var i = 0; i < groupList.length; i++) { | ||
103 | + goodsList.push({ | ||
104 | + actEndTime:'' | ||
105 | + }) | ||
106 | + goodsList[i].actEndTime = groupList[i].over_time | ||
107 | + } | ||
87 | this.setData({ | 108 | this.setData({ |
88 | - groupList: res.list | 109 | + groupList: res.list, |
110 | + goodsList: goodsList | ||
89 | }) | 111 | }) |
90 | }) | 112 | }) |
91 | }, | 113 | }, |
@@ -100,12 +122,10 @@ | @@ -100,12 +122,10 @@ | ||
100 | "XX-Token": wx.getStorageSync('token') | 122 | "XX-Token": wx.getStorageSync('token') |
101 | } | 123 | } |
102 | app.post(url, params, header).then((res) => { | 124 | app.post(url, params, header).then((res) => { |
103 | - console.log(res) | ||
104 | - var recordList= res.list | ||
105 | - for(var i=0;i<recordList.length;i++){ | 125 | + var recordList = res.list |
126 | + for (var i = 0; i < recordList.length; i++) { | ||
106 | var chargeTime = recordList[i].create_time | 127 | var chargeTime = recordList[i].create_time |
107 | chargeTime = time.formatTimeTwo(chargeTime, 'Y-M-D') | 128 | chargeTime = time.formatTimeTwo(chargeTime, 'Y-M-D') |
108 | - console.log(chargeTime) | ||
109 | recordList[i].create_time = chargeTime | 129 | recordList[i].create_time = chargeTime |
110 | } | 130 | } |
111 | this.setData({ | 131 | this.setData({ |
@@ -122,7 +142,7 @@ | @@ -122,7 +142,7 @@ | ||
122 | "XX-Token": wx.getStorageSync('token') | 142 | "XX-Token": wx.getStorageSync('token') |
123 | } | 143 | } |
124 | app.post(url, params, header).then((res) => { | 144 | app.post(url, params, header).then((res) => { |
125 | - // console.log(res) | 145 | + console.log('团购配置人数加个:',res) |
126 | this.setData({ | 146 | this.setData({ |
127 | pay_info: res.info | 147 | pay_info: res.info |
128 | }) | 148 | }) |
@@ -201,6 +221,50 @@ | @@ -201,6 +221,50 @@ | ||
201 | 221 | ||
202 | }, | 222 | }, |
203 | 223 | ||
224 | + timeFormat(param) { //小于10的格式化函数 | ||
225 | + return param < 10 ? '0' + param : param; | ||
226 | + }, | ||
227 | + countDown() { //倒计时函数 | ||
228 | + // 获取当前时间,同时得到活动结束时间数组 | ||
229 | + let newTime = new Date().getTime(); | ||
230 | + let endTimeList = this.data.actEndTimeList; | ||
231 | + let countDownArr = []; | ||
232 | + | ||
233 | + // 对结束时间进行处理渲染到页面 | ||
234 | + endTimeList.forEach(o => { | ||
235 | + let endTime = new Date(o).getTime(); | ||
236 | + let obj = null; | ||
237 | + // 如果活动未结束,对时间进行处理 | ||
238 | + if (endTime - newTime > 0) { | ||
239 | + let time = (endTime - newTime) / 1000; | ||
240 | + // 获取天、时、分、秒 | ||
241 | + let day = parseInt(time / (60 * 60 * 24)); | ||
242 | + let hou = parseInt(time % (60 * 60 * 24) / 3600); | ||
243 | + let min = parseInt(time % (60 * 60 * 24) % 3600 / 60); | ||
244 | + let sec = parseInt(time % (60 * 60 * 24) % 3600 % 60); | ||
245 | + obj = { | ||
246 | + day: this.timeFormat(day), | ||
247 | + hou: this.timeFormat(hou), | ||
248 | + min: this.timeFormat(min), | ||
249 | + sec: this.timeFormat(sec) | ||
250 | + } | ||
251 | + } else { //活动已结束,全部设置为'00' | ||
252 | + obj = { | ||
253 | + day: '00', | ||
254 | + hou: '00', | ||
255 | + min: '00', | ||
256 | + sec: '00' | ||
257 | + } | ||
258 | + } | ||
259 | + countDownArr.push(obj); | ||
260 | + }) | ||
261 | + // 渲染,然后每隔一秒执行一次倒计时函数 | ||
262 | + this.setData({ | ||
263 | + countDownList: countDownArr | ||
264 | + }) | ||
265 | + setTimeout(this.countDown, 1000); | ||
266 | + }, | ||
267 | + | ||
204 | /** | 268 | /** |
205 | * 生命周期函数--监听页面加载 | 269 | * 生命周期函数--监听页面加载 |
206 | */ | 270 | */ |
@@ -208,6 +272,17 @@ | @@ -208,6 +272,17 @@ | ||
208 | this.takeGroup() | 272 | this.takeGroup() |
209 | this.record() | 273 | this.record() |
210 | this.PayDetail() | 274 | this.PayDetail() |
275 | + let endTimeList = []; | ||
276 | + // 将活动的结束时间参数提成一个单独的数组,方便操作 | ||
277 | + this.data.goodsList.forEach(o => { | ||
278 | + endTimeList.push(o.actEndTime) | ||
279 | + }) | ||
280 | + this.setData({ | ||
281 | + actEndTimeList: endTimeList | ||
282 | + }); | ||
283 | + // 执行倒计时函数 | ||
284 | + this.countDown(); | ||
285 | + | ||
211 | }, | 286 | }, |
212 | 287 | ||
213 | /** | 288 | /** |
@@ -60,9 +60,28 @@ | @@ -60,9 +60,28 @@ | ||
60 | <text>{{item.num}}</text>人,已参与: | 60 | <text>{{item.num}}</text>人,已参与: |
61 | <text>{{item.count}}</text> 人,快呼唤伙伴参与吧!</view> | 61 | <text>{{item.count}}</text> 人,快呼唤伙伴参与吧!</view> |
62 | <view class='list_info'> | 62 | <view class='list_info'> |
63 | - <view class='list_info_item'>剩余 | ||
64 | - <text>{{item.surplus_time}}</text> 结束</view> | ||
65 | - </view> | 63 | + <view class='list_info_item'> |
64 | + 剩余 | ||
65 | + <!-- <text>{{item.surplus_time}}</text> --> | ||
66 | + <text wx:for="{{countDownList}}" wx:key="countDownList"> | ||
67 | + <text class=''>{{item.hou}}</text> | ||
68 | + <text>:</text> | ||
69 | + <text class=''>{{item.min}}</text> | ||
70 | + <text>:</text> | ||
71 | + <text class=' '>{{item.sec}}</text> | ||
72 | + </text> | ||
73 | + 结束 | ||
74 | + </view> | ||
75 | + </view> | ||
76 | + <!-- | ||
77 | + <view class='tui-countdown-content' wx:for="{{countDownList}}" wx:key="countDownList"> | ||
78 | + 剩余 | ||
79 | + <!-- <text class='tui-conutdown-box'>{{item.day}}</text>天 | ||
80 | + <text class='tui-conutdown-box'>{{item.hou}}</text>时 | ||
81 | + <text class='tui-conutdown-box'>{{item.min}}</text>分 | ||
82 | + <text class='tui-conutdown-box tui-countdown-bg'>{{item.sec}}</text>秒 | ||
83 | + </view> --> | ||
84 | + | ||
66 | <view> | 85 | <view> |
67 | <view class='user_info_box'> | 86 | <view class='user_info_box'> |
68 | <view class='user_info'> | 87 | <view class='user_info'> |
@@ -99,10 +118,10 @@ | @@ -99,10 +118,10 @@ | ||
99 | <view class='list_label'>长按兑换码即可复制</view> | 118 | <view class='list_label'>长按兑换码即可复制</view> |
100 | </view> | 119 | </view> |
101 | </view> | 120 | </view> |
102 | - <view class='list_tab list_content' wx:for='{{recordList}}' wx:key=''> | 121 | + <view class='list_tab list_content' wx:for='{{recordList}}' wx:key='' data-index='{{index}}'> |
103 | <view class='list_tab_item'>{{item.create_time}}</view> | 122 | <view class='list_tab_item'>{{item.create_time}}</view> |
104 | <view class='list_tab_item'>{{item.is_used == 1?'已完成':'未完成'}}</view> | 123 | <view class='list_tab_item'>{{item.is_used == 1?'已完成':'未完成'}}</view> |
105 | - <view class='list_tab_item' selectable='true' bindlongtap='copy'>{{item.redeem_code}}</view> | 124 | + <text class='list_tab_item' selectable='true' bindlongtap='copy' data-index='{{index}}'>{{item.redeem_code}}</text> |
106 | </view> | 125 | </view> |
107 | </view> | 126 | </view> |
108 | </view> | 127 | </view> |
@@ -11,6 +11,8 @@ Page({ | @@ -11,6 +11,8 @@ Page({ | ||
11 | swipercurrent: 0, | 11 | swipercurrent: 0, |
12 | current_student: 0, | 12 | current_student: 0, |
13 | }, | 13 | }, |
14 | + | ||
15 | + | ||
14 | //获取轮播当前页 | 16 | //获取轮播当前页 |
15 | swiperCharge(e) { | 17 | swiperCharge(e) { |
16 | console.log(e.detail.current) | 18 | console.log(e.detail.current) |
@@ -31,6 +33,7 @@ Page({ | @@ -31,6 +33,7 @@ Page({ | ||
31 | this.setData({imgsUrl: res.list, service: res.service}) | 33 | this.setData({imgsUrl: res.list, service: res.service}) |
32 | }) | 34 | }) |
33 | }, | 35 | }, |
36 | + | ||
34 | //畅玩卡说明 | 37 | //畅玩卡说明 |
35 | card() { | 38 | card() { |
36 | let url = '/wxapp/public/arc_card' | 39 | let url = '/wxapp/public/arc_card' |
@@ -50,18 +53,21 @@ Page({ | @@ -50,18 +53,21 @@ Page({ | ||
50 | url: '../appointmentRecord/appointmentRecord?student_id=' + this.data.imgsUrl[this.data.current_student].id, | 53 | url: '../appointmentRecord/appointmentRecord?student_id=' + this.data.imgsUrl[this.data.current_student].id, |
51 | }) | 54 | }) |
52 | }, | 55 | }, |
56 | + | ||
53 | //立即购买 | 57 | //立即购买 |
54 | buyCard() { | 58 | buyCard() { |
55 | wx.navigateTo({ | 59 | wx.navigateTo({ |
56 | url: '../buyCard/buyCard', | 60 | url: '../buyCard/buyCard', |
57 | }) | 61 | }) |
58 | }, | 62 | }, |
63 | + | ||
59 | //团购畅玩卡 | 64 | //团购畅玩卡 |
60 | groupBuy() { | 65 | groupBuy() { |
61 | wx.navigateTo({ | 66 | wx.navigateTo({ |
62 | url: '../groupBuy/groupBuy', | 67 | url: '../groupBuy/groupBuy', |
63 | }) | 68 | }) |
64 | }, | 69 | }, |
70 | + | ||
65 | /** | 71 | /** |
66 | * 生命周期函数--监听页面加载 | 72 | * 生命周期函数--监听页面加载 |
67 | */ | 73 | */ |
1 | // pages/my/takeGroupBuy/takeGroupBuy.js | 1 | // pages/my/takeGroupBuy/takeGroupBuy.js |
2 | -const app=getApp() | 2 | +const app = getApp() |
3 | Page({ | 3 | Page({ |
4 | 4 | ||
5 | /** | 5 | /** |
@@ -7,10 +7,10 @@ Page({ | @@ -7,10 +7,10 @@ Page({ | ||
7 | */ | 7 | */ |
8 | data: { | 8 | data: { |
9 | group_info: "", | 9 | group_info: "", |
10 | - take_info:'', | ||
11 | - is_agree:false, | ||
12 | - rule:'', | ||
13 | - group_id:'' | 10 | + take_info: '', |
11 | + is_agree: false, | ||
12 | + rule: '', | ||
13 | + group_id: '' | ||
14 | }, | 14 | }, |
15 | 15 | ||
16 | 16 | ||
@@ -24,7 +24,7 @@ Page({ | @@ -24,7 +24,7 @@ Page({ | ||
24 | 24 | ||
25 | //参与的组团 | 25 | //参与的组团 |
26 | takeGroup() { | 26 | takeGroup() { |
27 | - var that=this | 27 | + var that = this |
28 | let url = '/portal/Group/group_detail' | 28 | let url = '/portal/Group/group_detail' |
29 | let params = { | 29 | let params = { |
30 | // id: wx.getStorageSync('group_id') | 30 | // id: wx.getStorageSync('group_id') |
@@ -135,10 +135,24 @@ Page({ | @@ -135,10 +135,24 @@ Page({ | ||
135 | this.setData({ | 135 | this.setData({ |
136 | group_id: options.group_id | 136 | group_id: options.group_id |
137 | }) | 137 | }) |
138 | - // if (options.group_id !== '' || options.group_id!=undefined){ | ||
139 | this.takeGroup() | 138 | this.takeGroup() |
140 | - // } | ||
141 | this.getRule() | 139 | this.getRule() |
140 | + wx.getSetting({ | ||
141 | + success: (res) => { | ||
142 | + console.log(res) | ||
143 | + if (res.authSetting['scope.userInfo'] == undefined) { | ||
144 | + wx.navigateTo({ | ||
145 | + url: '/pages/start/start', | ||
146 | + }) | ||
147 | + } | ||
148 | + }, | ||
149 | + fail: (res) => { | ||
150 | + console.log(res) | ||
151 | + wx.navigateTo({ | ||
152 | + url: '/pages/start/start', | ||
153 | + }) | ||
154 | + } | ||
155 | + }) | ||
142 | }, | 156 | }, |
143 | 157 | ||
144 | /** | 158 | /** |
@@ -36,7 +36,7 @@ | @@ -36,7 +36,7 @@ | ||
36 | "list": [] | 36 | "list": [] |
37 | }, | 37 | }, |
38 | "miniprogram": { | 38 | "miniprogram": { |
39 | - "current": 1, | 39 | + "current": 2, |
40 | "list": [ | 40 | "list": [ |
41 | { | 41 | { |
42 | "id": -1, | 42 | "id": -1, |
@@ -49,6 +49,11 @@ | @@ -49,6 +49,11 @@ | ||
49 | "name": "card", | 49 | "name": "card", |
50 | "pathName": "pages/my/takeGroupBuy/takeGroupBuy", | 50 | "pathName": "pages/my/takeGroupBuy/takeGroupBuy", |
51 | "query": "group_id=60" | 51 | "query": "group_id=60" |
52 | + }, | ||
53 | + { | ||
54 | + "id": -1, | ||
55 | + "name": "share", | ||
56 | + "pathName": "pages/my/cardIntroduction/cardIntroduction" | ||
52 | } | 57 | } |
53 | ] | 58 | ] |
54 | } | 59 | } |
-
请 注册 或 登录 后发表评论