Authored by 郭成尧

Merge branch 'gray' into 'master'

Gray



See merge request !387
@@ -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
@@ -97,7 +120,10 @@ const shop = { @@ -97,7 +120,10 @@ const shop = {
97 title: result.name, 120 title: result.name,
98 id: result.id 121 id: result.id
99 }; 122 };
100 - return Promise.all([listModel.getBrandBanner(brandId), searchModel.getSearchData(searchParam)]).then(brandResult => { 123 + return Promise.all([
  124 + listModel.getBrandBanner(brandId),
  125 + searchModel.getSearchData(searchParam)
  126 + ]).then(brandResult => {
101 let brandBanner = brandResult[0]; 127 let brandBanner = brandResult[0];
102 let newGoods = brandResult[1]; 128 let newGoods = brandResult[1];
103 129
@@ -184,8 +210,12 @@ const shop = { @@ -184,8 +210,12 @@ const shop = {
184 } 210 }
185 211
186 /* 基础店铺返回程序内的跳转信号,跳转到基础店铺 */ 212 /* 基础店铺返回程序内的跳转信号,跳转到基础店铺 */
187 - if (shopInfoResult && shopInfoResult.shop_template_type && parseInt(shopInfoResult.shop_template_type, 10) === 1) {  
188 - return Promise.all([listModel.getBaseShopData(req.query, shopInfo), searchModel.getSearchData(searchParam)]).then(fResult => { 213 + if (shopInfoResult && shopInfoResult.shop_template_type &&
  214 + parseInt(shopInfoResult.shop_template_type, 10) === 1) {
  215 + return Promise.all([
  216 + listModel.getBaseShopData(req.query, shopInfo),
  217 + searchModel.getSearchData(searchParam)
  218 + ]).then(fResult => {
189 let baseShop = fResult[0]; 219 let baseShop = fResult[0];
190 let newGoods = fResult[1]; 220 let newGoods = fResult[1];
191 221
@@ -205,8 +235,10 @@ const shop = { @@ -205,8 +235,10 @@ const shop = {
205 showDownloadApp: true, 235 showDownloadApp: true,
206 pageFooter: true, 236 pageFooter: true,
207 title: shopInfo.shop_name + '|' + shopInfo.shop_name + '潮流服装服饰-Yoho!Buy有货', 237 title: shopInfo.shop_name + '|' + shopInfo.shop_name + '潮流服装服饰-Yoho!Buy有货',
208 - keywords: shopInfo.shop_name + ',' + shopInfo.shop_name + '服装服饰,' + shopInfo.shop_name + '潮流服装服饰',  
209 - description: shopInfo.shop_name + '|Yoho!Buy有货' + shopInfo.shop_name + '潮流服饰官方授权店!100%品牌正品保证,支持货到付款。', 238 + keywords: shopInfo.shop_name + ',' + shopInfo.shop_name + '服装服饰,' +
  239 + shopInfo.shop_name + '潮流服装服饰',
  240 + description: shopInfo.shop_name + '|Yoho!Buy有货' + shopInfo.shop_name +
  241 + '潮流服饰官方授权店!100%品牌正品保证,支持货到付款。',
210 shopId: shopId, 242 shopId: shopId,
211 shopPage: true, 243 shopPage: true,
212 _noLazy: true, 244 _noLazy: true,
@@ -217,7 +249,10 @@ const shop = { @@ -217,7 +249,10 @@ const shop = {
217 }); 249 });
218 } else { 250 } else {
219 // 经典装修店铺 251 // 经典装修店铺
220 - return Promise.all([listModel.getShopDecorator(shopId).then(), listModel.getShopCategoryApi(shopId, channel)]).then(fResult => { 252 + return Promise.all([
  253 + listModel.getShopDecorator(shopId).then(),
  254 + listModel.getShopCategoryApi(shopId, channel)
  255 + ]).then(fResult => {
221 256
222 let shopDeco = fResult[0]; 257 let shopDeco = fResult[0];
223 let shopCategory = fResult[1]; 258 let shopCategory = fResult[1];
@@ -230,7 +265,8 @@ const shop = { @@ -230,7 +265,8 @@ const shop = {
230 265
231 let result = listModel.formShopData(shopData, shopId, isApp); 266 let result = listModel.formShopData(shopData, shopId, isApp);
232 267
233 - result = _.assign(result, pageHeader, {shopId: shopId, coverChannel: channel, seoResult: seoResult}); 268 + result = _.assign(result, pageHeader,
  269 + {shopId: shopId, coverChannel: channel, seoResult: seoResult});
234 270
235 res.render('newshop/shop-classics', { 271 res.render('newshop/shop-classics', {
236 module: 'product', 272 module: 'product',
@@ -349,28 +385,31 @@ const shop = { @@ -349,28 +385,31 @@ const shop = {
349 banner, brand, introData, decoratorsData, 385 banner, brand, introData, decoratorsData,
350 time3: [0, 1, 2] 386 time3: [0, 1, 2]
351 }); 387 });
352 - }); 388 + }).catch(next);
353 389
354 - }  
355 -}; 390 + },
356 391
357 -/**  
358 - * 从 useragent 获取 uid  
359 - * @returns {*}  
360 - * @private  
361 - */  
362 -const _getUidFromUserAgent = (req) => {  
363 - let userAgent = _.split(req.headers['user-agent'], ';');  
364 - let uidString = ''; 392 + /**
  393 + * 店铺全部品牌页面
  394 + */
  395 + allBrand(req, res, next) {
  396 + let shopId = req.query.shop_id;
365 397
366 - _.forEach(userAgent, value => {  
367 - if (_.startsWith(value, 'uid')) {  
368 - uidString = value;  
369 - return; 398 + if (!shopId) {
  399 + return next();
370 } 400 }
371 - });  
372 401
373 - return _.split(uidString, '=')[1]; 402 + shopModel.getShopBrands(req.query.shop_id).then(result => {
  403 + res.render('newshop/all-brand', {
  404 + result: result,
  405 + pageHeader: headerModel.setNav({
  406 + navTitle: '品牌'
  407 + }),
  408 + module: 'product',
  409 + page: 'all-brand',
  410 + });
  411 + }).catch(next);
  412 + }
374 }; 413 };
375 414
376 module.exports = shop; 415 module.exports = shop;
  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>
1 { 1 {
2 "name": "m-yohobuy-node", 2 "name": "m-yohobuy-node",
3 - "version": "5.4.33", 3 + "version": "5.4.34",
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": {
@@ -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 };
  1 +require('../common');