您的位置:首页 > 其它

根据国家 ID 和运输方式正则限制字样

2017-06-24 21:24 246 查看
/*
* 方法一
*/
function packStation(submit) {
var methodOne = $('[name=shipping_method] option:selected').val();
var consignee_address1 = $('[name=consignee_address1]').val();
var consignee_address2 = $('[name=consignee_address2]').val();
var country = $('[name=consignee_country_id] option:selected').val();
if ($.inArray(methodOne, ['SFCQMDE', 'DEAM2', 'EUEXP1', 'EUEXP3', 'DERAM2', 'SFCQMDER']) == -1) {
return true;
}
if (((/Packstation/i).test(consignee_address1)) || ((/Packstation/i).test(consignee_address2))) {
if (methodOne == 'SFCQMDER') {
if (ubmit) {
$("#messageDialog").html('<{t}>100002240<{/t}><{t}>100002275<{/t}>').dialog("open");
}
} else {
if ($.inArray(methodOne, ['SFCQMDE', 'DEAM2', 'DERAM2']) != -1) {
if (country == 89) {
$("#messageDialog").html('<{t}>100002240<{/t}><{t}>100002276<{/t}>').dialog("open");
return false;
} else {
return true;
}
} else {
$("#messageDialog").html('<{t}>100002240<{/t}><{t}>100002276<{/t}>').dialog("open");
return false;
}
}
}
return true;
}

/*
* 方法二
*/
function RestrictionWords() {
var consignee_country_id = $("[name=consignee_country_id] option:selected").val();
var shipping_method = $("[name=shipping_method] option:selected").val();
var consignee_first_name = $("[name=consignee_first_name]").val();
var consignee_last_name = $("[name=consignee_last_name]").val();
var consignee_company = $("[name=consignee_company]").val();
var consignee_address1 = $("[name=consignee_address1]").val();
var consignee_address2 = $("[name=consignee_address2]").val();
if (((/FBA/i).test(consignee_first_name)) ||
((/Amazon/i).test(consignee_first_name)) ||
((/FBA/i).test(consignee_last_name)) ||
((/Amazon/i).test(consignee_last_name)) ||
((/FBA/i).test(consignee_company)) ||
((/Amazon/i).test(consignee_company)) ||
((/FBA/i).test(consignee_address1)) ||
((/Amazon/i).test(consignee_address1)) ||
((/FBA/i).test(consignee_address2)) ||
((/Amazon/i).test(consignee_address2))) {
if (consignee_country_id == 115 && shipping_method == 'SFCQMITR' ||
consignee_country_id == 221 && shipping_method == 'SFCQMESR') {
$("#messageDialog").html('<{t}>100002294<{/t}>').dialog("open");
return false;
}
}
return true;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: