Authored by ccbikai(👎🏻🍜)

Merge branch 'master' into release/5.5

... ... @@ -67,6 +67,8 @@ const _getOrderStatus = (order, showLogistics) => {
isPayonline: true
});
let isPayaly = order.paymentName === '' ? false : true;
switch (order.status) {
case 0:
... ... @@ -83,7 +85,7 @@ const _getOrderStatus = (order, showLogistics) => {
/* 已付款状态不给查看物流 URL */
Object.assign(result, {
unreceived: true,
payAly: true
payAly: isPayaly
});
break;
case 4:
... ... @@ -92,7 +94,7 @@ const _getOrderStatus = (order, showLogistics) => {
/* 已发货状态,给查看物流或二维码URL */
Object.assign(result, {
unreceived: true,
payAly: true
payAly: isPayaly
});
/* 是否门票 */
... ... @@ -109,7 +111,7 @@ const _getOrderStatus = (order, showLogistics) => {
/* 已成功订单,给查看物流或二维码URL */
Object.assign(result, {
completed: true,
payAly: true
payAly: isPayaly
});
/* 是否门票 */
... ...
... ... @@ -6,6 +6,7 @@
const mRoot = '../models';
const utils = '../../../utils';
const listModel = require(`${mRoot}/list`);
const shopModel = require(`${mRoot}/shop`);
const searchModel = require(`${mRoot}/search`);
const redsShopModel = require(`${mRoot}/popular-shop`);
const headerModel = require('../../../doraemon/models/header');
... ... @@ -14,6 +15,25 @@ const helpers = global.yoho.helpers;
const productProcess = require(`${utils}/product-process`);
/**
* 从 useragent 获取 uid
* @returns {*}
* @private
*/
const _getUidFromUserAgent = (req) => {
let userAgent = _.split(req.headers['user-agent'], ';');
let uidString = '';
_.forEach(userAgent, value => {
if (_.startsWith(value, 'uid')) {
uidString = value;
return;
}
});
return _.split(uidString, '=')[1];
};
const shop = {
index(req, res, next) {
let params = Object.assign({}, req.query);
... ... @@ -66,7 +86,10 @@ const shop = {
shop.shop(req, res, next);
return false;
} else if (req.query.from === 'search') {
return Promise.all([listModel.getBrandShops(brandId, req), searchModel.getSearchData(searchParam)]).then(shopResult => {
return Promise.all([
listModel.getBrandShops(brandId, req),
searchModel.getSearchData(searchParam)
]).then(shopResult => {
let brandShop = shopResult[0];
let newGoods = shopResult[1];
... ... @@ -105,7 +128,10 @@ const shop = {
title: result.name,
id: result.id
};
return Promise.all([listModel.getBrandBanner(brandId), searchModel.getSearchData(searchParam)]).then(brandResult => {
return Promise.all([
listModel.getBrandBanner(brandId),
searchModel.getSearchData(searchParam)
]).then(brandResult => {
let brandBanner = brandResult[0];
let newGoods = brandResult[1];
... ... @@ -193,8 +219,12 @@ const shop = {
}
/* 基础店铺返回程序内的跳转信号,跳转到基础店铺 */
if (shopInfoResult && shopInfoResult.shop_template_type && parseInt(shopInfoResult.shop_template_type, 10) === 1) {
return Promise.all([listModel.getBaseShopData(req.query, shopInfo), searchModel.getSearchData(searchParam)]).then(fResult => {
if (shopInfoResult && shopInfoResult.shop_template_type &&
parseInt(shopInfoResult.shop_template_type, 10) === 1) {
return Promise.all([
listModel.getBaseShopData(req.query, shopInfo),
searchModel.getSearchData(searchParam)
]).then(fResult => {
let baseShop = fResult[0];
let newGoods = fResult[1];
... ... @@ -214,8 +244,10 @@ const shop = {
showDownloadApp: true,
pageFooter: true,
title: shopInfo.shop_name + '|' + shopInfo.shop_name + '潮流服装服饰-Yoho!Buy有货',
keywords: shopInfo.shop_name + ',' + shopInfo.shop_name + '服装服饰,' + shopInfo.shop_name + '潮流服装服饰',
description: shopInfo.shop_name + '|Yoho!Buy有货' + shopInfo.shop_name + '潮流服饰官方授权店!100%品牌正品保证,支持货到付款。',
keywords: shopInfo.shop_name + ',' + shopInfo.shop_name + '服装服饰,' +
shopInfo.shop_name + '潮流服装服饰',
description: shopInfo.shop_name + '|Yoho!Buy有货' + shopInfo.shop_name +
'潮流服饰官方授权店!100%品牌正品保证,支持货到付款。',
shopId: shopId,
shopPage: true,
_noLazy: true,
... ... @@ -226,7 +258,10 @@ const shop = {
});
} else {
// 经典装修店铺
return Promise.all([listModel.getShopDecorator(shopId).then(), listModel.getShopCategoryApi(shopId, channel)]).then(fResult => {
return Promise.all([
listModel.getShopDecorator(shopId).then(),
listModel.getShopCategoryApi(shopId, channel)
]).then(fResult => {
let shopDeco = fResult[0];
let shopCategory = fResult[1];
... ... @@ -239,7 +274,8 @@ const shop = {
let result = listModel.formShopData(shopData, shopId, isApp);
result = _.assign(result, pageHeader, {shopId: shopId, coverChannel: channel, seoResult: seoResult});
result = _.assign(result, pageHeader,
{shopId: shopId, coverChannel: channel, seoResult: seoResult});
res.render('newshop/shop-classics', {
module: 'product',
... ... @@ -358,28 +394,31 @@ const shop = {
banner, brand, introData, decoratorsData,
time3: [0, 1, 2]
});
});
}).catch(next);
}
};
},
/**
* 从 useragent 获取 uid
* @returns {*}
* @private
*/
const _getUidFromUserAgent = (req) => {
let userAgent = _.split(req.headers['user-agent'], ';');
let uidString = '';
/**
* 店铺全部品牌页面
*/
allBrand(req, res, next) {
let shopId = req.query.shop_id;
_.forEach(userAgent, value => {
if (_.startsWith(value, 'uid')) {
uidString = value;
return;
if (!shopId) {
return next();
}
});
return _.split(uidString, '=')[1];
shopModel.getShopBrands(req.query.shop_id).then(result => {
res.render('newshop/all-brand', {
result: result,
pageHeader: headerModel.setNav({
navTitle: '品牌'
}),
module: 'product',
page: 'all-brand',
});
}).catch(next);
}
};
module.exports = shop;
... ...
... ... @@ -352,7 +352,7 @@ const _formShopData = (data, shopId, isApp) => {
_.forEach(resData, (item) => {
if (item.brandDomain) {
brand.list.push({
url: helpers.urlFormat('', '', item.brandDomain) + (isApp ? `?openby:yohobuy={"action":"go.brand","params":{"shop_id":${shopId},"brand_id":${item.id}}}` : ''), //eslint-disable-line
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
img: helpers.image(item.brandIco, 640, 400),
brandName: item.brandName
});
... ...
/**
* 店铺
*/
'use strict';
const _ = require('lodash');
const helpers = global.yoho.helpers;
const api = global.yoho.API;
/**
* 店铺品牌列表
*/
const getShopBrands = (shopId) => {
return api.get('', {
method: 'app.shops.getShopsBrands',
shop_id: shopId
}, {code: 200}).then(result => {
if (result && result.data) {
_.forEach(result.data, value => {
value.url = helpers.urlFormat('', {
shop_id: shopId,
brand: value.brand_id,
title: value.brand_name
}, 'list');
});
return result.data;
} else {
return [];
}
});
};
module.exports = {
getShopBrands
};
... ...
... ... @@ -198,4 +198,6 @@ router.get('/bundle/detail', bundle.detail); // 套装详情页
router.post('/opt/favoriteProduct', newDetail.favoriteProduct); // 商品收藏、取消收藏
router.get('/detail/limitHelp', newDetail.limitHelp);
router.get('/index/allBrand', newShop.allBrand); // 店铺全部品牌
module.exports = router;
... ...
<div class="brand-shop-page">
{{# result}}
<a class="brand-list buriedpoint" href="{{url}}" data-bp-id="guang_brandlist_{{brand_name}}_0">
{{brand_name}}
</a>
{{/ result}}
</div>
\ No newline at end of file
... ...
... ... @@ -10,37 +10,10 @@ var qrCheck = {
},
init: function() {
var // ifr,
u = navigator.userAgent.toLowerCase(),
isiOS = u.indexOf('os') > -1 || u.indexOf('iphone') > -1 || u.indexOf('mac') > -1 || u.indexOf('ipad') > -1,
qr = this.getQuery('qr'),
isApp = this.getQuery('app_version');
var qr = this.getQuery('qr');
if (qr && isApp) {
location.href = '//m.yohobuy.com/passport/update';
}
if (qr && !isApp) {
if (isiOS) {
window.location = 'yohobuy://http://m.yohobuy.com/signin.html?qr=' + qr;
} else {
// 安卓跳下载
location.href = '//m.yohobuy.com/passport/update';
// 安卓暂时不处理
// ifr = document.createElement('iframe');
// ifr.src = 'yohobuy://http://m.yohobuy.com/signin.html?qr=' + qr;
// ifr.style.display = 'none';
// document.body.appendChild(ifr);
}
// time = Date.now();
// window.setTimeout(function() {
// document.body.removeChild(ifr);
// if (Date.now() - time < 2200) {
// window.location.href = 'http://a.app.qq.com/o/simple.jsp?pkgname=com.yoho';
// }
// }, 2000);
if (qr) {
location.href = 'http://union.yoho.cn/union/app-downloads.html';
}
}
};
... ...
... ... @@ -32,6 +32,7 @@ let imgCheck = new ImgCheck('#js-img-check', {
imgCheck.init();
require('./login/qr-check');
// 显示找回密码面板
function showRetrivePanel() {
... ...
require('../common');
... ...
... ... @@ -186,13 +186,14 @@
.multi-brands {
width: 100%;
height: 270px;
height: 290px;
background: #fff;
border: 1px solid #e0e0e0;
border-top: none;
font-size: 20px;
text-align: center;
padding-top: 25px;
padding-bottom: 20px;
margin-bottom: 30px;
overflow: hidden;
... ...