正在显示
6 个修改的文件
包含
105 行增加
和
54 行删除
@@ -70,7 +70,7 @@ | @@ -70,7 +70,7 @@ | ||
70 | // 长按复制 | 70 | // 长按复制 |
71 | copy: function(e) { | 71 | copy: function(e) { |
72 | console.log(e) | 72 | console.log(e) |
73 | - var index=e.currentTarget.dataset.index | 73 | + var index = e.currentTarget.dataset.index |
74 | var recordList = this.data.recordList | 74 | var recordList = this.data.recordList |
75 | var chargenum = recordList[index].redeem_code | 75 | var chargenum = recordList[index].redeem_code |
76 | var that = this; | 76 | var that = this; |
@@ -86,32 +86,6 @@ | @@ -86,32 +86,6 @@ | ||
86 | }, | 86 | }, |
87 | 87 | ||
88 | 88 | ||
89 | - //参与的组团 | ||
90 | - takeGroup() { | ||
91 | - let url = '/portal/Group/group_list' | ||
92 | - let params = { | ||
93 | - page: this.data.page | ||
94 | - } | ||
95 | - let header = { | ||
96 | - "XX-Token": wx.getStorageSync('token') | ||
97 | - } | ||
98 | - app.post(url, params, header).then((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 | - } | ||
108 | - this.setData({ | ||
109 | - groupList: res.list, | ||
110 | - goodsList: goodsList | ||
111 | - }) | ||
112 | - }) | ||
113 | - }, | ||
114 | - | ||
115 | //成交记录 | 89 | //成交记录 |
116 | record() { | 90 | record() { |
117 | let url = '/portal/Group/group_complete' | 91 | let url = '/portal/Group/group_complete' |
@@ -142,7 +116,7 @@ | @@ -142,7 +116,7 @@ | ||
142 | "XX-Token": wx.getStorageSync('token') | 116 | "XX-Token": wx.getStorageSync('token') |
143 | } | 117 | } |
144 | app.post(url, params, header).then((res) => { | 118 | app.post(url, params, header).then((res) => { |
145 | - console.log('团购配置人数加个:',res) | 119 | + console.log('团购配置人数加个:', res) |
146 | this.setData({ | 120 | this.setData({ |
147 | pay_info: res.info | 121 | pay_info: res.info |
148 | }) | 122 | }) |
@@ -217,22 +191,60 @@ | @@ -217,22 +191,60 @@ | ||
217 | icon: 'none' | 191 | icon: 'none' |
218 | }) | 192 | }) |
219 | } | 193 | } |
194 | + }, | ||
220 | 195 | ||
221 | 196 | ||
197 | + //参与的组团 | ||
198 | + takeGroup() { | ||
199 | + let url = '/portal/Group/group_list' | ||
200 | + let params = { | ||
201 | + page: this.data.page | ||
202 | + } | ||
203 | + let header = { | ||
204 | + "XX-Token": wx.getStorageSync('token') | ||
205 | + } | ||
206 | + app.post(url, params, header).then((res) => { | ||
207 | + var groupList = res.list | ||
208 | + var goodsList = this.data.goodsList | ||
209 | + console.log(groupList.length) | ||
210 | + for (var i = 0; i < groupList.length; i++) { | ||
211 | + goodsList.push({ | ||
212 | + actEndTime: '' | ||
213 | + }) | ||
214 | + // goodsList[i].actEndTime = '2018-12-27 13:59:44' | ||
215 | + goodsList[i].actEndTime = groupList[i].over_time | ||
216 | + } | ||
217 | + goodsList.pop() | ||
218 | + let endTimeList = []; | ||
219 | + goodsList.forEach(o => { | ||
220 | + endTimeList.push(o.actEndTime) | ||
221 | + }) | ||
222 | + this.setData({ | ||
223 | + actEndTimeList: endTimeList | ||
224 | + }); | ||
225 | + // console.log(endTimeList) | ||
226 | + this.countDown(); | ||
227 | + this.setData({ | ||
228 | + groupList: res.list, | ||
229 | + goodsList: goodsList | ||
230 | + }) | ||
231 | + }) | ||
222 | }, | 232 | }, |
223 | 233 | ||
224 | timeFormat(param) { //小于10的格式化函数 | 234 | timeFormat(param) { //小于10的格式化函数 |
225 | return param < 10 ? '0' + param : param; | 235 | return param < 10 ? '0' + param : param; |
226 | }, | 236 | }, |
237 | + | ||
227 | countDown() { //倒计时函数 | 238 | countDown() { //倒计时函数 |
228 | // 获取当前时间,同时得到活动结束时间数组 | 239 | // 获取当前时间,同时得到活动结束时间数组 |
229 | let newTime = new Date().getTime(); | 240 | let newTime = new Date().getTime(); |
230 | let endTimeList = this.data.actEndTimeList; | 241 | let endTimeList = this.data.actEndTimeList; |
242 | + // console.log(endTimeList) | ||
231 | let countDownArr = []; | 243 | let countDownArr = []; |
232 | - | ||
233 | // 对结束时间进行处理渲染到页面 | 244 | // 对结束时间进行处理渲染到页面 |
234 | endTimeList.forEach(o => { | 245 | endTimeList.forEach(o => { |
235 | let endTime = new Date(o).getTime(); | 246 | let endTime = new Date(o).getTime(); |
247 | + // console.log(endTime) | ||
236 | let obj = null; | 248 | let obj = null; |
237 | // 如果活动未结束,对时间进行处理 | 249 | // 如果活动未结束,对时间进行处理 |
238 | if (endTime - newTime > 0) { | 250 | if (endTime - newTime > 0) { |
@@ -258,10 +270,21 @@ | @@ -258,10 +270,21 @@ | ||
258 | } | 270 | } |
259 | countDownArr.push(obj); | 271 | countDownArr.push(obj); |
260 | }) | 272 | }) |
273 | + | ||
274 | + var groupList = this.data.groupList | ||
275 | + for (var i = 0; i < groupList.length; i++) { | ||
276 | + for (var j = 0; j < countDownArr.length; j++) { | ||
277 | + groupList[i].hou = countDownArr[i].hou | ||
278 | + groupList[i].min = countDownArr[i].min | ||
279 | + groupList[i].sec = countDownArr[i].sec | ||
280 | + } | ||
281 | + } | ||
261 | // 渲染,然后每隔一秒执行一次倒计时函数 | 282 | // 渲染,然后每隔一秒执行一次倒计时函数 |
262 | this.setData({ | 283 | this.setData({ |
263 | - countDownList: countDownArr | 284 | + countDownList: countDownArr, |
285 | + groupList: groupList | ||
264 | }) | 286 | }) |
287 | + // console.log(this.data.countDownList) | ||
265 | setTimeout(this.countDown, 1000); | 288 | setTimeout(this.countDown, 1000); |
266 | }, | 289 | }, |
267 | 290 | ||
@@ -272,16 +295,7 @@ | @@ -272,16 +295,7 @@ | ||
272 | this.takeGroup() | 295 | this.takeGroup() |
273 | this.record() | 296 | this.record() |
274 | this.PayDetail() | 297 | 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(); | 298 | + |
285 | 299 | ||
286 | }, | 300 | }, |
287 | 301 |
@@ -63,24 +63,37 @@ | @@ -63,24 +63,37 @@ | ||
63 | <view class='list_info_item'> | 63 | <view class='list_info_item'> |
64 | 剩余 | 64 | 剩余 |
65 | <!-- <text>{{item.surplus_time}}</text> --> | 65 | <!-- <text>{{item.surplus_time}}</text> --> |
66 | - <text wx:for="{{countDownList}}" wx:key="countDownList"> | 66 | + |
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 | + | ||
73 | + <!-- <text wx:for="{{countDownList}}" wx:key="countDownList"> | ||
67 | <text class=''>{{item.hou}}</text> | 74 | <text class=''>{{item.hou}}</text> |
68 | <text>:</text> | 75 | <text>:</text> |
69 | <text class=''>{{item.min}}</text> | 76 | <text class=''>{{item.min}}</text> |
70 | <text>:</text> | 77 | <text>:</text> |
71 | <text class=' '>{{item.sec}}</text> | 78 | <text class=' '>{{item.sec}}</text> |
72 | - </text> | 79 | + </text> --> |
73 | 结束 | 80 | 结束 |
74 | </view> | 81 | </view> |
75 | - </view> | ||
76 | - <!-- | ||
77 | - <view class='tui-countdown-content' wx:for="{{countDownList}}" wx:key="countDownList"> | 82 | + |
83 | + | ||
84 | + | ||
85 | + <!-- <view class='tui-countdown-content' wx:for="{{countDownList}}" wx:key="countDownList"> | ||
78 | 剩余 | 86 | 剩余 |
79 | - <!-- <text class='tui-conutdown-box'>{{item.day}}</text>天 | 87 | + <text class='tui-conutdown-box'>{{item.day}}</text>天 |
80 | <text class='tui-conutdown-box'>{{item.hou}}</text>时 | 88 | <text class='tui-conutdown-box'>{{item.hou}}</text>时 |
81 | <text class='tui-conutdown-box'>{{item.min}}</text>分 | 89 | <text class='tui-conutdown-box'>{{item.min}}</text>分 |
82 | <text class='tui-conutdown-box tui-countdown-bg'>{{item.sec}}</text>秒 | 90 | <text class='tui-conutdown-box tui-countdown-bg'>{{item.sec}}</text>秒 |
83 | - </view> --> | 91 | + </view> --> |
92 | + | ||
93 | + | ||
94 | + | ||
95 | + </view> | ||
96 | + | ||
84 | 97 | ||
85 | <view> | 98 | <view> |
86 | <view class='user_info_box'> | 99 | <view class='user_info_box'> |
@@ -107,12 +107,12 @@ Page({ | @@ -107,12 +107,12 @@ Page({ | ||
107 | */ | 107 | */ |
108 | onShareAppMessage: function() { | 108 | onShareAppMessage: function() { |
109 | let that = this; | 109 | let that = this; |
110 | - var id = this.data.id | ||
111 | - console.log(id) | 110 | + var group_id = this.data.id |
111 | + console.log(group_id) | ||
112 | // 设置菜单中的转发按钮触发转发事件时的转发内容 | 112 | // 设置菜单中的转发按钮触发转发事件时的转发内容 |
113 | var shareObj = { | 113 | var shareObj = { |
114 | title: '科学队长', // 默认是小程序的名称(可以写slogan等) | 114 | title: '科学队长', // 默认是小程序的名称(可以写slogan等) |
115 | - path: '/pages/my/takeGroupBuy/takeGroupBuy?id=' + id, // 默认是当前页面,必须是以‘/’开头的完整路径 | 115 | + path: '/pages/my/takeGroupBuy/takeGroupBuy?group_id=' + group_id,// 默认是当前页面,必须是以‘/’开头的完整路径 |
116 | imageUrl: '', //自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径,支持PNG及JPG,不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4 | 116 | imageUrl: '', //自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径,支持PNG及JPG,不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4 |
117 | success: function(res) { | 117 | success: function(res) { |
118 | if (res.errMsg == 'shareAppMessage:ok') {} | 118 | if (res.errMsg == 'shareAppMessage:ok') {} |
@@ -40,6 +40,7 @@ Page({ | @@ -40,6 +40,7 @@ Page({ | ||
40 | }) | 40 | }) |
41 | }) | 41 | }) |
42 | }, | 42 | }, |
43 | + | ||
43 | //团购规则 | 44 | //团购规则 |
44 | getRule() { | 45 | getRule() { |
45 | let url = '/wxapp/public/arc_group' | 46 | let url = '/wxapp/public/arc_group' |
@@ -126,6 +127,21 @@ Page({ | @@ -126,6 +127,21 @@ Page({ | ||
126 | }) | 127 | }) |
127 | }, | 128 | }, |
128 | 129 | ||
130 | + checkMobile(){ | ||
131 | + let url = '/portal/Index/check_mobile' | ||
132 | + let params = {} | ||
133 | + let header = { | ||
134 | + "XX-Token": wx.getStorageSync('token') | ||
135 | + } | ||
136 | + app.post(url, params, header).then((res) => { | ||
137 | + if (res.is_binding==0){ | ||
138 | + wx.navigateTo({ | ||
139 | + url: '/pages/index/phone-code/phone-code', | ||
140 | + }) | ||
141 | + } | ||
142 | + }) | ||
143 | + }, | ||
144 | + | ||
129 | 145 | ||
130 | /** | 146 | /** |
131 | * 生命周期函数--监听页面加载 | 147 | * 生命周期函数--监听页面加载 |
@@ -153,6 +169,7 @@ Page({ | @@ -153,6 +169,7 @@ Page({ | ||
153 | }) | 169 | }) |
154 | } | 170 | } |
155 | }) | 171 | }) |
172 | + // this.checkMobile() | ||
156 | }, | 173 | }, |
157 | 174 | ||
158 | /** | 175 | /** |
@@ -166,7 +183,7 @@ Page({ | @@ -166,7 +183,7 @@ Page({ | ||
166 | * 生命周期函数--监听页面显示 | 183 | * 生命周期函数--监听页面显示 |
167 | */ | 184 | */ |
168 | onShow: function() { | 185 | onShow: function() { |
169 | - | 186 | + this.checkMobile() |
170 | }, | 187 | }, |
171 | 188 | ||
172 | /** | 189 | /** |
@@ -90,7 +90,7 @@ | @@ -90,7 +90,7 @@ | ||
90 | <text class='service_info' catchtap='serviceProtocol'>服务协议</text> | 90 | <text class='service_info' catchtap='serviceProtocol'>服务协议</text> |
91 | </view> | 91 | </view> |
92 | <view class='service_btn_box'> | 92 | <view class='service_btn_box'> |
93 | - <view>单价:¥{{take_info.price}}</view> | 93 | + <view>单价:¥{{group_info.price}}</view> |
94 | <view class='pay_btn' bindtap='goPay'>参与并支付</view> | 94 | <view class='pay_btn' bindtap='goPay'>参与并支付</view> |
95 | </view> | 95 | </view> |
96 | </view> | 96 | </view> |
@@ -36,7 +36,7 @@ | @@ -36,7 +36,7 @@ | ||
36 | "list": [] | 36 | "list": [] |
37 | }, | 37 | }, |
38 | "miniprogram": { | 38 | "miniprogram": { |
39 | - "current": 2, | 39 | + "current": 3, |
40 | "list": [ | 40 | "list": [ |
41 | { | 41 | { |
42 | "id": -1, | 42 | "id": -1, |
@@ -53,7 +53,14 @@ | @@ -53,7 +53,14 @@ | ||
53 | { | 53 | { |
54 | "id": -1, | 54 | "id": -1, |
55 | "name": "share", | 55 | "name": "share", |
56 | - "pathName": "pages/my/cardIntroduction/cardIntroduction" | 56 | + "pathName": "pages/my/cardIntroduction/cardIntroduction", |
57 | + "query": "" | ||
58 | + }, | ||
59 | + { | ||
60 | + "id": -1, | ||
61 | + "name": "group", | ||
62 | + "pathName": "pages/my/groupBuy/groupBuy", | ||
63 | + "query": "group_id=60" | ||
57 | } | 64 | } |
58 | ] | 65 | ] |
59 | } | 66 | } |
-
请 注册 或 登录 后发表评论