主页:写程序的小王叔叔的博客欢迎来访👀
支持:点赞收藏关注
$.ajax({ type:"POST", url:"${ctx}/wx/getRechargeList?storeId="+$("#storeId").val(), dataType:"json", timeout : 5000, async : true,//同步success:function (data,i){ if(data.rechargeRankList!=null&&data.rechargeRankList.length>0){ varrightClass="pull-right recharge_nub bgfff"; varleftClass="pull-left recharge_nub bgfff"; varhtml=""; for(vari=0; i<data.rechargeRankList.length; i++ ){ varrankList=data.rechargeRankList[i]; if(parseInt(i)%2==0){ html=html+"<li id=\""+rankList.id+"\" value=\""+rankList.rechareAmount+"\" class=\""+leftClass+"\">"+"¥"+rankList.rechareAmount+"</li>" }else{ html=html+"<li id=\""+rankList.id+"\" value=\""+rankList.rechareAmount+"\" class=\""+rightClass+"\">"+"¥"+rankList.rechareAmount+"</li>" } html=html+"<input type='hidden' name='giveAmount' value='"+rankList.fixedAmount+"'>"; html=html+"<input type='hidden' name='givePoints' value='"+rankList.givePoints+"'>"; } $("#ulRecharge").append(html); $("#ulRecharge").find("li").click(function() { $("#rechargeAccount").html($(this).val());//充值的金额$("#consumeDiscount").html($(this).val());//充值满的额度$("#fixedAmount").html(parseFloat( $(this).next().val() ).toFixed(0));//充值满返还的额度$("#givePoints").html(parseFloat( $(this).next().next().val() ).toFixed(0));//充值满返还的积分/*会员充值样式*/$(this).css({ "border-color":"#4DAC4A", "color":"#4DAC4A", }).siblings().css({ "border-color":"#e7e7e7", "color":"#999", }); //实际充值金额 vardiscount=parseFloat( $("#consumeDiscount").text() ); varamount=parseFloat( $("#fixedAmount").text() ); $("#amount").html("¥"+((discount-amount).toFixed(2))); }); } }, error:function(XMLHttpRequest){ alert(XMLHttpRequest.status); } });