seckill.js 2.03 KB
/**
 * 秒杀页面
 * @author: 陈峰<feng.chen@yoho.cn>
 * @date: 2016/09/08
 */

'use strict';
const headerModel = require('../../../doraemon/models/header');


/**
 * [秒杀列表页面]
 */
const _index = (req, res, next) => {
	let headerData = headerModel.setNav({
        navTitle: '秒杀活动',
        navBtn: true,

    });
    let result = {
        products: [{
            id: 1,
            now: true
        },{
            id: 2,
            wait: true
        },{
            id: 1,
            over: true
        },{
            id: 1,
            chance: true
        }],
        navs: [{
            day: '2016/09/1',
            time: '12:00',
            over: true
        }, {
            day: '2016/09/1',
            time: '12:00',
            over: true
        }, {
            day: '2016/09/2',
            time: '12:00',
            over: true
        }, {
            day: '2016/09/2',
            time: '12:00',
            over: true
        }, {
            day: '2016/09/09',
            time: '12:00',
            over: true
        }, {
            day: '2016/09/12',
            time: '10:40',
            now: true
        }, {
            day: '2016/09/12',
            time: '10:50',
            wait: true
        }, {
            day: '2016/09/12',
            time: '11:00',
            wait: true
        }, {
            day: '2016/09/12',
            time: '11:10',
            last: true,
            wait: true
        }]
    };
    var hbsHelper = {
        helpers: {
            statusClass: (nav) => {
                if (nav.over) {
                    return 'over';
                } else if(nav.now) {
                    return 'now';
                } else if(nav.wait) {
                    return 'wait';
                } else {
                    return '';
                }
            }
        }
        
    }

    res.render('seckill', Object.assign({
    	pageHeader: headerData,
    	pageFooter: true,
    	width750: true,
        times: 12
    }, result, hbsHelper));
}

module.exports = {
	index: _index
}