outlets.js 9.83 KB
/**
 * 商品促销controller
 * @author: yyq<yanqing.yang@yoho.cn>
 * @date: 2016/5/19
 */

'use strict';

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

// 开发用模拟数据
const outletsSimulation = require('../models/simulation');

/**
 * outlets 首页
 * @param  {[type]} req [description]
 * @param  {[type]} res [description]
 * @return {[type]}     [description]
 */
exports.index = (req, res) => {
    let data = {};

    data.module = 'product';
    data.page = 'outlets';
    data.footerTop = true;
    data.devEnv = true;

    data.banner = [
        {
            href: '#',
            img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/25/09/01ee927cf2bec307e50dbc437141665090.jpg?imageView2/1/w/{width}/h/{height}'
        },
        {
            href: '#',
            img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/25/09/01ee927cf2bec307e50dbc437141665090.jpg?imageView2/1/w/{width}/h/{height}'
        },
        {
            href: '#',
            img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/25/09/01ee927cf2bec307e50dbc437141665090.jpg?imageView2/1/w/{width}/h/{height}'
        }
    ];

    data.column = [
        {
            href: '#',
            img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/25/09/01ee927cf2bec307e50dbc437141665090.jpg?imageView2/1/w/{width}/h/{height}'
        },
        {
            href: '#',
            img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/25/09/01ee927cf2bec307e50dbc437141665090.jpg?imageView2/1/w/{width}/h/{height}'
        },
        {
            href: '#',
            img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/25/09/01ee927cf2bec307e50dbc437141665090.jpg?imageView2/1/w/{width}/h/{height}'
        }
    ];

    data.limitedBuy = {
        name: '限时嗨购',
        topic: [
            {
                href: '#',
                img: 'http://img11.static.yhbimg.com/yhb-img01/2016/05/25/11/01d71a4867ac110b1894504da65b5cf596.jpg?imageView2/1/w/{width}/h/{height}',
                logo: 'http://img10.static.yhbimg.com/brandLogo/2012/08/02/15/0119ad6a2407f5505268688a470d6f6c13.jpg',
                discount: '7.5',
                title: '多元化潮流风格',
                limit: '1500'
            },
            {
                href: '#',
                img: 'http://img11.static.yhbimg.com/yhb-img01/2016/05/25/11/01d71a4867ac110b1894504da65b5cf596.jpg?imageView2/1/w/{width}/h/{height}',
                logo: 'http://img10.static.yhbimg.com/brandLogo/2012/08/02/15/0119ad6a2407f5505268688a470d6f6c13.jpg',
                discount: '7.5',
                title: '多元化潮流风格',
                limit: '1500'
            },
            {
                href: '#',
                img: 'http://img11.static.yhbimg.com/yhb-img01/2016/05/25/11/01d71a4867ac110b1894504da65b5cf596.jpg?imageView2/1/w/{width}/h/{height}',
                logo: 'http://img10.static.yhbimg.com/brandLogo/2012/08/02/15/0119ad6a2407f5505268688a470d6f6c13.jpg',
                discount: '7.5',
                title: '多元化潮流风格',
                limit: '1500'
            }
        ],
        extra: {
            sourceImg: {
                href: '#',
                img: 'http://img12.static.yhbimg.com/yhb-img01/2016/04/13/01/023d062b8384103df7a8dfada98afaf204.jpg?imageView2/1/w/{width}/h/{height}'
            },
            hotType: {
                title: '热销推荐',
                classify: [
                    {
                        href: '#',
                        name: '上衣'
                    },
                    {
                        href: '#',
                        name: 'T恤'
                    },
                    {
                        href: '#',
                        name: '裤子'
                    }
                ]
            },
            trendGood: {
                title: '潮品推荐',
                goods: [
                    {
                        href: '#',
                        img: 'http://img13.static.yhbimg.com/goodsimg/2015/08/04/10/02129fcc058455de1615ce770d3a4555a6.jpg?imageView/1/w/{width}/h/{height}',
                        name: 'Life·After Life 像素风sneaker印花长袖衬衫',
                        market: '¥260',
                        sale: '¥203',
                        discount: '2'
                    },
                    {
                        href: '#',
                        img: 'http://img13.static.yhbimg.com/goodsimg/2015/08/04/10/02129fcc058455de1615ce770d3a4555a6.jpg?imageView/1/w/{width}/h/{height}',
                        name: 'Life·After Life 像素风sneaker印花长袖衬衫',
                        market: '¥260',
                        sale: '¥203',
                        discount: '2'
                    },
                    {
                        href: '#',
                        img: 'http://img13.static.yhbimg.com/goodsimg/2015/08/04/10/02129fcc058455de1615ce770d3a4555a6.jpg?imageView/1/w/{width}/h/{height}',
                        name: 'Life·After Life 像素风sneaker印花长袖衬衫',
                        market: '¥260',
                        sale: '¥203',
                        discount: '2'
                    },
                    {
                        href: '#',
                        img: 'http://img13.static.yhbimg.com/goodsimg/2015/08/04/10/02129fcc058455de1615ce770d3a4555a6.jpg?imageView/1/w/{width}/h/{height}',
                        name: 'Life·After Life 像素风sneaker印花长袖衬衫',
                        market: '¥260',
                        sale: '¥203',
                        discount: '2'
                    }
                ]
            }
        }
    };

    data.nearOver = {
        name: '即将结束',
        topic: [
            {
                href: '#',
                img: 'http://img12.static.yhbimg.com/yhb-img01/2016/02/05/08/02bb2c8efb12319cf50f247bae13d60dde.jpg?imageView/1/w/{width}/h/{height}',
                logo: 'http://img10.static.yhbimg.com/brandLogo/2012/08/02/15/0119ad6a2407f5505268688a470d6f6c13.jpg',
                discount: '7.5',
                title: '多元化潮流风格',
                limit: '1500'
            },
            {
                href: '#',
                img: 'http://img12.static.yhbimg.com/yhb-img01/2016/02/05/08/02bb2c8efb12319cf50f247bae13d60dde.jpg?imageView/1/w/{width}/h/{height}',
                logo: 'http://img10.static.yhbimg.com/brandLogo/2012/08/02/15/0119ad6a2407f5505268688a470d6f6c13.jpg',
                discount: '7.5',
                title: '多元化潮流风格',
                limit: '1500'
            },
            {
                href: '#',
                img: 'http://img12.static.yhbimg.com/yhb-img01/2016/02/05/08/02bb2c8efb12319cf50f247bae13d60dde.jpg?imageView/1/w/{width}/h/{height}',
                logo: 'http://img10.static.yhbimg.com/brandLogo/2012/08/02/15/0119ad6a2407f5505268688a470d6f6c13.jpg',
                discount: '7.5',
                title: '多元化潮流风格',
                limit: '1500'
            },
            {
                href: '#',
                img: 'http://img12.static.yhbimg.com/yhb-img01/2016/02/05/08/02bb2c8efb12319cf50f247bae13d60dde.jpg?imageView/1/w/{width}/h/{height}',
                logo: 'http://img10.static.yhbimg.com/brandLogo/2012/08/02/15/0119ad6a2407f5505268688a470d6f6c13.jpg',
                discount: '7.5',
                title: '多元化潮流风格',
                limit: '1500'
            }
        ]
    };

    data.goodsBoard = {
        goodsMenu: {
            title: '最新折扣',
            menuList: [
                {
                    name: 'T恤',
                    href: '#',
                    cur: true
                },
                {
                    name: '衬衫',
                    href: '#'
                },
                {
                    name: '休闲裤',
                    href: '#'
                },
                {
                    name: '连衣裙',
                    href: '#'
                }
            ],
            more: '#'
        },
        sort: {
            sortType: [
                {
                    name: '最新',
                    active: true,
                    href: '',
                    hasSortOrient: true
                }
            ]
        },
        list: [
            {
                href: '#',
                img: 'http://img12.static.yhbimg.com/yhb-img01/2016/02/05/08/02bb2c8efb12319cf50f247bae13d60dde.jpg?imageView/1/w/{width}/h/{height}',
                logo: 'http://img10.static.yhbimg.com/brandLogo/2012/08/02/15/0119ad6a2407f5505268688a470d6f6c13.jpg',
                price: '¥340',
                discount: '7.5',
                title: '多元化潮流风格'
            },
            {
                href: '#',
                img: 'http://img12.static.yhbimg.com/yhb-img01/2016/02/05/08/02bb2c8efb12319cf50f247bae13d60dde.jpg?imageView/1/w/{width}/h/{height}',
                logo: 'http://img10.static.yhbimg.com/brandLogo/2012/08/02/15/0119ad6a2407f5505268688a470d6f6c13.jpg',
                price: '¥340',
                discount: '7.5',
                title: '多元化潮流风格'
            }
        ]
    };
    res.render('outlets/index', data);
};

/**
 * outlets 频道页
 * @param  {[type]} req [description]
 * @param  {[type]} res [description]
 * @return {[type]}     [description]
 */
exports.channel = (req, res) => {
    let channel = {
        boys: 'true',
        girls: 'true',
        kids: '',
        lifestyle: ''
    };
    let response = {
        module: 'product',
        page: 'outlets',
        footerTop: true,
        devEnv: true
    };

    if (!channel[req.params.channel]) {
        response.pageErr = true;
    }

    // 假数据输出
    res.render('outlets/channel', Object.assign(response, outletsSimulation.outletBanner()));

    // res.render('outlets/channel', response);
};