Merge branch 'feature/cart' of http://git.yoho.cn/fe/yohobuywap-node into feature/cart
Showing
4 changed files
with
36 additions
and
7 deletions
@@ -269,6 +269,14 @@ const payZero = (req, res, next) => { | @@ -269,6 +269,14 @@ const payZero = (req, res, next) => { | ||
269 | title: '支付中心 | Yoho!Buy有货 | 潮流购物逛不停' | 269 | title: '支付中心 | Yoho!Buy有货 | 潮流购物逛不停' |
270 | }; | 270 | }; |
271 | 271 | ||
272 | + let responseFailure = { | ||
273 | + pageHeader: headerModel.setNav({ | ||
274 | + navTitle: '支付中心', | ||
275 | + navBtn: false | ||
276 | + }), | ||
277 | + title: '支付中心 | Yoho!Buy有货 | 潮流购物逛不停' | ||
278 | + }; | ||
279 | + | ||
272 | let param = { | 280 | let param = { |
273 | uid: req.user.uid, | 281 | uid: req.user.uid, |
274 | udid: req.sessionID || require('md5')(req.ip) || 'yoho', | 282 | udid: req.sessionID || require('md5')(req.ip) || 'yoho', |
@@ -284,8 +292,13 @@ const payZero = (req, res, next) => { | @@ -284,8 +292,13 @@ const payZero = (req, res, next) => { | ||
284 | } | 292 | } |
285 | 293 | ||
286 | payModel.getPayAli(param).then(result => { | 294 | payModel.getPayAli(param).then(result => { |
295 | + | ||
287 | if (result.match === true) { | 296 | if (result.match === true) { |
288 | - res.render('pay/pay-ali', Object.assign(responseData, result)); | 297 | + if (result.isCancel && result.isCancel === true) { |
298 | + return res.render('pay/pay-failure', responseFailure); | ||
299 | + } else { | ||
300 | + res.render('pay/pay-ali', Object.assign(responseData, result)); | ||
301 | + } | ||
289 | } else { | 302 | } else { |
290 | res.redirect('/'); | 303 | res.redirect('/'); |
291 | } | 304 | } |
@@ -39,6 +39,10 @@ exports.ensure = (req, res, next) => { | @@ -39,6 +39,10 @@ exports.ensure = (req, res, next) => { | ||
39 | uid | 39 | uid |
40 | }; | 40 | }; |
41 | let skillData = yield seckillModel.skillData(skn); // 根据skn查活动信息 | 41 | let skillData = yield seckillModel.skillData(skn); // 根据skn查活动信息 |
42 | + let view = { | ||
43 | + orderEnsure: false, | ||
44 | + message: '' | ||
45 | + }; | ||
42 | 46 | ||
43 | skillData = skillData.data; | 47 | skillData = skillData.data; |
44 | 48 | ||
@@ -51,7 +55,15 @@ exports.ensure = (req, res, next) => { | @@ -51,7 +55,15 @@ exports.ensure = (req, res, next) => { | ||
51 | skillData && | 55 | skillData && |
52 | skillData.secKillSku.some(obj => obj.productSku === sku) // skn has sku; | 56 | skillData.secKillSku.some(obj => obj.productSku === sku) // skn has sku; |
53 | )) { | 57 | )) { |
54 | - return Promise.reject('活动不存在'); | 58 | + view.message = '挤爆啦,系统繁忙'; |
59 | + return res.render('order-ensure', Object.assign({ | ||
60 | + module: 'cart', | ||
61 | + page: 'seckill', | ||
62 | + pageHeader: headerModel.setNav({ | ||
63 | + navTitle: '确认订单', | ||
64 | + backUrl: '/product/show_' + skn + '.html' | ||
65 | + }), | ||
66 | + }, view)); | ||
55 | } | 67 | } |
56 | 68 | ||
57 | paymentOption.activity_id = activityId = skillData.activityId; | 69 | paymentOption.activity_id = activityId = skillData.activityId; |
@@ -68,7 +80,6 @@ exports.ensure = (req, res, next) => { | @@ -68,7 +80,6 @@ exports.ensure = (req, res, next) => { | ||
68 | 80 | ||
69 | // 获取结算 数据 | 81 | // 获取结算 数据 |
70 | let paymentInfo = yield seckillModel.payment(paymentOption, orderInfo, orderComputerData.data); | 82 | let paymentInfo = yield seckillModel.payment(paymentOption, orderInfo, orderComputerData.data); |
71 | - let view; | ||
72 | 83 | ||
73 | if (paymentInfo.code !== 200) { | 84 | if (paymentInfo.code !== 200) { |
74 | view = { | 85 | view = { |
@@ -439,12 +439,17 @@ const getPayAli = (param) => { | @@ -439,12 +439,17 @@ const getPayAli = (param) => { | ||
439 | 439 | ||
440 | if (result && result[2] && result[2].data && result[2].data.payment_amount) { | 440 | if (result && result[2] && result[2].data && result[2].data.payment_amount) { |
441 | resu.packageTitle = _.get(result[2], 'data.package_title', ''); | 441 | resu.packageTitle = _.get(result[2], 'data.package_title', ''); |
442 | + | ||
443 | + resu.payment = result[2].data.payment_amount; | ||
444 | + | ||
442 | if (param.isPay && param.isPay === true) { | 445 | if (param.isPay && param.isPay === true) { |
443 | - resu.payment = '0.00'; | ||
444 | - resu.payWay = false; | 446 | + if (result[2].data.payment_status && result[2].data.payment_status === 'Y') { |
447 | + resu.payWay = false; | ||
448 | + } else { | ||
449 | + resu.isCancel = true; | ||
450 | + } | ||
445 | } else { | 451 | } else { |
446 | resu.payWay = true; | 452 | resu.payWay = true; |
447 | - resu.payment = result[2].data.payment_amount; | ||
448 | } | 453 | } |
449 | 454 | ||
450 | } else { | 455 | } else { |
@@ -24,7 +24,7 @@ var richTip = require('../plugin/rich-tip'); | @@ -24,7 +24,7 @@ var richTip = require('../plugin/rich-tip'); | ||
24 | var $loadingToast = $('.loading-toast'); | 24 | var $loadingToast = $('.loading-toast'); |
25 | 25 | ||
26 | /* TODO 影响加载此段 JS */ | 26 | /* TODO 影响加载此段 JS */ |
27 | -var theOrderCode = document.getElementById('ordercode').value; | 27 | +var theOrderCode = document.getElementById('ordercode') ? document.getElementById('ordercode').value : ''; |
28 | 28 | ||
29 | var wxPayEl = document.getElementById('weixin'), | 29 | var wxPayEl = document.getElementById('weixin'), |
30 | wxHammer = wxPayEl && new Hammer(wxPayEl); | 30 | wxHammer = wxPayEl && new Hammer(wxPayEl); |
-
Please register or login to post a comment