|
|
// import qs from 'yoho-qs';
|
|
|
import dialog from 'plugin/dialog';
|
|
|
import safeCheckBoxHbs from 'cart/order-ensure/safe-check-box.hbs';
|
|
|
import Page from 'yoho-page';
|
|
|
import tip from 'plugin/tip';
|
|
|
|
|
|
class OrderEnsure {
|
|
|
class OrderEnsure extends Page {
|
|
|
constructor(order) { // 参数为使用哪个 cookie
|
|
|
super();
|
|
|
|
|
|
this.order = order;
|
|
|
this.orderInfo = order.orderInfo;
|
|
|
|
...
|
...
|
@@ -73,13 +77,14 @@ class OrderEnsure { |
|
|
*/
|
|
|
sckDialogClickHandle(sureCallback) {
|
|
|
let $dialogWrapper = $('#dialog-wrapper');
|
|
|
let $verifyCodeInput = $dialogWrapper.find('input[name=verifyCode]');
|
|
|
let $getVerifyCodeBtn = $('#getVerifyCodeBtn');
|
|
|
let $cancelBtn = $dialogWrapper.find('.dialog-left-btn');
|
|
|
let $sureBtn = $dialogWrapper.find('.dialog-right-btn');
|
|
|
|
|
|
this.countDown();
|
|
|
|
|
|
$dialogWrapper.find('input[name=verifyCode]').on('input', () => {
|
|
|
$verifyCodeInput.on('input', () => {
|
|
|
if ($(event.target).val()) {
|
|
|
$sureBtn.addClass('active');
|
|
|
} else {
|
...
|
...
|
@@ -89,6 +94,7 @@ class OrderEnsure { |
|
|
|
|
|
$getVerifyCodeBtn.on('click', () => {
|
|
|
if (!$getVerifyCodeBtn.hasClass('disable')) {
|
|
|
$verifyCodeInput.val('');
|
|
|
this.resendSms();
|
|
|
}
|
|
|
});
|
...
|
...
|
@@ -104,16 +110,25 @@ class OrderEnsure { |
|
|
});
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 重发验证码
|
|
|
*/
|
|
|
resendSms() {
|
|
|
console.log('sent');
|
|
|
this.countDown();
|
|
|
this.ajax({
|
|
|
url: '/cart/index/new/giftCardSendSms'
|
|
|
}).then(result => {
|
|
|
if (result.code === 200) {
|
|
|
this.countDown();
|
|
|
}
|
|
|
tip.show(result.message);
|
|
|
});
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取验证码倒计时
|
|
|
*/
|
|
|
countDown() {
|
|
|
let count = 59;
|
|
|
let count = 9;
|
|
|
let itime;
|
|
|
let $getVerifyCodeBtn = $('#getVerifyCodeBtn');
|
|
|
|
...
|
...
|
|