Help with a form + php + javascript

0

I'm doing a system where the person chooses the "League" + "Mode" + amount of victories and then a field appears to appear the email (I already have) and the value (Where is the problem, I am not managing to resolve this)

The problem is between these lines:

if( ligas[lig_atu_val].valor == 1){
         var _valor = (divisao[div_atu_val] + ligas[lig_des_val].preco) * vitorias[num_vit_val];
      }else if(ligas[lig_atu_val].valor == 2 ){
         var _valor = (divisao[div_atu_val] + ligas[lig_des_val].preco) * vitorias[num_vit_val];

         for(var x = ligas[lig_atu_val].valor-1; x > vitorias[num_vit_val]; x--){
            if(x==1){y='bronze';};if(x==2){y='prata';}if(x==3){y='ouro';}if(x==4){y='platina';}
            _valor += 5*ligas[y].preco;
         }

         _valor += (5 - vitorias[num_vit_val]) * ligas[lig_des_val].preco;            
      }

      var valor_final = _valor.toFixed(2).replace('.',',');

      $("#_botao #_botao_email div").first().html("R$ "+valor_final);
      $("#_valortt").val(valor_final);

   }
});

Can anyone help me solve this? mp.

Full Code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<title>Documento sem t&iacute;tulo</title>
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no" />

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script></head><body><style>#_opcoes_main{font-size:0;display:block;width:100%;text-align:center;color:#444;}._opcoes_div{display:inline-block;margin:10px0;vertical-align:top;font-size:18px;width:calc(100%/3.5);min-width:300px;}._opcoes_divem{color:#2896c8;font-size:1.2em;font-weight:bold;}._opcoes_divp{font-size:.8em;font-weight:bold;margin:3px0;}._opcoes_divselect{border:1pxsolid#ddd;padding:10px15px;margin-bottom:10px;width:200px;font-size:.8em;}._opcoes_divimg{height:120px;margin:70px035px;}#_botao_valor{font-size:0;border:2pxsolid#000;margin-top:20px;display:inline-block;cursor:pointer;padding:0;filter:grayscale(100%);transition:all.2sease-in-out;}#_botao_valor:hover{filter:grayscale(0%);}#_botao_valordiv{font-size:18px;display:inline-block;}#_botao_valordiv:nth-child(1){font-weight:bold;background:#eff2f4;padding:12px;border-right:1pxsolid#000;}#_botao_valordiv:nth-child(2){font-weight:bold;background:green;padding:12px20px;color:#fff;}#_botaolabel{font-size:16px;}#_botaolabel#_email{font-size:18px;border:1pxsolid#bbb;padding:10px;margin:3px020px;width:270px;}</style><divid="_opcoes_main">
   <form action="elos2.php" id="_form" onsubmit="return valEmail()" method="post">
      <input type="hidden" id="_valortt" name="_valortt" />
      <div class="_opcoes_div">
         <em>1.</em> <strong>Selecione a Liga e Divisão atual</strong>
         <br />
         <img id="img_ligatual" src="img_bronze.jpeg" />
         <br />
         <p>Liga</p>
         <select name="lig_atu" id="lig_atu">
            <option value="bronze">Bronze</option>
            <option value="prata">Prata</option>
            <option value="ouro">Ouro</option>
            <option value="platina">Platina</option>
            <option value="diamante">Diamante</option>
         </select>
         <br />
         <p>Divisão</p>
         <select name="div_atu" id="div_atu">
            <option value="v">V</option>
            <option value="iv">IV</option>
            <option value="iii">III</option>
            <option value="ii">II</option>
            <option value="i">I</option>
         </select>
      </div>
      <div class="_opcoes_div">
         <em>2.</em> <strong>Selecione a Fila desejada</strong>
         <br />
         <img src="img_bronze.jpeg" />
         <br />
         <p>Fila</p>
         <select name="_fila" id="_fila">
            <option value="solo/duo">Solo/Duo</option>
            <option value="flex">Flex</option>
         </select>
      </div>
      <div class="_opcoes_div">
         <em>3.</em><strong>Selecione a Quantidade de Vitórias que quer comprar</strong>
         <br />
         <img src="img_bronze.jpeg" />
         <br />
         <select name="num_vit" id="num_vit">
            <option value="3">3</option>
            <option value="4">4</option>
            <option value="5">5</option>
            <option value="6">6</option>
            <option value="7">7</option>
            <option value="8">8</option>
            <option value="9">9</option>
            <option value="10">10</option>
         </select>
      </div>
      <br clear="all" />
      <div id="_botao">
         <div id="_botao_email" style="display: none;">
            <label>
               <strong>E-mail</strong>
               <br />
               <input onkeyup="$('#_botao #_botao_email label strong').html('E-mail').css('color','#444')" required="required" id="_email" name="_email" type="email" placeholder="Insira seu e-mail" />
            </label>
            <br />
            <button type="submit" id="_botao_valor">
               <div>
                  R$ 0,00
               </div>
               <div>
                  ADQUIRIR
               </div>
            </button>
         </div>
      </div>
   </form>
