brand.js 1.61 KB
/**
 * Created by PhpStorm.
 * User: Targaryen
 * Date: 2016/7/19
 * Time: 10:03
 */
'use strict';

// const _ = require('lodash');
// const helpers = global.yoho.helpers;
const mRoot = '../models';
const brandModel = require(`${mRoot}/brand`);

/**
 * 品牌,品类,店铺相关页面
 */
module.exports = {

    /* 品牌店铺页面 */
    index: (req, res) => {
        res.render('brand/index', {
            module: 'channel',
            page: 'brand'
        });
    },

    /* 获取品牌介绍 */
    getBrandIntro: (req, res) => {
        brandModel.getBrandData({
            shopId: '323',
            uid: req.user.uid
        }).then(result => {
            res.json(result);
        });
    },

    /* 获取商品列表 */
    getBrandShopGoods: (req, res) => {
        let params = req.query;

        brandModel.getBrandShopGoodsData(params).then(result => {
            res.json(result);
        });
    },

    /* 品牌列表页 */
    brandList: (req, res) => {

        res.render('brand/brand-list', {
            module: 'channel',
            page: 'brand-list'
        });
    },

    getBrandList: (req, res) => {

        brandModel.getBrandListData({
            channel: req.query.channel || req.cookies._Channel || 'men'
        }).then(result => {
            res.json(result);
        });
    },

    /* 全部分类 */
    cate: (req, res) => {
        let params = req.query;

        brandModel.getCateListData(params).then(result => {
            res.render('brand/cate', {
                module: 'channel',
                page: 'cate',
                result: result
            });
        });
    }
};