Authored by zzzzzzz

优惠券页面

'use strict';
const headerModel = require('../../../doraemon/models/header'); // 头部model
const index = (req, res) => {
res.render('coupons', {
module: 'home',
page: 'coupons',
pageHeader: headerModel.setNav({
navTitle: '优惠券'
}),
title: '优惠券',
pageFooter: true,
});
};
const couponData = (req, res) => {
};
module.exports = {
index,
couponData
};
... ...
... ... @@ -17,6 +17,7 @@ const favorite = require(`${cRoot}/favorite`);
const orderController = require(`${cRoot}/order`);
const orderDetailController = require(`${cRoot}/orderDetail`);
const currencyController = require(`${cRoot}/myCurrency`);
const coupons = require(`${cRoot}/coupons`);
// const myDetail = require(`${cRoot}/myDetail);
... ... @@ -63,4 +64,8 @@ router.get('/favBrand', favorite.favfavBrand);
// 取消收藏
router.post('/favoriteDel', favorite.favoriteDelete);
// 优惠券
router.get('/coupons', coupons.index);
router.post('/couponData', coupons.couponData);
module.exports = router;
... ...
<div class="yoho-page my-coupon-page">
<div class="employ">
<span class="active">未使用</span>
<span>已使用</span>
</div>
<div id="employ" class="coupon-list"></div>
</div>
\ No newline at end of file
... ...
var $ = require('yoho-jquery'),
Hammer = require('yoho-hammer'),
ellipsis = require('yoho-mlellipsis'),
loading = require('../plugin/loading');
var employ,
statu = 0,
page = 1;
ellipsis.init();
function couponAJAX(statu, page) {
return;
loading.showLoadingMask();
$.ajax({
type: 'POST',
url: '/home/couponData',
dataType: 'html',
data: {
status: statu,
page: page
},
success: function(data) {
$('#employ').append(data);
window.rePosFooter();
loading.hideLoadingMask();
}
});
}
$('.yoho-footer').css('border-top', '1px solid #e0e0e0');
$('.employ span').each(function(index) {
employ = new Hammer($('.employ span')[index]);
employ.on('tap', function(e) {
$('.employ span').removeClass('active').eq(index).addClass('active');
$('#employ').html(' ');
statu = index;
page = 1;
couponAJAX(statu, page);
window.rePosFooter();
});
});
function scrollHandler() {
if ($(window).scrollTop() + $(window).height() > $('body').height() - 100) {
page++;
couponAJAX(statu, page);
return;
}
}
$(window).scroll(function() {
window.requestAnimationFrame(scrollHandler);
});
couponAJAX(statu, page);
... ...
... ... @@ -2,3 +2,4 @@
@import "favorite";
@import "address/index";
@import "favorite";
@import "coupons";
... ...
... ... @@ -2,7 +2,6 @@
@import "vip-grade";
@import "order";
@import "order-detail";
@import "coupons";
@import "personal-details";
@import "yoho-coin";
@import "fav";
... ...