select-coupon.js
781 Bytes
/*
* @Author: Targaryen
* @Date: 2017-06-27 17:18:56
* @Last Modified by: Targaryen
*/
const $couponCodeInput = $('input[name=couponCode]');
const $submit = $('.submit');
const $useCouponBtnGroup = $('.use-coupon-btn-group');
let Tab = require('plugin/tab');
Tab.prototype.couponavailable = () => {
$useCouponBtnGroup.removeClass('disable');
};
Tab.prototype.couponunavailable = () => {
$useCouponBtnGroup.addClass('disable');
};
$('.select-coupon-page').css('min-height', function() {
return $(window).height() - $('#yoho-header').height() + 20;
});
/**
* 优惠券码输入监听
*/
$couponCodeInput.bind('input', () => {
if ($couponCodeInput.val()) {
$submit.addClass('active');
} else {
$submit.removeClass('active');
}
});