Authored by zhangxiaoru

0元支付增加订单状态判断

... ... @@ -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) {
res.render('pay/pay-ali', Object.assign(responseData, result));
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('/');
}
... ...
... ... @@ -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';
resu.payWay = false;
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);
... ...