Merge branch 'feature/group-buy' of git.yoho.cn:fe/yohobuywap-node into feature/group-buy
Showing
10 changed files
with
405 additions
and
20 deletions
@@ -5,6 +5,7 @@ const headerModel = require('../../../doraemon/models/header'); // 头部model | @@ -5,6 +5,7 @@ const headerModel = require('../../../doraemon/models/header'); // 头部model | ||
5 | const _ = require('lodash'); | 5 | const _ = require('lodash'); |
6 | const utils = '../../../utils'; | 6 | const utils = '../../../utils'; |
7 | const detailProcess = require(`${utils}/detail-process`); | 7 | const detailProcess = require(`${utils}/detail-process`); |
8 | +const helpers = global.yoho.helpers; | ||
8 | 9 | ||
9 | function index(req, res, next) { | 10 | function index(req, res, next) { |
10 | req.ctx(GroupService).groupIndex().then(result => { | 11 | req.ctx(GroupService).groupIndex().then(result => { |
@@ -133,6 +134,7 @@ function goodsDetail(req, res, next) { | @@ -133,6 +134,7 @@ function goodsDetail(req, res, next) { | ||
133 | req.ctx(GroupService).goodsDetail({ | 134 | req.ctx(GroupService).goodsDetail({ |
134 | activityId: param.activityId, | 135 | activityId: param.activityId, |
135 | productSkn: param.productSkn, | 136 | productSkn: param.productSkn, |
137 | + groupNo: param.groupNo | ||
136 | }).then((result) => { | 138 | }).then((result) => { |
137 | if (_.isEmpty(result)) { | 139 | if (_.isEmpty(result)) { |
138 | return next(); | 140 | return next(); |
@@ -145,6 +147,9 @@ function goodsDetail(req, res, next) { | @@ -145,6 +147,9 @@ function goodsDetail(req, res, next) { | ||
145 | finalResult.support = result.support; | 147 | finalResult.support = result.support; |
146 | finalResult.floor = result.floor; | 148 | finalResult.floor = result.floor; |
147 | finalResult.storage_sum = result.storage_sum; | 149 | finalResult.storage_sum = result.storage_sum; |
150 | + finalResult.groupNo = param.groupNo; | ||
151 | + finalResult.activityId = param.activityId; | ||
152 | + finalResult.isShowPop = result.activityIdDetail.joinLimit === 1 ? true : false; | ||
148 | return res.render('group/goodsDetail', { | 153 | return res.render('group/goodsDetail', { |
149 | page: 'group-goodsDetail', | 154 | page: 'group-goodsDetail', |
150 | nodownload: true, | 155 | nodownload: true, |
@@ -161,6 +166,65 @@ function goodsDetail(req, res, next) { | @@ -161,6 +166,65 @@ function goodsDetail(req, res, next) { | ||
161 | }).catch(next); | 166 | }).catch(next); |
162 | } | 167 | } |
163 | 168 | ||
169 | +function delOrder(req, res, next) { | ||
170 | + let orderCode = req.query.id; | ||
171 | + let uid = req.user.uid; | ||
172 | + | ||
173 | + req.ctx(GroupService).delOrder({ orderCode, uid }).then((result) => { | ||
174 | + res.json(result); | ||
175 | + }).catch(next); | ||
176 | +} | ||
177 | + | ||
178 | +function cancelOrder(req, res, next) { | ||
179 | + let orderCode = req.query.id; | ||
180 | + let uid = req.user.uid; | ||
181 | + | ||
182 | + req.ctx(GroupService).cancelOrder({ orderCode, uid }).then((result) => { | ||
183 | + res.json(result); | ||
184 | + }).catch(next); | ||
185 | +} | ||
186 | + | ||
187 | +function changeOrderStatus(orderItem) { | ||
188 | + const orderBtn = []; | ||
189 | + | ||
190 | + if (!orderItem) { | ||
191 | + return {}; | ||
192 | + } | ||
193 | + _.each(orderItem.links, function(val) { | ||
194 | + switch (val) { | ||
195 | + case 'buyNow': | ||
196 | + orderBtn.push({ | ||
197 | + buyNow: true, | ||
198 | + link: helpers.urlFormat('/home/orders/paynew', {order_code: orderItem.order_code}), | ||
199 | + }); | ||
200 | + break; | ||
201 | + case 'closeOrder':// 取消订单 | ||
202 | + orderBtn.push({ | ||
203 | + closeOrder: true | ||
204 | + }); | ||
205 | + break; | ||
206 | + case 'delOrder':// 删除订单 | ||
207 | + orderBtn.push({ | ||
208 | + delOrder: true, | ||
209 | + }); | ||
210 | + break; | ||
211 | + case 'groupInvite': | ||
212 | + orderBtn.push({ | ||
213 | + groupInvite: true, | ||
214 | + link: helpers.urlFormat('/activity/group/progress', { | ||
215 | + groupNo: orderItem.group_no, | ||
216 | + activityId: orderItem.activity_id | ||
217 | + }), | ||
218 | + }); | ||
219 | + break; | ||
220 | + default: | ||
221 | + break; | ||
222 | + | ||
223 | + } | ||
224 | + }); | ||
225 | + return orderBtn; | ||
226 | +} | ||
227 | + | ||
164 | function order(req, res, next) { | 228 | function order(req, res, next) { |
165 | const uid = req.user.uid; | 229 | const uid = req.user.uid; |
166 | const { | 230 | const { |
@@ -170,7 +234,7 @@ function order(req, res, next) { | @@ -170,7 +234,7 @@ function order(req, res, next) { | ||
170 | const param = { | 234 | const param = { |
171 | page: 1, | 235 | page: 1, |
172 | limit: 50, | 236 | limit: 50, |
173 | - type: type || 1, | 237 | + type: type || 2, |
174 | uid | 238 | uid |
175 | }; | 239 | }; |
176 | 240 | ||
@@ -179,6 +243,11 @@ function order(req, res, next) { | @@ -179,6 +243,11 @@ function order(req, res, next) { | ||
179 | if (_.isEmpty(result)) { | 243 | if (_.isEmpty(result)) { |
180 | return next(); | 244 | return next(); |
181 | } | 245 | } |
246 | + _.each(result.order_list, function(orderItem) { | ||
247 | + const orderBtn = changeOrderStatus(orderItem); | ||
248 | + | ||
249 | + orderItem.orderBtn = orderBtn; | ||
250 | + }); | ||
182 | return res.render('group/order', { | 251 | return res.render('group/order', { |
183 | title: '我的拼团', | 252 | title: '我的拼团', |
184 | page: 'group-order', | 253 | page: 'group-order', |
@@ -188,6 +257,7 @@ function order(req, res, next) { | @@ -188,6 +257,7 @@ function order(req, res, next) { | ||
188 | wechatShare: true, | 257 | wechatShare: true, |
189 | pageStyle: 'group-order-page', | 258 | pageStyle: 'group-order-page', |
190 | result, | 259 | result, |
260 | + type: type || 2, | ||
191 | navs: [{ | 261 | navs: [{ |
192 | title: '进行中', | 262 | title: '进行中', |
193 | src: '/activity/group/order?type=2&selectIndex=0' | 263 | src: '/activity/group/order?type=2&selectIndex=0' |
@@ -211,5 +281,7 @@ module.exports = { | @@ -211,5 +281,7 @@ module.exports = { | ||
211 | goodsDetail, | 281 | goodsDetail, |
212 | order, | 282 | order, |
213 | filter, | 283 | filter, |
214 | - searchList | 284 | + searchList, |
285 | + delOrder, | ||
286 | + cancelOrder | ||
215 | }; | 287 | }; |
@@ -175,6 +175,32 @@ class GroupApi extends global.yoho.BaseModel { | @@ -175,6 +175,32 @@ class GroupApi extends global.yoho.BaseModel { | ||
175 | }); | 175 | }); |
176 | } | 176 | } |
177 | 177 | ||
178 | + delOrder({ | ||
179 | + orderCode, | ||
180 | + uid | ||
181 | + }) { | ||
182 | + return this.get({ | ||
183 | + data: { | ||
184 | + method: 'app.SpaceOrders.delOrderByCode', | ||
185 | + uid: uid, | ||
186 | + order_code: orderCode | ||
187 | + } | ||
188 | + }); | ||
189 | + } | ||
190 | + | ||
191 | + cancelOrder({ | ||
192 | + orderCode, | ||
193 | + uid | ||
194 | + }) { | ||
195 | + return this.get({ | ||
196 | + data: { | ||
197 | + method: 'app.SpaceOrders.close', | ||
198 | + uid: uid, | ||
199 | + order_code: orderCode | ||
200 | + } | ||
201 | + }); | ||
202 | + } | ||
203 | + | ||
178 | getRefundApplyReasons(param) { | 204 | getRefundApplyReasons(param) { |
179 | return this.get({ | 205 | return this.get({ |
180 | url: '', | 206 | url: '', |
@@ -278,6 +278,38 @@ class GroupService extends global.yoho.BaseModel { | @@ -278,6 +278,38 @@ class GroupService extends global.yoho.BaseModel { | ||
278 | } | 278 | } |
279 | } | 279 | } |
280 | 280 | ||
281 | + async delOrder({ | ||
282 | + orderCode, | ||
283 | + uid | ||
284 | + }) { | ||
285 | + try { | ||
286 | + const result = await this.api.delOrder({ | ||
287 | + orderCode, | ||
288 | + uid | ||
289 | + }); | ||
290 | + | ||
291 | + return result; | ||
292 | + } catch (error) { | ||
293 | + throw new Error('Group delOrder fail.'); | ||
294 | + } | ||
295 | + } | ||
296 | + | ||
297 | + async cancelOrder({ | ||
298 | + orderCode, | ||
299 | + uid | ||
300 | + }) { | ||
301 | + try { | ||
302 | + const result = await this.api.cancelOrder({ | ||
303 | + orderCode, | ||
304 | + uid | ||
305 | + }); | ||
306 | + | ||
307 | + return result; | ||
308 | + } catch (error) { | ||
309 | + throw new Error('Group cancelOrder fail.'); | ||
310 | + } | ||
311 | + } | ||
312 | + | ||
281 | add0(m) { | 313 | add0(m) { |
282 | return m < 10 ? '0' + m : m; | 314 | return m < 10 ? '0' + m : m; |
283 | } | 315 | } |
@@ -375,5 +375,7 @@ router.get('/group/progress', auth, group.progress); // 拼团状态详情页 | @@ -375,5 +375,7 @@ router.get('/group/progress', auth, group.progress); // 拼团状态详情页 | ||
375 | router.get('/group/productData', group.productData); // 商品信息 | 375 | router.get('/group/productData', group.productData); // 商品信息 |
376 | router.get('/group/detail', group.goodsDetail); | 376 | router.get('/group/detail', group.goodsDetail); |
377 | router.get('/group/order', auth, group.order); // 我的拼团 | 377 | router.get('/group/order', auth, group.order); // 我的拼团 |
378 | +router.get('/group/delOrder', auth, group.delOrder); // 删除拼团订单 | ||
379 | +router.get('/group/cancelOrder', auth, group.cancelOrder); // 取消拼团订单 | ||
378 | 380 | ||
379 | module.exports = router; | 381 | module.exports = router; |
@@ -61,7 +61,7 @@ | @@ -61,7 +61,7 @@ | ||
61 | data-value="{{leftTime}}">{{formatLeftTime}}</span></div> | 61 | data-value="{{leftTime}}">{{formatLeftTime}}</span></div> |
62 | </div> | 62 | </div> |
63 | 63 | ||
64 | - <div class='ibutton'> | 64 | + <div class='ibutton' data-value="{{groupNo}}"> |
65 | 立即参团 | 65 | 立即参团 |
66 | </div> | 66 | </div> |
67 | </div> | 67 | </div> |
@@ -132,6 +132,7 @@ | @@ -132,6 +132,7 @@ | ||
132 | <div data-current="{{activityIdDetail.currentTime}}" | 132 | <div data-current="{{activityIdDetail.currentTime}}" |
133 | data-begin="{{activityIdDetail.beginTime}}" | 133 | data-begin="{{activityIdDetail.beginTime}}" |
134 | data-end="{{activityIdDetail.endTime}}" | 134 | data-end="{{activityIdDetail.endTime}}" |
135 | + id="date" | ||
135 | class="comp-count-dow-by-now"> | 136 | class="comp-count-dow-by-now"> |
136 | <span id="label"></span> | 137 | <span id="label"></span> |
137 | <span class="number" id="days"></span>天 | 138 | <span class="number" id="days"></span>天 |
@@ -141,16 +142,18 @@ | @@ -141,16 +142,18 @@ | ||
141 | </div> | 142 | </div> |
142 | {{/if}} | 143 | {{/if}} |
143 | </div> | 144 | </div> |
145 | + {{#unless groupNo}} | ||
144 | <div class='shoppint-cart-icon'> | 146 | <div class='shoppint-cart-icon'> |
145 | <img src="//img10.static.yhbimg.com/yhb-img01/2019/02/21/01/016b3f1cbc1b946fa0acbb1523f6386435.png" | 147 | <img src="//img10.static.yhbimg.com/yhb-img01/2019/02/21/01/016b3f1cbc1b946fa0acbb1523f6386435.png" |
146 | class="shoppint-cart-icon-image"/> | 148 | class="shoppint-cart-icon-image"/> |
147 | </div> | 149 | </div> |
150 | + {{/unless}} | ||
148 | {{#if isShowPop}} | 151 | {{#if isShowPop}} |
149 | - <div class='old-customer-tips'> | 152 | + <div class='old-customer-tips' id="isShowPop"> |
150 | <img style='width:100%;height:100%' src='/static/images/group/PT_tip@3x.png'/> | 153 | <img style='width:100%;height:100%' src='/static/images/group/PT_tip@3x.png'/> |
151 | </div> | 154 | </div> |
152 | {{/if}} | 155 | {{/if}} |
153 | - {{#if storage_sum }} | 156 | + {{#if storage_sum}} |
154 | <button class='shoppint-cart-add' | 157 | <button class='shoppint-cart-add' |
155 | bindtap="selfBuy" style='border-radius: 0;'> | 158 | bindtap="selfBuy" style='border-radius: 0;'> |
156 | {{#if groupNo}} | 159 | {{#if groupNo}} |
@@ -166,7 +169,7 @@ | @@ -166,7 +169,7 @@ | ||
166 | bindtap="buyAction"> | 169 | bindtap="buyAction"> |
167 | <span class="bottom-title">{{activityIdDetail.formatCollagePrice}}</span> | 170 | <span class="bottom-title">{{activityIdDetail.formatCollagePrice}}</span> |
168 | {{#if groupNo}} | 171 | {{#if groupNo}} |
169 | - <span class="bottom-title">确认参团{{#if activityIdDetail.joinLimit '==1'}},仅限新人{{/if}}</span> | 172 | + <span class="bottom-title">确认参团{{#if isShowPop}},仅限新人{{/if}}</span> |
170 | {{else}} | 173 | {{else}} |
171 | <div class="bottom-title">{{activityIdDetail.peopleNum}}人成团</div> | 174 | <div class="bottom-title">{{activityIdDetail.peopleNum}}人成团</div> |
172 | {{/if}} | 175 | {{/if}} |
@@ -191,7 +194,7 @@ | @@ -191,7 +194,7 @@ | ||
191 | {{#if preferenceUrl}} | 194 | {{#if preferenceUrl}} |
192 | <input id="preferenceUrl" type="hidden" value="{{preferenceUrl}}"> | 195 | <input id="preferenceUrl" type="hidden" value="{{preferenceUrl}}"> |
193 | {{/if}} | 196 | {{/if}} |
194 | - | 197 | + <input id="activityId" type="hidden" value="{{activityId}}"> |
195 | <input id="productSkn" type="hidden" value="{{productSkn}}"> | 198 | <input id="productSkn" type="hidden" value="{{productSkn}}"> |
196 | <input id="brand-id" type="hidden" value="{{brandId}}"> | 199 | <input id="brand-id" type="hidden" value="{{brandId}}"> |
197 | <input id="product-limit" type="hidden" value="{{isLimitBuy}}"> | 200 | <input id="product-limit" type="hidden" value="{{isLimitBuy}}"> |
1 | -<div class="group-order"> | 1 | +<div id="group-order" class="group-order" data-result={{result}}> |
2 | {{#if navs.length}} | 2 | {{#if navs.length}} |
3 | <div class="group-order-header"> | 3 | <div class="group-order-header"> |
4 | {{#each navs}} | 4 | {{#each navs}} |
@@ -13,7 +13,7 @@ | @@ -13,7 +13,7 @@ | ||
13 | {{#if result.order_list}} | 13 | {{#if result.order_list}} |
14 | <div class="group-order-list"> | 14 | <div class="group-order-list"> |
15 | {{#each result.order_list}} | 15 | {{#each result.order_list}} |
16 | - <div class="group-order-list-cell"> | 16 | + <div class="group-order-list-cell" data-id={{this.order_code}} data-select-index={{../selectIndex}}> |
17 | {{#ifcond @index '===' 0 }} | 17 | {{#ifcond @index '===' 0 }} |
18 | <div class="list-cell-no-top-header"> | 18 | <div class="list-cell-no-top-header"> |
19 | {{^}} | 19 | {{^}} |
@@ -50,18 +50,31 @@ | @@ -50,18 +50,31 @@ | ||
50 | <div class="list-cell-footer"> | 50 | <div class="list-cell-footer"> |
51 | <p class="buy-info">共{{this.buy_total}}件商品 实付<span class="sum-cost price-color">¥{{this.amount}}</span>(含运费¥{{this.shipping_cost}})</p> | 51 | <p class="buy-info">共{{this.buy_total}}件商品 实付<span class="sum-cost price-color">¥{{this.amount}}</span>(含运费¥{{this.shipping_cost}})</p> |
52 | <div class="links-array"> | 52 | <div class="links-array"> |
53 | - {{#each this.links}} | ||
54 | - {{#ifcond this '==' "buyNow" }} | ||
55 | - <div class="invite-btn">立即付款</div> | 53 | + {{#ifcond this.pay_lefttime '==' 0}} |
56 | {{^}} | 54 | {{^}} |
57 | - {{#ifcond this '==' "groupInvite" }} | ||
58 | - <div class="invite-btn">查看拼团详情</div> | ||
59 | - {{/ifcond}} | 55 | + <div class="links-time">剩余:<span class="left-time" |
56 | + data-value={{this.pay_lefttime}}>{{formatLeftTime}}</span> | ||
57 | + </div> | ||
60 | {{/ifcond}} | 58 | {{/ifcond}} |
59 | + <div class="links-link"> | ||
60 | + {{#each this.orderBtn}} | ||
61 | + {{#if this.closeOrder}} | ||
62 | + <a class="btn cancel" data-id={{this.order_code}}>取消订单</a> | ||
63 | + {{/if}} | ||
64 | + {{#if this.delOrder}} | ||
65 | + <a class="btn del" data-id={{this.order_code}}>删除订单</a> | ||
66 | + {{/if}} | ||
67 | + {{#if this.buyNow}} | ||
68 | + <a href={{this.link}} class="invite-btn">立即付款</a> | ||
69 | + {{/if}} | ||
70 | + {{#if this.groupInvite }} | ||
71 | + <a href={{this.link}} class="invite-btn">查看拼团详情</a> | ||
72 | + {{/if}} | ||
61 | {{/each}} | 73 | {{/each}} |
62 | </div> | 74 | </div> |
63 | </div> | 75 | </div> |
64 | </div> | 76 | </div> |
77 | + </div> | ||
65 | {{/each}} | 78 | {{/each}} |
66 | </div> | 79 | </div> |
67 | {{else}} | 80 | {{else}} |
@@ -52,13 +52,19 @@ class Detail extends Page { | @@ -52,13 +52,19 @@ class Detail extends Page { | ||
52 | lazyLoad($('img.lazy')); | 52 | lazyLoad($('img.lazy')); |
53 | this.selector = { | 53 | this.selector = { |
54 | introUrl: $('#introUrl'), | 54 | introUrl: $('#introUrl'), |
55 | - productDesc: $('#productDesc') | ||
56 | - | 55 | + productDesc: $('#productDesc'), |
56 | + $date: $('#date'), | ||
57 | + $days: $('#days'), | ||
58 | + $hours: $('#hours'), | ||
59 | + $minutes: $('#minutes'), | ||
60 | + $seconds: $('#seconds'), | ||
61 | + $label: $('#label') | ||
57 | }; | 62 | }; |
58 | this.getIntro(); | 63 | this.getIntro(); |
59 | this.goSwiper(); | 64 | this.goSwiper(); |
60 | this.toTop(); | 65 | this.toTop(); |
61 | this.startTimer(); | 66 | this.startTimer(); |
67 | + this.actTimer(); | ||
62 | } | 68 | } |
63 | 69 | ||
64 | getIntro() { | 70 | getIntro() { |
@@ -188,8 +194,37 @@ class Detail extends Page { | @@ -188,8 +194,37 @@ class Detail extends Page { | ||
188 | }, 1000); | 194 | }, 1000); |
189 | } | 195 | } |
190 | 196 | ||
191 | - stopTimer() { | ||
192 | - clearInterval(timer); | 197 | + actTimer() { |
198 | + let date = this.selector.$date[0]; | ||
199 | + const current = Number(date.getAttribute('data-current')); | ||
200 | + const begin = Number(date.getAttribute('data-begin')); | ||
201 | + const end = Number(date.getAttribute('data-end')); | ||
202 | + let label; | ||
203 | + let diff = Math.abs(begin - current > 0 ? begin - current : end - current); | ||
204 | + | ||
205 | + if (current && begin && end) { | ||
206 | + label = begin - current > 0 ? '距拼团开始还剩:' : '距拼团结束还剩:'; | ||
207 | + } | ||
208 | + console.log(this.selector.$label); | ||
209 | + this.selector.$label[0].innerText = label; | ||
210 | + let time = setInterval(() => { | ||
211 | + let days = Math.floor(diff / (24 * 3600)); | ||
212 | + let leave1 = diff % (24 * 3600); | ||
213 | + let hours = Math.floor(leave1 / (3600)); | ||
214 | + let leave2 = leave1 % 3600; | ||
215 | + let minutes = Math.floor(leave2 / 60); | ||
216 | + let seconds = leave2 % 60; | ||
217 | + | ||
218 | + this.selector.$days[0].innerText = days; | ||
219 | + this.selector.$hours[0].innerText = hours; | ||
220 | + this.selector.$minutes[0].innerText = minutes; | ||
221 | + this.selector.$seconds[0].innerText = seconds; | ||
222 | + --diff; | ||
223 | + if (diff < 0) { | ||
224 | + clearInterval(time); | ||
225 | + window.reload(); | ||
226 | + } | ||
227 | + }, 1000); | ||
193 | } | 228 | } |
194 | } | 229 | } |
195 | $(() => { | 230 | $(() => { |
1 | import 'scss/activity/group/group-order.page.scss'; | 1 | import 'scss/activity/group/group-order.page.scss'; |
2 | +import $ from 'yoho-jquery'; | ||
3 | +import Page from 'js/yoho-page'; | ||
4 | +const dialog = require('js/plugin/dialog'), | ||
5 | + tip = require('js/plugin/tip'); | ||
6 | + | ||
7 | + | ||
8 | +function add0(m) { | ||
9 | + return m < 10 ? '0' + m : m; | ||
10 | +} | ||
11 | + | ||
12 | +function formatDate(shijianchuo) { | ||
13 | + // 秒数 | ||
14 | + let second = Math.floor(shijianchuo); | ||
15 | + | ||
16 | + // 小时位 | ||
17 | + let hr = Math.floor(second / 3600); | ||
18 | + | ||
19 | + // 分钟位 | ||
20 | + let min = Math.floor((second - hr * 3600) / 60); | ||
21 | + | ||
22 | + // 秒位 | ||
23 | + let sec = (second - hr * 3600 - min * 60); | ||
24 | + | ||
25 | + return add0(hr) + ':' + add0(min) + ':' + add0(sec); | ||
26 | +} | ||
27 | + | ||
28 | +let timer; | ||
29 | + | ||
30 | +class GroupOrder extends Page { | ||
31 | + constructor() { | ||
32 | + super(); | ||
33 | + this.selector = { | ||
34 | + $cancel: $('.cancel'), | ||
35 | + $del: $('.del'), | ||
36 | + $page: $('.group-order') | ||
37 | + }; | ||
38 | + | ||
39 | + this.data = { | ||
40 | + | ||
41 | + }; | ||
42 | + | ||
43 | + this.init(); | ||
44 | + this.startTimer(); | ||
45 | + } | ||
46 | + | ||
47 | + init() { | ||
48 | + this.initData(); | ||
49 | + } | ||
50 | + | ||
51 | + initData() { | ||
52 | + let result = this.selector.$page.data('result'); | ||
53 | + | ||
54 | + this.data.result = result; | ||
55 | + | ||
56 | + } | ||
57 | + | ||
58 | + startTimer() { | ||
59 | + let list = []; | ||
60 | + let activityGroupDetailList = document.querySelectorAll('.left-time'); | ||
61 | + | ||
62 | + for (let item of activityGroupDetailList) { | ||
63 | + list.push(item.getAttribute('data-value')); | ||
64 | + } | ||
65 | + for (let i = 0; i < activityGroupDetailList.length; i++) { | ||
66 | + list[i] = Number(list[i]) - 1; | ||
67 | + if (list[i]) { | ||
68 | + activityGroupDetailList[i].innerText = formatDate(list[i]); | ||
69 | + } | ||
70 | + } | ||
71 | + timer = setInterval(function() { | ||
72 | + for (let i = 0; i < activityGroupDetailList.length; i++) { | ||
73 | + list[i] = Number(list[i]) - 1; | ||
74 | + if (list[i]) { | ||
75 | + activityGroupDetailList[i].innerText = formatDate(list[i]); | ||
76 | + } else { | ||
77 | + clearInterval(timer); | ||
78 | + window.location.reload(); | ||
79 | + } | ||
80 | + } | ||
81 | + }, 1000); | ||
82 | + } | ||
83 | + | ||
84 | + stopTimer() { | ||
85 | + clearInterval(timer); | ||
86 | + } | ||
87 | +} | ||
88 | + | ||
89 | +$('#group-order').on('click', function(e) { | ||
90 | + let $cur = $(e.target), | ||
91 | + $order, | ||
92 | + id, | ||
93 | + selectIndex; | ||
94 | + | ||
95 | + if ($cur.closest('.locHref').length > 0) { | ||
96 | + return; | ||
97 | + } | ||
98 | + | ||
99 | + $order = $cur.closest('.group-order-list-cell'); | ||
100 | + id = $order.data('id'); | ||
101 | + selectIndex = $order.data('selectIndex'); | ||
102 | + console.log(selectIndex); | ||
103 | + | ||
104 | + // $reaMask.data('orderId', id); | ||
105 | + // $refundReaMask.data('orderId', id); | ||
106 | + | ||
107 | + if ($cur.closest('.del').length > 0) { | ||
108 | + | ||
109 | + // Order delete | ||
110 | + dialog.showDialog({ | ||
111 | + dialogText: '确认删除该订单吗?删除了的订单不可恢复!', | ||
112 | + hasFooter: { | ||
113 | + leftBtnText: '取消', | ||
114 | + rightBtnText: '确定' | ||
115 | + } | ||
116 | + }, function() { | ||
117 | + $.ajax({ | ||
118 | + type: 'GET', | ||
119 | + url: '/activity/group/delOrder', | ||
120 | + data: { | ||
121 | + id: id | ||
122 | + }, | ||
123 | + success: function(data) { | ||
124 | + dialog.hideDialog(); | ||
125 | + if (data.message) { | ||
126 | + tip.show(data.message); | ||
127 | + } | ||
128 | + if (data.code === 200) { | ||
129 | + | ||
130 | + // 删除订单页面刷新 | ||
131 | + window.location.reload(); | ||
132 | + } | ||
133 | + }, | ||
134 | + error: function() { | ||
135 | + tip.show('删除订单失败'); | ||
136 | + } | ||
137 | + }); | ||
138 | + }); | ||
139 | + } else if ($cur.closest('.cancel').length > 0) { | ||
140 | + // 取消订单 | ||
141 | + dialog.showDialog({ | ||
142 | + dialogText: selectIndex === 1 ? '确认取消该订单吗?' : '确认申请退货该订单吗?', | ||
143 | + hasFooter: { | ||
144 | + leftBtnText: '返回', | ||
145 | + rightBtnText: selectIndex === 1 ? '取消订单' : '申请退款' | ||
146 | + } | ||
147 | + }, function() { | ||
148 | + $.ajax({ | ||
149 | + type: 'GET', | ||
150 | + url: '/activity/group/cancelOrder', | ||
151 | + data: { | ||
152 | + id: id | ||
153 | + }, | ||
154 | + success: function(data) { | ||
155 | + dialog.hideDialog(); | ||
156 | + if (data.message) { | ||
157 | + tip.show(data.message); | ||
158 | + } | ||
159 | + if (data.code === 200) { | ||
160 | + | ||
161 | + // 删除订单页面刷新 | ||
162 | + window.location.reload(); | ||
163 | + } | ||
164 | + }, | ||
165 | + error: function() { | ||
166 | + tip.show('取消订单失败'); | ||
167 | + } | ||
168 | + }); | ||
169 | + | ||
170 | + // $reaMask.css('visibility', 'visible'); | ||
171 | + }); | ||
172 | + } | ||
173 | +}); | ||
174 | + | ||
175 | +$(() => { | ||
176 | + new GroupOrder(); | ||
177 | +}); |
@@ -292,6 +292,7 @@ | @@ -292,6 +292,7 @@ | ||
292 | 292 | ||
293 | .shoppint-cart-add { | 293 | .shoppint-cart-add { |
294 | flex: 1; | 294 | flex: 1; |
295 | + align-items: center; | ||
295 | border-radius: 0; | 296 | border-radius: 0; |
296 | background-color: #444; | 297 | background-color: #444; |
297 | vertical-align: center; | 298 | vertical-align: center; |
@@ -319,6 +320,7 @@ | @@ -319,6 +320,7 @@ | ||
319 | 320 | ||
320 | .buynow { | 321 | .buynow { |
321 | flex: 1; | 322 | flex: 1; |
323 | + align-items: center; | ||
322 | vertical-align: center; | 324 | vertical-align: center; |
323 | justify-content: center; | 325 | justify-content: center; |
324 | background-color: #d0021b; | 326 | background-color: #d0021b; |
@@ -138,10 +138,22 @@ | @@ -138,10 +138,22 @@ | ||
138 | .links-array { | 138 | .links-array { |
139 | display: flex; | 139 | display: flex; |
140 | flex-direction: row; | 140 | flex-direction: row; |
141 | - justify-content: flex-end; | 141 | + align-items: center; |
142 | padding: 27px; | 142 | padding: 27px; |
143 | border-bottom: 1px solid #e0e0e0; | 143 | border-bottom: 1px solid #e0e0e0; |
144 | 144 | ||
145 | + .links-link { | ||
146 | + flex-grow: 1; | ||
147 | + display: flex; | ||
148 | + flex-direction: row; | ||
149 | + justify-content: flex-end; | ||
150 | + align-items: center; | ||
151 | + } | ||
152 | + | ||
153 | + .links-time { | ||
154 | + width: 200px; | ||
155 | + } | ||
156 | + | ||
145 | .invite-btn { | 157 | .invite-btn { |
146 | border-radius: 10px; | 158 | border-radius: 10px; |
147 | height: 54px; | 159 | height: 54px; |
@@ -155,6 +167,18 @@ | @@ -155,6 +167,18 @@ | ||
155 | margin-left: 10px; | 167 | margin-left: 10px; |
156 | padding: 0 8px 0 8px; | 168 | padding: 0 8px 0 8px; |
157 | } | 169 | } |
170 | + | ||
171 | + .btn { | ||
172 | + display: inline-block; | ||
173 | + box-sizing: border-box; | ||
174 | + height: 54px; | ||
175 | + line-height: 54px; | ||
176 | + font-size: 25px; | ||
177 | + text-align: center; | ||
178 | + border: 1px solid #000; | ||
179 | + border-radius: 10px; | ||
180 | + padding: 0 8px 0 8px; | ||
181 | + } | ||
158 | } | 182 | } |
159 | 183 | ||
160 | .info-title-color { | 184 | .info-title-color { |
-
Please register or login to post a comment