Authored by 王水玲

Merge branch 'develop' into feature/star

@@ -133,6 +133,10 @@ Session.vim @@ -133,6 +133,10 @@ Session.vim
133 # auto-generated tag files 133 # auto-generated tag files
134 tags 134 tags
135 135
  136 +
  137 +### VS Code ###
  138 +.vscode/
  139 +
136 ### YOHO ### 140 ### YOHO ###
137 dist 141 dist
138 public/css/* 142 public/css/*
@@ -191,7 +191,7 @@ exports.search = (req, res) => { @@ -191,7 +191,7 @@ exports.search = (req, res) => {
191 191
192 if (req.query.saleType === '2') { 192 if (req.query.saleType === '2') {
193 vipObj = Object.assign({ 193 vipObj = Object.assign({
194 - saleVip: (req.query.saleType === '2' && (!uid || vipLevel === '1')), 194 + saleVip: (req.query.saleType === '2' && (!uid || vipLevel === '0')),
195 vipLevel: vipLevel, 195 vipLevel: vipLevel,
196 saleViplogin: vipLevel >= 1 ? true : false 196 saleViplogin: vipLevel >= 1 ? true : false
197 }, vipObj); 197 }, vipObj);
@@ -41,7 +41,7 @@ const typeCont = { @@ -41,7 +41,7 @@ const typeCont = {
41 price: ['s_p_desc', 's_p_asc'], 41 price: ['s_p_desc', 's_p_asc'],
42 discount: ['p_d_desc', 'p_d_asc'], 42 discount: ['p_d_desc', 'p_d_asc'],
43 sale: ['s_n_desc', 's_n_asc'], 43 sale: ['s_n_desc', 's_n_asc'],
44 - newest: ['s_t_desc', 's_t_asc'], 44 + newest: ['s_t_desc,s_s_desc', 's_t_asc,s_s_asc'],
45 stock: ['s_s_desc', 's_s_asc'] 45 stock: ['s_s_desc', 's_s_asc']
46 }; 46 };
47 47
@@ -22,7 +22,7 @@ router.get(/\/pro_([\d]+)_([\d]+)\/(.*)/, detail.index); @@ -22,7 +22,7 @@ router.get(/\/pro_([\d]+)_([\d]+)\/(.*)/, detail.index);
22 router.get('/detail/intro/:productskn', detail.intro); 22 router.get('/detail/intro/:productskn', detail.intro);
23 router.get('/detail/preference/:productskn/:yhchannel/:brandId', detail.preference); 23 router.get('/detail/preference/:productskn/:yhchannel/:brandId', detail.preference);
24 24
25 -router.get('/sale/index', sale.index); 25 +router.get('/sale', sale.index);
26 router.get('/sale/discount', sale.discount); 26 router.get('/sale/discount', sale.discount);
27 router.get('/sale/discount/detail', sale.discountDetail); 27 router.get('/sale/discount/detail', sale.discountDetail);
28 router.get('/sale/breakingYards', sale.breakingYards); 28 router.get('/sale/breakingYards', sale.breakingYards);
@@ -11,7 +11,7 @@ const isTest = process.env.NODE_ENV === 'test'; @@ -11,7 +11,7 @@ const isTest = process.env.NODE_ENV === 'test';
11 11
12 module.exports = { 12 module.exports = {
13 port: 6001, 13 port: 6001,
14 - siteUrl: 'http://m.yohobuy.com', 14 + siteUrl: '//m.yohobuy.com',
15 domains: { 15 domains: {
16 api: 'http://testapi.yoho.cn:28078/', // http://192.168.102.205:8080/gateway 16 api: 'http://testapi.yoho.cn:28078/', // http://192.168.102.205:8080/gateway
17 service: 'http://testservice.yoho.cn:28077/' 17 service: 'http://testservice.yoho.cn:28077/'
@@ -35,15 +35,15 @@ @@ -35,15 +35,15 @@
35 {{#if @root.saleViplogin}} 35 {{#if @root.saleViplogin}}
36 <i class="vip-grade vip-grade-{{@root.vipLevel}}"></i> 36 <i class="vip-grade vip-grade-{{@root.vipLevel}}"></i>
37 <span class="sale-price {{^marketPrice}}no-price{{/marketPrice}}">¥ 37 <span class="sale-price {{^marketPrice}}no-price{{/marketPrice}}">¥
38 - {{#ifEqualTo @root.vipLevel '1'}}{{vip1Price}}{{/ifEquelTo}}  
39 - {{#ifEquelTo @root.vipLevel '2'}}{{vip2Price}}{{/ifEquelTo}}  
40 - {{#ifEquelTo @root.vipLevel '3'}}{{vip3Price}}{{/ifEquelTo}} 38 + {{#if @root.vipPrice1}}{{round vip1Price}}{{/if}}
  39 + {{#if @root.vipPrice2}}{{round vip2Price}}{{/if}}
  40 + {{#if @root.vipPrice3}}{{round vip3Price}}{{/if}}
41 </span> 41 </span>
42 {{else}} 42 {{else}}
43 - <span class="sale-price {{^marketPrice}}no-price{{/marketPrice}}">¥{{salesPrice}}</span> 43 + <span class="sale-price {{^marketPrice}}no-price{{/marketPrice}}">¥{{round salesPrice}}</span>
44 {{/if}} 44 {{/if}}
45 {{#marketPrice}} 45 {{#marketPrice}}
46 - <span class="market-price">¥{{.}}</span> 46 + <span class="market-price">¥{{round .}}</span>
47 {{/marketPrice}} 47 {{/marketPrice}}
48 </div> 48 </div>
49 {{#if @root.saleVip}} 49 {{#if @root.saleVip}}
@@ -92,6 +92,19 @@ exports.upperCase = (str) => { @@ -92,6 +92,19 @@ exports.upperCase = (str) => {
92 return str.toUpperCase(); 92 return str.toUpperCase();
93 }; 93 };
94 94
  95 +
  96 +/**
  97 + * 四舍五入
  98 + * @param {[type]} num 数字
  99 + * @param {[type]} precision 精度
  100 + * @return {[type]}
  101 + */
  102 +exports.round = (num, precision) => {
  103 + precision = _.isNumber(precision) ? precision : 2;
  104 + num = _.isInteger(num) ? (+num).toFixed(precision) : _.round(num, precision);
  105 + return num;
  106 +};
  107 +
