Authored by 陈峰

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

... ... @@ -269,6 +269,14 @@ const payZero = (req, res, next) => {
title: '支付中心 | Yoho!Buy有货 | 潮流购物逛不停'
};
let responseFailure = {
pageHeader: headerModel.setNav({
navTitle: '支付中心',
navBtn: false
}),
title: '支付中心 | Yoho!Buy有货 | 潮流购物逛不停'
};
let param = {
uid: req.user.uid,
udid: req.sessionID || require('md5')(req.ip) || 'yoho',
... ... @@ -284,8 +292,13 @@ const payZero = (req, res, next) => {
}
payModel.getPayAli(param).then(result => {
if (result.match === true) {
if (result.isCancel && result.isCancel === true) {
return res.render('pay/pay-failure', responseFailure);
} else {
res.render('pay/pay-ali', Object.assign(responseData, result));
}
} else {
res.redirect('/');
}
... ...
... ... @@ -39,6 +39,10 @@ exports.ensure = (req, res, next) => {
uid
};
let skillData = yield seckillModel.skillData(skn); // 根据skn查活动信息
let view = {
orderEnsure: false,
message: ''
};
skillData = skillData.data;
... ... @@ -51,7 +55,15 @@ exports.ensure = (req, res, next) => {
skillData &&
skillData.secKillSku.some(obj => obj.productSku === sku) // skn has sku;
)) {
return Promise.reject('活动不存在');
view.message = '挤爆啦,系统繁忙';
return res.render('order-ensure', Object.assign({
module: 'cart',
page: 'seckill',
pageHeader: headerModel.setNav({
navTitle: '确认订单',
backUrl: '/product/show_' + skn + '.html'
}),
}, view));
}
paymentOption.activity_id = activityId = skillData.activityId;
... ... @@ -68,7 +80,6 @@ exports.ensure = (req, res, next) => {
// 获取结算 数据
let paymentInfo = yield seckillModel.payment(paymentOption, orderInfo, orderComputerData.data);
let view;
if (paymentInfo.code !== 200) {
view = {
... ...
... ... @@ -439,12 +439,17 @@ const getPayAli = (param) => {
if (result && result[2] && result[2].data && result[2].data.payment_amount) {
resu.packageTitle = _.get(result[2], 'data.package_title', '');
resu.payment = result[2].data.payment_amount;
if (param.isPay && param.isPay === true) {
resu.payment = '0.00';
if (result[2].data.payment_status && result[2].data.payment_status === 'Y') {
resu.payWay = false;
} else {
resu.isCancel = true;
}
} else {
resu.payWay = true;
resu.payment = result[2].data.payment_amount;
}
} else {
... ...
... ... @@ -24,7 +24,7 @@ var richTip = require('../plugin/rich-tip');
var $loadingToast = $('.loading-toast');
/* TODO 影响加载此段 JS */
var theOrderCode = document.getElementById('ordercode').value;
var theOrderCode = document.getElementById('ordercode') ? document.getElementById('ordercode').value : '';
var wxPayEl = document.getElementById('weixin'),
wxHammer = wxPayEl && new Hammer(wxPayEl);
... ...