Authored by 毕凯

Merge branch 'feature/buynow' into 'release/5.8.1'

closeBuyNowButton



See merge request !681
@@ -153,6 +153,7 @@ const newDetail = { @@ -153,6 +153,7 @@ const newDetail = {
153 153
154 let uid = req.user.uid || 0; 154 let uid = req.user.uid || 0;
155 let shoppingKey = req.cookies._SPK || ''; 155 let shoppingKey = req.cookies._SPK || '';
  156 + let closeBuyNowButton = _.get(req.app.locals.wap, 'close.buyNowButton', false);
156 157
157 detailModel.getNewProductAsyncData(Object.assign({ 158 detailModel.getNewProductAsyncData(Object.assign({
158 id: req.query.id, 159 id: req.query.id,
@@ -161,7 +162,8 @@ const newDetail = { @@ -161,7 +162,8 @@ const newDetail = {
161 bundleType: req.query.bundleType, 162 bundleType: req.query.bundleType,
162 uid: uid, 163 uid: uid,
163 shoppingKey: shoppingKey, 164 shoppingKey: shoppingKey,
164 - ua: req.get('user-agent') || '' 165 + ua: req.get('user-agent') || '',
  166 + closeBuyNowButton: closeBuyNowButton
165 }, req.__User__)).then((result) => { 167 }, req.__User__)).then((result) => {
166 if (_.isEmpty(result)) { 168 if (_.isEmpty(result)) {
167 return res.json({ 169 return res.json({
@@ -479,7 +479,7 @@ let getNewProductAsyncData = (data) => { @@ -479,7 +479,7 @@ let getNewProductAsyncData = (data) => {
479 479
480 let apiArray = [ 480 let apiArray = [
481 _cartCount(data.uid, data.shoppingKey), 481 _cartCount(data.uid, data.shoppingKey),
482 - _detailDataPkgAsync(result, data.uid, data.vipLevel, data.ua), // eslint-disable-line 482 + _detailDataPkgAsync(_.assign(result, {closeBuyNowButton: data.closeBuyNowButton}), data.uid, data.vipLevel, data.ua), // eslint-disable-line
483 _getFavorite(result.product_id, data.uid) 483 _getFavorite(result.product_id, data.uid)
484 ]; 484 ];
485 485
@@ -758,7 +758,7 @@ let _detailDataPkgAsync = (origin, uid, vipLevel, ua) => { @@ -758,7 +758,7 @@ let _detailDataPkgAsync = (origin, uid, vipLevel, ua) => {
758 return resolve(dest); 758 return resolve(dest);
759 } 759 }
760 }); 760 });
761 - } else if (origin.buy_now === 1) { // 显示立即购买和加入购物车两个按钮 761 + } else if (origin.buy_now === 1 && !origin.closeBuyNowButton) { // 显示立即购买和加入购物车两个按钮,closeBuyNowButton 关闭开关
762 Object.assign(dest.cartInfo, cartInfo, { 762 Object.assign(dest.cartInfo, cartInfo, {
763 price: dest.goodsPrice.previousPrice ? dest.goodsPrice.previousPrice : '', 763 price: dest.goodsPrice.previousPrice ? dest.goodsPrice.previousPrice : '',
764 salePrice: dest.goodsPrice.currentPrice ? dest.goodsPrice.currentPrice : '', 764 salePrice: dest.goodsPrice.currentPrice ? dest.goodsPrice.currentPrice : '',