95 /** 108 /**
96 * 时间格式化 109 * 时间格式化
97 * @param format 格式化token @see{http://momentjs.cn/docs/#/displaying/format/} 110 * @param format 格式化token @see{http://momentjs.cn/docs/#/displaying/format/}
@@ -72,6 +72,8 @@ lazyLoad($('img.lazy')); @@ -72,6 +72,8 @@ lazyLoad($('img.lazy'));
72 72
73 if ($('.banner-swiper .swiper-slide').length > 1) { 73 if ($('.banner-swiper .swiper-slide').length > 1) {
74 new Swiper('.swiper-container', { 74 new Swiper('.swiper-container', {
  75 + observer: true,
  76 + observeParents: true,
75 lazyLoading: true, 77 lazyLoading: true,
76 lazyLoadingInPrevNext: true, 78 lazyLoadingInPrevNext: true,
77 loop: true, 79 loop: true,
@@ -122,8 +124,6 @@ function search(opt) { @@ -122,8 +124,6 @@ function search(opt) {
122 page, 124 page,
123 i; 125 i;
124 126
125 - delete defaultOpt.size;  
126 -  
127 if (searching) { 127 if (searching) {
128 return; 128 return;
129 } 129 }
@@ -185,9 +185,9 @@ function search(opt) { @@ -185,9 +185,9 @@ function search(opt) {
185 default: 185 default:
186 break; 186 break;
187 } 187 }
188 - }  
189 188
190 - $.extend(defaultOpt, ext); // 扩展筛选项 189 + $.extend(defaultOpt, ext); // 扩展筛选项
  190 + }
191 } 191 }
192 192
193 // 导航类别 193 // 导航类别
@@ -398,7 +398,7 @@ $listNav.on('touchend touchcancel', function(e) { @@ -398,7 +398,7 @@ $listNav.on('touchend touchcancel', function(e) {
398 e.stopPropagation(); 398 e.stopPropagation();
399 }); 399 });
400 400
401 -$swiperSize.on('touchend touchcancel', function(e) { 401 +$swiperSize.on('click', function(e) {
402 var $this = $(e.target).closest('li'), 402 var $this = $(e.target).closest('li'),
403 index = $this.parents('.swiper-size').index(), 403 index = $this.parents('.swiper-size').index(),
404 $parentType = $listNav.find('li').eq(index), 404 $parentType = $listNav.find('li').eq(index),
@@ -46,7 +46,7 @@ var $listNav = $('#list-nav'), @@ -46,7 +46,7 @@ var $listNav = $('#list-nav'),
46 end: false 46 end: false
47 }, 47 },
48 discount: { 48 discount: {
49 - order: 0, 49 + order: 1,
50 reload: true, 50 reload: true,
51 page: 0, 51 page: 0,
52 end: false 52 end: false
@@ -12,10 +12,15 @@ @@ -12,10 +12,15 @@
12 } 12 }
13 } 13 }
14 14
15 - #size-swiper-0,  
16 - #size-swiper-1,  
17 - #size-swiper-2,  
18 - #size-swiper-3 { 15 + .banner-swiper {
  16 + height: 200px;
  17 +
  18 + ul {
  19 + height: 200px;
  20 + }
  21 + }
  22 +
  23 + .swiper-size {
19 display: none; 24 display: none;
20 box-sizing: border-box; 25 box-sizing: border-box;
21 padding: 0 22px; 26 padding: 0 22px;
@@ -45,4 +45,12 @@ @@ -45,4 +45,12 @@
45 .good-detail-text .price { 45 .good-detail-text .price {
46 white-space: nowrap; 46 white-space: nowrap;
47 } 47 }
  48 +
  49 + .banner-swiper {
  50 + height: 200px;
  51 +
  52 + ul {
  53 + height: 200px;
  54 + }
  55 + }
48 } 56 }
@@ -72,22 +72,22 @@ exports.processProductList = (list, options) => { @@ -72,22 +72,22 @@ exports.processProductList = (list, options) => {
72 // thumb: product.defaultImages 72 // thumb: product.defaultImages
73 // }); 73 // });
74 74
75 - if (options.showPoint) {  
76 - product.marketPrice += '.00';  
77 - product.salesPrice += '.00';  
78 -  
79 - if (product.vip1Price) {  
80 - product.vip1Price = parseInt(product.vip1Price) + '.00';  
81 - }  
82 -  
83 - if (product.vip2Price) {  
84 - product.vip2Price = parseInt(product.vip2Price) + '.00';  
85 - }  
86 -  
87 - if (product.vip3Price) {  
88 - product.vip3Price = parseInt(product.vip3Price) + '.00';  
89 - }  
90 - } 75 + // if (options.showPoint) {
  76 + // // product.marketPrice += '.00';
  77 + // // product.salesPrice += '.00';
  78 +
  79 + // // if (product.vip1Price) {
  80 + // // product.vip1Price = parseInt(product.vip1Price) + '.00';
  81 + // // }
  82 +
  83 + // // if (product.vip2Price) {
  84 + // // product.vip2Price = parseInt(product.vip2Price) + '.00';
  85 + // // }
  86 +
  87 + // // if (product.vip3Price) {
  88 + // // product.vip3Price = parseInt(product.vip3Price) + '.00';
  89 + // // }
  90 + // }
91 91
92 product.isSoonSoldOut = product.isSoonSoldOut === 'Y'; 92 product.isSoonSoldOut = product.isSoonSoldOut === 'Y';
93 product.url = helpers.urlFormat(`/product/pro_${product.productId}_${product.goodsList[0].goodsId}/${product.cnAlphabet}.html`); // eslint-disable-line 93 product.url = helpers.urlFormat(`/product/pro_${product.productId}_${product.goodsList[0].goodsId}/${product.cnAlphabet}.html`); // eslint-disable-line