Authored by 郭成尧

Merge branch 'release/5.5' of git.yoho.cn:fe/yohobuywap-node into release/5.5

@@ -75,7 +75,6 @@ app.use(global.yoho.hbs({ @@ -75,7 +75,6 @@ app.use(global.yoho.hbs({
75 app.use(global.yoho.middleware()); 75 app.use(global.yoho.middleware());
76 76
77 app.use(favicon(path.join(__dirname, '/favicon.ico'))); 77 app.use(favicon(path.join(__dirname, '/favicon.ico')));
78 -app.use(express.static(path.join(__dirname, 'public')));  
79 app.use(bodyParser.json()); 78 app.use(bodyParser.json());
80 app.use(bodyParser.urlencoded({ 79 app.use(bodyParser.urlencoded({
81 extended: false 80 extended: false
1 <div class="yoho-live yoho-page"> 1 <div class="yoho-live yoho-page">
2 {{! 导航条}} 2 {{! 导航条}}
3 {{#unless isApp}} 3 {{#unless isApp}}
4 - <div class="home-header clearfix yoho-header"> 4 + <div class="home-header clearfix yoho-header" id="home-header">
5 <a href="javascript:history.go(-1);" class="iconfont nav-back buriedpoint" data-bp-id="page_header_back_0"></a> 5 <a href="javascript:history.go(-1);" class="iconfont nav-back buriedpoint" data-bp-id="page_header_back_0"></a>
6 <p class="nav-title">直播列表</p> 6 <p class="nav-title">直播列表</p>
7 </div> 7 </div>
  8 + <script type="text/javascript">
  9 + var isWechat = /micromessenger/i.test(navigator.userAgent || '');
  10 + if (isWechat) {
  11 + document.getElementById('home-header').classList.add('hide');
  12 + }
  13 + </script>
8 {{/unless}} 14 {{/unless}}
9 15
10 -  
11 {{#content}} 16 {{#content}}
12 {{! 头部banner}} 17 {{! 头部banner}}
13 {{#if focus}} 18 {{#if focus}}
@@ -170,10 +170,22 @@ const _getLeftNav = (choosed) => { @@ -170,10 +170,22 @@ const _getLeftNav = (choosed) => {
170 /** 170 /**
171 * 获取热门搜索 171 * 获取热门搜索
172 **/ 172 **/
173 -const _getSearchIndex = () => {  
174 - return API.get('', { 173 +const _getSearchIndex = (params) => {
  174 + let channels = {
  175 + boys: 1,
  176 + girl: 2,
  177 + kids: 3,
  178 + lifestyle: 4
  179 + };
  180 +
  181 + if (params.gender && channels[params.gender]) {
  182 + params.yh_channel = channels[params.gender];
  183 + delete params.gender;
  184 + }
  185 +
  186 + return API.get('', _.assign({
175 method: 'app.search.getTerms' 187 method: 'app.search.getTerms'
176 - }, { 188 + }, params), {
177 cache: true 189 cache: true
178 }).then((result) => { 190 }).then((result) => {
179 if (result && result.code === 200) { 191 if (result && result.code === 200) {
@@ -270,10 +282,14 @@ let getChannelData = (params) => { @@ -270,10 +282,14 @@ let getChannelData = (params) => {
270 var channelData = {}; 282 var channelData = {};
271 let navGender = _.cloneDeep(params.gender); 283 let navGender = _.cloneDeep(params.gender);
272 284
273 - return Promise.all([getChannelResource(params), _getLeftNav(navGender), _getSearchIndex()]).then((data) => { 285 + return Promise.all([getChannelResource(params), _getLeftNav(navGender), _getSearchIndex({
  286 + gender: navGender,
  287 + uid: params.uid,
  288 + })]).then((data) => {
274 channelData.content = data[0] || []; // 资源位数据 289 channelData.content = data[0] || []; // 资源位数据
275 channelData.sideNav = data[1] || []; // 侧边栏数据 290 channelData.sideNav = data[1] || []; // 侧边栏数据
276 - channelData.defaultTerms = (data[2] && data[2].defaultTerms && data[2].defaultTerms.length !== 0) ? data[2].defaultTerms[0].content : '搜索商品、品牌'; 291 + channelData.defaultTerms = (data[2] && data[2].defaultTerms && data[2].defaultTerms.length) ?
  292 + data[2].defaultTerms[0].content : '搜索商品、品牌';
277 return channelData; 293 return channelData;
278 }); 294 });
279 }; 295 };
@@ -67,6 +67,8 @@ const _getOrderStatus = (order, showLogistics) => { @@ -67,6 +67,8 @@ const _getOrderStatus = (order, showLogistics) => {
67 isPayonline: true 67 isPayonline: true
68 }); 68 });
69 69
  70 + let isPayaly = order.paymentName === '' ? false : true;
  71 +
70 switch (order.status) { 72 switch (order.status) {
71 case 0: 73 case 0:
72 74
@@ -83,7 +85,7 @@ const _getOrderStatus = (order, showLogistics) => { @@ -83,7 +85,7 @@ const _getOrderStatus = (order, showLogistics) => {
83 /* 已付款状态不给查看物流 URL */ 85 /* 已付款状态不给查看物流 URL */
84 Object.assign(result, { 86 Object.assign(result, {
85 unreceived: true, 87 unreceived: true,
86 - payAly: true 88 + payAly: isPayaly
87 }); 89 });
88 break; 90 break;
89 case 4: 91 case 4:
@@ -92,7 +94,7 @@ const _getOrderStatus = (order, showLogistics) => { @@ -92,7 +94,7 @@ const _getOrderStatus = (order, showLogistics) => {
92 /* 已发货状态,给查看物流或二维码URL */ 94 /* 已发货状态,给查看物流或二维码URL */
93 Object.assign(result, { 95 Object.assign(result, {
94 unreceived: true, 96 unreceived: true,
95 - payAly: true 97 + payAly: isPayaly
96 }); 98 });
97 99
98 /* 是否门票 */ 100 /* 是否门票 */
@@ -109,7 +111,7 @@ const _getOrderStatus = (order, showLogistics) => { @@ -109,7 +111,7 @@ const _getOrderStatus = (order, showLogistics) => {
109 /* 已成功订单,给查看物流或二维码URL */ 111 /* 已成功订单,给查看物流或二维码URL */
110 Object.assign(result, { 112 Object.assign(result, {
111 completed: true, 113 completed: true,
112 - payAly: true 114 + payAly: isPayaly
113 }); 115 });
114 116
115 /* 是否门票 */ 117 /* 是否门票 */
@@ -6,6 +6,7 @@ @@ -6,6 +6,7 @@
6 const mRoot = '../models'; 6 const mRoot = '../models';
7 const utils = '../../../utils'; 7 const utils = '../../../utils';
8 const listModel = require(`${mRoot}/list`); 8 const listModel = require(`${mRoot}/list`);
  9 +const shopModel = require(`${mRoot}/shop`);
9 const searchModel = require(`${mRoot}/search`); 10 const searchModel = require(`${mRoot}/search`);
10 const redsShopModel = require(`${mRoot}/popular-shop`); 11 const redsShopModel = require(`${mRoot}/popular-shop`);
11 const headerModel = require('../../../doraemon/models/header'); 12 const headerModel = require('../../../doraemon/models/header');
@@ -14,6 +15,25 @@ const helpers = global.yoho.helpers; @@ -14,6 +15,25 @@ const helpers = global.yoho.helpers;
14 const productProcess = require(`${utils}/product-process`); 15 const productProcess = require(`${utils}/product-process`);
15 16
16 17
  18 +/**
  19 + * 从 useragent 获取 uid
  20 + * @returns {*}
  21 + * @private
  22 + */
  23 +const _getUidFromUserAgent = (req) => {
  24 + let userAgent = _.split(req.headers['user-agent'], ';');
  25 + let uidString = '';
  26 +
  27 + _.forEach(userAgent, value => {
  28 + if (_.startsWith(value, 'uid')) {
  29 + uidString = value;
  30 + return;
  31 + }
  32 + });
  33 +
  34 + return _.split(uidString, '=')[1];
  35 +};
  36 +
17 const shop = { 37 const shop = {
18 index(req, res, next) { 38 index(req, res, next) {
19 let params = Object.assign({}, req.query); 39 let params = Object.assign({}, req.query);
@@ -66,7 +86,10 @@ const shop = { @@ -66,7 +86,10 @@ const shop = {
66 shop.shop(req, res, next); 86 shop.shop(req, res, next);
67 return false; 87 return false;
68 } else if (req.query.from === 'search') { 88 } else if (req.query.from === 'search') {
69 - return Promise.all([listModel.getBrandShops(brandId, req), searchModel.getSearchData(searchParam)]).then(shopResult => { 89 + return Promise.all([
  90 + listModel.getBrandShops(brandId, req),
  91 + searchModel.getSearchData(searchParam)
  92 + ]).then(shopResult => {
70 let brandShop = shopResult[0]; 93 let brandShop = shopResult[0];
71 let newGoods = shopResult[1]; 94 let newGoods = shopResult[1];
72 95
@@ -105,7 +128,10 @@ const shop = { @@ -105,7 +128,10 @@ const shop = {
105 title: result.name, 128 title: result.name,
106 id: result.id 129 id: result.id
107 }; 130 };
108 - return Promise.all([listModel.getBrandBanner(brandId), searchModel.getSearchData(searchParam)]).then(brandResult => { 131 + return Promise.all([
  132 + listModel.getBrandBanner(brandId),
  133 + searchModel.getSearchData(searchParam)
  134 + ]).then(brandResult => {
109 let brandBanner = brandResult[0]; 135 let brandBanner = brandResult[0];
110 let newGoods = brandResult[1]; 136 let newGoods = brandResult[1];
111 137
@@ -193,8 +219,12 @@ const shop = { @@ -193,8 +219,12 @@ const shop = {
193 } 219 }
194 220
195 /* 基础店铺返回程序内的跳转信号,跳转到基础店铺 */ 221 /* 基础店铺返回程序内的跳转信号,跳转到基础店铺 */
196 - if (shopInfoResult && shopInfoResult.shop_template_type && parseInt(shopInfoResult.shop_template_type, 10) === 1) {  
197 - return Promise.all([listModel.getBaseShopData(req.query, shopInfo), searchModel.getSearchData(searchParam)]).then(fResult => { 222 + if (shopInfoResult && shopInfoResult.shop_template_type &&
  223 + parseInt(shopInfoResult.shop_template_type, 10) === 1) {
  224 + return Promise.all([
  225 + listModel.getBaseShopData(req.query, shopInfo),
  226 + searchModel.getSearchData(searchParam)
  227 + ]).then(fResult => {
198 let baseShop = fResult[0]; 228 let baseShop = fResult[0];
199 let newGoods = fResult[1]; 229 let newGoods = fResult[1];
200 230
@@ -214,8 +244,10 @@ const shop = { @@ -214,8 +244,10 @@ const shop = {
214 showDownloadApp: true, 244 showDownloadApp: true,
215 pageFooter: true, 245 pageFooter: true,
216 title: shopInfo.shop_name + '|' + shopInfo.shop_name + '潮流服装服饰-Yoho!Buy有货', 246 title: shopInfo.shop_name + '|' + shopInfo.shop_name + '潮流服装服饰-Yoho!Buy有货',
217 - keywords: shopInfo.shop_name + ',' + shopInfo.shop_name + '服装服饰,' + shopInfo.shop_name + '潮流服装服饰',  
218 - description: shopInfo.shop_name + '|Yoho!Buy有货' + shopInfo.shop_name + '潮流服饰官方授权店!100%品牌正品保证,支持货到付款。', 247 + keywords: shopInfo.shop_name + ',' + shopInfo.shop_name + '服装服饰,' +
  248 + shopInfo.shop_name + '潮流服装服饰',
  249 + description: shopInfo.shop_name + '|Yoho!Buy有货' + shopInfo.shop_name +
  250 + '潮流服饰官方授权店!100%品牌正品保证,支持货到付款。',
219 shopId: shopId, 251 shopId: shopId,
220 shopPage: true, 252 shopPage: true,
221 _noLazy: true, 253 _noLazy: true,
@@ -226,7 +258,10 @@ const shop = { @@ -226,7 +258,10 @@ const shop = {
226 }); 258 });
227 } else { 259 } else {
228 // 经典装修店铺 260 // 经典装修店铺
229 - return Promise.all([listModel.getShopDecorator(shopId).then(), listModel.getShopCategoryApi(shopId, channel)]).then(fResult => { 261 + return Promise.all([
  262 + listModel.getShopDecorator(shopId).then(),
  263 + listModel.getShopCategoryApi(shopId, channel)
  264 + ]).then(fResult => {
230 265
231 let shopDeco = fResult[0]; 266 let shopDeco = fResult[0];
232 let shopCategory = fResult[1]; 267 let shopCategory = fResult[1];
@@ -239,7 +274,8 @@ const shop = { @@ -239,7 +274,8 @@ const shop = {
239 274
240 let result = listModel.formShopData(shopData, shopId, isApp); 275 let result = listModel.formShopData(shopData, shopId, isApp);
241 276
242 - result = _.assign(result, pageHeader, {shopId: shopId, coverChannel: channel, seoResult: seoResult}); 277 + result = _.assign(result, pageHeader,
  278 + {shopId: shopId, coverChannel: channel, seoResult: seoResult});
243 279
244 res.render('newshop/shop-classics', { 280 res.render('newshop/shop-classics', {
245 module: 'product', 281 module: 'product',
@@ -358,28 +394,31 @@ const shop = { @@ -358,28 +394,31 @@ const shop = {
358 banner, brand, introData, decoratorsData, 394 banner, brand, introData, decoratorsData,
359 time3: [0, 1, 2] 395 time3: [0, 1, 2]
360 }); 396 });
361 - }); 397 + }).catch(next);
362 398
363 - }  
364 -}; 399 + },
365 400
366 -/**  
367 - * 从 useragent 获取 uid  
368 - * @returns {*}  
369 - * @private  
370 - */  
371 -const _getUidFromUserAgent = (req) => {  
372 - let userAgent = _.split(req.headers['user-agent'], ';');  
373 - let uidString = ''; 401 + /**
  402 + * 店铺全部品牌页面
  403 + */
  404 + allBrand(req, res, next) {
  405 + let shopId = req.query.shop_id;
374 406
375 - _.forEach(userAgent, value => {  
376 - if (_.startsWith(value, 'uid')) {  
377 - uidString = value;  
378 - return; 407 + if (!shopId) {
  408 + return next();
379 } 409 }
380 - });  
381 410
382 - return _.split(uidString, '=')[1]; 411 + shopModel.getShopBrands(req.query.shop_id).then(result => {
  412 + res.render('newshop/all-brand', {
  413 + result: result,
  414 + pageHeader: headerModel.setNav({
  415 + navTitle: '品牌'
  416 + }),
  417 + module: 'product',
  418 + page: 'all-brand',
  419 + });
  420 + }).catch(next);
  421 + }
383 }; 422 };
384 423
385 module.exports = shop; 424 module.exports = shop;
@@ -157,7 +157,11 @@ const index = (req, res, next) => { @@ -157,7 +157,11 @@ const index = (req, res, next) => {
157 if (_.get(req, 'app.locals.wap.search.removeHotSearch', false)) { 157 if (_.get(req, 'app.locals.wap.search.removeHotSearch', false)) {
158 render([]); 158 render([]);
159 } else { 159 } else {
160 - searchModel.getSearchIndex(uid).then((result) => { 160 +
  161 + searchModel.getSearchIndex({
  162 + gender: req.yoho.channel || 'boys',
  163 + uid: uid
  164 + }).then((result) => {
161 render(result); 165 render(result);
162 }).catch(next); 166 }).catch(next);
163 } 167 }
@@ -172,9 +176,8 @@ const index = (req, res, next) => { @@ -172,9 +176,8 @@ const index = (req, res, next) => {
172 pageFooter: true, 176 pageFooter: true,
173 width750: true, 177 width750: true,
174 search: { 178 search: {
175 - defaultTerms: (result && result.hotTerms &&  
176 - result.hotTerms.defaultTerms && result.hotTerms.defaultTerms.length !== 0) ?  
177 - result.hotTerms.defaultTerms[0].content : '', 179 + defaultTerms: (result && result.defaultTerms && result.defaultTerms.length) ?
  180 + result.defaultTerms[0].content : '',
178 url: helpers.urlFormat('', null, 'search'), 181 url: helpers.urlFormat('', null, 'search'),
179 hotTerms: result.hotTerms, 182 hotTerms: result.hotTerms,
180 wantTerms: result.guessTerms 183 wantTerms: result.guessTerms
@@ -352,7 +352,7 @@ const _formShopData = (data, shopId, isApp) => { @@ -352,7 +352,7 @@ const _formShopData = (data, shopId, isApp) => {
352 _.forEach(resData, (item) => { 352 _.forEach(resData, (item) => {
353 if (item.brandDomain) { 353 if (item.brandDomain) {
354 brand.list.push({ 354 brand.list.push({
355 - url: helpers.urlFormat('', '', item.brandDomain) + (isApp ? `?openby:yohobuy={"action":"go.brand","params":{"shop_id":${shopId},"brand_id":${item.id}}}` : ''), //eslint-disable-line 355 + url: helpers.urlFormat('/', {brand: item.id, shop_id: shopId, title: item.brandName}, 'list') + (isApp ? `?openby:yohobuy={"action":"go.brand","params":{"shop_id":${shopId},"brand_id":${item.id}}}` : ''), //eslint-disable-line
356 img: helpers.image(item.brandIco, 640, 400), 356 img: helpers.image(item.brandIco, 640, 400),
357 brandName: item.brandName 357 brandName: item.brandName
358 }); 358 });
@@ -229,7 +229,7 @@ const tool = { @@ -229,7 +229,7 @@ const tool = {
229 return { 229 return {
230 tabName: _.get(bundleData, 'bundleInfo.tabName') || '', 230 tabName: _.get(bundleData, 'bundleInfo.tabName') || '',
231 title: _.get(bundleData, 'bundleInfo.bundleName') || '优惠套装', 231 title: _.get(bundleData, 'bundleInfo.bundleName') || '优惠套装',
232 - href: helpers.urlFormat('/product/bundle/detail', {skn: skn, productId: productId, index: index}), 232 + href: helpers.urlFormat('/product/bundle/detail', {bundle_skn: skn, productId: productId, index: index}),
233 description: subPrice ? '立省¥' + subPrice : 0, 233 description: subPrice ? '立省¥' + subPrice : 0,
234 productList: productProcess.processProductList(bundleData && bundleData.productList) 234 productList: productProcess.processProductList(bundleData && bundleData.productList)
235 }; 235 };
@@ -300,11 +300,22 @@ const getAllBrandNames = () => { @@ -300,11 +300,22 @@ const getAllBrandNames = () => {
300 /** 300 /**
301 * 搜索主页 301 * 搜索主页
302 */ 302 */
303 -const getSearchIndex = (uid) => {  
304 - return api.get('', {  
305 - method: 'app.search.getTerms',  
306 - uid: uid  
307 - }, { 303 +const getSearchIndex = (params) => {
  304 + let channels = {
  305 + boys: 1,
  306 + girl: 2,
  307 + kids: 3,
  308 + lifestyle: 4
  309 + };
  310 +
  311 + if (params.gender && channels[params.gender]) {
  312 + params.yh_channel = channels[params.gender];
  313 + delete params.gender;
  314 + }
  315 +
  316 + return api.get('', _.assign({
  317 + method: 'app.search.getTerms'
  318 + }, params), {
308 cache: true 319 cache: true
309 }).then((result) => { 320 }).then((result) => {
310 if (result && result.code === 200) { 321 if (result && result.code === 200) {
  1 +/**
  2 + * 店铺
  3 + */
  4 +'use strict';
  5 +const _ = require('lodash');
  6 +const helpers = global.yoho.helpers;
  7 +const api = global.yoho.API;
  8 +
  9 +/**
  10 + * 店铺品牌列表
  11 + */
  12 +const getShopBrands = (shopId) => {
  13 + return api.get('', {
  14 + method: 'app.shops.getShopsBrands',
  15 + shop_id: shopId
  16 + }, {code: 200}).then(result => {
  17 + if (result && result.data) {
  18 + _.forEach(result.data, value => {
  19 + value.url = helpers.urlFormat('', {
  20 + shop_id: shopId,
  21 + brand: value.brand_id,
  22 + title: value.brand_name
  23 + }, 'list');
  24 + });
  25 +
  26 + return result.data;
  27 + } else {
  28 + return [];
  29 + }
  30 + });
  31 +};
  32 +
  33 +module.exports = {
  34 + getShopBrands
  35 +};
@@ -198,4 +198,6 @@ router.get('/bundle/detail', bundle.detail); // 套装详情页 @@ -198,4 +198,6 @@ router.get('/bundle/detail', bundle.detail); // 套装详情页
198 router.post('/opt/favoriteProduct', newDetail.favoriteProduct); // 商品收藏、取消收藏 198 router.post('/opt/favoriteProduct', newDetail.favoriteProduct); // 商品收藏、取消收藏
199 router.get('/detail/limitHelp', newDetail.limitHelp); 199 router.get('/detail/limitHelp', newDetail.limitHelp);
200 200
  201 +router.get('/index/allBrand', newShop.allBrand); // 店铺全部品牌
  202 +
201 module.exports = router; 203 module.exports = router;
  1 +<div class="brand-shop-page">
  2 + {{# result}}
  3 + <a class="brand-list buriedpoint" href="{{url}}" data-bp-id="guang_brandlist_{{brand_name}}_0">
  4 + {{brand_name}}
  5 + </a>
  6 + {{/ result}}
  7 +</div>
@@ -15,15 +15,9 @@ const domains = { @@ -15,15 +15,9 @@ const domains = {
15 liveApi: 'http://testapi.live.yohops.com:9999/', 15 liveApi: 'http://testapi.live.yohops.com:9999/',
16 singleApi: 'http://api-test3.yohops.com:9999/', 16 singleApi: 'http://api-test3.yohops.com:9999/',
17 17
18 - // api: 'http://api.yoho.yohoops.org/',  
19 - // service: 'http://service.yoho.yohoops.org/',  
20 - // liveApi: 'http://api.live.yoho.cn/',  
21 - // singleApi: 'http://single.yoho.cn/',  
22 -  
23 - imSocket: 'wss://imsocket.yohobuy.com:443',  
24 - imCs: 'https://imhttp.yohobuy.com/api',  
25 - imServer: 'https://imhttp.yohobuy.com/server'  
26 - 18 + imSocket: 'ws://socket.yohobuy.com:10240',
  19 + imCs: 'https://im.yohobuy.com/api',
  20 + imServer: 'https://im.yohobuy.com/server'
27 }; 21 };
28 22
29 module.exports = { 23 module.exports = {
1 { 1 {
2 "name": "m-yohobuy-node", 2 "name": "m-yohobuy-node",
3 - "version": "93.1.13", 3 + "version": "93.1.15",
4 "private": true, 4 "private": true,
5 "description": "A New Yohobuy Project With Express", 5 "description": "A New Yohobuy Project With Express",
6 "repository": { 6 "repository": {
@@ -2,6 +2,8 @@ var $ = require('yoho-jquery'), @@ -2,6 +2,8 @@ var $ = require('yoho-jquery'),
2 lazyLoad = require('yoho-jquery-lazyload'); 2 lazyLoad = require('yoho-jquery-lazyload');
3 var Swiper = require('yoho-swiper'); 3 var Swiper = require('yoho-swiper');
4 4
  5 +require('../common');
  6 +
5 lazyLoad($('img')); 7 lazyLoad($('img'));
6 8
7 $('.swiper-container').each(function() { 9 $('.swiper-container').each(function() {
@@ -20,6 +20,8 @@ var _ChannelVary = { @@ -20,6 +20,8 @@ var _ChannelVary = {
20 lifestyle: 4 20 lifestyle: 4
21 }; 21 };
22 22
  23 +require('./common/share');
  24 +
23 function cookie(name) { 25 function cookie(name) {
24 var cookies = document.cookie, 26 var cookies = document.cookie,
25 cookieVal; 27 cookieVal;
@@ -122,6 +122,8 @@ class ChosePanel { @@ -122,6 +122,8 @@ class ChosePanel {
122 // 获取sku列表中库存小于最小购买数量的属性,如果在其他sku中它们没有满足购买数量条件的可以灰色 122 // 获取sku列表中库存小于最小购买数量的属性,如果在其他sku中它们没有满足购买数量条件的可以灰色
123 let noStorageSkus = this.skus.filter(sku => sku.storage < this.minBuyNum); 123 let noStorageSkus = this.skus.filter(sku => sku.storage < this.minBuyNum);
124 124
  125 + $chosePanel.find('.thumb').attr('src', this.data.cartInfo.defaultThumb);
  126 +
125 $('.block').removeClass('zero-stock'); 127 $('.block').removeClass('zero-stock');
126 noStorageSkus.forEach(sku => { 128 noStorageSkus.forEach(sku => {
127 for (let propType in sku.prop) { 129 for (let propType in sku.prop) {
@@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
2 * 移动端尝试打开 app 2 * 移动端尝试打开 app
3 */ 3 */
4 const qs = require('yoho-qs'); 4 const qs = require('yoho-qs');
  5 +const cookie = require('yoho-cookie');
5 6
6 const u = navigator.userAgent; 7 const u = navigator.userAgent;
7 const isFromYOHO = /m\.yohobuy\.com/i.test(document.referrer); 8 const isFromYOHO = /m\.yohobuy\.com/i.test(document.referrer);
@@ -57,19 +58,21 @@ const canOpenApp = () => { @@ -57,19 +58,21 @@ const canOpenApp = () => {
57 const getAppPath = () => { 58 const getAppPath = () => {
58 let appPath = document.getElementById('main-wrap').dataset.apppath || 'yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.home","params":{"gender":"1","channel":"2"}}'; 59 let appPath = document.getElementById('main-wrap').dataset.apppath || 'yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.home","params":{"gender":"1","channel":"2"}}';
59 let ct = qs.mkt_code || qs.union_type || getMktcBySeo() || '100000000000349'; 60 let ct = qs.mkt_code || qs.union_type || getMktcBySeo() || '100000000000349';
  61 + let clientId = cookie.get('_yasvd');
60 62
61 if (ct) { 63 if (ct) {
62 appPath = appPath.replace('goapp?', 'goapp?ct=' + ct + '&'); 64 appPath = appPath.replace('goapp?', 'goapp?ct=' + ct + '&');
63 } 65 }
64 66
  67 + if (clientId) {
  68 + appPath = appPath.replace('goapp?', 'goapp?client_id=' + clientId + '&');
  69 + }
  70 +
65 return appPath; 71 return appPath;
66 }; 72 };
67 73
68 74
69 if (canOpenApp()) { 75 if (canOpenApp()) {
70 - let appPath = getAppPath();  
71 - let ifr;  
72 -  
73 setTimeout(function() { 76 setTimeout(function() {
74 if (window._yas && window._yas.sendCustomInfo) { 77 if (window._yas && window._yas.sendCustomInfo) {
75 window._yas.sendCustomInfo({ 78 window._yas.sendCustomInfo({
@@ -84,16 +87,19 @@ if (canOpenApp()) { @@ -84,16 +87,19 @@ if (canOpenApp()) {
84 if (window._hmt && window._hmt.push) { 87 if (window._hmt && window._hmt.push) {
85 window._hmt.push(['_trackEvent', 'H5唤起APP', isiOS ? 'Apple' : 'Android', document.title, location.href]); 88 window._hmt.push(['_trackEvent', 'H5唤起APP', isiOS ? 'Apple' : 'Android', document.title, location.href]);
86 } 89 }
87 - }, 2000); 90 + }, 1000);
88 91
89 - if (isiOS) {  
90 - setTimeout(function() { 92 + setTimeout(function() {
  93 + let appPath = getAppPath();
  94 + let ifr;
  95 +
  96 + if (isiOS) {
91 window.location.href = appPath; 97 window.location.href = appPath;
92 - }, 2000);  
93 - } else {  
94 - ifr = document.createElement('iframe');  
95 - ifr.src = appPath;  
96 - ifr.style.display = 'none';  
97 - document.body.appendChild(ifr);  
98 - } 98 + } else {
  99 + ifr = document.createElement('iframe');
  100 + ifr.src = appPath;
  101 + ifr.style.display = 'none';
  102 + document.body.appendChild(ifr);
  103 + }
  104 + }, 2000);
99 } 105 }
@@ -115,6 +115,8 @@ $('.coupon-list').on('click', '.info-btn', function() { @@ -115,6 +115,8 @@ $('.coupon-list').on('click', '.info-btn', function() {
115 COUPON_ID: $this.closest('.coupon-group').data('coupon-id') 115 COUPON_ID: $this.closest('.coupon-group').data('coupon-id')
116 }) 116 })
117 }, true); 117 }, true);
  118 +
  119 + window.rePosFooter(); // 重新计算底部位置
118 }); 120 });
119 121
120 // 立即使用 122 // 立即使用
@@ -387,7 +387,7 @@ $reaMask.find('.box-cmp').on('touchend', function() { @@ -387,7 +387,7 @@ $reaMask.find('.box-cmp').on('touchend', function() {
387 reasonId: reasonId 387 reasonId: reasonId
388 } 388 }
389 }).then(function(res) { 389 }).then(function(res) {
390 - $reaMask.css('visibility', 'visible'); 390 + $reaMask.css('visibility', 'hidden');
391 if ($.type(res) !== 'object') { 391 if ($.type(res) !== 'object') {
392 return; 392 return;
393 } 393 }
@@ -261,7 +261,7 @@ $reaMask.find('.box-cmp').on('touchend', function() { @@ -261,7 +261,7 @@ $reaMask.find('.box-cmp').on('touchend', function() {
261 reasonId: reasonId 261 reasonId: reasonId
262 } 262 }
263 }).then(function(res) { 263 }).then(function(res) {
264 - $reaMask.css('visibility', 'visible'); 264 + $reaMask.css('visibility', 'hidden');
265 if ($.type(res) !== 'object') { 265 if ($.type(res) !== 'object') {
266 return; 266 return;
267 } 267 }
@@ -302,7 +302,7 @@ $refundReaMask.find('.box-cmp').on('touchend', function() { @@ -302,7 +302,7 @@ $refundReaMask.find('.box-cmp').on('touchend', function() {
302 reasonId: reasonId 302 reasonId: reasonId
303 } 303 }
304 }).then(function(res) { 304 }).then(function(res) {
305 - $refundReaMask.css('visibility', 'visible'); 305 + $refundReaMask.css('visibility', 'hidden');
306 if ($.type(res) !== 'object') { 306 if ($.type(res) !== 'object') {
307 return; 307 return;
308 } 308 }
@@ -10,37 +10,10 @@ var qrCheck = { @@ -10,37 +10,10 @@ var qrCheck = {
10 }, 10 },
11 11
12 init: function() { 12 init: function() {
13 - var // ifr,  
14 - u = navigator.userAgent.toLowerCase(),  
15 - isiOS = u.indexOf('os') > -1 || u.indexOf('iphone') > -1 || u.indexOf('mac') > -1 || u.indexOf('ipad') > -1,  
16 - qr = this.getQuery('qr'),  
17 - isApp = this.getQuery('app_version'); 13 + var qr = this.getQuery('qr');
18 14
19 - if (qr && isApp) {  
20 - location.href = '//m.yohobuy.com/passport/update';  
21 - }  
22 -  
23 - if (qr && !isApp) {  
24 - if (isiOS) {  
25 - window.location = 'yohobuy://http://m.yohobuy.com/signin.html?qr=' + qr;  
26 - } else {  
27 - // 安卓跳下载  
28 - location.href = '//m.yohobuy.com/passport/update';  
29 -  
30 - // 安卓暂时不处理  
31 - // ifr = document.createElement('iframe');  
32 - // ifr.src = 'yohobuy://http://m.yohobuy.com/signin.html?qr=' + qr;  
33 - // ifr.style.display = 'none';  
34 - // document.body.appendChild(ifr);  
35 - }  
36 -  
37 - // time = Date.now();  
38 - // window.setTimeout(function() {  
39 - // document.body.removeChild(ifr);  
40 - // if (Date.now() - time < 2200) {  
41 - // window.location.href = 'http://a.app.qq.com/o/simple.jsp?pkgname=com.yoho';  
42 - // }  
43 - // }, 2000); 15 + if (qr) {
  16 + location.href = 'http://union.yoho.cn/union/app-downloads.html';
44 } 17 }
45 } 18 }
46 }; 19 };
@@ -32,6 +32,7 @@ let imgCheck = new ImgCheck('#js-img-check', { @@ -32,6 +32,7 @@ let imgCheck = new ImgCheck('#js-img-check', {
32 32
33 imgCheck.init(); 33 imgCheck.init();
34 34
  35 +require('./login/qr-check');
35 36
36 // 显示找回密码面板 37 // 显示找回密码面板
37 function showRetrivePanel() { 38 function showRetrivePanel() {
  1 +require('../common');
@@ -37,7 +37,7 @@ var $input = $('#search-input').find('input[name="query"]'), @@ -37,7 +37,7 @@ var $input = $('#search-input').find('input[name="query"]'),
37 $search = $('#search'); 37 $search = $('#search');
38 38
39 var shopId, sort, brand, outlets, app_type, age_level, msort, misort, coin, app_version, students, couponId, searchFrom; 39 var shopId, sort, brand, outlets, app_type, age_level, msort, misort, coin, app_version, students, couponId, searchFrom;
40 -var size, color, style, standard, gender, price, p_d, query, limited, specialoffer, specialsale_id, promotion; 40 +var size, color, style, standard, gender, price, p_d, oldquery, query, limited, specialoffer, specialsale_id, promotion;
41 41
42 // 默认筛选条件 42 // 默认筛选条件
43 var defaultOpt = require('common/query-param'); 43 var defaultOpt = require('common/query-param');
@@ -240,7 +240,8 @@ gender = getQueryString('gender'); @@ -240,7 +240,8 @@ gender = getQueryString('gender');
240 price = getQueryString('price'); 240 price = getQueryString('price');
241 p_d = getQueryString('p_d'); 241 p_d = getQueryString('p_d');
242 brand = getQueryString('brand'); 242 brand = getQueryString('brand');
243 -query = $('.query-param[data-attr="query"]').val() || getQueryString('query'); 243 +oldquery = getQueryString('query');
  244 +query = $('.query-param[data-attr="query"]').val() || oldquery;
244 limited = getQueryString('limited'); 245 limited = getQueryString('limited');
245 specialoffer = getQueryString('specialoffer'); 246 specialoffer = getQueryString('specialoffer');
246 specialsale_id = getQueryString('specialsale_id'); 247 specialsale_id = getQueryString('specialsale_id');
@@ -538,6 +539,11 @@ function search(opt) { @@ -538,6 +539,11 @@ function search(opt) {
538 } 539 }
539 } 540 }
540 541
  542 + // 如果page =1,默认是用户输入的搜索词,否则是推荐词
  543 + if (setting.start !== 12 && setting.page === 1 && oldquery) {
  544 + setting.query = oldquery;
  545 + }
  546 +
541 $.ajax({ 547 $.ajax({
542 type: 'GET', 548 type: 'GET',
543 url: location.protocol + '//m.yohobuy.com/product/search/search', 549 url: location.protocol + '//m.yohobuy.com/product/search/search',
@@ -39,7 +39,8 @@ var $input = $('#search-input').find('input[name="query"]'), @@ -39,7 +39,8 @@ var $input = $('#search-input').find('input[name="query"]'),
39 39
40 var C_ID, filext = {}, total, argument; 40 var C_ID, filext = {}, total, argument;
41 41
42 -var shopId, sort, brand, outlets, app_type, age_level, msort, misort, coin, app_version, first_load = true, searchFrom; 42 +var shopId, sort, brand, outlets, app_type, age_level, msort, misort,
  43 + coin, app_version, first_load = true, searchFrom, oldquery, query;
43 44
44 // 默认筛选条件 45 // 默认筛选条件
45 var defaultOpt = require('common/query-param'); 46 var defaultOpt = require('common/query-param');
@@ -215,6 +216,8 @@ misort = getQueryString('misort'); @@ -215,6 +216,8 @@ misort = getQueryString('misort');
215 coin = getQueryString('coin'); 216 coin = getQueryString('coin');
216 app_version = getQueryString('app_version') || getQueryString('appVersion'); 217 app_version = getQueryString('app_version') || getQueryString('appVersion');
217 searchFrom = getQueryString('from'); 218 searchFrom = getQueryString('from');
  219 +oldquery = getQueryString('query');
  220 +query = $('.query-param[data-attr="query"]').val() || oldquery;
218 221
219 /** 222 /**
220 * 筛选注册的回调,筛选子项点击后逻辑 223 * 筛选注册的回调,筛选子项点击后逻辑
@@ -385,6 +388,11 @@ function search(opt) { @@ -385,6 +388,11 @@ function search(opt) {
385 388
386 argument = setting; 389 argument = setting;
387 390
  391 + // 如果page =1,默认是用户输入的搜索词,否则是推荐词
  392 + if (setting.start !== 12 && setting.page === 1 && oldquery) {
  393 + setting.query = oldquery;
  394 + }
  395 +
388 $.ajax({ 396 $.ajax({
389 type: 'GET', 397 type: 'GET',
390 url: location.protocol + '//m.yohobuy.com/product/search/search', 398 url: location.protocol + '//m.yohobuy.com/product/search/search',
@@ -447,10 +455,9 @@ function search(opt) { @@ -447,10 +455,9 @@ function search(opt) {
447 } 455 }
448 } else { 456 } else {
449 457
450 -  
451 if (nav.reload) { 458 if (nav.reload) {
452 459
453 - var goodList = []; 460 + var goodList = [], wordContents = [];
454 461
455 $(data).each(function(i, goodInfo) { 462 $(data).each(function(i, goodInfo) {
456 if ($(goodInfo).hasClass('good-info')) { 463 if ($(goodInfo).hasClass('good-info')) {
@@ -458,7 +465,10 @@ function search(opt) { @@ -458,7 +465,10 @@ function search(opt) {
458 goodIds.push($(goodInfo).data('good-id')); 465 goodIds.push($(goodInfo).data('good-id'));
459 } else if ($(goodInfo).hasClass('total')) { 466 } else if ($(goodInfo).hasClass('total')) {
460 total = $(goodInfo).data('id'); 467 total = $(goodInfo).data('id');
  468 + } else if ($(goodInfo).hasClass('word-content')) {
  469 + wordContents.push(goodInfo);
461 } 470 }
  471 +
462 }); 472 });
463 473
464 yasparm = Object.assign(yasparm, { 474 yasparm = Object.assign(yasparm, {
@@ -482,7 +492,7 @@ function search(opt) { @@ -482,7 +492,7 @@ function search(opt) {
482 goodList.splice(0, 4); 492 goodList.splice(0, 4);
483 $container.append(goodList); 493 $container.append(goodList);
484 } else { 494 } else {
485 - $container.html(goodList); 495 + $container.html([].concat(wordContents, goodList));
486 } 496 }
487 lazyLoad($container.find('.lazy')); 497 lazyLoad($container.find('.lazy'));
488 } else { 498 } else {
@@ -152,11 +152,13 @@ @@ -152,11 +152,13 @@
152 152
153 .close { 153 .close {
154 float: right; 154 float: right;
155 - width: 30px;  
156 - height: 30px;  
157 - margin: 16px 16px 0 0;  
158 - text-align: right; 155 + width: 60px;
  156 + height: 60px;
  157 + text-align: center;
  158 + line-height: 60px;
159 color: #b1b1b1; 159 color: #b1b1b1;
  160 + position: relative;
  161 + z-index: 2;
160 } 162 }
161 163
162 .infos { 164 .infos {
1 .recommend-for-you { 1 .recommend-for-you {
2 - &.width750 {  
3 - }  
4 padding: 30px 0; 2 padding: 30px 0;
5 border-top: 1px solid #e0e0e0; 3 border-top: 1px solid #e0e0e0;
6 border-bottom: 1px solid #e0e0e0; 4 border-bottom: 1px solid #e0e0e0;
7 background: #fff; 5 background: #fff;
8 font-size: 12px; 6 font-size: 12px;
  7 + padding-left: 15px;
9 8
10 .title { 9 .title {
11 color: #444; 10 color: #444;
@@ -46,7 +45,6 @@ @@ -46,7 +45,6 @@
46 line-height: 1; 45 line-height: 1;
47 46
48 .sale-price { 47 .sale-price {
49 - /*display: block;*/  
50 margin-right: 8px; 48 margin-right: 8px;
51 color: #d9134f; 49 color: #d9134f;
52 } 50 }
@@ -95,7 +93,6 @@ @@ -95,7 +93,6 @@
95 font-size: 28px; 93 font-size: 28px;
96 94
97 .sale-price { 95 .sale-price {
98 - /*display: block;*/  
99 margin-right: 9px; 96 margin-right: 9px;
100 } 97 }
101 } 98 }
@@ -186,13 +186,14 @@ @@ -186,13 +186,14 @@
186 186
187 .multi-brands { 187 .multi-brands {
188 width: 100%; 188 width: 100%;
189 - height: 270px; 189 + height: 290px;
190 background: #fff; 190 background: #fff;
191 border: 1px solid #e0e0e0; 191 border: 1px solid #e0e0e0;
192 border-top: none; 192 border-top: none;
193 font-size: 20px; 193 font-size: 20px;
194 text-align: center; 194 text-align: center;
195 padding-top: 25px; 195 padding-top: 25px;
  196 + padding-bottom: 20px;
196 margin-bottom: 30px; 197 margin-bottom: 30px;
197 overflow: hidden; 198 overflow: hidden;
198 199
@@ -399,9 +399,9 @@ exports.processSkusInfo = (origin) => { @@ -399,9 +399,9 @@ exports.processSkusInfo = (origin) => {
399 let colorProp = dest.props.find(prop => prop.type === 'color'), 399 let colorProp = dest.props.find(prop => prop.type === 'color'),
400 sizeProp = dest.props.find(prop => prop.type === 'size'); 400 sizeProp = dest.props.find(prop => prop.type === 'size');
401 401
402 - if (!_.some(colorProp.values, prop => prop.id === color.color_id)) { 402 + if (!_.some(colorProp.values, prop => prop.id === color.product_skc)) {
403 colorProp.values.push({ 403 colorProp.values.push({
404 - id: color.color_id, 404 + id: color.product_skc,
405 name: color.factory_goods_name || color.color_name 405 name: color.factory_goods_name || color.color_name
406 }); 406 });
407 } 407 }
@@ -419,7 +419,7 @@ exports.processSkusInfo = (origin) => { @@ -419,7 +419,7 @@ exports.processSkusInfo = (origin) => {
419 thumb: helpers.image(color.color_image, 300, 395), 419 thumb: helpers.image(color.color_image, 300, 395),
420 prop: { 420 prop: {
421 color: { 421 color: {
422 - valId: color.color_id, 422 + valId: color.product_skc,
423 valName: color.factory_goods_name || color.color_name 423 valName: color.factory_goods_name || color.color_name
424 }, 424 },
425 size: { 425 size: {