...
|
...
|
@@ -14,8 +14,7 @@ var $balanceDetail = $('#balance-detail'), |
|
|
$orderPrice = $('#order-price');
|
|
|
|
|
|
var order = {
|
|
|
printPrice: 'Y',
|
|
|
giftCard: 'eqweqw'
|
|
|
printPrice: 'Y'
|
|
|
};
|
|
|
|
|
|
var payWay,
|
...
|
...
|
@@ -690,7 +689,6 @@ giftCard = { |
|
|
return;
|
|
|
}
|
|
|
|
|
|
|
|
|
this.$giftCardWrap = this.$el.next();
|
|
|
|
|
|
this.getList();
|
...
|
...
|
@@ -706,7 +704,12 @@ giftCard = { |
|
|
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);
|
|
|
that.checkContent = '<h2>安全验证</h2>' +
|
|
|
'<p class="tip-info">您正在使用礼品卡支付,为了保障您的安全,请进行安全验证。</p>' +
|
|
|
'<p class="receiver-info">验证码已发送至' + (data.data.userMobile || '您绑定的') + '手机号</p>' +
|
|
|
'<p><input type="text" placeholder="短信验证码" maxlength="8"><span class="send-sms">获取验证码</span></p>';
|
|
|
}
|
|
|
});
|
|
|
},
|
...
|
...
|
@@ -746,6 +749,10 @@ giftCard = { |
|
|
compute();
|
|
|
},
|
|
|
setUseStatus: function(price) {
|
|
|
if (!this.$radios) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (price && price * 1 > 0) {
|
|
|
this.$radios.filter('.disable').removeClass('disable');
|
|
|
} else {
|
...
|
...
|
@@ -771,8 +778,6 @@ refund = { |
|
|
}
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
$('.locker-switch').click(function() {
|
|
|
var $this = $(this),
|
|
|
$par = $this.parent();
|
...
|
...
|
@@ -972,9 +977,10 @@ $('#order-submit').click(function() { |
|
|
return;
|
|
|
}
|
|
|
|
|
|
// 使用礼品卡时候进行短信校验
|
|
|
if (order.giftCard) {
|
|
|
checkDg = new dialog.Dialog({
|
|
|
content: '<p>您正在使用礼品卡支付,为了保障您的安全,请进行安全验证。</p><span class="send-sms"></span>',
|
|
|
content: giftCard.checkContent || '',
|
|
|
className: 'gift-card-check-dialog',
|
|
|
btns: [{
|
|
|
id: 'check-cancel',
|
...
|
...
|
@@ -986,48 +992,60 @@ $('#order-submit').click(function() { |
|
|
}, {
|
|
|
id: 'check-sure',
|
|
|
btnClass: ['check-sure'],
|
|
|
name: '返回购物车',
|
|
|
name: '确定使用',
|
|
|
cb: function() {
|
|
|
order.checkCode = '';
|
|
|
submitOrder(order);
|
|
|
order.checkCode = $('input', checkDg.$el).val();
|
|
|
|
|
|
if (order.checkCode) {
|
|
|
submitOrder(order);
|
|
|
checkDg.close();
|
|
|
}
|
|
|
}
|
|
|
}]
|
|
|
}).show();
|
|
|
});
|
|
|
|
|
|
checkDg.$sendBtn = $('.send-sms', checkDg.$el);
|
|
|
checkDg.countdown = function() {
|
|
|
checkDg.sendSms = function() {
|
|
|
var that = this;
|
|
|
|
|
|
if (!this.$sendBtn || this.seconds > 0) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
sendCkeckSms(); // 发送验证码
|
|
|
|
|
|
if (!this.seconds || this.seconds < 1) {
|
|
|
this.seconds = 59;
|
|
|
}
|
|
|
|
|
|
this.timer && clearInterval(this.timer);
|
|
|
|
|
|
this.$sendBtn.text((this.seconds--) + 's').addClass('timer');
|
|
|
|
|
|
this.timer = setInterval(function() {
|
|
|
if (checkDg.seconds > 0) {
|
|
|
checkDg.$sendBtn.text((checkDg.seconds--) + 's');
|
|
|
if (that.seconds > 0) {
|
|
|
that.$sendBtn.text((that.seconds--) + 's').addClass('timer');
|
|
|
} else {
|
|
|
checkDg.$sendBtn.text('获取验证码');
|
|
|
clearInterval(checkDg.timer);
|
|
|
that.$sendBtn.text('获取验证码').removeClass('timer');
|
|
|
clearInterval(that.timer);
|
|
|
}
|
|
|
}, 1000);
|
|
|
|
|
|
return this;
|
|
|
};
|
|
|
|
|
|
checkDg.$sendBtn.click(function() {
|
|
|
checkDg.countdown();
|
|
|
checkDg.sendSms();
|
|
|
});
|
|
|
|
|
|
sendCkeckSms(); // 发送验证码
|
|
|
checkDg.countdown(); // 倒计时
|
|
|
checkDg.sendSms().show();
|
|
|
|
|
|
return;
|
|
|
} else {
|
|
|
order.checkCode && delete order.checkCode;
|
|
|
}
|
|
|
|
|
|
submitOrder(order);
|
|
|
|
|
|
});
|
|
|
|
|
|
payWay.init();
|
...
|
...
|
|