Showing
8 changed files
with
92 additions
and
1 deletions
apps/home/controllers/coupons.js
0 → 100644
1 | +'use strict'; | ||
2 | +const headerModel = require('../../../doraemon/models/header'); // 头部model | ||
3 | + | ||
4 | +const index = (req, res) => { | ||
5 | + res.render('coupons', { | ||
6 | + module: 'home', | ||
7 | + page: 'coupons', | ||
8 | + pageHeader: headerModel.setNav({ | ||
9 | + navTitle: '优惠券' | ||
10 | + }), | ||
11 | + title: '优惠券', | ||
12 | + pageFooter: true, | ||
13 | + }); | ||
14 | +}; | ||
15 | + | ||
16 | +const couponData = (req, res) => { | ||
17 | +}; | ||
18 | + | ||
19 | +module.exports = { | ||
20 | + index, | ||
21 | + couponData | ||
22 | +}; |
apps/home/models/coupons.js
0 → 100644
@@ -17,6 +17,7 @@ const favorite = require(`${cRoot}/favorite`); | @@ -17,6 +17,7 @@ const favorite = require(`${cRoot}/favorite`); | ||
17 | const orderController = require(`${cRoot}/order`); | 17 | const orderController = require(`${cRoot}/order`); |
18 | const orderDetailController = require(`${cRoot}/orderDetail`); | 18 | const orderDetailController = require(`${cRoot}/orderDetail`); |
19 | const currencyController = require(`${cRoot}/myCurrency`); | 19 | const currencyController = require(`${cRoot}/myCurrency`); |
20 | +const coupons = require(`${cRoot}/coupons`); | ||
20 | 21 | ||
21 | // const myDetail = require(`${cRoot}/myDetail); | 22 | // const myDetail = require(`${cRoot}/myDetail); |
22 | 23 | ||
@@ -63,4 +64,8 @@ router.get('/favBrand', favorite.favfavBrand); | @@ -63,4 +64,8 @@ router.get('/favBrand', favorite.favfavBrand); | ||
63 | // 取消收藏 | 64 | // 取消收藏 |
64 | router.post('/favoriteDel', favorite.favoriteDelete); | 65 | router.post('/favoriteDel', favorite.favoriteDelete); |
65 | 66 | ||
67 | +// 优惠券 | ||
68 | +router.get('/coupons', coupons.index); | ||
69 | +router.post('/couponData', coupons.couponData); | ||
70 | + | ||
66 | module.exports = router; | 71 | module.exports = router; |
apps/home/views/action/coupons.hbs
0 → 100644
public/js/home/coupons.page.js
0 → 100644
1 | +var $ = require('yoho-jquery'), | ||
2 | + Hammer = require('yoho-hammer'), | ||
3 | + ellipsis = require('yoho-mlellipsis'), | ||
4 | + loading = require('../plugin/loading'); | ||
5 | + | ||
6 | +var employ, | ||
7 | + statu = 0, | ||
8 | + page = 1; | ||
9 | + | ||
10 | +ellipsis.init(); | ||
11 | + | ||
12 | +function couponAJAX(statu, page) { | ||
13 | + return; | ||
14 | + loading.showLoadingMask(); | ||
15 | + $.ajax({ | ||
16 | + type: 'POST', | ||
17 | + url: '/home/couponData', | ||
18 | + dataType: 'html', | ||
19 | + data: { | ||
20 | + status: statu, | ||
21 | + page: page | ||
22 | + }, | ||
23 | + success: function(data) { | ||
24 | + $('#employ').append(data); | ||
25 | + window.rePosFooter(); | ||
26 | + loading.hideLoadingMask(); | ||
27 | + } | ||
28 | + }); | ||
29 | +} | ||
30 | + | ||
31 | +$('.yoho-footer').css('border-top', '1px solid #e0e0e0'); | ||
32 | +$('.employ span').each(function(index) { | ||
33 | + employ = new Hammer($('.employ span')[index]); | ||
34 | + employ.on('tap', function(e) { | ||
35 | + $('.employ span').removeClass('active').eq(index).addClass('active'); | ||
36 | + $('#employ').html(' '); | ||
37 | + statu = index; | ||
38 | + page = 1; | ||
39 | + couponAJAX(statu, page); | ||
40 | + window.rePosFooter(); | ||
41 | + }); | ||
42 | +}); | ||
43 | + | ||
44 | + | ||
45 | +function scrollHandler() { | ||
46 | + if ($(window).scrollTop() + $(window).height() > $('body').height() - 100) { | ||
47 | + page++; | ||
48 | + couponAJAX(statu, page); | ||
49 | + return; | ||
50 | + } | ||
51 | +} | ||
52 | + | ||
53 | +$(window).scroll(function() { | ||
54 | + window.requestAnimationFrame(scrollHandler); | ||
55 | +}); | ||
56 | + | ||
57 | +couponAJAX(statu, page); |
@@ -2,7 +2,6 @@ | @@ -2,7 +2,6 @@ | ||
2 | @import "vip-grade"; | 2 | @import "vip-grade"; |
3 | @import "order"; | 3 | @import "order"; |
4 | @import "order-detail"; | 4 | @import "order-detail"; |
5 | -@import "coupons"; | ||
6 | @import "personal-details"; | 5 | @import "personal-details"; |
7 | @import "yoho-coin"; | 6 | @import "yoho-coin"; |
8 | @import "fav"; | 7 | @import "fav"; |
-
Please register or login to post a comment