Authored by 王水玲

Merge branch 'develop' into feature/star

... ... @@ -133,6 +133,10 @@ Session.vim
# auto-generated tag files
tags
### VS Code ###
.vscode/
### YOHO ###
dist
public/css/*
... ...
... ... @@ -191,7 +191,7 @@ exports.search = (req, res) => {
if (req.query.saleType === '2') {
vipObj = Object.assign({
saleVip: (req.query.saleType === '2' && (!uid || vipLevel === '1')),
saleVip: (req.query.saleType === '2' && (!uid || vipLevel === '0')),
vipLevel: vipLevel,
saleViplogin: vipLevel >= 1 ? true : false
}, vipObj);
... ...
... ... @@ -41,7 +41,7 @@ const typeCont = {
price: ['s_p_desc', 's_p_asc'],
discount: ['p_d_desc', 'p_d_asc'],
sale: ['s_n_desc', 's_n_asc'],
newest: ['s_t_desc', 's_t_asc'],
newest: ['s_t_desc,s_s_desc', 's_t_asc,s_s_asc'],
stock: ['s_s_desc', 's_s_asc']
};
... ...
... ... @@ -22,7 +22,7 @@ router.get(/\/pro_([\d]+)_([\d]+)\/(.*)/, detail.index);
router.get('/detail/intro/:productskn', detail.intro);
router.get('/detail/preference/:productskn/:yhchannel/:brandId', detail.preference);
router.get('/sale/index', sale.index);
router.get('/sale', sale.index);
router.get('/sale/discount', sale.discount);
router.get('/sale/discount/detail', sale.discountDetail);
router.get('/sale/breakingYards', sale.breakingYards);
... ...
... ... @@ -11,7 +11,7 @@ const isTest = process.env.NODE_ENV === 'test';
module.exports = {
port: 6001,
siteUrl: 'http://m.yohobuy.com',
siteUrl: '//m.yohobuy.com',
domains: {
api: 'http://testapi.yoho.cn:28078/', // http://192.168.102.205:8080/gateway
service: 'http://testservice.yoho.cn:28077/'
... ...
... ... @@ -35,15 +35,15 @@
{{#if @root.saleViplogin}}
<i class="vip-grade vip-grade-{{@root.vipLevel}}"></i>
<span class="sale-price {{^marketPrice}}no-price{{/marketPrice}}">¥
{{#ifEqualTo @root.vipLevel '1'}}{{vip1Price}}{{/ifEquelTo}}
{{#ifEquelTo @root.vipLevel '2'}}{{vip2Price}}{{/ifEquelTo}}
{{#ifEquelTo @root.vipLevel '3'}}{{vip3Price}}{{/ifEquelTo}}
{{#if @root.vipPrice1}}{{round vip1Price}}{{/if}}
{{#if @root.vipPrice2}}{{round vip2Price}}{{/if}}
{{#if @root.vipPrice3}}{{round vip3Price}}{{/if}}
</span>
{{else}}
<span class="sale-price {{^marketPrice}}no-price{{/marketPrice}}">¥{{salesPrice}}</span>
<span class="sale-price {{^marketPrice}}no-price{{/marketPrice}}">¥{{round salesPrice}}</span>
{{/if}}
{{#marketPrice}}
<span class="market-price">¥{{.}}</span>
<span class="market-price">¥{{round .}}</span>
{{/marketPrice}}
</div>
{{#if @root.saleVip}}
... ...
... ... @@ -92,6 +92,19 @@ exports.upperCase = (str) => {
return str.toUpperCase();
};
/**
* 四舍五入
* @param {[type]} num 数字
* @param {[type]} precision 精度
* @return {[type]}
*/
exports.round = (num, precision) => {
precision = _.isNumber(precision) ? precision : 2;
num = _.isInteger(num) ? (+num).toFixed(precision) : _.round(num, precision);
return num;
};
/**
* 时间格式化
* @param format 格式化token @see{http://momentjs.cn/docs/#/displaying/format/}
... ...
... ... @@ -72,6 +72,8 @@ lazyLoad($('img.lazy'));
if ($('.banner-swiper .swiper-slide').length > 1) {
new Swiper('.swiper-container', {
observer: true,
observeParents: true,
lazyLoading: true,
lazyLoadingInPrevNext: true,
loop: true,
... ... @@ -122,8 +124,6 @@ function search(opt) {
page,
i;
delete defaultOpt.size;
if (searching) {
return;
}
... ... @@ -185,9 +185,9 @@ function search(opt) {
default:
break;
}
}
$.extend(defaultOpt, ext); // 扩展筛选项
$.extend(defaultOpt, ext); // 扩展筛选项
}
}
// 导航类别
... ... @@ -398,7 +398,7 @@ $listNav.on('touchend touchcancel', function(e) {
e.stopPropagation();
});
$swiperSize.on('touchend touchcancel', function(e) {
$swiperSize.on('click', function(e) {
var $this = $(e.target).closest('li'),
index = $this.parents('.swiper-size').index(),
$parentType = $listNav.find('li').eq(index),
... ...
... ... @@ -46,7 +46,7 @@ var $listNav = $('#list-nav'),
end: false
},
discount: {
order: 0,
order: 1,
reload: true,
page: 0,
end: false
... ...
... ... @@ -12,10 +12,15 @@
}
}
#size-swiper-0,
#size-swiper-1,
#size-swiper-2,
#size-swiper-3 {
.banner-swiper {
height: 200px;
ul {
height: 200px;
}
}
.swiper-size {
display: none;
box-sizing: border-box;
padding: 0 22px;
... ...
... ... @@ -45,4 +45,12 @@
.good-detail-text .price {
white-space: nowrap;
}
.banner-swiper {
height: 200px;
ul {
height: 200px;
}
}
}
... ...
... ... @@ -72,22 +72,22 @@ exports.processProductList = (list, options) => {
// thumb: product.defaultImages
// });
if (options.showPoint) {
product.marketPrice += '.00';
product.salesPrice += '.00';
if (product.vip1Price) {
product.vip1Price = parseInt(product.vip1Price) + '.00';
}
if (product.vip2Price) {
product.vip2Price = parseInt(product.vip2Price) + '.00';
}
if (product.vip3Price) {
product.vip3Price = parseInt(product.vip3Price) + '.00';
}
}
// if (options.showPoint) {
// // product.marketPrice += '.00';
// // product.salesPrice += '.00';
// // if (product.vip1Price) {
// // product.vip1Price = parseInt(product.vip1Price) + '.00';
// // }
// // if (product.vip2Price) {
// // product.vip2Price = parseInt(product.vip2Price) + '.00';
// // }
// // if (product.vip3Price) {
// // product.vip3Price = parseInt(product.vip3Price) + '.00';
// // }
// }
product.isSoonSoldOut = product.isSoonSoldOut === 'Y';
product.url = helpers.urlFormat(`/product/pro_${product.productId}_${product.goodsList[0].goodsId}/${product.cnAlphabet}.html`); // eslint-disable-line
... ...