Authored by 刘传洋

m

@@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
7 const _ = require('lodash'); 7 const _ = require('lodash');
8 const co = require('bluebird').coroutine; 8 const co = require('bluebird').coroutine;
9 const logger = global.yoho.logger; 9 const logger = global.yoho.logger;
  10 +const yohoHelpers = global.yoho.helpers;
10 const service = require('../models/cart-service'); 11 const service = require('../models/cart-service');
11 const helper = require('../models/cart-helper'); 12 const helper = require('../models/cart-helper');
12 const ghelper = require('../../guang/models/guang-helper'); 13 const ghelper = require('../../guang/models/guang-helper');
@@ -105,6 +106,11 @@ const cart = (req, res, next) => { @@ -105,6 +106,11 @@ const cart = (req, res, next) => {
105 let shoppingKey = helper.getShoppingKeyByCookie(req); 106 let shoppingKey = helper.getShoppingKeyByCookie(req);
106 let cartDelList = req.cookies['cart-del-list']; 107 let cartDelList = req.cookies['cart-del-list'];
107 108
  109 + let isNewCart = _.get(req.app.locals.pc, 'pay.oldCart', false);
  110 +
  111 + if (isNewCart) {
  112 + return res.redirect(yohoHelpers.urlFormat('/shopping/cart'));
  113 + }
108 if (cartDelList) { 114 if (cartDelList) {
109 res.cookie('cart-del-list', '', { 115 res.cookie('cart-del-list', '', {
110 domain: '.yohobuy.com', 116 domain: '.yohobuy.com',
@@ -346,13 +346,13 @@ const swapGift = (uid, shoppingKey, promotionId, newSkn, newSku) => { @@ -346,13 +346,13 @@ const swapGift = (uid, shoppingKey, promotionId, newSkn, newSku) => {
346 346
347 /** 347 /**
348 * 查询所有可选的赠品或者加价购活动下的商品 348 * 查询所有可选的赠品或者加价购活动下的商品
349 - * @param promotionId 349 + * @param promotionId array
350 * @returns {*} 350 * @returns {*}
351 */ 351 */
352 -const queryPromotionGift = (promotionId) => { 352 +const queryPromotionGift = (promotionIds) => {
353 let param = { 353 let param = {
354 - method: 'app.Shopping.queryPromotionGift',  
355 - promotion_id: promotionId 354 + method: 'app.Shopping.queryPromotionGifts',
  355 + promotion_ids: promotionIds
356 }; 356 };
357 357
358 return api.get('', param); 358 return api.get('', param);
@@ -521,7 +521,7 @@ const formatCart = (cartDataRet, uid, shoppingKey, cartDelList) => { @@ -521,7 +521,7 @@ const formatCart = (cartDataRet, uid, shoppingKey, cartDelList) => {
521 // 未登录 521 // 未登录
522 if (!uid) { 522 if (!uid) {
523 result.loginUrl = helpers.urlFormat('/signin.html', { 523 result.loginUrl = helpers.urlFormat('/signin.html', {
524 - refer: helpers.urlFormat('/shopping/cart') 524 + refer: helpers.urlFormat('/cart/cart')
525 }); 525 });
526 } 526 }
527 527
@@ -630,7 +630,7 @@ const addToFav = (uid, skuList, hasPromotion, cartDelList) => { @@ -630,7 +630,7 @@ const addToFav = (uid, skuList, hasPromotion, cartDelList) => {
630 message: '请先登录!', 630 message: '请先登录!',
631 data: { 631 data: {
632 url: helpers.urlFormat('/signin.html', { 632 url: helpers.urlFormat('/signin.html', {
633 - refer: helpers.urlFormat('/shopping/cart') 633 + refer: helpers.urlFormat('/cart/cart')
634 }) 634 })
635 } 635 }
636 }; 636 };
@@ -920,7 +920,14 @@ const queryUserPromotionGift = (promotionId, uid, shoppingKey) => { @@ -920,7 +920,14 @@ const queryUserPromotionGift = (promotionId, uid, shoppingKey) => {
920 let currentProduct = null; // 默认展示第一个商品 920 let currentProduct = null; // 默认展示第一个商品
921 921
922 if (promotionGifts && promotionGifts.code === 200) { 922 if (promotionGifts && promotionGifts.code === 200) {
923 - promotionGifts.data = chelper.formatPriceGiftOne(promotionGifts.data); 923 + // chelper.formatPriceGiftOne(promotionGifts.data);
  924 + let promotionList = chelper.formatPriceGifts(_.get(promotionGifts, 'data.arrays'));
  925 +
  926 + if (promotionList && promotionList.length >= 0) {
  927 + promotionGifts.data = promotionList[0];
  928 + } else {
  929 + promotionGifts.data = {};
  930 + }
924 931
925 if (promotionGifts.data.goodsList && promotionGifts.data.goodsList.length) { 932 if (promotionGifts.data.goodsList && promotionGifts.data.goodsList.length) {
926 currentProduct = promotionGifts.data.goodsList[0]; 933 currentProduct = promotionGifts.data.goodsList[0];
@@ -1107,7 +1107,7 @@ const _detailDataPkg = (origin, uid, vipLevel, cookies) => { @@ -1107,7 +1107,7 @@ const _detailDataPkg = (origin, uid, vipLevel, cookies) => {
1107 result.maxSortId = propOrigin('maxSortId', ''); 1107 result.maxSortId = propOrigin('maxSortId', '');
1108 result.smallSortId = propOrigin('smallSortId', ''); 1108 result.smallSortId = propOrigin('smallSortId', '');
1109 1109
1110 - result.goCartUrl = helpers.urlFormat('/shopping/cart'); 1110 + result.goCartUrl = helpers.urlFormat('/cart/cart');
1111 1111
1112 // 定金预售 1112 // 定金预售
1113 result.deposit = propOrigin('is_deposit_advance', 'N'); 1113 result.deposit = propOrigin('is_deposit_advance', 'N');
@@ -101,7 +101,7 @@ @@ -101,7 +101,7 @@
101 </form> 101 </form>
102 </div> 102 </div>
103 <div class="go-cart"> 103 <div class="go-cart">
104 - <a href="//www.yohobuy.com/shopping/cart"> 104 + <a href="//www.yohobuy.com/cart/cart">
105 <span class="iconfont ">&#xe600;</span> 105 <span class="iconfont ">&#xe600;</span>
106 {{#unless @root.pc.common.removeCartCount}} 106 {{#unless @root.pc.common.removeCartCount}}
107 <span class="goods-num-tip hide">0</span> 107 <span class="goods-num-tip hide">0</span>
@@ -58,7 +58,7 @@ @@ -58,7 +58,7 @@
58 <div> 58 <div>
59 <p data-role="totalinfo" 59 <p data-role="totalinfo"
60 data-total="{{total}}">购物车里还有<span data-role="last-num">{{total}}</span>件商品</p> 60 data-total="{{total}}">购物车里还有<span data-role="last-num">{{total}}</span>件商品</p>
61 - <a href="//www.yohobuy.com/shopping/cart">查看我的购物车</a> 61 + <a href="//www.yohobuy.com/cart/cart">查看我的购物车</a>
62 </div> 62 </div>
63 </div> 63 </div>
64 </div> 64 </div>