Authored by yyq

Merge branch 'feature/sale' of http://git.dev.yoho.cn/web/yohobuy-node into feature/sale

... ... @@ -10,9 +10,7 @@ const headerModel = require('../../../doraemon/models/header');
const mRoot = '../models';
// sale 页 model
// const sale = require(`${mRoot}/sale`);
// const saleDiscount = require(`${mRoot}/sale-discount`);
const sale = require(`${mRoot}/sale`);
// 开发用模拟数据
const simulation = require(`${mRoot}/simulation`);
... ... @@ -67,15 +65,15 @@ exports.discount = (req, res) => {
response.devEnv = true;
// 假数据输出
res.render('sale/discount', Object.assign(response, simulation.discount()));
// res.render('sale/discount', Object.assign(response, simulation.discount()));
/* return saleDiscount.getSaleDiscountData()
return sale.getSaleGoodsListData()
.then(result => {
response.result = result;
response.resultShow = JSON.stringify(result, null, 4);
res.render('sale/discount', response);
});*/
});
})
.catch(() => {
... ... @@ -101,7 +99,7 @@ exports.vip = (req, res) => {
// 假数据输出
res.render('sale/other', Object.assign(response, simulation.other()));
/* return saleVip.getSaleVipData()
/* return sale.getSaleGoodsListData()
.then(result => {
response.result = result;
response.resultShow = JSON.stringify(result, null, 4);
... ... @@ -133,7 +131,7 @@ exports.breakingYards = (req, res) => {
// 假数据输出
res.render('sale/other', Object.assign(response, simulation.other()));
/* return breakingYards.getSaleBreakingYardsData()
/* return sale.getSaleGoodsListData()
.then(result => {
response.result = result;
response.resultShow = JSON.stringify(result, null, 4);
... ... @@ -165,7 +163,7 @@ exports.newSale = (req, res) => {
// 假数据输出
res.render('sale/other', Object.assign(response, simulation.other()));
/* return newSale.getSaleNewSaleData()
/* return sale.getSaleNewSaleData()
.then(result => {
response.result = result;
response.resultShow = JSON.stringify(result, null, 4);
... ...
/*
* @Author: Targaryen
* @Date: 2016-05-19 16:10:11
* @Last Modified by: Targaryen
* @Last Modified time: 2016-05-19 16:16:55
*/
'use strict';
const library = '../../../library';
const API = require(`${library}/api`).API;
const sign = require(`${library}/sign`);
const api = new API();
/**
* 处理商品列表数据
* @param {[type]} origin [description]
* @return {[type]} [description]
*/
const handleSaleDiscountData = (origin) => {
var dest = {};
dest = origin;
return dest;
};
/**
* 获取商品列表数据
* @return {[type]} [description]
*/
exports.getSaleDiscountData = () => {
return api.get('', sign.apiSign({
method: 'app.search.sales',
limit: 20,
order: 's_t_desc',
page: 1,
productSize: '384x511',
yh_channel: 1
})).then(result => {
return handleSaleDiscountData(result);
});
};
... ... @@ -2,7 +2,7 @@
* @Author: Targaryen
* @Date: 2016-05-19 10:20:08
* @Last Modified by: Targaryen
* @Last Modified time: 2016-05-19 16:49:04
* @Last Modified time: 2016-05-19 17:27:36
*/
'use strict';
... ... @@ -24,6 +24,19 @@ const handleSaleData = (origin) => {
};
/**
* 处理商品列表数据
* @param {[type]} origin [description]
* @return {[type]} [description]
*/
const handleSaleGoodsListData = (origin) => {
var dest = {};
dest = origin;
return dest;
};
/**
* 获取首页数据
* @return {[type]} [description]
*/
... ... @@ -37,3 +50,22 @@ exports.getSaleDate = () => {
return handleSaleData(result);
});
};
/**
* 获取商品列表数据
* @return {[type]} [description]
*/
exports.getSaleGoodsListData = () => {
return api.get('', sign.apiSign({
method: 'app.search.sales',
limit: 20,
order: 's_t_desc',
page: 1,
productSize: '384x511',
yh_channel: 1
})).then(result => {
return handleSaleGoodsListData(result);
});
};
... ...
... ... @@ -217,7 +217,40 @@ exports.saleIndex = () => {
exports.discount = () => {
return {
module: 'product',
page: 'sale',
page: 'discount',
saleBanner:
{
bannerHeight: 170,
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/378/h/500'
},
saleList:
{
saleTitle: {
title: 'stage 精品上装店',
up: true,
time: '12313'
},
sort: [
{
name: '全部',
number: 10
},
{
name: '上装',
number: 20
},
{
name: '夏装',
number: 5
},
{
name: '衣服',
number: 20
}
]
}
};
... ...
... ... @@ -24,4 +24,3 @@
</div>
{{/ saleList}}
</div>
{{> layout/f
... ...
{{# saleBanner}}
<div class="sale-list-banner" style="height: {{bannerHeight}}px;">
<ul style="height: {{bannerHeight}}px;">
{{# list}}
... ... @@ -5,3 +6,4 @@
{{/ list}}
</ul>
</div>
{{/ saleBanner}}
... ...
{{# leftContent}}
{{!-- 全部折扣 --}}
{{# allDiscount}}
<div class="sort-container">
<ul class="sort-child-list new-sale">
{{#each list}}
<li {{#if active}}class="active"{{/if}}>
<a href="{{href}}" title="{{name}}">
{{name}}
<span>{{num}}</span>
</a>
</li>
{{/each}}
</ul>
</div>
{{/ allDiscount}}
{{!-- 新品上架 --}}
{{# newSales}}
<div class="sort-container">
<h2 title="{{name}}">
一周新品上架
<span>{{updateNum}}</span>
</h2>
<ul class="sort-child-list new-sale">
{{#each list}}
<li {{#if active}}class="active"{{/if}}>
<a href="{{href}}" title="{{name}}">
{{name}}
<span>{{num}}</span>
</a>
</li>
{{/each}}
</ul>
</div>
{{/ newSales}}
{{!-- 全部品类--}}
{{# allSort}}
<div class="sort-container">
<ul>
{{#all}}
<li>
<h2>
<a href="{{href}}" title="{{name}}">
{{name}}
<span>{{updateNum}}</span>
</a>
</h2>
</li>
{{/all}}
{{#each list}}
<li class="product-list-nav {{#if active}}active{{/if}}">
<h3 title="{{name}}">
<span class="icon-triangle"></span>
{{name}}
<span>{{num}}</span>
</h3>
<ul class="sort-child-list">
{{#each childList}}
<li class="{{#if childActive}}active{{/if}}">
<a href="{{href}}" title="{{name}}">
{{name}}
<span>{{num}}</span>
</a>
</li>
{{/each}}
</ul>
</li>
{{/each}}
</ul>
</div>
{{/ allSort}}
{{!-- 图片链接 --}}
{{# picLink}}
{{#if picTitle}}
<h2 class="nav-pic-title">{{picTitle}}</h2>
{{/if}}
<ul class="pic-nav">
{{#each list}}
<li>
<a href="{{href}}">
<img src="{{src}}">
</a>
</li>
{{/each}}
</ul>
{{/ picLink}}
{{/ leftContent}}
{{#if brandBanner.dataId}}
<script id="pic-link-tpl" type="text/html">
\{{# picLink}}
\{{#if picTitle}}
<h2 class="nav-pic-title">\{{picTitle}}</h2>
\{{/if}}
<ul class="pic-nav">
\{{#each list}}
<li>
<a href="\{{href}}">
<img src="\{{src}}">
</a>
</li>
\{{/each}}
</ul>
\{{/ picLink}}
</script>
<div id="brand-ad" class="brand-ad"></div>
{{/if}}
{{!-- 水牌广告 --}}
{{#if node}}
<div id="brand-card" class="brand-card" data-node="{{node}}"></div>
{{/if}}
... ...
<div class="no-result">
<p class="no-title">
抱歉!没有找到{{#if keyWord}}与"<b class="keyword">{{keyWord}}</b>"{{/if}}相关的商品
</p>
<div class="search-again clearfix">
<form method="GET" action="{{searchActionUrl}}">
<input id="no-result-input" name="query" type="text" placeholder="换个关键词试试">
<button class="search-again-btn" type="submit">
<i class="iconfont">&#xe611;</i>
</button>
</form>
</div>
<p class="no-tip">建议您:看看输入的文字是否有误 / 减少分类条件限制 / 重新搜索</p>
</div>
... ...
{{!-- 搜索页、列表页、NEW/SALE页标准内容--}}
{{# filters}}
{{> product/filter-box}}
{{/ filters}}
{{# opts}}
<div class="sort-pager">
{{# sortType}}
<a class="sort-type{{#if active}} active{{/if}}" href="{{href}}">
{{name}}
{{#if hasSortOrient}}
{{#if active}}
{{#if desc}}
<span class="active-icon iconfont">&#xe603;</span>
{{^}}
<span class="active-icon iconfont">&#xe604;</span>
{{/if}}
{{^}}
<span class="iconfont">&#xe614;</span>
{{/if}}
{{^}}
<span class="iconfont">&#xe604;</span>
{{/if}}
</a>
{{/ sortType}}
{{# checks}}
{{#if this}}
<a class="checks{{#if checked}} checked{{/if}}" href="{{href}}">
{{#if checked}}
<span class="iconfont">&#xe636;</span>
{{^}}
<span class="iconfont">&#xe635;</span>
{{/if}}
{{name}}
</a>
{{/if}}
{{/ checks}}
{{#if ../goods}}
<div class="pager-wrap">
<div class="page-count">
<span id="count-per-page">
{{countPerPage}}
<i class="iconfont">&#xe604;</i>
</span>
每页
<ul>
{{# pageCounts}}
<li>
<a href="{{href}}">{{count}}</a>
</li>
{{/ pageCounts}}
</ul>
</div>
<p class="page-orient">
{{#if preHref}}
<a href="{{preHref}}">
<span class="iconfont">&#xe615;</span>
</a>
{{^}}
<span class="dis-icon iconfont">&#xe615;</span>
{{/if}}
<span>
<i>{{curPage}}</i>/{{pageCount}}
</span>
{{#if nextHref}}
<a href="{{nextHref}}">
<span class="iconfont">&#xe601;</span>
</a>
{{^}}
<span class="dis-icon iconfont">&#xe601;</span>
{{/if}}
</p>
</div>
{{/if}}
</div>
{{/ opts}}
{{#if goods}}
<div class="goods-container clearfix">
{{#each goods}}
{{> product/good}}
{{/each}}
{{# hasNextPage}}
<div class="block-next-page">
<a href="{{href}}">
<img src="{{src}}" alt=""/>
</a>
</div>
{{/ hasNextPage}}
<div class="good-item-wrapper">
<div class="good-info-main"></div>
<div class="good-select-color"></div>
</div>
</div>
<div class="product-pager clearfix">
<span class="total">{{opts.start}} - {{opts.end}} / 共{{totalCount}}件商品</span>
<div class="pager">
{{{pager}}}
</div>
</div>
{{^}}
{{> product/no-result}}
{{/if}}
... ...