</div>

<script>
   var ligas = {
   bronze: { valor: 1, preco: 3.00 },
   prata: { valor : 2, preco: 4.00 },
   ouro: { valor : 3, preco: 6.00 },
   platina: { valor : 4, preco: 8.00 },
   diamante: { valor : 5, preco: 18.00 }
}

var divisao = {
   i: 1,
   ii: 2,
   iii: 3,
   iv: 4,
   v: 5
}
var vitorias = ["3", "4", "5", "6", "7", "8", "9", "10"];

$("form#_form select").not("#_fila").on("change", function(e){

   var _mostra_btn = false;

   var lig_atu_val = $("#lig_atu").val();
   var div_atu_val = $("#div_atu").val();
   var num_vit_val = $("#num_vit").val();

   
if(e.target.id.match(/_atu/)){
      $("#img_ligatual").attr("src","img_"+lig_atu_val+".jpeg");
   }
   
   if(ligas[lig_atu_val].valor){
         _mostra_btn = true;
      }
   
   if(_mostra_btn){
      $("#_botao_email").show();
      
      if( ligas[lig_atu_val].valor == 1){
         var _valor = (divisao[div_atu_val] + ligas[lig_des_val].preco) * vitorias[num_vit_val];
      }else if(ligas[lig_atu_val].valor == 2 ){
         var _valor = (divisao[div_atu_val] + ligas[lig_des_val].preco) * vitorias[num_vit_val];
         
         for(var x = ligas[lig_atu_val].valor-1; x > vitorias[num_vit_val]; x--){
            if(x==1){y='bronze';};if(x==2){y='prata';}if(x==3){y='ouro';}if(x==4){y='platina';}
            _valor += 5*ligas[y].preco;
         }

         _valor += (5 - vitorias[num_vit_val]) * ligas[lig_des_val].preco;            
      }

      var valor_final = _valor.toFixed(2).replace('.',',');
      
      $("#_botao #_botao_email div").first().html("R$ "+valor_final);
      $("#_valortt").val(valor_final);
      
   }
});
   
   function valEmail(){
   if( !checkMail($("#_email").val().replace(/\s/g,'')) ){
      $('#_botao #_botao_email label strong').html('E-mail inválido!').css('color','#f30');
      return false;
   }
}

function checkMail(email) {
   invalidChars = " ~\'^\'\"*+=\|][(){}$&!%/:,;ç";
   
   if(email==""){return false;}
   
   for (i=0; i<invalidChars.length; i++) {
      badChar = invalidChars.charAt(i);
      if (email.indexOf(badChar,0) > -1) {
         return false;
      }
   }
   
   lengthOfEmail = email.length;
   if ((email.charAt(lengthOfEmail - 1) == ".") || (email.charAt(lengthOfEmail - 2) == ".")) {
      return false;
   }
   
   Pos = email.indexOf("@",1);
   if (email.charAt(Pos + 1) == ".") {
      return false;
   }
   
   while ((Pos < lengthOfEmail) && ( Pos != -1)) {
      Pos = email.indexOf(".",Pos);
      if (email.charAt(Pos + 1) == ".") {
         return false;
      }
      if (Pos != -1) {
         Pos++;
      }
   }
   
   atPos = email.indexOf("@",1);
   if (atPos == -1) {
      return false;
   }
   
   if (email.indexOf("@",atPos+1) != -1) {
      return false;
   }
   
   periodPos = email.indexOf(".",atPos);
   if (periodPos == -1) {
      return false;
   }
   
   if (periodPos+3 > email.length) {
      return false;
   }
   return true;
}
   </script>

   </body>
