Authored by 郭成尧

bundle-bug-fixed

... ... @@ -57,7 +57,10 @@ exports.orderEnsure = (req, res, next) => {
let userProfilePromise = userModel.queryProfile(uid);
let addressPromise = addressModel.addressData(uid);
if (req.query.activityType === 'bundle') {
if (req.query.cartType === 'bundle') {
if (!req.cookies._cartType) {
res.cookie('_cartType', 'bundle', actCkOpthn);
}
let activityInfo = JSON.parse(req.cookies['activity-info']);
orderPromise = cartModel.cartPay(uid, cartType, null, null, sku, skn, buyNumber, activityInfo);
... ... @@ -127,7 +130,7 @@ exports.orderCompute = (req, res, next) => {
let type = req.body.type;
if (type !== 'tickets') {
if (req.body.activityType === 'bundle') {
if (req.body.cartType === 'bundle') {
let activityInfo = JSON.parse(req.cookies['activity-info']);
cartModel.orderCompute(uid, cartType, deliveryId, paymentTypeId, couponCode, yohoCoin, null, activityInfo).then(result => {
... ... @@ -372,7 +375,8 @@ exports.invoiceInfo = (req, res, next) => {
res.render('select-invoice', _.assign(returnData, {
pageHeader: headerData,
module: 'cart',
page: 'select-invoice'
page: 'select-invoice',
addressMore: helpers.urlFormat('/cart/index/new/orderEnsure', {cartType: req.cookies._cartType})
}));
})().catch(next);
};
... ...
... ... @@ -92,7 +92,7 @@ exports.orderComputeAPI = (uid, cartType, deliveWay, paymentType, couponCode, yo
// 购买套餐商品需要的数据
if (activityInfo) {
param.activity_id = activityInfo.activity_id;
param.product_sku_list = activityInfo.product_sku_list;
param.product_sku_list = JSON.stringify(activityInfo.product_sku_list);
}
return api.get('', param, {code: 200});
... ...
... ... @@ -338,7 +338,7 @@ function submitOrder() {
cookie.set('activity-info', '', {
expires: 'Session',
path: '/',
domain: '.m.yohobuy.com'
domain: 'm.yohobuy.com'
});
window.location.href = url;
} else if (res.code === 409) {
... ...
... ... @@ -2,6 +2,7 @@
* Created by targaryen on 2016/11/28.
*/
var $ = require('yoho-jquery'),
cookie = require('yoho-cookie'),
tip = require('../plugin/tip');
require('../common');
... ... @@ -18,7 +19,7 @@ var $selectBtn = $('.select-btn'),
};
$(function() {
window.setCookie('activity-info', '', actCkOpthn);
cookie.set('activity-info', '', actCkOpthn);
});
/**
... ... @@ -99,7 +100,8 @@ $buyNowBtn.on('click', function() {
}
if (gsknSelected) {
window.setCookie('activity-info', JSON.stringify({
cookie.set('_cartType', 'bundle', actCkOpthn);
cookie.set('activity-info', JSON.stringify({
product_sku_list: bundleGoods,
activity_id: bundleId
}), actCkOpthn);
... ...