Authored by 郭成尧

bundle-bug-fixed

@@ -57,7 +57,10 @@ exports.orderEnsure = (req, res, next) => { @@ -57,7 +57,10 @@ exports.orderEnsure = (req, res, next) => {
57 let userProfilePromise = userModel.queryProfile(uid); 57 let userProfilePromise = userModel.queryProfile(uid);
58 let addressPromise = addressModel.addressData(uid); 58 let addressPromise = addressModel.addressData(uid);
59 59
60 - if (req.query.activityType === 'bundle') { 60 + if (req.query.cartType === 'bundle') {
  61 + if (!req.cookies._cartType) {
  62 + res.cookie('_cartType', 'bundle', actCkOpthn);
  63 + }
61 let activityInfo = JSON.parse(req.cookies['activity-info']); 64 let activityInfo = JSON.parse(req.cookies['activity-info']);
62 65
63 orderPromise = cartModel.cartPay(uid, cartType, null, null, sku, skn, buyNumber, activityInfo); 66 orderPromise = cartModel.cartPay(uid, cartType, null, null, sku, skn, buyNumber, activityInfo);
@@ -127,7 +130,7 @@ exports.orderCompute = (req, res, next) => { @@ -127,7 +130,7 @@ exports.orderCompute = (req, res, next) => {
127 let type = req.body.type; 130 let type = req.body.type;
128 131
129 if (type !== 'tickets') { 132 if (type !== 'tickets') {
130 - if (req.body.activityType === 'bundle') { 133 + if (req.body.cartType === 'bundle') {
131 let activityInfo = JSON.parse(req.cookies['activity-info']); 134 let activityInfo = JSON.parse(req.cookies['activity-info']);
132 135
133 cartModel.orderCompute(uid, cartType, deliveryId, paymentTypeId, couponCode, yohoCoin, null, activityInfo).then(result => { 136 cartModel.orderCompute(uid, cartType, deliveryId, paymentTypeId, couponCode, yohoCoin, null, activityInfo).then(result => {
@@ -372,7 +375,8 @@ exports.invoiceInfo = (req, res, next) => { @@ -372,7 +375,8 @@ exports.invoiceInfo = (req, res, next) => {
372 res.render('select-invoice', _.assign(returnData, { 375 res.render('select-invoice', _.assign(returnData, {
373 pageHeader: headerData, 376 pageHeader: headerData,
374 module: 'cart', 377 module: 'cart',
375 - page: 'select-invoice' 378 + page: 'select-invoice',
  379 + addressMore: helpers.urlFormat('/cart/index/new/orderEnsure', {cartType: req.cookies._cartType})
376 })); 380 }));
377 })().catch(next); 381 })().catch(next);
378 }; 382 };
@@ -92,7 +92,7 @@ exports.orderComputeAPI = (uid, cartType, deliveWay, paymentType, couponCode, yo @@ -92,7 +92,7 @@ exports.orderComputeAPI = (uid, cartType, deliveWay, paymentType, couponCode, yo
92 // 购买套餐商品需要的数据 92 // 购买套餐商品需要的数据
93 if (activityInfo) { 93 if (activityInfo) {
94 param.activity_id = activityInfo.activity_id; 94 param.activity_id = activityInfo.activity_id;
95 - param.product_sku_list = activityInfo.product_sku_list; 95 + param.product_sku_list = JSON.stringify(activityInfo.product_sku_list);
96 } 96 }
97 97
98 return api.get('', param, {code: 200}); 98 return api.get('', param, {code: 200});
@@ -338,7 +338,7 @@ function submitOrder() { @@ -338,7 +338,7 @@ function submitOrder() {
338 cookie.set('activity-info', '', { 338 cookie.set('activity-info', '', {
339 expires: 'Session', 339 expires: 'Session',
340 path: '/', 340 path: '/',
341 - domain: '.m.yohobuy.com' 341 + domain: 'm.yohobuy.com'
342 }); 342 });
343 window.location.href = url; 343 window.location.href = url;
344 } else if (res.code === 409) { 344 } else if (res.code === 409) {
@@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
2 * Created by targaryen on 2016/11/28. 2 * Created by targaryen on 2016/11/28.
3 */ 3 */
4 var $ = require('yoho-jquery'), 4 var $ = require('yoho-jquery'),
  5 + cookie = require('yoho-cookie'),
5 tip = require('../plugin/tip'); 6 tip = require('../plugin/tip');
6 7
7 require('../common'); 8 require('../common');
@@ -18,7 +19,7 @@ var $selectBtn = $('.select-btn'), @@ -18,7 +19,7 @@ var $selectBtn = $('.select-btn'),
18 }; 19 };
19 20
20 $(function() { 21 $(function() {
21 - window.setCookie('activity-info', '', actCkOpthn); 22 + cookie.set('activity-info', '', actCkOpthn);
22 }); 23 });
23 24
24 /** 25 /**
@@ -99,7 +100,8 @@ $buyNowBtn.on('click', function() { @@ -99,7 +100,8 @@ $buyNowBtn.on('click', function() {
99 } 100 }
100 101
101 if (gsknSelected) { 102 if (gsknSelected) {
102 - window.setCookie('activity-info', JSON.stringify({ 103 + cookie.set('_cartType', 'bundle', actCkOpthn);
  104 + cookie.set('activity-info', JSON.stringify({
103 product_sku_list: bundleGoods, 105 product_sku_list: bundleGoods,
104 activity_id: bundleId 106 activity_id: bundleId
105 }), actCkOpthn); 107 }), actCkOpthn);