</html>

One photo:

As you can see, the value does not appear.

    
asked by anonymous 06.01.2018 / 22:37

2 answers

1

If you want to multiply the value of the related price in the "Align" option by the "Quantity of Wins" option, you would have to get the value of a select and multiply by the other.

First of all, the content of this if( ligas[lig_atu_val].valor == 1){ seems to me invalid. There is much calculation for a simple thing, which is to multiply one value by another. It has a lig_des_val variable that does not exist too (!).

Another thing I noticed is that the button with the value is hidden with style="display: none;" and that it would only be shown when an option was chosen ( var _mostra_btn = false; ). I do not think this is necessary because you can already calculate the direct value in the page load based on the initial% value of% of the last 3 . So it does not make sense to also start the hidden button.

I had to rewrite the code to do the calculation and play on the button (mostly delete the aforementioned select which was not making sense). I also had to put a if with trigger to call the function document.ready of onchange select .

  

I also noticed that the $("form#_form select") object has no function in the   code. If you do not use it elsewhere, you can also delete it.

See it working:

var ligas = {
   bronze: { valor: 1, preco: 3.00 },
   prata: { valor : 2, preco: 4.00 },
   ouro: { valor : 3, preco: 6.00 },
   platina: { valor : 4, preco: 8.00 },
   diamante: { valor : 5, preco: 18.00 }
}

var divisao = {
   i: 1,
   ii: 2,
   iii: 3,
   iv: 4,
   v: 5
}

$(document).ready(function(){
   $("form#_form select").change();
});

$("#_fila").on("change", function(){
   $("#img_flex").attr("src","img_"+$(this).val().replace("/","")+".jpeg");
});

$("form#_form select").on("change", function(e){
   
   var _mostra_btn = true;

   var lig_atu_val = $("#lig_atu").val();
   var div_atu_val = $("#div_atu").val();
   var num_vit_val = $("#num_vit").val();

   if(e.target.id.match(/_atu/)){
      $("#img_ligatual").attr("src","img_"+lig_atu_val+".jpeg");
   }

   $("#_errmsg").hide();
   $("#_botao_email").show();
   
   _valor = ligas[lig_atu_val].preco*num_vit_val;

   var valor_final = _valor.toFixed(2).replace('.',',');
   
   $("#_botao #_botao_email div").first().html("R$ "+valor_final);
   $("#_valortt").val(valor_final);
      
});

function valEmail(){
   if( !checkMail($("#_email").val().replace(/\s/g,'')) ){
      $('#_botao #_botao_email label strong').html('E-mail inválido!').css('color','#f30');
      return false;
   }
   
   $("#_modal").show();
}

function checkMail(email) {
	invalidChars = " ~\'^\'\"*+=\|][(){}$&!%/:,;ç";
	
	if(email==""){return false;}
	
	for (i=0; i<invalidChars.length; i++) {
		badChar = invalidChars.charAt(i);
		if (email.indexOf(badChar,0) > -1) {
			return false;
		}
	}
	
	lengthOfEmail = email.length;
	if ((email.charAt(lengthOfEmail - 1) == ".") || (email.charAt(lengthOfEmail - 2) == ".")) {
		return false;
	}
	
	Pos = email.indexOf("@",1);
	if (email.charAt(Pos + 1) == ".") {
		return false;
	}
	
	while ((Pos < lengthOfEmail) && ( Pos != -1)) {
		Pos = email.indexOf(".",Pos);
		if (email.charAt(Pos + 1) == ".") {
			return false;
		}
		if (Pos != -1) {
			Pos++;
		}
	}
	
	atPos = email.indexOf("@",1);
	if (atPos == -1) {
		return false;
	}
	
	if (email.indexOf("@",atPos+1) != -1) {
		return false;
	}
	
	periodPos = email.indexOf(".",atPos);
	if (periodPos == -1) {
		return false;
	}
	
	if (periodPos+3 > email.length) {
		return false;
	}
	return true;
}
#_opcoes_main{
   font-size: 0;
   display: block;
   width: 100%;
   text-align: center;
   color: #444;
}

._opcoes_div{
   display: inline-block;
   margin: 10px 0;
   vertical-align: top;
   font-size: 18px;
   width: calc(100% / 3.5);
   min-width: 300px;
}

._opcoes_div em{
   color: #2896c8;
   font-size: 1.2em;
   font-weight: bold;
}

