|
|
'use strict';
|
|
|
const _ = require('lodash');
|
|
|
const helpers = global.yoho.helpers;
|
|
|
const co = require('bluebird').coroutine;
|
|
|
const co = Promise.coroutine;
|
|
|
const cartModel = require('../models/cart');
|
|
|
const headerModel = require('../../../doraemon/models/header');
|
|
|
const userModel = require('../models/user');
|
...
|
...
|
@@ -211,6 +211,7 @@ exports.orderSub = (req, res, next) => { |
|
|
let msg = req.body.msg || null;
|
|
|
let couponCode = req.body.couponCode || null;
|
|
|
let gift_card_code = req.body.gift_card_code || null;
|
|
|
let verifyCode = req.body.verifyCode || null;
|
|
|
let yohoCoin = req.body.yohoCoin || 0;
|
|
|
let skuList = req.body.skuList || '';
|
|
|
let isPrintPrice = req.body.isPrintPrice || 'Y';
|
...
|
...
|
@@ -258,6 +259,23 @@ exports.orderSub = (req, res, next) => { |
|
|
}
|
|
|
|
|
|
return co(function* () {
|
|
|
// 使用礼品卡,发送验证码
|
|
|
if (gift_card_code) {
|
|
|
if (!verifyCode) {
|
|
|
yield orderModel.giftCardSendSms(uid);
|
|
|
|
|
|
return res.json({
|
|
|
code: 411
|
|
|
});
|
|
|
} else {
|
|
|
let verifyResult = yield orderModel.validRegCode(uid, verifyCode);
|
|
|
|
|
|
if (verifyResult.code !== 200) {
|
|
|
return res.json(verifyResult);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
let result;
|
|
|
let params = {
|
|
|
uid: uid,
|
...
|
...
|
@@ -536,3 +554,14 @@ exports.jitDetail = (req, res, next) => { |
|
|
}));
|
|
|
})().catch(next);
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 重发验证码
|
|
|
*/
|
|
|
exports.giftCardSendSms = (req, res, next) => {
|
|
|
let uid = req.user.uid;
|
|
|
|
|
|
orderModel.giftCardSendSms(uid).then(result => {
|
|
|
res.json(result);
|
|
|
}).catch(next);
|
|
|
}; |
...
|
...
|
|