...
|
...
|
@@ -2,7 +2,7 @@ |
|
|
* @Author: Targaryen
|
|
|
* @Date: 2017-06-21 10:15:38
|
|
|
* @Last Modified by: Targaryen
|
|
|
* @Last Modified time: 2017-06-26 16:19:38
|
|
|
* @Last Modified time: 2017-06-27 15:20:50
|
|
|
*/
|
|
|
const _ = require('lodash');
|
|
|
const co = require('bluebird').coroutine;
|
...
|
...
|
@@ -16,6 +16,7 @@ const paymentProcess = require(`${utils}/payment-process`); |
|
|
const crypto = global.yoho.crypto;
|
|
|
const logger = global.yoho.logger;
|
|
|
const helpers = global.yoho.helpers;
|
|
|
const camelCase = global.yoho.camelCase;
|
|
|
|
|
|
// cookie 参数
|
|
|
const actCkOpthn = {
|
...
|
...
|
@@ -59,7 +60,11 @@ class BuyNowController { |
|
|
product_sku: product_sku,
|
|
|
sku_type: req.query.sku_type,
|
|
|
buy_number: buy_number,
|
|
|
use_yoho_coin: parseInt(orderInfo.use_yoho_coin, 10)
|
|
|
payment_type: orderInfo.payment_type,
|
|
|
delivery_way: orderInfo.delivery_way,
|
|
|
use_yoho_coin: parseInt(orderInfo.use_yoho_coin, 10),
|
|
|
coupon_code: orderInfo.coupon_code,
|
|
|
promotion_code: orderInfo.promotion_code
|
|
|
});
|
|
|
let validCouponCount = yield req.ctx(BuyNowModel).countUsableCoupon({
|
|
|
uid: req.user.uid,
|
...
|
...
|
@@ -71,6 +76,25 @@ class BuyNowController { |
|
|
navTitle: '确认订单',
|
|
|
navBtn: false
|
|
|
});
|
|
|
let orderEnsure = _.assign(
|
|
|
paymentProcess.tranformPayment(result.data, orderInfo, null, null, computeData.data),
|
|
|
{
|
|
|
coupon: paymentProcess.coupon(
|
|
|
_.get(validCouponCount, 'data.count', 0),
|
|
|
orderInfo,
|
|
|
computeData.data
|
|
|
),
|
|
|
selectAddressUrl: helpers.urlFormat('/cart/index/buynow/selectAddress', {
|
|
|
product_sku: product_sku,
|
|
|
buy_number: buy_number
|
|
|
}),
|
|
|
selectCouponUrl: helpers.urlFormat('/cart/index/buynow/selectCoupon', {
|
|
|
product_sku: product_sku,
|
|
|
buy_number: buy_number
|
|
|
}),
|
|
|
isOrdinaryCart: true
|
|
|
}
|
|
|
);
|
|
|
|
|
|
return res.render('buynow/order-ensure', {
|
|
|
pageHeader: headerData,
|
...
|
...
|
@@ -80,17 +104,7 @@ class BuyNowController { |
|
|
width750: true,
|
|
|
localCss: true,
|
|
|
product_sku: product_sku,
|
|
|
orderEnsure: _.assign(
|
|
|
paymentProcess.tranformPayment(result.data, orderInfo, null, null, computeData.data),
|
|
|
{
|
|
|
coupon: paymentProcess.coupon(_.get(validCouponCount, 'data.count', 0), orderInfo, computeData),
|
|
|
selectAddressUrl: helpers.urlFormat('/cart/index/buynow/selectAddress', {
|
|
|
product_sku: product_sku,
|
|
|
buy_number: buy_number
|
|
|
}),
|
|
|
isOrdinaryCart: true
|
|
|
}
|
|
|
)
|
|
|
orderEnsure: orderEnsure
|
|
|
});
|
|
|
|
|
|
})().catch(next);
|
...
|
...
|
@@ -283,7 +297,9 @@ class BuyNowController { |
|
|
buy_number: req.query.buy_number
|
|
|
});
|
|
|
|
|
|
res.json(result);
|
|
|
let finalResult = _.get(result, 'data', {});
|
|
|
|
|
|
res.json(camelCase(finalResult));
|
|
|
})().catch(next);
|
|
|
}
|
|
|
|
...
|
...
|
|