Authored by lijing

非秒杀详情页跳转

... ... @@ -26,80 +26,81 @@ exports.getUser = (req, res, next) => {
detailModel.getUserProfile(uid).then((data) => {
result.isStudent = data.data && data.data.vip_info && data.data.vip_info.is_student ? true : false;
result.vipLevel = (data.data && data.data.vip_info && data.data.vip_info.cur_level) || '0';
req.__User__ = result;
next();
}).catch(next);
};
/**
* 商品基本信息
* @param {[type]} req [description]
* @param {[type]} res [description]
* @return {[type]} [description]
*/
exports.index = (req, res, next) => {
if (!req.params[0] || !req.params[1]) {
return next();
}
let uid = req.user.uid || 0;
let headerData = headerModel.setNav({
navTitle: '商品详情'
});
detailModel.getProductData({
id: req.params[0],
goodsId: req.params[1],
uid: uid,
ua: req.get('user-agent') || ''
}).then((result) => {
if (_.isEmpty(result)) {
return next();
}
result.studentPrice = req.__User__.isStudent && result && result.goodsPrice && result.goodsPrice.studentPrice ? result.goodsPrice.studentPrice : false;
res.render('detail/detail', {
pageHeader: headerData,
result: result,
page: 'seckill-detail',
title: result.goodsName,
pageFooter: true
});
}).catch(next);
};
/**
* 商品基本信息 SKN 进入
* @param {[type]} req [description]
* @param {[type]} res [description]
* @return {[type]} [description]
*/
exports.indexSkn = (req, res, next) => {
if (!req.params[0]) {
return next();
}
let uid = req.user.uid || 0;
let headerData = headerModel.setNav({
navTitle: '商品详情'
});
detailModel.getProductData({
productSkn: req.params[0],
uid: uid,
ua: req.get('user-agent') || ''
}).then((result) => {
if (_.isEmpty(result)) {
return next();
}
result.studentPrice = req.__User__.isStudent && result && result.goodsPrice && result.goodsPrice.studentPrice ? result.goodsPrice.studentPrice : false;
res.render('detail/detail', {
pageHeader: headerData,
result: result,
page: 'seckill-detail',
title: result.goodsName,
pageFooter: true
});
}).catch(next);
};
// /**
// * 商品基本信息
// * @param {[type]} req [description]
// * @param {[type]} res [description]
// * @return {[type]} [description]
// */
// exports.index = (req, res, next) => {
// if (!req.params[0] || !req.params[1]) {
// return next();
// }
// let uid = req.user.uid || 0;
// let headerData = headerModel.setNav({
// navTitle: '商品详情'
// });
// detailModel.getProductData({
// id: req.params[0],
// goodsId: req.params[1],
// uid: uid,
// ua: req.get('user-agent') || ''
// }).then((result) => {
// if (_.isEmpty(result)) {
// return next();
// }
// result.studentPrice = req.__User__.isStudent && result && result.goodsPrice && result.goodsPrice.studentPrice ? result.goodsPrice.studentPrice : false;
// res.render('detail/detail', {
// pageHeader: headerData,
// result: result,
// page: 'detail',
// title: result.goodsName,
// pageFooter: true
// });
// }).catch(next);
// };
// /**
// * 商品基本信息 SKN 进入
// * @param {[type]} req [description]
// * @param {[type]} res [description]
// * @return {[type]} [description]
// */
// exports.indexSkn = (req, res, next) => {
// if (!req.params[0]) {
// return next();
// }
// let uid = req.user.uid || 0;
// let headerData = headerModel.setNav({
// navTitle: '商品详情'
// });
// detailModel.getProductData({
// productSkn: req.params[0],
// uid: uid,
// ua: req.get('user-agent') || ''
// }).then((result) => {
// if (_.isEmpty(result)) {
// return next();
// }
// result.studentPrice = req.__User__.isStudent && result && result.goodsPrice && result.goodsPrice.studentPrice ? result.goodsPrice.studentPrice : false;
// res.render('detail/detail', {
// pageHeader: headerData,
// result: result,
// page: 'detail',
// title: result.goodsName,
// pageFooter: true
// });
// }).catch(next);
// };
/**
* 商品尺码信息详情
... ... @@ -260,6 +261,115 @@ exports.consultsubmit = (req, res, next) => {
}).catch(next);
};
/**
* 商品基本信息 SKN 进入 pagecache重构
* @param {[type]} req [description]
* @param {[type]} res [description]
* @return {[type]} [description]
*/
exports.indexSkn = (req, res, next) => {
if (!req.params[0]) {
return next();
}
// let uid = req.user.uid || 0;// pagecache重构
let headerData = headerModel.setNav({
navTitle: '商品详情'
});
detailModel.getProductData({
productSkn: req.params[0],
// uid: uid,
ua: req.get('user-agent') || ''
}).then((result) => {
if (_.isEmpty(result)) {
return next();
}
// pagecache重构
// result.studentPrice = req.__User__.isStudent && result && result.goodsPrice && result.goodsPrice.studentPrice ? result.goodsPrice.studentPrice : false;
res.render('detail/detail', {
pageHeader: headerData,
result: result,
page: 'seckill-detail',
title: result.goodsName,
pageFooter: true
});
}).catch(next);
};
/**
* 商品基本信息 pagecache重构
* @param {[type]} req [description]
* @param {[type]} res [description]
* @return {[type]} [description]
*/
exports.index = (req, res, next) => {
if (!req.params[0] || !req.params[1]) {
return next();
}
// let uid = req.user.uid || 0; // pagecache重构
let headerData = headerModel.setNav({
navTitle: '商品详情'
});
detailModel.getProductData({
id: req.params[0],
goodsId: req.params[1],
// uid: uid,
ua: req.get('user-agent') || ''
}).then((result) => {
if (_.isEmpty(result)) {
return next();
}
// pagecache重构
// result.studentPrice = req.__User__.isStudent && result && result.goodsPrice && result.goodsPrice.studentPrice ? result.goodsPrice.studentPrice : false;
res.render('detail/detail', {
pageHeader: headerData,
result: result,
page: 'seckill-detail',
title: result.goodsName,
pageFooter: true
});
}).catch(next);
};
/**
* 商品信息异步数据
* @param {[type]} req [description]
* @param {[type]} res [description]
* @return {[type]} [description]
*/
exports.indexData = (req, res, next)=> {
if (!req.xhr) {
return next();
}
if (!req.body.id) {
return next();
}
let uid = req.user.uid || 0;
detailModel.getProductAsyncData(Object.assign({
id: req.body.id,
goodsId: req.body.goodsId,
productSkn: req.body.productSkn,
uid: uid,
ua: req.get('user-agent') || ''
}, req.__User__)).then((result) => {
if (_.isEmpty(result)) {
return res.json({code: 400, message: '数据错误'});
}
result.studentPrice = req.__User__.isStudent && result && result.goodsPrice && result.goodsPrice.studentPrice ? result.goodsPrice.studentPrice : false;
return res.json(result);
}).catch(next);
};
// 获取秒杀信息
exports.getSeckillData = (req, res) => {
detailModel.getSeckillData({
... ...
... ... @@ -1577,6 +1577,10 @@ let _detailDataPkgAsync = (origin, uid, vipLevel, ua) => {
dest.goodsPrice = goodsPrice;
if (origin.is_secKill) {
dest.isSecKill = origin.is_secKill;// 判断秒杀字段
}
// 商品返回 YOHO 币
origin.yohoCoinNum && (dest.commodityReturn = origin.yohoCoinNum);
... ...
... ... @@ -9,6 +9,7 @@ const _ = require('lodash');
const comment = require('./consult-comment');
const api = global.yoho.API;
const singleAPI = global.yoho.SingleAPI;
const helpers = global.yoho.helpers;
const SINGLE_TICKETS_SKN = 51335912; // 展览票
... ... @@ -132,7 +133,1005 @@ const _getLimitCodeUrl = (productCode, skn, ua) => {
return url;
};
const _detailDataPkg = (origin, uid, vipLevel, ua) => {
/**
* 详情页数据格式化
* @param origin Object 原始数据
* @return dest Object 格式化数据
*/
// 老接口h5的代码
// const _detailDataPkg = (origin, uid, vipLevel, ua) => {
// let dest = {}, // 结果输出
// thumbImageList = [],
// colorGroup = {},
// sizeGroup = [],
// totalStorageNum = 0;
// // 商品名称
// if (origin.productName === null || typeof origin.productName === 'undefined') {
// return dest;
// }
// dest.goodsName = origin.productName;
// // 是否是虚拟商品
// dest.virtualGoods = origin.attribute * 1 === 3 ? true : false;
// // 用户未登录时
// if (!uid) {
// let params = {};
// params.refer = helpers.urlFormat('/product/show_' + origin.erpProductId + '.html');
// dest.loginUrl = helpers.urlFormat('/signin.html', params);
// }
// // 商品促销短语
// if (origin.salesPhrase) {
// dest.goodsSubtitle = origin.salesPhrase;
// }
// // 促销信息 TODO: 换新接口
// if (origin.promotionBoList) {
// let discountList = [];
// _.forEach(origin.promotionBoList, function(value) {
// discountList.push({
// text: `【${value.promotionType}】${value.promotionTitle}`
// });
// });
// if (discountList.length) {
// dest.goodsDiscount = {
// list: discountList
// };
// }
// }
// // 商品标签
// if (origin.productTagBoList) {
// let productTags = {};
// _.forEach(origin.productTagBoList, function(value) {
// switch (value.tagLabel) {
// case 'is_soon_sold_out':
// productTags.is_soon_sold_out = true;
// break;
// case 'is_new':
// productTags.is_new = true;
// break;
// case 'is_discount':
// productTags.is_discount = true;
// break;
// case 'is_limited':
// productTags.is_limited = true;
// break;
// case 'is_yohood':
// productTags.is_yohood = true;
// break;
// case 'is_advance':
// productTags.is_advance = true;
// break;
// default:
// break;
// }
// });
// dest.tags = productTags;
// }
// // 商品价格
// if (origin.productPriceBo) {
// let originPrice = origin.productPriceBo;
// let goodsPrice = {
// currentPrice: originPrice.formatSalesPrice
// };
// if (originPrice.formatMarketPrice !== originPrice.formatSalesPrice) {
// goodsPrice.previousPrice = originPrice.formatMarketPrice;
// }
// dest.goodsPrice = goodsPrice;
// // 商品返回 有货币
// if (originPrice.yohoCoinNum) {
// dest.commodityReturn = originPrice.yohoCoinNum;
// }
// }
// // VIP 商品价格
// if (origin.productPriceBo.vipPrices) {
// let vipList = [];
// _.forEach(origin.productPriceBo.vipPrices, function(value) {
// vipList.push({
// level: value.vipLevel,
// text: value.vipPrice,
// currentLevel: (value.vipLevel === vipLevel)
// });
// });
// if (vipList.length) {
// dest.vipLevel = {
// list: vipList
// };
// }
// }
// // 上市期
// if (origin.expectArrivalTime) {
// dest.periodOfMarket = `${origin.expectArrivalTime}月`;
// }
// // 商品咨询
// dest.feedbacks = {
// consults: [],
// consultsNum: 0
// };
// let consultParams = {
// product_id: origin.id
// };
// if (_.has(dest, 'feedbacks.consultsNum')) {
// consultParams.total = dest.feedbacks.consultsNum;
// dest.feedbacks.consultsUrl = helpers.urlFormat('/product/detail/consults', consultParams);
// } else {
// dest.feedbacks.consultsUrl = helpers.urlFormat('/product/detail/consultform', consultParams);
// }
// // 商品评价
// dest.feedbacks.commentsNum = 0;
// if (origin.commentBoWrapper) {
// dest.feedbacks.commentsNum = origin.commentBoWrapper.commentTotal;
// let commentList = [];
// _.forEach(origin.commentBoWrapper.commentBoList, function(value) {
// commentList.push({
// userName: value.nickName,
// desc: `${value.colorName}/${value.sizeName}`,
// content: value.content ? value.content : '',
// time: value.createTime
// });
// });
// dest.feedbacks.comments = commentList;
// dest.feedbacks.commentsUrl = helpers.urlFormat('/product/detail/comments', {
// product_id: origin.id,
// total: dest.feedbacks.commentsNum
// });
// }
// // 品牌信息
// if (origin.brand) {
// let extra = `?productSkn=${origin.erpProductId}&brandId=${origin.brand.id}`;
// dest.preferenceUrl = `/product/detail/preference${extra}`;
// }
// dest.productSkn = origin.erpProductId;
// // 商品信息
// if (origin.goodsList) {
// let goodsGroup = [],
// sizeName = '',
// colorList = [],
// sizeList = {},
// allSizeList = {},
// colorStorageGroup = {},
// colorStorageNum = 0;
// _.forEach(origin.goodsList, function(value) {
// if (value.status === 0) {
// return;
// }
// colorStorageNum = 0;
// // 商品分组
// if (value.goodsImagesList) {
// _.forEach(value.goodsImagesList, function(good) {
// goodsGroup.push({
// goodsId: good.goodsId,
// img: good.imageUrl
// });
// });
// }
// // 商品的尺码列表
// colorStorageGroup[value.productSkc] = {};
// if (value.goodsSizeBoList) {
// sizeList[value.productSkc] = [];
// _.forEach(value.goodsSizeBoList, function(size) {
// sizeList[value.productSkc].push({
// id: size.id,
// skuId: size.goodsSizeSkuId,
// goodsId: size.goodsId,
// colorId: size.colorId,
// name: size.sizeName,
// sizeNum: size.goodsSizeStorageNum
// });
// sizeName = size.sizeName;
// // 所有尺码列表,赋值用于前端展示默认尺码的时候
// // 判断出没有库存则显示灰色
// let build = {
// id: size.id,
// storage: size.goodsSizeStorageNum
// };
// allSizeList[sizeName] = (allSizeList[sizeName] === null ||
// typeof allSizeList[sizeName] === 'undefined') ? build :
// allSizeList[sizeName];
// colorStorageNum += parseInt(size.goodsSizeStorageNum, 10);
// colorStorageGroup[value.productSkc][sizeName] = parseInt(size.goodsSizeStorageNum, 10);
// });
// // 颜色分组
// colorList.push({
// id: value.colorId,
// skcId: value.productSkc,
// name: value.colorName,
// goodsName: value.goodsName,
// colorNum: colorStorageNum
// });
// }
// // 缩略图
// thumbImageList.push({
// img: value.colorImage
// });
// // 商品库存总数
// totalStorageNum += _.toNumber(colorStorageNum);
// });
// // 遍历所有尺码,构建颜色显示数据
// let i = 1;
// sizeGroup[0] = {
// size: []
// };
// _.forEach(allSizeList, (value, key) => {
// // 默认尺码
// sizeGroup[0].size.push({
// name: key,
// sizeNum: _.toNumber(value.storage) > 0 ? true : false,
// id: value.id
// });
// colorGroup[i] = {
// color: []
// };
// // 各个颜色的尺码, 每行显示一个尺码对应的颜色
// _.forEach(colorList, (colorArr) => {
// let tempColorArr = _.cloneDeep(colorArr);
// if (colorStorageGroup[tempColorArr.skcId] &&
// colorStorageGroup[tempColorArr.skcId][key]) {
// tempColorArr.colorNum = colorStorageGroup[tempColorArr.skcId][key];
// } else {
// tempColorArr.colorNum = 0;
// }
// colorGroup[i].color.push(Object.assign({}, tempColorArr));
// });
// colorGroup[i].id = value.id;
// ++i;
// });
// colorGroup[0] = {
// color: []
// };
// // 遍历所有颜色, 构建尺码显示数据
// i = 1;
// _.forEach(colorList, function(value) {
// // 各个尺码的颜色, 每行显示一个颜色的对应尺码
// sizeGroup[i] = {
// size: sizeList[value.skcId],
// colorId: value.skcId
// };
// // 默认颜色
// colorGroup[0].color.push(value);
// ++i;
// });
// // 商品图:多个
// if (goodsGroup.length > 1) {
// let bannerList = [];
// _.forEach(goodsGroup, function(value) {
// bannerList.push({
// img: value.img
// });
// });
// dest.bannerTop = {
// list: bannerList
// };
// } else if (goodsGroup[0] !== null && typeof goodsGroup[0] !== 'undefined') {
// dest.bannerTop = {
// img: goodsGroup[0].img
// };
// }
// }
// // 悬浮的购物车信息
// dest.cartInfo = {
// cartUrl: helpers.urlFormat('/cart/index/index'),
// numInCart: 0,
// goodsInstore: origin.storage
// };
// let soldOut = (origin.storage === 0) || (origin.status === 0 || totalStorageNum === 0);
// let notForSale = origin.attribute === 2;
// // 显示加入购物车链接
// if (!soldOut && !notForSale) {
// _.orderBy(colorGroup);
// Object.assign(dest.cartInfo, {
// productId: origin.id,
// thumbs: thumbImageList,
// name: dest.goodsName ? dest.goodsName : '',
// price: dest.goodsPrice.previousPrice ? dest.goodsPrice.previousPrice : '',
// salePrice: dest.goodsPrice.currentPrice ? dest.goodsPrice.currentPrice : '',
// totalNum: totalStorageNum,
// colors: _.toArray(colorGroup),
// sizes: sizeGroup
// });
// // 限购商品
// if (origin.isLimitBuy === 'Y') {
// // 是否开售
// let isBeginSale = (origin.saleStatus !== null && typeof origin.saleStatus !== 'undefined' &&
// origin.saleStatus === 1);
// // 限购商品有关的展示状态
// let showStatus = 1;
// if (origin.showStatus !== null && typeof origin.showStatus !== 'undefined') {
// showStatus = parseInt(origin.showStatus, 10);
// }
// // 处理限购商品有关的按钮状态
// dest = _procShowStatus(dest, showStatus, isBeginSale);
// dest.cartInfo.limitProductCode = origin.limitProductCode;
// dest.cartInfo.limitCodeUrl = _getLimitCodeUrl(origin.limitProductCode, origin.erpProductId, ua);
// dest.cartInfo.limitProductPay = helpers.urlFormat('/cart/index/orderEnsure');
// } else {
// dest.cartInfo.addToCartUrl = helpers.urlFormat('/product/buy_' + origin.id + '_' +
// origin.goodsList.id + '.html');
// }
// } else if (notForSale) {
// dest.cartInfo.notForSale = true;
// } else if (soldOut) {
// dest.cartInfo.soldOut = true;
// }
// // 是否收藏
// dest.isCollect = false;
// if (origin.isCollect !== null && typeof origin.isCollect !== 'undefined' && origin.isCollect === 'Y') {
// dest.isCollect = true;
// dest.cartInfo.isCollect = true;
// }
// // 底部简介URL链接
// dest.introUrl = '/product/detail/intro/' + origin.erpProductId;
// dest.id = origin.id;
// // 虚拟商品(门票)
// if (origin.attribute * 1 === 3) {
// dest.tickets = true;
// dest.ticketsConfirm = helpers.urlFormat('/cart/index/ticketsConfirm');
// // 展览票
// if (origin.erpProductId * 1 === SINGLE_TICKETS_SKN) {
// dest.single = true;
// } else {
// // 套票
// dest.package = true;
// }
// // 购票限制
// dest.cartInfo.limit = 4;
// // 清空活动
// dest.goodsDiscount = [];
// // 来自登录页,自动弹出选择框
// // if (isset($_GET['product_type']) && $_GET['product_type'] == 'ticket') {
// // $result['showPannel'] = true;
// // }
// }
// return dest;
// };
// const _detailDataPkg = (origin, uid, vipLevel, ua) => {
// let dest = {}, // 结果输出
// thumbImageList = [],
// colorGroup = {},
// sizeGroup = [],
// totalStorageNum = 0;
// // 商品名称
// if (!origin.productName) {
// dest.feedbacks = {};
// return dest;
// }
// dest.goodsName = origin.productName;
// // 是否是虚拟商品
// dest.virtualGoods = (origin.attribute * 1 === 3);
// // 用户未登录时
// if (!uid) {
// dest.loginUrl = helpers.urlFormat('/signin.html', {
// refer: helpers.urlFormat('/product/show_' + origin.productSkn + '.html')
// });
// }
// // 商品促销短语
// origin.salesPhrase && (dest.goodsSubtitle = origin.salesPhrase);
// // 促销信息 TODO: 换新接口
// if (origin.promotionBoList) {
// let discountList = [];
// _.forEach(origin.promotionBoList, function(value) {
// discountList.push({
// text: `【${value.promotionType}】${value.promotionTitle}`
// });
// });
// discountList.length && (dest.goodsDiscount = {
// list: discountList
// });
// }
// // 商品标签
// if (origin.tags) {
// let productTags = {};
// _.forEach(origin.tags, function(value) {
// productTags[value] = true;
// });
// dest.tags = productTags;
// }
// // 商品价格
// let goodsPrice = {
// currentPrice: origin.formatSalesPrice === '0' ? origin.formatMarketPrice : origin.formatSalesPrice
// };
// if (origin.formatSalesPrice !== '0' && origin.formatMarketPrice !== origin.formatSalesPrice) {
// goodsPrice.previousPrice = origin.formatMarketPrice;
// }
// dest.goodsPrice = goodsPrice;
// // 商品返回 YOHO 币
// origin.yohoCoinNum && (dest.commodityReturn = origin.yohoCoinNum);
// // VIP 商品价格
// if (origin.vip) {
// let vipList = [];
// let levelList = {
// 银卡: 1,
// 金卡: 2,
// 白金: 3
// };
// _.forEach(origin.vip, function(value) {
// vipList.push({
// level: levelList[value.caption],
// text: value.price,
// currentLevel: (value.vipLevel === vipLevel)
// });
// });
// vipList.length && (dest.vipLevel = {
// list: vipList
// });
// }
// // 上市期
// origin.expectArrivalTime && (dest.periodOfMarket = `${origin.expectArrivalTime}月`);
// // 商品咨询
// dest.feedbacks = {
// consults: [],
// consultsNum: 0
// };
// let consultParams = {
// product_id: origin.productId
// };
// if (_.has(dest, 'feedbacks.consultsNum')) {
// consultParams.total = dest.feedbacks.consultsNum;
// dest.feedbacks.consultsUrl = helpers.urlFormat('/product/detail/consults', consultParams);
// } else {
// dest.feedbacks.consultsUrl = helpers.urlFormat('/product/detail/consultform', consultParams);
// }
// // 商品评价
// dest.feedbacks.commentsUrl = helpers.urlFormat('/product/detail/comments', {
// product_id: origin.productId,
// });
// // 品牌信息
// if (origin.brand) {
// let extra = `?productSkn=${origin.productSkn}&brandId=${origin.brandInfo.brandId}`;
// dest.preferenceUrl = `/product/detail/preference${extra}`;
// }
// dest.productSkn = origin.productSkn;
// // 商品信息
// if (origin.goodsList) {
// let goodsGroup = [],
// sizeName = '',
// colorList = [],
// sizeList = {},
// allSizeList = {},
// colorStorageGroup = {},
// colorStorageNum = 0;
// _.forEach(origin.goodsList, function(value) {
// if (value.status === 0) {
// return;
// }
// colorStorageNum = 0;
// // 商品分组
// if (value.imagesList) {
// _.forEach(value.imagesList, function(good) {
// goodsGroup.push({
// goodsId: value.goodsId,
// img: good.imageUrl
// });
// });
// }
// // 商品的尺码列表
// colorStorageGroup[value.productSkc] = {};
// if (value.sizeList) {
// sizeList[value.productSkc] = [];
// _.forEach(value.sizeList, function(size) {
// sizeList[value.productSkc].push({
// id: size.sizeId,
// skuId: size.productSku,
// goodsId: value.goodsId,
// colorId: value.colorId,
// name: size.sizeName,
// sizeNum: size.storageNumber
// });
// sizeName = size.sizeName;
// // 所有尺码列表,赋值用于前端展示默认尺码的时候
// // 判断出没有库存则显示灰色
// let build = {
// id: size.sizeId,
// storage: size.storageNumber
// };
// allSizeList[sizeName] = (allSizeList[sizeName] === null ||
// typeof allSizeList[sizeName] === 'undefined') ? build : allSizeList[sizeName];
// colorStorageNum += parseInt(size.storageNumber, 10);
// colorStorageGroup[value.productSkc][sizeName] = parseInt(size.storageNumber, 10);
// });
// // 颜色分组
// colorList.push({
// id: value.colorId,
// skcId: value.productSkc,
// name: value.colorName,
// colorNum: colorStorageNum
// });
// }
// // 缩略图
// thumbImageList.push({
// img: value.colorImage
// });
// // 商品库存总数
// totalStorageNum += _.toNumber(colorStorageNum);
// });
// // 遍历所有尺码,构建颜色显示数据
// let i = 1;
// sizeGroup[0] = {
// size: []
// };
// _.forEach(allSizeList, (value, key) => {
// // 默认尺码
// sizeGroup[0].size.push({
// name: key,
// sizeNum: _.toNumber(value.storage) > 0 ? true : false,
// id: value.id
// });
// colorGroup[i] = {
// color: []
// };
// // 各个颜色的尺码, 每行显示一个尺码对应的颜色
// _.forEach(colorList, (colorArr) => {
// let tempColorArr = _.cloneDeep(colorArr);
// if (colorStorageGroup[tempColorArr.skcId] &&
// colorStorageGroup[tempColorArr.skcId][key]) {
// tempColorArr.colorNum = colorStorageGroup[tempColorArr.skcId][key];
// } else {
// tempColorArr.colorNum = 0;
// }
// colorGroup[i].color.push(Object.assign({}, tempColorArr));
// });
// colorGroup[i].id = value.id;
// ++i;
// });
// colorGroup[0] = {
// color: []
// };
// // 遍历所有颜色, 构建尺码显示数据
// i = 1;
// _.forEach(colorList, function(value) {
// // 各个尺码的颜色, 每行显示一个颜色的对应尺码
// sizeGroup[i] = {
// size: sizeList[value.skcId],
// colorId: value.skcId
// };
// // 默认颜色
// colorGroup[0].color.push(value);
// ++i;
// });
// // 商品图:多个
// if (goodsGroup.length > 1) {
// let bannerList = [];
// _.forEach(goodsGroup, function(value) {
// bannerList.push({
// img: value.img
// });
// });
// dest.bannerTop = {
// list: bannerList
// };
// } else if (goodsGroup[0]) {
// dest.bannerTop = {
// img: goodsGroup[0].img
// };
// }
// }
// // 悬浮的购物车信息
// dest.cartInfo = {
// cartUrl: helpers.urlFormat('/cart/index/index'),
// numInCart: 0,
// goodsInstore: origin.storageSum
// };
// let soldOut = (origin.storageSum === 0) || (totalStorageNum === 0); // status
// let notForSale = origin.attribute === 2;
// // 显示加入购物车链接
// if (!soldOut && !notForSale) {
// _.orderBy(colorGroup);
// Object.assign(dest.cartInfo, {
// productId: origin.productId,
// thumbs: thumbImageList,
// name: dest.goodsName ? dest.goodsName : '',
// price: dest.goodsPrice.previousPrice ? dest.goodsPrice.previousPrice : '',
// salePrice: dest.goodsPrice.currentPrice ? dest.goodsPrice.currentPrice : '',
// totalNum: totalStorageNum,
// colors: _.toArray(colorGroup),
// sizes: sizeGroup
// });
// // 限购商品
// if (origin.isLimitBuy) {
// // 是否开售
// let isBeginSale = (origin.saleStatus === 1);
// // 限购商品有关的展示状态
// let showStatus = 1;
// origin.showStatus && (showStatus = parseInt(origin.showStatus, 10));
// // 处理限购商品有关的按钮状态
// dest = _procShowStatus(dest, showStatus, isBeginSale);
// dest.cartInfo.limitProductCode = origin.limitProductCode;
// dest.cartInfo.limitCodeUrl = _getLimitCodeUrl(origin.limitProductCode, origin.productSkn, ua);
// dest.cartInfo.limitProductPay = helpers.urlFormat('/cart/index/orderEnsure');
// } else {
// dest.cartInfo.addToCartUrl = helpers.urlFormat('/product/buy_' + origin.productId + '_' +
// origin.goodsList.goodsId + '.html');
// }
// } else if (notForSale) {
// dest.cartInfo.notForSale = true;
// } else if (soldOut) {
// dest.cartInfo.soldOut = true;
// }
// // 是否收藏
// dest.isCollect = false;
// if (origin.isCollect === 'Y') {
// dest.isCollect = true;
// dest.cartInfo.isCollect = true;
// }
// // 底部简介URL链接
// dest.introUrl = '/product/detail/intro/' + origin.productSkn;
// dest.id = origin.productId;
// // 虚拟商品(门票)
// if (origin.attribute * 1 === 3) {
// dest.tickets = true;
// dest.ticketsConfirm = helpers.urlFormat('/cart/index/ticketsConfirm');
// // 展览票
// if (origin.productSkn * 1 === SINGLE_TICKETS_SKN) {
// dest.single = true;
// } else {
// // 套票
// dest.package = true;
// }
// // 购票限制
// dest.cartInfo.limit = 4;
// // 清空活动
// dest.goodsDiscount = [];
// // 来自登录页,自动弹出选择框
// // if (isset($_GET['product_type']) && $_GET['product_type'] == 'ticket') {
// // $result['showPannel'] = true;
// // }
// }
// return dest;
// };
let _getShopsInfo = (brandId) => {
if (!brandId) {
return Promise.resolve([]);
}
return api.get('', {
method: 'app.shop.seckill.queryShopsByBrandId',
brand_id: _.toString(brandId)
}, {
cache: true
}).then(shops => {
if (shops.code === 200) {
return _processShopsInfo(shops.data);
}
return [];
});
};
let _getPromotionInfo = (skn) => {
return api.get('', {
method: 'app.product.seckill.promotion',
product_skn: _.toString(skn)
}, {
cache: true
}).then((result) => {
if (result.code === 200) {
return result.data;
}
return {};
});
};
/**
* [单独获取用户收藏商品状态]
*/
let _getFavorite = (productId, uid) => {
if (!uid) {
return Promise.resolve({});
}
return singleAPI.get('favorite', {
method: 'app.favorite.isFavoriteNew',
uid: uid,
id: productId
}).then((result) => {
if (result.code === 200) {
return result.data;
}
return {};
});
};
// let getProductData = (data) => {
// let finalResult;
// let params = {
// method: 'app.product.seckill.data'
// };
// if (data.id) { // 通过 productId 获取商品详情
// Object.assign(params, {
// product_id: _.toString(data.id)
// });
// } else if (data.productSkn) { // 通过 productSkn 获取商品详情
// Object.assign(params, {
// product_skn: _.toString(data.productSkn)
// });
// }
// if (data.uid) {
// params.uid = data.uid;
// }
// return _getUserProfile(params.uid).then((user) => {
// data.vipLevel = (user.data && user.data.vip_info && user.data.vip_info.cur_level) || '0';
// data.isStudent = (user.data && user.data.vip_info && user.data.vip_info.is_student) ? true : false;
// params.is_student = data.isStudent ? 1 : 0;
// params.current_vip_level = data.vipLevel;
// return api.get('', params, {
// code: 200
// }).then(global.yoho.camelCase).then(result => {
// if (result.code === 500 || !result.data) {
// return {};
// }
// result = result.data;
// return Promise.all([
// _getShopsInfo(_.get(result, 'brandInfo.brandId', 0)),
// _getPromotionInfo(result.productSkn),
// comment.getCommentInfo({
// productId: result.productId
// }),
// _getCommonConsult(),
// comment.getConsults(result.productId, 1, 2)
// ]).then((info) => {
// result.promotionBoList = info[1];
// finalResult = _detailDataPkg(result, data.uid, data.vipLevel, data.ua);
// finalResult.enterStore = info[0];
// finalResult.isStudent = data.isStudent;
// Object.assign(finalResult.feedbacks, info[2]);
// /* 如果有咨询,显示咨询,否则显示常见问题 */
// if (info[4].total) {
// finalResult.feedbacks.consultsNum = parseInt(info[4].total, 10);
// Object.assign(finalResult.feedbacks, {
// commonConsults: false,
// consultsNum: parseInt(info[4].total, 10),
// consults: _.take(info[4].list, 2)
// });
// } else if (!_.isEmpty(info[3]) && !_.get(info[2], 'feedbacks.consultsNum', 0)) {
// Object.assign(finalResult.feedbacks, {
// commonConsults: true,
// consultsNum: true,
// consults: _.take(info[3], 2)
// });
// }
// return finalResult;
// });
// });
// });
// };
//
/**
* [商品获取数据] pagecache重构
*/
let getProductData = (data) => {
let finalResult;
let params = {
method: 'app.product.seckill.data'
};
if (data.id) { // 通过 productId 获取商品详情
Object.assign(params, {
product_id: _.toString(data.id)
});
} else if (data.productSkn) { // 通过 productSkn 获取商品详情
Object.assign(params, {
product_skn: _.toString(data.productSkn)
});
}
// pagecache重构
// if (data.uid) {
// params.uid = data.uid;
// }
// pagecache重构
// return _getUserProfile(params.uid).then((user) => {
// data.vipLevel = (user.data && user.data.vip_info && user.data.vip_info.cur_level) || '0';
// data.isStudent = (user.data && user.data.vip_info && user.data.vip_info.is_student) ? true : false;
// params.is_student = data.isStudent ? 1 : 0;
// params.current_vip_level = data.vipLevel;
return api.get('', params, {
code: 200,
cache: true
}).then(result => {
if (result.code === 500 || !result.data) {
return {};
}
result = result.data;
result.goods_id = data.goodsId;
return Promise.all([
_getShopsInfo(_.get(result, 'brand_info.brand_id', 0)),
// _getPromotionInfo(result.product_skn),
comment.getCommentInfo({
productId: result.product_id
}),
_getCommonConsult(),
comment.getConsults(result.product_id, 1, 2)
]).then((info) => {
// result.promotionBoList = info[1];
// finalResult = _detailDataPkg(result, data.uid, data.vipLevel, data.ua);
finalResult = _detailDataPkg(result, data.ua);
finalResult.enterStore = info[0];
finalResult.isStudent = data.isStudent;
Object.assign(finalResult.feedbacks, info[1]);
/* 如果有咨询,显示咨询,否则显示常见问题 */
if (info[3].total) {
finalResult.feedbacks.consultsNum = parseInt(info[3].total, 10);
Object.assign(finalResult.feedbacks, {
commonConsults: false,
consultsNum: parseInt(info[3].total, 10),
consults: _.take(info[3].list, 2)
});
} else if (!_.isEmpty(info[2]) && !_.get(info[1], 'feedbacks.consultsNum', 0)) {
Object.assign(finalResult.feedbacks, {
commonConsults: true,
consultsNum: true,
consults: _.take(info[2], 2)
});
}
return finalResult;
});
});
// });
};
/**
* [商品数据格式化] pagecache重构
*/
// const _detailDataPkg = (origin, uid, vipLevel, ua) => {
const _detailDataPkg = (origin, ua) => {
let dest = {}, // 结果输出
thumbImageList = [],
colorGroup = {},
... ... @@ -140,40 +1139,39 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => {
totalStorageNum = 0;
// 商品名称
if (!origin.productName) {
if (!origin.product_name) {
dest.feedbacks = {};
return dest;
}
dest.goodsName = origin.productName;
dest.goodsName = origin.product_name;
// 是否是虚拟商品
dest.virtualGoods = (origin.attribute * 1 === 3);
// 用户未登录时
if (!uid) {
dest.loginUrl = helpers.urlFormat('/signin.html', {
refer: helpers.urlFormat('/product/show_' + origin.productSkn + '.html')
});
}
// 用户未登录时 pagecache重构
// if (!uid) {
// dest.loginUrl = helpers.urlFormat('/signin.html', {
// refer: helpers.urlFormat('/product/show_' + origin.product_skn + '.html')
// });
// }
// 商品促销短语
origin.salesPhrase && (dest.goodsSubtitle = origin.salesPhrase);
origin.sales_phrase && (dest.goodsSubtitle = origin.sales_phrase);
// 促销信息 TODO: 换新接口
if (origin.promotionBoList) {
let discountList = [];
// 促销信息 TODO: 换新接口 pagecache重构
// if (origin.promotionBoList) {
// let discountList = [];
_.forEach(origin.promotionBoList, function(value) {
discountList.push({
text: `【${value.promotionType}${value.promotionTitle}`
});
});
// _.forEach(origin.promotionBoList, function(value) {
// discountList.push({
// text: `【${value.promotionType}】${value.promotionTitle}`
// });
// });
discountList.length && (dest.goodsDiscount = {
list: discountList
});
}
// discountList.length && (dest.goodsDiscount = {
// list: discountList
// });
// }
// 商品标签
if (origin.tags) {
... ... @@ -186,42 +1184,42 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => {
dest.tags = productTags;
}
// 商品价格
let goodsPrice = {
currentPrice: origin.formatSalesPrice === '0' ? origin.formatMarketPrice : origin.formatSalesPrice
};
// 商品价格 pagecache重构
// let goodsPrice = {
// currentPrice: origin.format_sales_price === '0' ? origin.format_market_price : origin.format_sales_price
// };
if (origin.formatSalesPrice !== '0' && origin.formatMarketPrice !== origin.formatSalesPrice) {
goodsPrice.previousPrice = origin.formatMarketPrice;
}
// if (origin.format_sales_price !== '0' && origin.format_market_price !== origin.format_sales_price) {
// goodsPrice.previousPrice = origin.format_market_price;
// }
dest.goodsPrice = goodsPrice;
// dest.goodsPrice = goodsPrice;
// 商品返回 YOHO 币
origin.yohoCoinNum && (dest.commodityReturn = origin.yohoCoinNum);
// 商品返回 YOHO 币 pagecache重构
// origin.yohoCoinNum && (dest.commodityReturn = origin.yohoCoinNum);
// VIP 商品价格
if (origin.vip) {
let vipList = [];
let levelList = {
银卡: 1,
金卡: 2,
白金: 3
};
// VIP 商品价格 pagecache重构
// if (origin.vip) {
// let vipList = [];
// let levelList = {
// 银卡: 1,
// 金卡: 2,
// 白金: 3
// };
_.forEach(origin.vip, function(value) {
vipList.push({
level: levelList[value.caption],
text: value.price,
currentLevel: (levelList[value.caption] === parseInt(vipLevel, 10))
});
});
// _.forEach(origin.vip, function(value) {
// vipList.push({
// level: levelList[value.caption],
// text: value.price,
// currentLevel: (value.vipLevel === vipLevel)
// });
// });
vipList.length && (dest.vipLevel = {
list: vipList
});
// vipList.length && (dest.vipLevel = {
// list: vipList
// });
}
// }
// 上市期
origin.expectArrivalTime && (dest.periodOfMarket = `${origin.expectArrivalTime}月`);
... ... @@ -233,7 +1231,7 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => {
};
let consultParams = {
product_id: origin.productId
product_id: origin.product_id
};
if (_.has(dest, 'feedbacks.consultsNum')) {
... ... @@ -245,20 +1243,368 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => {
// 商品评价
dest.feedbacks.commentsUrl = helpers.urlFormat('/product/detail/comments', {
product_id: origin.productId,
product_id: origin.product_id
});
// 品牌信息
if (origin.brand) {
let extra = `?productSkn=${origin.productSkn}&brandId=${origin.brandInfo.brandId}`;
let extra = `?productSkn=${origin.product_skn}&brandId=${origin.brand_info.brand_id}`;
dest.preferenceUrl = `/product/detail/preference${extra}`;
}
dest.productSkn = origin.productSkn;
dest.productSkn = origin.product_skn;
// 商品信息
if (origin.goodsList) {
if (origin.goods_list.length) {
let goodsGroup = [];
// pagecache重构
// sizeName = '',
// colorList = [],
// sizeList = {},
// allSizeList = {},
// colorStorageGroup = {},
// colorStorageNum = 0;
// pagecache重构
_.forEach(origin.goods_list, function(value) {
if (value.status === 0) {
return;
}
// colorStorageNum = 0;
// 商品分组
if (value.images_list) {
_.forEach(value.images_list, function(good) {
goodsGroup.push({
goodsId: value.goods_id,
img: good.image_url
});
});
}
// // 商品的尺码列表
// colorStorageGroup[value.product_skc] = {};
// if (value.size_list) {
// sizeList[value.product_skc] = [];
// _.forEach(value.size_list, function(size) {
// sizeList[value.product_skc].push({
// id: size.size_id,
// skuId: size.product_sku,
// goodsId: value.goods_id,
// colorId: value.color_id,
// name: size.size_name,
// sizeNum: size.storage_number
// });
// sizeName = size.size_name;
// // 所有尺码列表,赋值用于前端展示默认尺码的时候
// // 判断出没有库存则显示灰色
// let build = {
// id: size.size_id,
// storage: size.storage_number
// };
// allSizeList[sizeName] = (allSizeList[sizeName] === null ||
// typeof allSizeList[sizeName] === 'undefined') ? build : allSizeList[sizeName];
// colorStorageNum += parseInt(size.storage_number, 10);
// colorStorageGroup[value.product_skc][sizeName] = parseInt(size.storage_number, 10);
// });
// // 颜色分组
// colorList.push({
// id: value.color_id,
// skcId: value.product_skc,
// name: value.color_name,
// colorNum: colorStorageNum
// });
// }
// // 缩略图
// thumbImageList.push({
// img: value.color_image
// });
// // 商品库存总数
// totalStorageNum += _.toNumber(colorStorageNum);
// });
// // 遍历所有尺码,构建颜色显示数据
// let i = 1;
// sizeGroup[0] = {
// size: []
// };
// _.forEach(allSizeList, (value, key) => {
// // 默认尺码
// sizeGroup[0].size.push({
// name: key,
// sizeNum: _.toNumber(value.storage) > 0 ? true : false,
// id: value.id
// });
// colorGroup[i] = {
// color: []
// };
// // 各个颜色的尺码, 每行显示一个尺码对应的颜色
// _.forEach(colorList, (colorArr) => {
// let tempColorArr = _.cloneDeep(colorArr);
// if (colorStorageGroup[tempColorArr.skcId] &&
// colorStorageGroup[tempColorArr.skcId][key]) {
// tempColorArr.colorNum = colorStorageGroup[tempColorArr.skcId][key];
// } else {
// tempColorArr.colorNum = 0;
// }
// colorGroup[i].color.push(Object.assign({}, tempColorArr));
// });
// colorGroup[i].id = value.id;
// ++i;
// });
// colorGroup[0] = {
// color: []
// };
// // 遍历所有颜色, 构建尺码显示数据
// i = 1;
// _.forEach(colorList, function(value) {
// // 各个尺码的颜色, 每行显示一个颜色的对应尺码
// sizeGroup[i] = {
// size: sizeList[value.skcId],
// colorId: value.skcId
// };
// // 默认颜色
// colorGroup[0].color.push(value);
// ++i;
});
// 商品图:多个
if (goodsGroup.length > 1) {
let bannerList = [];
_.forEach(goodsGroup, function(value) {
bannerList.push({
img: value.img
});
});
dest.bannerTop = {
list: bannerList
};
} else if (goodsGroup[0]) {
dest.bannerTop = {
img: goodsGroup[0].img
};
}
}
// 悬浮的购物车信息
dest.cartInfo = {
cartUrl: helpers.urlFormat('/cart/index/index'),
numInCart: 0,
goodsInstore: origin.storage_sum
};
// pagecache重构
// let soldOut = (origin.storage_sum === 0) || (totalStorageNum === 0); // status
// let notForSale = origin.attribute === 2;
// 显示加入购物车链接 pagecache重构
// if (!soldOut && !notForSale) {
// _.orderBy(colorGroup);
// Object.assign(dest.cartInfo, {
// productId: origin.product_id,
// thumbs: thumbImageList,
// name: dest.goodsName ? dest.goodsName : '',
// price: dest.goodsPrice.previousPrice ? dest.goodsPrice.previousPrice : '',
// salePrice: dest.goodsPrice.currentPrice ? dest.goodsPrice.currentPrice : '',
// totalNum: totalStorageNum,
// colors: _.toArray(colorGroup),
// sizes: sizeGroup
// });
// // 限购商品
// if (origin.isLimitBuy) {
// // 是否开售
// let isBeginSale = (origin.saleStatus === 1);
// // 限购商品有关的展示状态
// let showStatus = 1;
// origin.showStatus && (showStatus = parseInt(origin.showStatus, 10));
// // 处理限购商品有关的按钮状态
// dest = _procShowStatus(dest, showStatus, isBeginSale);
// dest.cartInfo.limitProductCode = origin.limitProductCode;
// dest.cartInfo.limitCodeUrl = _getLimitCodeUrl(origin.limitProductCode, origin.product_skn, ua);
// dest.cartInfo.limitProductPay = helpers.urlFormat('/cart/index/orderEnsure');
// } else {
// dest.cartInfo.addToCartUrl = helpers.urlFormat('/product/buy_' + origin.product_id + '_' +
// origin.goods_list.goods_id + '.html');
// }
// } else if (notForSale) {
// dest.cartInfo.notForSale = true;
// } else if (soldOut) {
// dest.cartInfo.soldOut = true;
// }
// // 是否收藏
// dest.isCollect = false;
// if (origin.is_collect === 'Y') {
// dest.isCollect = true;
// dest.cartInfo.isCollect = true;
// }
// 底部简介URL链接
dest.introUrl = '/product/detail/intro/' + origin.product_skn;
dest.id = origin.product_id;
dest.goodsId = origin.goods_id;
return dest;
};
/**
* [商品信息的异步数据获取]
*/
let getProductAsyncData = (data) => {
let finalResult;
let params = {
method: 'app.product.seckill.data'
};
if (data.id) { // 通过 productId 获取商品详情
Object.assign(params, {
product_id: _.toString(data.id)
});
} else if (data.productSkn) { // 通过 productSkn 获取商品详情
Object.assign(params, {
product_skn: _.toString(data.productSkn)
});
}
if (data.uid) {
params.uid = data.uid;
}
params.is_student = data.isStudent ? 1 : 0;
params.current_vip_level = data.vipLevel;
return api.get('', params, {
code: 200,
cache: true
}).then(result => {
if (result.code === 500 || !result.data) {
return {};
}
result = result.data;
result.goods_id = data.goodsId;
return Promise.all([_getPromotionInfo(result.product_skn), _getFavorite(result.product_id, data.uid)]).then((res) => {
result.promotionBoList = res[0];
var isFavorite = res[1];
finalResult = _detailDataPkgAsync(result, data.uid, data.vipLevel, data.ua);
finalResult.isCollect = isFavorite;
if (finalResult.cartInfo) {
finalResult.cartInfo.isCollect = isFavorite;
}
finalResult.isStudent = data.isStudent;
return finalResult;
});
});
};
/**
* [商品信息格式化异步接口]
*/
let _detailDataPkgAsync = (origin, uid, vipLevel, ua) => {
let dest = {}, // 结果输出
thumbImageList = [],
colorGroup = {},
sizeGroup = [],
totalStorageNum = 0;
// 用户未登录时
if (!uid) {
dest.loginUrl = helpers.urlFormat('/signin.html', {
refer: helpers.urlFormat('/product/show_' + origin.product_skn + '.html')
});
}
// 商品名称
if (!origin.product_name) {
dest.feedbacks = {};
return dest;
}
dest.goodsName = origin.product_name;
// 商品促销短语
origin.sales_phrase && (dest.goodsSubtitle = origin.sales_phrase);
// 促销信息 TODO: 换新接口
if (origin.promotionBoList) {
let discountList = [];
_.forEach(origin.promotionBoList, function(value) {
discountList.push({
text: `【${value.promotionType}${value.promotionTitle}`
});
});
discountList.length && (dest.goodsDiscount = {
list: discountList
});
}
// 商品价格
let goodsPrice = {
currentPrice: origin.format_sales_price === '0' ? origin.format_market_price : origin.format_sales_price
};
if (origin.format_sales_price !== '0' && origin.format_market_price !== origin.format_sales_price) {
goodsPrice.previousPrice = origin.format_market_price;
}
dest.goodsPrice = goodsPrice;
// 商品返回 YOHO 币
origin.yohoCoinNum && (dest.commodityReturn = origin.yohoCoinNum);
// VIP 商品价格
if (origin.vip) {
let vipList = [];
let levelList = {
银卡: 1,
金卡: 2,
白金: 3
};
_.forEach(origin.vip, function(value) {
vipList.push({
level: levelList[value.caption],
text: value.price,
currentLevel: (levelList[value.caption] === parseInt(vipLevel, 10))
});
});
vipList.length && (dest.vipLevel = {
list: vipList
});
}
// 商品信息
if (origin.goods_list.length) {
let goodsGroup = [],
sizeName = '',
colorList = [],
... ... @@ -267,7 +1613,7 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => {
colorStorageGroup = {},
colorStorageNum = 0;
_.forEach(origin.goodsList, function(value) {
_.forEach(origin.goods_list, function(value) {
if (value.status === 0) {
return;
}
... ... @@ -275,63 +1621,63 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => {
colorStorageNum = 0;
// 商品分组
if (value.imagesList) {
_.forEach(value.imagesList, function(good) {
if (value.images_list) {
_.forEach(value.images_list, function(good) {
goodsGroup.push({
goodsId: value.goodsId,
img: good.imageUrl
goodsId: value.goods_id,
img: good.image_url
});
});
}
// 商品的尺码列表
colorStorageGroup[value.productSkc] = {};
if (value.sizeList) {
sizeList[value.productSkc] = [];
_.forEach(value.sizeList, function(size) {
sizeList[value.productSkc].push({
id: size.sizeId,
skuId: size.productSku,
goodsId: value.goodsId,
colorId: value.colorId,
name: size.sizeName,
sizeNum: size.storageNumber
// 商品的尺码列表
colorStorageGroup[value.product_skc] = {};
if (value.size_list) {
sizeList[value.product_skc] = [];
_.forEach(value.size_list, function(size) {
sizeList[value.product_skc].push({
id: size.size_id,
skuId: size.product_sku,
goodsId: value.goods_id,
colorId: value.color_id,
name: size.size_name,
sizeNum: size.storage_number
});
sizeName = size.sizeName;
sizeName = size.size_name;
// 所有尺码列表,赋值用于前端展示默认尺码的时候
// 判断出没有库存则显示灰色
// 所有尺码列表,赋值用于前端展示默认尺码的时候
// 判断出没有库存则显示灰色
let build = {
id: size.sizeId,
storage: size.storageNumber
id: size.size_id,
storage: size.storage_number
};
allSizeList[sizeName] = (allSizeList[sizeName] === null ||
typeof allSizeList[sizeName] === 'undefined') ? build : allSizeList[sizeName];
colorStorageNum += parseInt(size.storageNumber, 10);
colorStorageGroup[value.productSkc][sizeName] = parseInt(size.storageNumber, 10);
colorStorageNum += parseInt(size.storage_number, 10);
colorStorageGroup[value.product_skc][sizeName] = parseInt(size.storage_number, 10);
});
// 颜色分组
// 颜色分组
colorList.push({
id: value.colorId,
skcId: value.productSkc,
name: value.colorName,
id: value.color_id,
skcId: value.product_skc,
name: value.color_name,
colorNum: colorStorageNum
});
}
// 缩略图
// 缩略图
thumbImageList.push({
img: value.colorImage
img: helpers.image(value.color_image, 60, 60)
});
// 商品库存总数
// 商品库存总数
totalStorageNum += _.toNumber(colorStorageNum);
});
// 遍历所有尺码,构建颜色显示数据
// 遍历所有尺码,构建颜色显示数据
let i = 1;
sizeGroup[0] = {
... ... @@ -349,7 +1695,7 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => {
color: []
};
// 各个颜色的尺码, 每行显示一个尺码对应的颜色
// 各个颜色的尺码, 每行显示一个尺码对应的颜色
_.forEach(colorList, (colorArr) => {
let tempColorArr = _.cloneDeep(colorArr);
... ... @@ -370,58 +1716,37 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => {
color: []
};
// 遍历所有颜色, 构建尺码显示数据
// 遍历所有颜色, 构建尺码显示数据
i = 1;
_.forEach(colorList, function(value) {
// 各个尺码的颜色, 每行显示一个颜色的对应尺码
// 各个尺码的颜色, 每行显示一个颜色的对应尺码
sizeGroup[i] = {
size: sizeList[value.skcId],
colorId: value.skcId
};
// 默认颜色
// 默认颜色
colorGroup[0].color.push(value);
++i;
});
// 商品图:多个
if (goodsGroup.length > 1) {
let bannerList = [];
_.forEach(goodsGroup, function(value) {
bannerList.push({
img: value.img
});
});
dest.bannerTop = {
list: bannerList
};
} else if (goodsGroup[0]) {
dest.bannerTop = {
img: goodsGroup[0].img
};
}
}
let soldOut = (origin.storage_sum === 0) || (totalStorageNum === 0); // status
let notForSale = origin.attribute === 2;
// 悬浮的购物车信息
// 悬浮的购物车信息
dest.cartInfo = {
cartUrl: helpers.urlFormat('/cart/index/index'),
numInCart: 0,
goodsInstore: origin.storageSum
goodsInstore: origin.storage_sum
};
let soldOut = (origin.storageSum === 0) || (totalStorageNum === 0); // status
let notForSale = origin.attribute === 2;
// 显示加入购物车链接
// 显示加入购物车链接
if (!soldOut && !notForSale) {
_.orderBy(colorGroup);
Object.assign(dest.cartInfo, {
productId: origin.productId,
productId: origin.product_id,
thumbs: thumbImageList,
name: dest.goodsName ? dest.goodsName : '',
name: dest.goodsName || '',
price: dest.goodsPrice.previousPrice ? dest.goodsPrice.previousPrice : '',
salePrice: dest.goodsPrice.currentPrice ? dest.goodsPrice.currentPrice : '',
totalNum: totalStorageNum,
... ... @@ -431,73 +1756,90 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => {
// 限购商品
if (origin.isLimitBuy) {
// 是否开售
let isBeginSale = (origin.saleStatus === 1);
// 限购商品有关的展示状态
let showStatus = 1;
origin.showStatus && (showStatus = parseInt(origin.showStatus, 10));
// 处理限购商品有关的按钮状态
dest = _procShowStatus(dest, showStatus, isBeginSale);
return api.get('', {
method: 'app.limitProduct.productStatus',
limitProductCode: origin.limitProductCode,
uid: uid,
product_skn: origin.product_skn
}, {
code: 200,
cache: true
}).then((result) => {
if (result.data) {
if (!result.data.isLimitBuy) {
dest.cartInfo.soldOut = true;
return callback();
}
// 是否开售
let isBeginSale = (result.data.saleStatus === 1);
// 限购商品有关的展示状态
let showStatus = 1;
origin.showStatus && (showStatus = parseInt(result.data.showStatus, 10));
// 处理限购商品有关的按钮状态
dest = _procShowStatus(dest, showStatus, isBeginSale);
dest.cartInfo.limitProductCode = origin.limitProductCode;
dest.cartInfo.limitCodeUrl = _getLimitCodeUrl(origin.limitProductCode, origin.product_skn, ua);
dest.cartInfo.limitProductPay = helpers.urlFormat('/cart/index/orderEnsure');
return callback();
} else {
dest.cartInfo.soldOut = true;
return callback();
}
dest.cartInfo.limitProductCode = origin.limitProductCode;
dest.cartInfo.limitCodeUrl = _getLimitCodeUrl(origin.limitProductCode, origin.productSkn, ua);
dest.cartInfo.limitProductPay = helpers.urlFormat('/cart/index/orderEnsure');
});
} else {
dest.cartInfo.addToCartUrl = helpers.urlFormat('/product/buy_' + origin.productId + '_' +
origin.goodsList.goodsId + '.html');
dest.cartInfo.addToCartUrl = helpers.urlFormat('/product/buy_' + origin.product_id + '_' +
origin.goods_id + '.html');
return callback();
}
} else if (notForSale) {
dest.cartInfo.notForSale = true;
return callback();
} else if (soldOut) {
dest.cartInfo.soldOut = true;
return callback();
}
// 是否收藏
dest.isCollect = false;
if (origin.isCollect === 'Y') {
dest.isCollect = true;
dest.cartInfo.isCollect = true;
}
// 是否收藏 使用单独收藏接口获取
// dest.isCollect = false;
// if (origin.is_collect === 'Y') {
// dest.isCollect = true;
// dest.cartInfo.isCollect = true;
// }
function callback() {
// 虚拟商品(门票)
if (origin.attribute * 1 === 3) {
dest.tickets = true;
dest.ticketsConfirm = helpers.urlFormat('/cart/index/ticketsConfirm');
// 展览票
if (origin.product_skn * 1 === SINGLE_TICKETS_SKN) {
dest.single = true;
} else {
// 套票
dest.package = true;
}
// 底部简介URL链接
dest.introUrl = '/product/detail/intro/' + origin.productSkn;
dest.id = origin.productId;
// 购票限制
dest.cartInfo.limit = 4;
// 虚拟商品(门票)
if (origin.attribute * 1 === 3) {
dest.tickets = true;
dest.ticketsConfirm = helpers.urlFormat('/cart/index/ticketsConfirm');
// 清空活动
dest.goodsDiscount = [];
// 展览票
if (origin.productSkn * 1 === SINGLE_TICKETS_SKN) {
dest.single = true;
} else {
// 套票
dest.package = true;
// 来自登录页,自动弹出选择框
// if (isset($_GET['product_type']) && $_GET['product_type'] == 'ticket') {
// $result['showPannel'] = true;
// }
}
// 购票限制
dest.cartInfo.limit = 4;
// 清空活动
dest.goodsDiscount = [];
// 来自登录页,自动弹出选择框
// if (isset($_GET['product_type']) && $_GET['product_type'] == 'ticket') {
// $result['showPannel'] = true;
// }
dest.id = origin.product_id;
dest.goodsId = origin.goods_id;
return Promise.resolve(dest);
}
return dest;
};
let _getShopsInfo = (brandId) => {
if (!brandId) {
return Promise.resolve([]);
}
return api.get('', {
method: 'app.shop.seckill.queryShopsByBrandId',
brand_id: _.toString(brandId)
... ... @@ -512,17 +1854,6 @@ let _getShopsInfo = (brandId) => {
});
};
let _getPromotionInfo = (skn) => {
return api.get('', {
method: 'app.product.seckill.promotion',
product_skn: _.toString(skn)
}, {
code: 200,
cache: true
}).then((result) => {
return result && result.data;
});
};
/**
* 获取默认咨询列表
... ... @@ -546,6 +1877,25 @@ const _getCommonConsult = () => {
};
/**
* [根据商品SKN获取商品的简要信息]
* @param {[array]} skns [skns]
* @return {[type]}
*/
let _productInfoBySkns = (skns) => {
// 调用搜索接口
let param = {
method: 'app.search.li',
query: skns.join(' '),
limit: skns.length,
order: 's_t_desc'
};
return api.get('', param, {
cache: true
});
};
/**
* 获取秒杀列表
*/
const getSeckillData = (param) => {
... ... @@ -573,110 +1923,10 @@ const getSeckillData = (param) => {
});
};
let getProductData = (data) => {
let finalResult = {};
let params = {
method: 'app.product.seckill.data'
};
if (data.id) { // 通过 productId 获取商品详情
Object.assign(params, {
product_id: _.toString(data.id)
});
} else if (data.productSkn) { // 通过 productSkn 获取商品详情
Object.assign(params, {
product_skn: _.toString(data.productSkn)
});
}
if (data.uid) {
params.uid = data.uid;
}
return _getUserProfile(params.uid).then((user) => {
data.vipLevel = (user.data && user.data.vip_info && user.data.vip_info.cur_level) || '0';
data.isStudent = (user.data && user.data.vip_info && user.data.vip_info.is_student) ? true : false;
params.is_student = data.isStudent ? 1 : 0;
params.current_vip_level = data.vipLevel;
return api.get('', params, {
code: 200
}).then(global.yoho.camelCase).then(result => {
if (result.code === 500 || !result.data) {
return {};
}
result = result.data;
return Promise.all([
_getShopsInfo(_.get(result, 'brandInfo.brandId', 0)),
_getPromotionInfo(result.productSkn),
comment.getCommentInfo({
productId: result.productId
}),
_getCommonConsult(),
comment.getConsults(result.productId, 1, 2)
]).then((info) => {
result.promotionBoList = info[1];
finalResult = _detailDataPkg(result, data.uid, data.vipLevel, data.ua);
finalResult.enterStore = info[0];
finalResult.isStudent = data.isStudent;
Object.assign(finalResult.feedbacks, info[2]);
finalResult.goodsPrice.previousPrice = '¥' + result.marketPrice;
/* 预售商品不能购买 */
if (_.get(result, 'isDepositAdvance', '') === 'Y') {
finalResult.cartInfo.isDepositAdvance = true;
}
/* 如果有咨询,显示咨询,否则显示常见问题 */
if (info[4].total) {
finalResult.feedbacks.consultsNum = parseInt(info[4].total, 10);
Object.assign(finalResult.feedbacks, {
commonConsults: false,
consultsNum: parseInt(info[4].total, 10),
consults: _.take(info[4].list, 2)
});
} else if (!_.isEmpty(info[3]) && !_.get(info[2], 'feedbacks.consultsNum', 0)) {
Object.assign(finalResult.feedbacks, {
commonConsults: true,
consultsNum: true,
consults: _.take(info[3], 2)
});
}
finalResult.limit = info[2];
return finalResult;
});
});
});
};
/**
* [根据商品SKN获取商品的简要信息]
* @param {[array]} skns [skns]
* @return {[type]}
*/
let _productInfoBySkns = (skns) => {
// 调用搜索接口
let param = {
method: 'app.search.li',
query: skns.join(' '),
limit: skns.length,
order: 's_t_desc'
};
return api.get('', param, {
cache: true
});
};
module.exports = {
getSeckillData,
getProductData,
getProductAsyncData,
getUserProfile: _getUserProfile,
getSeckillData,
productInfoBySkns: _productInfoBySkns
};
... ...
... ... @@ -49,6 +49,9 @@ const seckillDetail = require(`${cRoot}/seckill-detail`);
// /pro_136349_455445/HEARTSOFARMianMaShuJiaoXiuXianKuPS1684.html
// 因为正则匹配原因,秒杀详情页路由要放在普通详情页前面,待解决
router.get(/^\/seckill\/show_([\d]+)/, seckillDetail.getUser, seckillDetail.indexSkn); // 秒杀商品详情页 SKN 进入
router.get(/\/pro_([\d]+)_([\d]+)\/(.*)/, detail.index); // 商品详情页
// /show_51047967.html
router.get(/\/show_([\d]+)/, detail.indexSkn); // 商品详情页 SKN 进入
... ... @@ -91,7 +94,7 @@ router.get('/recommend-for-you/cart', recommendForYou.cart);
router.get('/seckill', seckill.checkAppVer('5.1.0'), seckill.index); // 秒杀列表页
router.get(/^\/seckill\/show_([\d]+)/, seckillDetail.getUser, seckillDetail.indexSkn); // 秒杀商品详情页 SKN 进入
router.post('/seckill/remind', seckill.remind); // only app; 秒杀提醒
router.get('/seckill/get-product-list', seckill.getProductList); // 秒杀列表根据活动id获取商品列表
... ...
... ... @@ -12,22 +12,20 @@ const isTest = process.env.NODE_ENV === 'test';
module.exports = {
app: 'h5',
appVersion: '4.9.2', // 调用api的版本
appName: 'm.yohobuy.com',
port: 6001,
siteUrl: '//m.yohobuy.com',
assetUrl: '//localhost:5001',
domains: {
api: 'http://api.yoho.cn/',
// api: 'http://api.yoho.cn/',
api: 'http://api-test3.yohops.com:9999/', // 测试接口
service: 'http://service.yoho.cn/',
liveApi: 'http://api.live.yoho.cn/',
singleApi: 'http://single.yoho.cn/'
// api: 'http://api-test1.yohops.com:9999/',
// service: 'http://service-test1.yohops.com:9999/',
// api: 'http://api.yoho.cn/',
// service: 'http://service.yoho.cn/',
// liveApi: 'http://api.live.yoho.cn/',
// singleApi: 'http://single.yoho.cn/',
// liveApi: 'http://testapi.live.yohops.com:9999/',
// singleApi: 'http://api-test1.yohops.com:9999/'
},
subDomains: {
host: '.m.yohobuy.com',
... ... @@ -39,14 +37,11 @@ module.exports = {
activity: '//activity.yohobuy.com',
index: '//m.yohobuy.com'
},
trace: false,
useCache: false,
memcache: {
master: ['192.168.102.168:11211'],
slave: ['192.168.102.168:11211'],
session: ['192.168.102.168:11211'],
poolSize: 25,
reconnect: 5000,
master: ['192.168.102.168:12111'],
slave: ['192.168.102.168:12111'],
session: ['192.168.102.168:12111'],
timeout: 1000,
retries: 0
},
... ... @@ -55,11 +50,9 @@ module.exports = {
},
loggers: {
infoFile: {
close: true,
name: 'info',
level: 'info',
filename: 'logs/info.log',
maxFiles: 7
filename: 'logs/info.log'
},
errorFile: {
name: 'error',
... ... @@ -70,12 +63,12 @@ module.exports = {
},
udp: { // send by udp
measurement: 'yohobuy_wap_node_log',
level: 'info', // logger level
level: 'debug', // logger level
host: 'influxdblog.yohoops.org', // influxdb host
port: 4444 // influxdb port
port: '4444' // influxdb port
},
console: {
level: 'info',
level: 'debug',
colorize: 'all',
prettyPrint: true
}
... ... @@ -102,7 +95,6 @@ if (isProduction) {
master: ['memcache1.yohoops.org:12111', 'memcache2.yohoops.org:12111', 'memcache3.yohoops.org:12111'],
slave: ['memcache1.yohoops.org:12112', 'memcache2.yohoops.org:12112', 'memcache3.yohoops.org:12112'],
session: ['memcache1.yohoops.org:12111', 'memcache2.yohoops.org:12111', 'memcache3.yohoops.org:12111'],
poolSize: 25,
reconnect: 5000,
timeout: 1000,
retries: 0
... ...
... ... @@ -17,6 +17,13 @@ module.exports = function(callback) {
productSkn: productSkn
},
success: function(data) {
// 如果当前是秒杀商品,且不在秒杀路径下,跳到该商品的秒杀详情页
var reg = /\/product\/show_([\d]+)/;
var thisHref = window.location.href;
if (data.isSecKill === 'Y' && reg.test(thisHref)) {
window.location.href = '/product/seckill/show_' + $('#productSkn').val() + '.html';
}
render(data);
callback(data);
}
... ...
... ... @@ -8,144 +8,150 @@ var $ = require('yoho-jquery'),
Hammer = require('yoho-hammer'),
lazyLoad = require('yoho-jquery-lazyload');
var $discountFolder = $('.goods-discount .discount-folder'),
$discountArrow = $('.goods-discount .first-item span');
var goodsDiscountEl = document.getElementById('goodsDiscount'),
goodsDiscountHammer = goodsDiscountEl && new Hammer(goodsDiscountEl),
$discountFirstItem = $(goodsDiscountEl).find('.first-item');
require('./detail/page-render')(function() {
var $discountFolder = $('.goods-discount .discount-folder'),
$discountArrow = $('.goods-discount .first-item span');
var $cart = $('.cart-bar');
var goodsDiscountEl = document.getElementById('goodsDiscount'),
goodsDiscountHammer = goodsDiscountEl && new Hammer(goodsDiscountEl),
$discountFirstItem = $(goodsDiscountEl).find('.first-item');
var appUrl = $('input[name="limitCodeUrl"]').val();
var $cart = $('.cart-bar');
var dialog = require('../plugin/dialog');
var appUrl = $('input[name="limitCodeUrl"]').val();
require('../common');
var dialog = require('../plugin/dialog');
require('./tick');
require('../common');
// add extra marign-bottom for footer to show the yoho copyright
function showFooter() {
var $cartBar = $('.cart-bar');
require('./tick');// 调用秒杀js
var timer = setInterval(function() {
if ($cartBar) {
window.reMarginFooter('.cart-bar');
clearInterval(timer);
} else {
$cartBar = $('.cart-bar');
}
}, 200);
}
showFooter();
lazyLoad($('img.lazy'));
if ($('#goodsDiscount h1').length < 1) {
$('.dropdown').remove();
}
// 顶部swiper
new Swiper('.banner-swiper', {
lazyLoading: true,
lazyLoadingInPrevNext: true,
paginationClickable: true,
pagination: '.banner-top .pagination-inner',
nextButton: '.my-swiper-button-next',
prevButton: '.my-swiper-button-prev',
spaceBetween: 3
});
// add extra marign-bottom for footer to show the yoho copyright
function showFooter() {
var $cartBar = $('.cart-bar');
// 初始化goods-discount
if ($discountFolder.children().length === 0) {
$discountFolder.css('display', 'none');
$discountArrow.html('');
}
// goods-discount下拉按钮点击事件
if (goodsDiscountHammer && $discountFolder.children().length > 0) {
goodsDiscountHammer.on('tap', function() {
if ($discountFolder.is(':hidden')) {
$discountFirstItem.removeClass('short-text');
$discountArrow.removeClass('icon-down').addClass('icon-up').html('&#xe608;');
$discountFolder.slideDown();
} else {
$discountFirstItem.addClass('short-text');
$discountArrow.removeClass('icon-up').addClass('icon-down').html('&#xe609;');
$discountFolder.slideUp();
}
});
}
$('#limit-sale').on('touchend', function(e) {
var loginUrl = $('#loginUrl').val(),
time,
ifr;
e.stopPropagation();
if (loginUrl) {
window.location = loginUrl;
} else {
dialog.showDialog({
dialogText: '进入有货APP,获取限购码',
hasFooter: {
rightBtnText: '打开Yoho!Buy有货APP'
var timer = setInterval(function() {
if ($cartBar) {
window.reMarginFooter('.cart-bar');
clearInterval(timer);
} else {
$cartBar = $('.cart-bar');
}
}, function() {
ifr = document.createElement('iframe');
ifr.src = appUrl;
ifr.style.display = 'none';
document.body.appendChild(ifr);
window.location.href = appUrl;
time = Date.now();
window.setTimeout(function() {
document.body.removeChild(ifr);
if (Date.now() - time < 3200) {
window.location.href = 'http://a.app.qq.com/o/simple.jsp?pkgname=com.yoho';
}
}, 3000);
}, 200);
}
}, null, true);
showFooter();
$('.dialog-wrapper').off('touchstart').on('touchstart', function(para) {
para.stopPropagation();
if ($(para.target).hasClass('dialog-wrapper')) {
dialog.hideDialog();
lazyLoad($('img.lazy'));
if ($('#goodsDiscount h1').length < 1) {
$('.dropdown').remove();
}
// 顶部swiper
new Swiper('.banner-swiper', {
lazyLoading: true,
lazyLoadingInPrevNext: true,
paginationClickable: true,
pagination: '.banner-top .pagination-inner',
nextButton: '.my-swiper-button-next',
prevButton: '.my-swiper-button-prev',
spaceBetween: 3
});
// 初始化goods-discount
if ($discountFolder.children().length === 0) {
$discountFolder.css('display', 'none');
$discountArrow.html('');
}
// goods-discount下拉按钮点击事件
if (goodsDiscountHammer && $discountFolder.children().length > 0) {
goodsDiscountHammer.on('tap', function() {
if ($discountFolder.is(':hidden')) {
$discountFirstItem.removeClass('short-text');
$discountArrow.removeClass('icon-down').addClass('icon-up').html('&#xe608;');
$discountFolder.slideDown();
} else {
$discountFirstItem.addClass('short-text');
$discountArrow.removeClass('icon-up').addClass('icon-down').html('&#xe609;');
$discountFolder.slideUp();
}
});
}
});
require('./detail/like');
require('./detail/desc');
require('./detail/comments-consults');
require('./detail/consultform');
require('./detail/recommend-for-you-product-desc');
// 购物车商品数量
$.ajax({
type: 'GET',
url: '/cart/index/count',
success: function(data) {
var count;
if (data.code === 200) {
count = data.data.cart_goods_count || 0;
if (count === 0) {
return false;
}
if (count > 99) {
count = '99+';
$('#limit-sale').on('touchend', function(e) {
var loginUrl = $('#loginUrl').val(),
time,
ifr;
e.stopPropagation();
if (loginUrl) {
window.location = loginUrl;
} else {
dialog.showDialog({
dialogText: '进入有货APP,获取限购码',
hasFooter: {
rightBtnText: '打开Yoho!Buy有货APP'
}
}, function() {
ifr = document.createElement('iframe');
ifr.src = appUrl;
ifr.style.display = 'none';
document.body.appendChild(ifr);
window.location.href = appUrl;
time = Date.now();
window.setTimeout(function() {
document.body.removeChild(ifr);
if (Date.now() - time < 3200) {
window.location.href = 'http://a.app.qq.com/o/simple.jsp?pkgname=com.yoho';
}
}, 3000);
}, null, true);
$('.dialog-wrapper').off('touchstart').on('touchstart', function(para) {
para.stopPropagation();
if ($(para.target).hasClass('dialog-wrapper')) {
dialog.hideDialog();
}
});
}
});
require('./detail/like');
require('./detail/desc');
require('./detail/comments-consults');
require('./detail/consultform');
require('./detail/recommend-for-you-product-desc');
// 购物车商品数量
$.ajax({
type: 'GET',
url: '/cart/index/count',
success: function(data) {
var count;
if (data.code === 200) {
count = data.data.cart_goods_count || 0;
if (count === 0) {
return false;
}
if (count > 99) {
count = '99+';
}
$cart.find('.num-tag').html(count).removeClass('hide');
}
$cart.find('.num-tag').html(count).removeClass('hide');
}
});
if ($('.good-detail-page').length > 0) {
$('#yoho-footer').css('border-top', '1px solid #e0e0e0');
}
});
if ($('.good-detail-page').length > 0) {
$('#yoho-footer').css('border-top', '1px solid #e0e0e0');
}
... ...