sendOrder: function(e) {
event.preventDefault();
//e.preventDefault();
var phone_input = $(this).find("input[type=tel]");
var phone_number = phone_input.val().replace(/[^0-9]/g,"");
if (phone_number.length === 0 ) {
phone_input.notify("Введите номер телефона", {position:"bottom" , className: 'error'})
}
if (phone_number.length < 12 && phone_number.length >= 4) {
phone_input.notify("Номер введён не полностью", {position:"bottom" , className: 'warn', gap: 0, autoHideDelay: 3000});
}
if (phone_number.length === 12) {
var data = $(this).serializeArray();
var orderlist = $.param(actions.getStorage());
data.push ({name: 'orderlist', value: orderlist});
data.push ({name: 'user_client', value: client_info});
data.push ({name: 'href', value: href});
data.push ({name: 'search', value: search});
data.push ({name: 'term', value: utm_key_value.utm_term});
data.push ({name: 'content', value: utm_key_value.utm_content});
data.push ({name: 'campaign', value: utm_key_value.utm_campaign});
data.push ({name: 'medium', value: utm_key_value.utm_medium});
data.push ({name: 'source', value: utm_key_value.utm_source});
data.push ({name: 'ref', value: ref});
var thisForm = $(this);
$.ajax({
url: opts.handler,
type: 'POST',
dataType: 'json',
data: data,
error: function() {},
success: function(resp) {
$('.jqcart-checkout').html('<p>' + resp.message + '</p>');
if(!resp.errors) {
setTimeout(methods.clearCart, 2000);
}
}
});
}
},