._opcoes_div p{
   font-size: .8em;
   font-weight: bold;
   margin: 3px 0;
}

._opcoes_div select{
   border: 1px solid #ddd;
   padding: 10px 15px;
   margin-bottom: 10px;
   width: 200px;
   font-size: .8em;
}

._opcoes_div img{
   height: 120px;
   margin: 70px 0 35px;
}

#_botao_valor{
   font-size: 0;
   border: 2px solid #000;
   margin-top: 20px;
   display: inline-block;
   cursor: pointer;
   padding: 0;
   filter: grayscale(100%);
   transition: all .2s ease-in-out;
}

#_botao_valor:hover{
   filter: grayscale(0%);
}

#_botao_valor div{
   font-size: 18px;
   display: inline-block;
}

#_botao_valor div:nth-child(1){
   font-weight: bold;
   background: #eff2f4;
   padding: 12px;
   border-right: 1px solid #000;
}

#_botao_valor div:nth-child(2){
   font-weight: bold;
   background: green;
   padding: 12px 20px;
   color: #fff;
}

#_botao label{
   font-size: 16px;
}

#_botao label #_email{
   font-size: 18px;
   border: 1px solid #bbb;
   padding: 10px;
   margin: 3px 0 20px;
   width: 270px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><divid="_opcoes_main">
   <form action="elos2.php" id="_form" onsubmit="return valEmail()" method="post">
      <input type="hidden" id="_valortt" name="_valortt" />
      <div class="_opcoes_div">
         <em>1.</em> <strong>Selecione a Liga e Divisão atual</strong>
         <br />
         <img id="img_ligatual" src="img_bronze.jpeg" />
         <br />
         <p>Liga</p>
         <select name="lig_atu" id="lig_atu">
            <option value="bronze">Bronze</option>
            <option value="prata">Prata</option>
            <option value="ouro">Ouro</option>
            <option value="platina">Platina</option>
            <option value="diamante">Diamante</option>
         </select>
         <br />
         <p>Divisão</p>
         <select name="div_atu" id="div_atu">
            <option value="v">V</option>
            <option value="iv">IV</option>
            <option value="iii">III</option>
            <option value="ii">II</option>
            <option value="i">I</option>
         </select>
      </div>
      <div class="_opcoes_div">
         <em>2.</em> <strong>Selecione a Fila desejada</strong>
         <br />
         <img src="img_bronze.jpeg" />
         <br />
         <p>Fila</p>
         <select name="_fila" id="_fila">
            <option value="solo/duo">Solo/Duo</option>
            <option value="flex">Flex</option>
         </select>
      </div>
      <div class="_opcoes_div">
         <em>3.</em><strong>Selecione a Quantidade de Vitórias que quer comprar</strong>
         <br />
         <img src="img_bronze.jpeg" />
         <br />
         <select name="num_vit" id="num_vit">
            <option value="3">3</option>
            <option value="4">4</option>
            <option value="5">5</option>
            <option value="6">6</option>
            <option value="7">7</option>
            <option value="8">8</option>
            <option value="9">9</option>
            <option value="10">10</option>
         </select>
      </div>
      <br clear="all" />
      <div id="_botao">
         <div id="_botao_email">
            <label>
               <strong>E-mail</strong>
               <br />
               <input onkeyup="$('#_botao #_botao_email label strong').html('E-mail').css('color','#444')" required="required" id="_email" name="_email" type="email" placeholder="Insira seu e-mail" />
            </label>
            <br />
            <button type="submit" id="_botao_valor">
               <div>
                  R$ 0,00
               </div>
               <div>
                  ADQUIRIR
               </div>
            </button>
         </div>
      </div>
   </form>
</div>
    
07.01.2018 / 00:01
1

Case A - with select in number of wins

var ligas = {
   bronze: { valor: 1, preco: 3.00 },
   prata: { valor : 2, preco: 4.00 },
   ouro: { valor : 3, preco: 6.00 },
   platina: { valor : 4, preco: 8.00 },
   diamante: { valor : 5, preco: 18.00 }
}

var divisao = {
   i: 1,
   ii: 2,
   iii: 3,
   iv: 4,
   v: 5
}
//desnecessário    
//var vitorias = ["3", "4", "5", "6", "7", "8", "9", "10"];

$("form#_form select").not("#_fila").on("change", function(e){

   var _mostra_btn = false;

   var lig_atu_val = $("#lig_atu").val();
   var div_atu_val = $("#div_atu").val();
   var num_vit_val = $("#num_vit").val();

   if(e.target.id.match(/_atu/)){
      $("#img_ligatual").attr("src","img_"+lig_atu_val+".jpeg");
   }
   
   if(ligas[lig_atu_val].valor){
         _mostra_btn = true;
   }
   
   if(_mostra_btn){
      $("#_botao_email").show();
      
      /*
        aqui não há necessidade de um if else if já que as duas condições
        retornam o mesmo valor da variável _valor.
        Basta uma comparação para valores diferentes de 1 ( >=2 )
      */
      var _valor = (divisao[div_atu_val] + ligas[lig_atu_val].preco) * [num_vit_val];
  
       if(ligas[lig_atu_val].valor >= 2 ){
          /*
          Não está suficientemente claro a intenção deste loop for.
          Este loop for só funciona para diamante e quantidade de vitorias=3,
          portanto o propósito dele é duvidoso.
          Se não me engano, falta a condição para diamante
          */
        for(var x = ligas[lig_atu_val].valor-1; x > num_vit_val; x--){
          if(x==1){y='bronze'};
          if(x==2){y='prata'};
          if(x==3){y='ouro'};
          if(x==4){y='platina'};
          _valor += 5*ligas[y].preco;
        }

          _valor += (5 - [num_vit_val]) * ligas[lig_atu_val].preco;            
      }

       var valor_final = _valor.toFixed(2).replace('.',',');
  
       $("#_botao #_botao_email div").first().html("R$ "+valor_final);
       $("#_valortt").val(valor_final);
  
    }
});

/*  
function valEmail(){
   .............
   .............
}
*/
#_opcoes_main{
   font-size: 0;
   display: block;
   width: 100%;
   text-align: center;
   color: #444;
}

._opcoes_div{
   display: inline-block;
   margin: 10px 0;
   vertical-align: top;
   font-size: 18px;
   width: calc(100% / 3.5);
   min-width: 300px;
}

._opcoes_div em{
   color: #2896c8;
   font-size: 1.2em;
   font-weight: bold;
}

._opcoes_div p{
   font-size: .8em;
   font-weight: bold;
   margin: 3px 0;
}

._opcoes_div select{
   border: 1px solid #ddd;
   padding: 10px 15px;
   margin-bottom: 10px;
   width: 200px;
   font-size: .8em;
}

._opcoes_div img{
   height: 120px;
   margin: 70px 0 35px;
}

#_botao_valor{
   font-size: 0;
   border: 2px solid #000;
   margin-top: 20px;
   display: inline-block;
   cursor: pointer;
   padding: 0;
   filter: grayscale(100%);
   transition: all .2s ease-in-out;
}

#_botao_valor:hover{
   filter: grayscale(0%);
}

#_botao_valor div{
   font-size: 18px;
   display: inline-block;
}

#_botao_valor div:nth-child(1){
   font-weight: bold;
   background: #eff2f4;
   padding: 12px;
   border-right: 1px solid #000;
}

#_botao_valor div:nth-child(2){
   font-weight: bold;
   background: green;
   padding: 12px 20px;
   color: #fff;
}

#_botao label{
   font-size: 16px;
}

#_botao label #_email{
   font-size: 18px;
   border: 1px solid #bbb;
   padding: 10px;
   margin: 3px 0 20px;
   width: 270px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><divid="_opcoes_main">
   <form action="elos2.php" id="_form" onsubmit="return valEmail()" method="post">
      <input type="hidden" id="_valortt" name="_valortt" />
      <div class="_opcoes_div">
         <em>1.</em> <strong>Selecione a Liga e Divisão atual</strong>
         <br />
         <img id="img_ligatual" src="img_bronze.jpeg" />
         <br />
         <p>Liga</p>
         <select name="lig_atu" id="lig_atu">
            <option value="bronze">Bronze</option>
            <option value="prata">Prata</option>
            <option value="ouro">Ouro</option>
            <option value="platina">Platina</option>
            <option value="diamante">Diamante</option>
         </select>
         <br />
         <p>Divisão</p>
         <select name="div_atu" id="div_atu">
            <option value="v">V</option>
            <option value="iv">IV</option>
            <option value="iii">III</option>
            <option value="ii">II</option>
            <option value="i">I</option>
         </select>
      </div>
      <div class="_opcoes_div">
         <em>2.</em> <strong>Selecione a Fila desejada</strong>
         <br />
         <img src="img_bronze.jpeg" />
         <br />
         <p>Fila</p>
         <select name="_fila" id="_fila">
            <option value="solo/duo">Solo/Duo</option>
            <option value="flex">Flex</option>
         </select>
      </div>
      <div class="_opcoes_div">
         <em>3.</em><strong>Selecione a Quantidade de Vitórias que quer comprar</strong>
         <br />
         <img src="img_bronze.jpeg" />
         <br />
         <select name="num_vit" id="num_vit">
            <option value="3">3</option>
            <option value="4">4</option>
            <option value="5">5</option>
            <option value="6">6</option>
            <option value="7">7</option>
            <option value="8">8</option>
            <option value="9">9</option>
            <option value="10">10</option>
         </select>
      </div>
      <br clear="all" />
      <div id="_botao">
         <div id="_botao_email" style="display: none;">
            <label>
               <strong>E-mail</strong>
               <br />
               <input onkeyup="$('#_botao #_botao_email label strong').html('E-mail').css('color','#444')" required="required" id="_email" name="_email" type="email" placeholder="Insira seu e-mail" />
            </label>
            <br />
            <button type="submit" id="_botao_valor">
               <div>
                  R$ 0,00
               </div>
               <div>
                  ADQUIRIR
               </div>
            </button>
         </div>
      </div>
   </form>
</div>
  

var vitorias disregarded.   Instead of lig_des_val that is not defined I used lig_atu_val

Case B - as requested in comment

To change this win quantity form to a scroll bar - you can use an input type range

 var ligas = {
   bronze: { valor: 1, preco: 3.00 },
   prata: { valor : 2, preco: 4.00 },
   ouro: { valor : 3, preco: 6.00 },
   platina: { valor : 4, preco: 8.00 },
   diamante: { valor : 5, preco: 18.00 }
}

var divisao = {
   i: 1,
   ii: 2,
   iii: 3,
   iv: 4,
   v: 5
}
//var vitorias = ["3", "4", "5", "6", "7", "8", "9", "10"];

//Linha modificada em relação ao exemplo com select (caso A)
$("#_form, #quant").not("#_fila").on("change", function(e){

   var _mostra_btn = false;
   var lig_atu_val = $("#lig_atu").val();
   var div_atu_val = $("#div_atu").val();

    //Linha modificada em relação ao exemplo com select (caso A)
    //Retorno do value do input type range
    var num_vit_val = $("#quant").val();
    //valor mostrado no input de id = num_vit
    $('#num_vit').val(num_vit_val);
   
	if(e.target.id.match(/_atu/)){
      $("#img_ligatual").attr("src","img_"+lig_atu_val+".jpeg");
    }
   
   if(ligas[lig_atu_val].valor){
         _mostra_btn = true;
      }
   
   if(_mostra_btn){
      $("#_botao_email").show();
      
      var _valor = (divisao[div_atu_val] + ligas[lig_atu_val].preco) * [num_vit_val];
      
           if(ligas[lig_atu_val].valor >= 2 ){
             /*
              Não está suficientemente claro a intenção deste loop for.
              Este loop for só funcionaria para diamante e quantidade de vitorias=3,
              portanto o propósito dele é duvidoso e foi comentado.
              Se não me engano, falta a condição para diamante
              
              for(var x = ligas[lig_atu_val].valor-1; x > num_vit_val; x--){
                if(x==1){y='bronze'};
                if(x==2){y='prata'};
                if(x==3){y='ouro'};
                if(x==4){y='platina'};
                _valor += 5*ligas[y].preco;
              }
            */

           _valor += (5 - [num_vit_val]) * ligas[lig_atu_val].preco;            
          }

      var valor_final = _valor.toFixed(2).replace('.',',');
      
      $("#_botao #_botao_email div").first().html("R$ "+valor_final);
      $("#_valortt").val(valor_final);
      
   }
});
   
   /*  
   function valEmail(){
      .............
      .............
   }
   */
#_opcoes_main{
   font-size: 0;
   display: block;
   width: 100%;
   text-align: center;
   color: #444;
}

