...
|
...
|
@@ -42,14 +42,14 @@ exports.orderEnsure = (req, res, next) => { |
|
|
headerData.backUrl = req.get('Referer') || returnUrl;
|
|
|
}
|
|
|
|
|
|
let order = cartModel.cartPay(uid, cartType, orderInfo, sku, skn, buyNumber, req.xhr);
|
|
|
let userProfile = userModel.queryProfile(uid);
|
|
|
let address = addressModel.addressData(uid);
|
|
|
let orderPromise = cartModel.cartPay(uid, cartType, orderInfo, sku, skn, buyNumber, req.xhr);
|
|
|
let userProfilePromise = userModel.queryProfile(uid);
|
|
|
let addressPromise = addressModel.addressData(uid);
|
|
|
|
|
|
return Promise.all([order, userProfile, address]).then(result => {
|
|
|
order = result[0];
|
|
|
userProfile = result[1];
|
|
|
address = result[2];
|
|
|
return Promise.all([orderPromise, userProfilePromise, addressPromise]).then(result => {
|
|
|
let order = result[0];
|
|
|
let userProfile = result[1];
|
|
|
let address = result[2];
|
|
|
|
|
|
if (order.cartUrl) { // TODO? 普通或者预售商品为空时, BUT WHEN AJAX?
|
|
|
return res.redirect(order.cartUrl);
|
...
|
...
|
@@ -74,16 +74,15 @@ exports.orderEnsure = (req, res, next) => { |
|
|
orderEnsurePage: true,
|
|
|
isOrdinaryCart: cartType !== 'advance',
|
|
|
orderEnsure: order,
|
|
|
userMobile: mobile
|
|
|
userMobile: mobile,
|
|
|
pageHeader: headerData,
|
|
|
pageFooter: true,
|
|
|
module: 'cart',
|
|
|
page: 'order-ensure',
|
|
|
width750: true,
|
|
|
title: '确认订单',
|
|
|
};
|
|
|
|
|
|
viewData.pageHeader = headerData;
|
|
|
viewData.pageFooter = true;
|
|
|
viewData.module = 'cart';
|
|
|
viewData.page = 'order-ensure';
|
|
|
viewData.width750 = true;
|
|
|
viewData.title = '确认订单';
|
|
|
|
|
|
res.render('order-ensure', viewData);
|
|
|
}).catch(next);
|
|
|
};
|
...
|
...
|
@@ -96,16 +95,42 @@ exports.fastPay = (req, res, next) => { |
|
|
navTitle: '确认订单',
|
|
|
navBtn: false
|
|
|
});
|
|
|
let uid = req.user.uid;
|
|
|
let orderPromise = cartModel.easyPayment(uid, req.query.skuList);
|
|
|
let userProfilePromise = userModel.queryProfile(uid);
|
|
|
let addressPromise = addressModel.addressData(uid);
|
|
|
|
|
|
let viewData = {
|
|
|
pageHeader: headerData,
|
|
|
module: 'cart',
|
|
|
page: 'order-ensure',
|
|
|
width750: true,
|
|
|
title: '确认订单'
|
|
|
};
|
|
|
Promise.all([orderPromise, userProfilePromise, addressPromise]).then(result => {
|
|
|
let order = result[0];
|
|
|
let userProfile = result[1];
|
|
|
let address = result[2];
|
|
|
|
|
|
// 获取用户完整手机号
|
|
|
let mobile = _.get(userProfile, 'data.mobile', '');
|
|
|
let orderAddress = _.get(order, 'address', []);
|
|
|
let addressList = _.get(address, 'data', []);
|
|
|
|
|
|
orderAddress.length && addressList.forEach(address => { //eslint-disable-line
|
|
|
if (address.address_id === orderAddress.address_id) {
|
|
|
mobile = address.mobile;
|
|
|
}
|
|
|
});
|
|
|
|
|
|
let viewData = {
|
|
|
orderEnsurePage: true,
|
|
|
isOrdinaryCart: true,
|
|
|
orderEnsure: order,
|
|
|
userMobile: mobile,
|
|
|
pageHeader: headerData,
|
|
|
pageFooter: true,
|
|
|
module: 'cart',
|
|
|
page: 'order-ensure',
|
|
|
width750: true,
|
|
|
title: '确认订单',
|
|
|
};
|
|
|
|
|
|
res.render('order-ensure', viewData);
|
|
|
res.render('order-ensure', viewData);
|
|
|
}).catch(next);
|
|
|
};
|
|
|
|
|
|
/**
|
...
|
...
|
|