Authored by ccbikai(👎🏻🍜)

Merge branch 'master' into release/5.5

@@ -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;
@@ -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 });
  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>
@@ -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');
@@ -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