._opcoes_div{
   display: inline-block;
   margin: 10px 0;
   vertical-align: top;
   font-size: 18px;
   width: calc(100% / 3.5);
   min-width: 300px;
}

._opcoes_div em{
   color: #2896c8;
   font-size: 1.2em;
   font-weight: bold;
}

._opcoes_div p{
   font-size: .8em;
   font-weight: bold;
   margin: 3px 0;
}

._opcoes_div select{
   border: 1px solid #ddd;
   padding: 10px 15px;
   margin-bottom: 10px;
   width: 200px;
   font-size: .8em;
}

._opcoes_div img{
   height: 120px;
   margin: 70px 0 35px;
}

#_botao_valor{
   font-size: 0;
   border: 2px solid #000;
   margin-top: 20px;
   display: inline-block;
   cursor: pointer;
   padding: 0;
   filter: grayscale(100%);
   transition: all .2s ease-in-out;
}

#_botao_valor:hover{
   filter: grayscale(0%);
}

#_botao_valor div{
   font-size: 18px;
   display: inline-block;
}

#_botao_valor div:nth-child(1){
   font-weight: bold;
   background: #eff2f4;
   padding: 12px;
   border-right: 1px solid #000;
}

#_botao_valor div:nth-child(2){
   font-weight: bold;
   background: green;
   padding: 12px 20px;
   color: #fff;
}

#_botao label{
   font-size: 16px;
}

#_botao label #_email{
   font-size: 18px;
   border: 1px solid #bbb;
   padding: 10px;
   margin: 3px 0 20px;
   width: 270px;
}

.vertical {
  margin-top: 50px;
   transform: rotate(270deg);
  -moz-transform: rotate(270deg); /*do same for other browsers if required*/
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><palign="right">Melhor visualizado clicando em pagina toda no canto superior direito
<font face="Times New Roman">&#8593;</font></p>


<div id="_opcoes_main">
   <form action="elos2.php" id="_form" onsubmit="return valEmail()" method="post">
      <input type="hidden" id="_valortt" name="_valortt" />
      <div class="_opcoes_div">
         <em>1.</em> <strong>Selecione a Liga e Divisão atual</strong>
         <br />
         <img id="img_ligatual" src="img_bronze.jpeg" />
         <br />
         <p>Liga</p>
         <select name="lig_atu" id="lig_atu">
            <option value="bronze">Bronze</option>
            <option value="prata">Prata</option>
            <option value="ouro">Ouro</option>
            <option value="platina">Platina</option>
            <option value="diamante">Diamante</option>
         </select>
         <br />
         <p>Divisão</p>
         <select name="div_atu" id="div_atu">
            <option value="v">V</option>
            <option value="iv">IV</option>
            <option value="iii">III</option>
            <option value="ii">II</option>
            <option value="i">I</option>
         </select>
      </div>
      <div class="_opcoes_div">
         <em>2.</em> <strong>Selecione a Fila desejada</strong>
         <br />
         <img src="img_bronze.jpeg" />
         <br />
         <p>Fila</p>
         <select name="_fila" id="_fila">
            <option value="solo/duo">Solo/Duo</option>
            <option value="flex">Flex</option>
         </select>
      </div>
      <div class="_opcoes_div">
         <em>3.</em><strong>Selecione a Quantidade de Vitórias que quer comprar</strong>
         <br />
         <img src="img_bronze.jpeg" />
         <br />

		<input class="vertical" id="quant" type="range" min="3" max="10" value="3" />
		<input id="num_vit" value="3" size="1" readonly />

      </div>
      <br clear="all" />
      <div id="_botao">
         <div id="_botao_email" style="display: none;">
            <label>
               <strong>E-mail</strong>
               <br />
               <input onkeyup="$('#_botao #_botao_email label strong').html('E-mail').css('color','#444')" required="required" id="_email" name="_email" type="email" placeholder="Insira seu e-mail" />
            </label>
            <br />
            <button type="submit" id="_botao_valor">
               <div>
                  R$ 0,00
               </div>
               <div>
                  ADQUIRIR
               </div>
            </button>
         </div>
      </div>
   </form>
</div>
  

To be vertical, a css class was used in the input type range

.vertical {
   margin-top: 50px;
   transform: rotate(270deg);
   -moz-transform: rotate(270deg);
 }
    
08.01.2018 / 00:11