-3
I have a delivery form that uses a file (form.js) where contain the billing data by zip code, so far so good, my question is, because sometimes it charges and then does not charge, being the same zip code? Example: Some days the CEP 20240-200 he recognizes and charges R $ 4,30 and the other not! Worse, sometimes it has more than one order for the same zip code and it IN THE SAME DAY charges for one and does not charge for another request, as this can happen????
Follow the complete CODE of this file:
//aqui eu pego o cep
var cep = document.getElementById("cep").value;
//verifica se deve incrementar ou não
if(cep == "20040-010" || cep == "20071-002" || cep == "20090-910" || cep == "20210-010" || cep == "20080-102" || cep == "20230-130" || cep == "20081-250" || cep == "20090-030" || cep == "20090-030" || cep == "20211-340" || cep == "20211-351" || cep == "20221-240" || cep == "20221-250" || cep == "20230-010" || cep == "20230-011" || cep == "20230-025" || cep == "20230-150" || cep == "20230-160" || cep == "20230-240" || cep == "20231-016" || cep == "20231-030" || cep == "20231-031" || cep == "20231-050" || cep == "20211-005" || cep == "20231-085" || cep == "20230-014" || cep == "20231-004" || cep == "20021-180" || cep == "20240-180" || cep == "20240-051" || cep == "20211-010" || cep == "20230-170" || cep == "20230-024" || cep == "20240-050" || cep == "20230-050" || cep == "20231-006" || cep == "20090-010" || cep == "20230-901" || cep == "20040-051" || cep == "20241-080" || cep == "20221-901" || cep == "20051-011" || cep == "20021-190" || cep == "20240-200" || cep == "20230-170" || cep == "20231-015" || cep == "20211-350" || cep == "20231-020" || cep == "20061-030"){
//se for um dos ceps acima, incrementa 4 no valor final
taxa = 4.30;
//verifica se deve incrementar ou não
}if(cep == "20241-220" || cep == "22210-015" || cep == "22220-000" || cep == "20241-160" || cep == "20021-040" || cep == "20241-150" || cep == "22210-010" || cep == "22211-230" || cep == "22220-000" || cep == "22220-070" || cep == "22221-060" || cep == "22211-200" || cep == "22221-020" || cep == "20241-180" || cep == "20240-200"){
//se for um dos ceps acima, incrementa 5.5 no valor final
taxa = 6.0;
}if(cep == "20050-091" || cep == "20060-050" || cep == "20071-000" || cep == "20080-003" || cep == "20081-000" || cep == "20081-050" || cep == "20090-000" || cep == "20090-003" || cep == "20231-092" || cep == "24938-600" || cep == "20051-002" || cep == "20090-050" || cep == "20231-046" || cep == "20231-047" || cep == "20231-048" || cep == "20090-001" || cep == "20231-093" || cep == "20051-011" || cep == "20060-010" || cep == "20050-002"){
//se for um dos ceps acima, incrementa 3.5 no valor final
taxa = 3.8;
}if(cep == "20031-170" || cep == "20040-004" || cep == "20040-902" | cep == "20021-360" || cep == "20040-020" || cep == "20040-908" || cep == "20071-000" || cep == "20230-070" || cep == "20071-004" || cep == "20040-009" || cep == "20230-060"){
//se for um dos ceps acima, incrementa 3 no valor final
taxa = 3.30;
}if(cep == "20010-010" || cep == "20020-906" || cep == "20031-908" || cep == "20031-917" || cep == "20040-001" || cep == "20040-006" || cep == "20050-090" || cep == "20070-022" || cep == "20031-909" || cep == "20031-904" || cep == "20021-390" || cep == "20031-919" || cep == "20031-912" || cep == "20031-905" || cep == "20050-060" || cep == "20031-901" || cep == "20031-924" || cep == "20051-040" || cep == "20031-901" || cep == "20003-191" || cep == "20241-110" || cep == "20050-030"){
//se for um dos ceps acima, incrementa 2.5 no valor final
taxa = 2.80;
}if(cep == "20010-020" || cep == "20011-020" || cep == "20011-030" || cep == "20011-040" || cep == "20011-901" || cep == "20020-000" || cep == "20010-170" || cep == "20011-000" || cep == "20021-260" || cep == "20021-350" || cep == "20031-040" || cep == "20031-050" || cep == "20031-130" || cep == "20031-204" || cep == "20021-245" || cep == "20040-002" || cep == "21335-253" || cep == "20040-031" || cep == "20030-041" || cep == "20040-000" || cep == "20004-002" || cep == "20040-003" || cep == "20040-007" || cep == "20011-010"){
//se for um dos ceps acima, incrementa 1.7 no valor final
taxa = 2.00;
}if(cep == "20010-090" || cep == "20020-100" || cep == "20021-130" || cep == "20021-315" || cep == "20030-001" || cep == "20031-000" || cep == "20031-003" || cep == "20031-010" || cep == "20031-050" || cep == "20031-141" || cep == "20031-143" || cep == "20031-005" || cep == "20031-001" || cep == "20020-903" || cep == "20031-144" || cep == "20030-080" || cep == "20031-142" || cep == "20031-120" || cep == "20031-007" || cep == "20010-009" || cep == "20031-913" || cep == "20021-370" || cep == "24220-280"){
//se for um dos ceps acima, incrementa 1.2 no valor final
taxa = 1.50;
}if(cep == "20020-010" || cep == "20020-040" || cep == "20020-080" || cep == "20021-060" || cep == "20021-120" || cep == "20021-900" || cep == "20021-903" || cep == "20030-002" || cep == "20030-015" || cep == "20030-013" || cep == "20030-020" || cep == "20030-021" || cep == "20030-060" || cep == "20030-070" || cep == "20030-120" || cep == "20002-080" || cep == "20003-021" || cep == "20030-905" || cep == "20030-015"){
//se for um dos ceps acima, incrementa 0.7 no valor final
taxa = 1.00;
}
total += taxa;
if(taxa != 0){
//caso a taxa seja diferente de 0, mostra ao usuário
document.getElementById("idTaxa").innerHTML = "Custo adicional: R$ " + taxa;
}
From now on I thank and MUCH the attention of all!!
Alessandro will be very difficult for anyone to look at all this code. You can try to isolate the piece that might be giving you trouble and better describe the problem itself?
– Sergio
Oi Sergio, the part of the zip code is this:
– Alessandro Ramos