Authored by yyq

submit udid

... ... @@ -55,10 +55,6 @@ const getCoupons = (req, res, next) => {
// 获取优惠券列表
const convertCoupons = (req, res, next) => {
oeModel.convertCoupons(req.user.uid, req.query.code).then(data => {
if (data.data) {
data.data.userMobile = req.user.mobile;
}
res.send(data);
}).catch(next);
};
... ... @@ -66,6 +62,10 @@ const convertCoupons = (req, res, next) => {
// 获取礼品卡列表
const getGiftCards = (req, res, next) => {
oeModel.getGiftCards(req.user.uid).then(data => {
if (data.data) {
data.data.userMobile = req.user.mobile;
}
res.send(data);
}).catch(next);
};
... ... @@ -105,7 +105,7 @@ const submitCheck = (req, res, next) => {
// 带礼品卡号和短信验证码,则校验短信验证码,否则删除使用礼品卡
if (req.body.giftCard && checkCode) {
return oeModel.checkGiftCardSmsCode(checkCode, req.yoho.udid).then(result => {
return oeModel.checkGiftCardSmsCode(req.user.uid, checkCode, req.yoho.udid).then(result => {
if (result.code === 200) {
return next();
}
... ... @@ -192,7 +192,16 @@ const submit = (req, res, next) => {
userAgent: userAgent
});
params.udid = req.cookies._yasvd || 'yoho_pc';
params.udid = req.yoho.udid;
// 5.8.1 发票优化需求
// 只接受电子发票(1 纸质 2 电子),发票内容为明细(id 12:明细)
if (params.invoicesType) {
Object.assign(params, {
invoicesType: 2,
invoicesContent: 12
});
}
if (params.sku) { // 快捷结算
easypayModel.easypayOrderSubmit(uid, 'ordinary', params, remoteIp).then(result => {
... ...
... ... @@ -146,6 +146,13 @@ const easypayOrderSubmitAsync = (uid, cartType, addressId, deliveryTime, deliver
});
}
// 礼品卡
if (other.giftCard) {
Object.assign(param, {
gift_card_code: other.giftCard
});
}
// 备注
if (other.remark) {
Object.assign(param, {
... ...
... ... @@ -93,6 +93,12 @@ const getOrderComputeAsync = (uid, cartType, paymentType, deliveryWay, other) =>
});
}
if (other.giftCard) {
Object.assign(param, {
gift_card_code: other.giftCard
});
}
if (other.couponCode) {
Object.assign(param, {
coupon_code: other.couponCode
... ... @@ -121,8 +127,9 @@ const sendGiftCardCkeckSmsAsync = (uid, udid) => api.get('', {
* 校验礼品卡使用短信验证码API
* @param code [number] code
*/
const checkGiftCardSmsCodeAsync = (code, udid) => api.get('', {
const checkGiftCardSmsCodeAsync = (uid, code, udid) => api.get('', {
method: 'app.giftcard.validRegCode',
uid: uid,
code: code,
udid: udid
});
... ...
... ... @@ -70,7 +70,7 @@ const getGiftCards = (uid) => ensureApi.getGiftCardAsync(uid).then(result => {
const sendGiftCardCkeckSms = (uid, udid) => ensureApi.sendGiftCardCkeckSmsAsync(uid, udid);
// 校验礼品卡使用短信验证码
const checkGiftCardSmsCode = (uid, udid) => ensureApi.checkGiftCardSmsCodeAsync(uid, udid);
const checkGiftCardSmsCode = (uid, code, udid) => ensureApi.checkGiftCardSmsCodeAsync(uid, code, udid);
// 订单计算
const compute = (uid, cartType, pa) => {
... ... @@ -97,15 +97,6 @@ const submit = (uid, cartType, p, remoteIp) => {
p.addressId = crypto.decrypt('', `${p.addressId}`);
}
// 5.8.1 发票优化需求
// 只接受电子发票(1 纸质 2 电子),发票内容为明细(id 12:明细)
if (p.invoicesType) {
Object.assign(p, {
invoicesType: 2,
invoicesContent: 12
});
}
return ensureApi.orderSubmitAsync(uid, cartType, p.addressId, p.deliveryTime,
p.deliveryWay, p.paymentType, p.paymentId, p.printPrice, p, remoteIp).then(result => {
if (result.code === 200) {
... ...
... ... @@ -257,11 +257,11 @@
<table>
<thead>
<tr>
<th>卡号</th>
<th width="260">卡号</th>
<th>面值</th>
<th>卡内余额</th>
<th>有效期</th>
<th>选择</th>
<th width="230">有效期</th>
<th width="86">选择</th>
</tr>
</thead>
<tbody>
... ...
... ... @@ -72,7 +72,7 @@ const modifyAddress = (req, res, next) => {
return '';
}
}());
let udid = req.cookies._yasvd || 'yoho_pc';
let udid = req.yoho.udid;
if (!orderId || !userName || !areaCode || !address) {
return res.json({
... ...
... ... @@ -76,7 +76,7 @@ module.exports = () => {
// uuid
yoho.udid = (function() {
let udid = req.cookies.udid;
let udid = req.cookies._yasvd || req.cookies.udid;
if (!udid) {
udid = md5(yoho.clientIp);
... ...
... ... @@ -3,7 +3,7 @@
<td>{{cardCode}}</td>
<td>{{amount}}</td>
<td>{{remainAmount}}</td>
<td>{{validity}}</td>
<td><span class="gift-card-radio on" data-id="{{cardCode}}" data-price="{{price}}"></span></td>
<td>{{dateStr}}</td>
<td><span class="gift-card-radio" data-id="{{cardCode}}" data-price="{{price}}"></span></td>
</tr>
{{/ usable_giftCards}}
... ...
... ... @@ -101,6 +101,11 @@ function compute(coin, cb) {
reqData.redEnvelopes = order.redEnvelopes;
}
// 礼品卡
if (order.giftCard) {
reqData.giftCard = order.giftCard;
}
if (esaypayInfo) {
if (order.sku) {
reqData.sku = order.sku;
... ... @@ -703,9 +708,13 @@ giftCard = {
}).then(function(data) {
if (data.code === 200) {
$('.can-use-tip', that.$el).text('(' + data.data.usable_giftCards.length + '张可用)');
$('tbody', that.$giftCardWrap).html(giftCardTpl(data.data));
that.$radios = $('.gift-card-radio', that.$giftCardWrap);
if (data.data.usable_giftCards.length) {
$('tbody', that.$giftCardWrap).html(giftCardTpl(data.data));
that.$radios = $('.gift-card-radio', that.$giftCardWrap);
}
that.checkContent = '<h2>安全验证</h2>' +
'<p class="tip-info">您正在使用礼品卡支付,为了保障您的安全,请进行安全验证。</p>' +
'<p class="receiver-info">验证码已发送至' + (data.data.userMobile || '您绑定的') + '手机号</p>' +
... ...