function ajaxsubmit(url) { $("#myform").validform({ tiptype:function(msg,o,cssctl){ if(msg!="通过信息验证!"){ if(msg=="正在提交数据…"){ layer.load(); } else { if(isnan(msg)){ layer.msg(msg); } } } }, postonce:true, ajaxpost:true, callback:function(data){ layer.closeall(); if (data.status=="y") { if (data.ico==9){ location.href=url; } else { if(isnan(data.ico)){ var myarr=data.ico.split("|"); if(myarr[0]>2){ if(myarr[0]==3){location.href="../../pay/wxpay/api.asp?c=order&orderid="+myarr[1]+"&total="+myarr[2]+"";}; if(myarr[0]==4){location.href="../../pay/alipay/index.asp?c=order&orderid="+myarr[1]+"&total="+myarr[2]+"";}; } else { layer.open({icon: 1 , content: data.info , yes: function(index, layero){location.href=url;}}); } } else { layer.open({icon: data.ico , content: data.info , yes: function(index, layero){location.href=url;}}); } } } else { layer.open({icon: data.ico , content: data.info}); } } }); } //刷新验证码 function reloadcode() { $("#safecode").attr("src","../../inc/code.asp?" + math.random()); } //获取优惠券 function getcoupon (id,jf) { var dh_str=""; if(jf>0){ dh_str="这将花费您"+jf+"积分!" } layer.msg('确定要获取吗?'+dh_str, { time: 0 ,btn: ['确定', '取消'] ,yes: function(index){ layer.close(index); $.ajax({ type:"get", url:"mould/coupon/?a=get&id="+id, cache: false, datatype:"html", beforesend:function(xmlhttprequest){ layer.load(); }, error: function(request) { layer.closeall(); layer.msg("连接失败,请重试!"); }, success:function(date){ layer.closeall(); layer.msg(date); } }); } }); } //兑换商品 function dhjf(p0,p1,p2){ layer.msg('确定要兑换吗?', { time: 0 ,btn: ['确定', '取消'] ,yes: function(index){ layer.close(index); $.ajax({ type:"get", url:"mould/jifen/?a=dh&type="+p0+"&id="+p1+"&score="+p2, cache: false, datatype:"html", beforesend:function(xmlhttprequest){ layer.load(); }, error: function(request) { layer.closeall(); layer.msg("连接失败,请重试!"); }, success:function(date){ layer.closeall(); layer.msg(date); if(date=="兑换成功!"){location.reload();} } }); } }); } //规格id,当前规格序号,原价,本站价,库存-以下在商品展示页 function checkgg(p0,p1,p2,p3,p4) { $(".show_gg2").attr("class","show_gg1"); $("#gg"+p1).attr("class","show_gg2"); $("#m_gg").val(p0); $("#m_yprice").html(p2.tofixed(2)); $("#m_dzprice").html(p3.tofixed(2)); $("#m_stock").html(p4); } //购买数量 function delnum() { var c_num=parseint($("#m_num").html()); if(c_num>1){ $("#m_num").html(c_num-1) } } function addnum() { var c_num=parseint($("#m_num").html()); if(c_num0) { $("#b_cart").html(date); $("#b_cart").show(); } } }); } //立即购买 function buynow(p0,p1){ var m_gg=parseint($("#m_gg").val()); var m_num=parseint($("#m_num").html()); if(parseint($("#m_stock").html())=0){ var m_price=parsefloat($("#m_price").val()) var m_yhprice=parsefloat($("#m_yhprice").val()) $("#m_sendprice").val(p1); $("#m_total").val(m_price+p1-m_yhprice); $("#span_sendprice").html(p1.tofixed(2)); $("#span_total").html((m_price+p1-m_yhprice).tofixed(2)); } } //选择优惠券 function selectcoupon(id){ $.ajax({ type:"get", url:"../../mould/user/?c=usecoupon&id="+id, cache: false, datatype:"html", beforesend:function(xmlhttprequest){ layer.load(); }, error: function(request) { layer.closeall(); layer.msg("连接失败,请重试!"); }, success:function(date){ layer.closeall(); date=parsefloat(date); $("#m_yhprice").val(date); $("#span_yhprice").html(date.tofixed(2)); var m_price=parsefloat($("#m_price").val()); var m_sendprice=parsefloat($("#m_sendprice").val()); $("#m_total").val(m_price+m_sendprice-date); $("#span_total").html((m_price+m_sendprice-date).tofixed(2)); } }); }