...
|
...
|
@@ -2,12 +2,12 @@ |
|
|
* @Author: Targaryen
|
|
|
* @Date: 2017-06-21 10:15:38
|
|
|
* @Last Modified by: Targaryen
|
|
|
* @Last Modified time: 2017-06-23 17:53:27
|
|
|
* @Last Modified time: 2017-06-26 16:21:29
|
|
|
*/
|
|
|
const _ = require('lodash');
|
|
|
const co = require('bluebird').coroutine;
|
|
|
const headerModel = require('../../../doraemon/models/header');
|
|
|
const BuyNowModel = require('../models/BuyNowModel');
|
|
|
const BuyNowModel = require('../models/buy-now-model');
|
|
|
const addressModel = require('../models/address');
|
|
|
const userModel = require('../models/user');
|
|
|
const orderModel = require('../models/order');
|
...
|
...
|
@@ -41,8 +41,9 @@ class BuyNowController { |
|
|
}
|
|
|
|
|
|
let product_sku = req.query.product_sku;
|
|
|
let buy_number = req.query.buy_number;
|
|
|
|
|
|
if (!product_sku) {
|
|
|
if (!product_sku || !buy_number) {
|
|
|
return next();
|
|
|
}
|
|
|
|
...
|
...
|
@@ -51,20 +52,20 @@ class BuyNowController { |
|
|
uid: req.user.uid,
|
|
|
product_sku: product_sku,
|
|
|
sku_type: req.query.sku_type,
|
|
|
buy_number: req.query.buy_number,
|
|
|
buy_number: buy_number,
|
|
|
});
|
|
|
let computeData = yield req.ctx(BuyNowModel).compute({
|
|
|
uid: req.user.uid,
|
|
|
product_sku: product_sku,
|
|
|
sku_type: req.query.sku_type,
|
|
|
buy_number: req.query.buy_number,
|
|
|
buy_number: buy_number,
|
|
|
use_yoho_coin: parseInt(orderInfo.use_yoho_coin, 10)
|
|
|
});
|
|
|
let validCouponCount = yield req.ctx(BuyNowModel).countUsableCoupon({
|
|
|
uid: req.user.uid,
|
|
|
product_sku: req.query.product_sku,
|
|
|
sku_type: req.query.sku_type,
|
|
|
buy_number: req.query.buy_number
|
|
|
buy_number: buy_number
|
|
|
});
|
|
|
let headerData = headerModel.setNav({
|
|
|
navTitle: '确认订单',
|
...
|
...
|
@@ -77,11 +78,17 @@ class BuyNowController { |
|
|
page: 'order-ensure',
|
|
|
title: '确认订单',
|
|
|
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)
|
|
|
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
|
|
|
}
|
|
|
)
|
|
|
});
|
...
|
...
|
@@ -170,10 +177,14 @@ class BuyNowController { |
|
|
selectAddress(req, res, next) {
|
|
|
let uid = req.user.uid;
|
|
|
let product_sku = req.query.product_sku;
|
|
|
let buy_number = req.query.buy_number;
|
|
|
|
|
|
co(function * () {
|
|
|
let address = yield addressModel.addressData(uid);
|
|
|
let moreUrl = helpers.urlFormat('/cart/index/buynow/orderEnsure', {product_sku: product_sku});
|
|
|
let moreUrl = helpers.urlFormat('/cart/index/buynow/orderensure', {
|
|
|
product_sku: product_sku,
|
|
|
buy_number: buy_number
|
|
|
});
|
|
|
|
|
|
address = address.data;
|
|
|
|
...
|
...
|
@@ -203,6 +214,7 @@ class BuyNowController { |
|
|
*/
|
|
|
selectInvoice(req, res, next) {
|
|
|
let product_sku = req.query.product_sku;
|
|
|
let buy_number = req.query.buy_number;
|
|
|
let uid = req.user.uid;
|
|
|
let orderInfo;
|
|
|
|
...
|
...
|
@@ -228,7 +240,10 @@ class BuyNowController { |
|
|
module: 'buynow',
|
|
|
page: 'select-invoice',
|
|
|
localCss: true,
|
|
|
addressMore: helpers.urlFormat('/cart/index/buynow/orderEnsure', {product_sku: product_sku})
|
|
|
addressMore: helpers.urlFormat('/cart/index/buynow/orderensure', {
|
|
|
product_sku: product_sku,
|
|
|
buy_number: buy_number
|
|
|
})
|
|
|
}));
|
|
|
})().catch(next);
|
|
|
}
|
...
|
...
|
|