Blame view

apps/product/controllers/outlets.js 10.1 KB
yyq authored
1 2 3 4 5 6 7 8
/**
 * 商品促销controller
 * @author: yyq<yanqing.yang@yoho.cn>
 * @date: 2016/5/19
 */

'use strict';
周少峰 authored
9 10
const headerModel = require('../../../doraemon/models/header');
const outlets = require('../models/outlets');
yyq authored
11
张丽霞 authored
12 13 14
// 开发用模拟数据
const outletsSimulation = require('../models/simulation');
yyq authored
15 16 17 18 19 20 21
/**
 * outlets 首页
 * @param  {[type]} req [description]
 * @param  {[type]} res [description]
 * @return {[type]}     [description]
 */
exports.index = (req, res) => {
yyq authored
22 23 24 25 26 27 28
    let data = {};

    data.module = 'product';
    data.page = 'outlets';
    data.footerTop = true;
    data.devEnv = true;
yyq authored
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
    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}',
yyq authored
65
                logo: 'http://img10.static.yhbimg.com/brandLogo/2012/08/02/15/0119ad6a2407f5505268688a470d6f6c13.jpg',
yyq authored
66 67 68 69 70 71 72
                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}',
yyq authored
73
                logo: 'http://img10.static.yhbimg.com/brandLogo/2012/08/02/15/0119ad6a2407f5505268688a470d6f6c13.jpg',
yyq authored
74 75 76 77 78 79 80
                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}',
yyq authored
81
                logo: 'http://img10.static.yhbimg.com/brandLogo/2012/08/02/15/0119ad6a2407f5505268688a470d6f6c13.jpg',
yyq authored
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
                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: '裤子'
                    }
yyq authored
107
                ]
yyq authored
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151
            },
            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: [
yyq authored
152 153
            {
                href: '#',
yyq authored
154 155 156 157 158
                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'
yyq authored
159 160
            },
            {
yyq authored
161 162 163 164 165 166
                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'
yyq authored
167 168
            },
            {
yyq authored
169 170 171 172 173 174
                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'
yyq authored
175 176
            },
            {
yyq authored
177 178 179 180 181 182
                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'
yyq authored
183
            }
yyq authored
184
        ]
yyq authored
185 186
    };
yyq authored
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221
    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: [
yyq authored
222
            {
yyq authored
223 224 225 226 227 228 229 230 231 232 233 234 235 236
                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: '多元化潮流风格'
yyq authored
237 238 239 240
            }
        ]
    };
    res.render('outlets/index', data);
yyq authored
241 242 243 244 245 246 247 248 249
};

/**
 * outlets 频道页
 * @param  {[type]} req [description]
 * @param  {[type]} res [description]
 * @return {[type]}     [description]
 */
exports.channel = (req, res) => {
周少峰 authored
250
yyq authored
251
    let channel = {
张丽霞 authored
252 253
        boys: 'true',
        girls: 'true',
周少峰 authored
254
        kids: 'true',
yyq authored
255 256
        lifestyle: ''
    };
周少峰 authored
257
张丽霞 authored
258 259 260 261 262 263
    let response = {
        module: 'product',
        page: 'outlets',
        footerTop: true,
        devEnv: true
    };
周少峰 authored
264
    //错误页面
yyq authored
265 266 267
    if (!channel[req.params.channel]) {
        response.pageErr = true;
    }
周少峰 authored
268
    console.log(req.params.channel);
张丽霞 authored
269
    // 假数据输出
周少峰 authored
270 271 272 273
    // res.render('outlets/channel', Object.assign(response, outletsSimulation.outletBanner()));
    // outlets.getOutletsChannelData().then();
    //输出数据
    res.render('outlets/channel', Object.assign(response, outlets.getOutletsChannelData({'channel':req.params.channel})));
张丽霞 authored
274 275

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