Authored by 陈峰

Merge branch 'feature/cart' of http://git.yoho.cn/fe/yohobuywap-node into feature/cart

... ... @@ -57,10 +57,13 @@ 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, orderInfo, sku, skn, buyNumber, activityInfo);
orderPromise = cartModel.cartPay(uid, cartType, null, null, sku, skn, buyNumber, activityInfo);
} else {
orderPromise = cartModel.cartPay(uid, cartType, orderInfo, sku, skn, buyNumber);
}
... ... @@ -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);
};
... ...
... ... @@ -40,7 +40,7 @@ exports.cartPayAPI = (uid, cartType, isUseYohoCoin, skuList, activityInfo) => {
// 购买套装和量贩商品时数据处理
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, {cache: false});
... ... @@ -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);
... ...
... ... @@ -271,7 +271,8 @@ function tranformPayment(data, orderInfo, cartType, skuList, orderComputeData) {
result.cartPayData = cartData.promotion_formula_list;
result.num = cartData.goods_count;
result.goodsPrice = cartData.str_order_amount;
result.price = orderComputeData ? orderComputeData.last_order_amount : cartData.last_order_amount;
result.price = _.get(orderComputeData, 'last_order_amount', null) ?
orderComputeData.last_order_amount : cartData.last_order_amount;
if (cartData.gain_yoho_coin > 0) {
result.yohoCoinNum = cartData.gain_yoho_coin;
... ...