Files
tlmall-v5-single/doc/htmljss/secKillPay.nohtml

64 lines
2.0 KiB
Plaintext
Raw Normal View History

2022-11-01 12:14:54 +08:00
<!DOCTYPE html>
<!-- saved from url=(0040)http://localhost:8081/#/secKillDetail/26 -->
<html lang="en">
<head>
<title>秒杀支付</title>
</head>
<body>
<noscript>
<strong>We're sorry but mall doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript>
<div>
<div id="payImage" hidden="true">
<h2>请扫码支付,以下为模拟演示图片</h2>
<img src="ewm.jpg" alt="">
</div>
<div id="showProgress">
<h2>请稍候,订单正在生成....</h2>
</div>
</div>
<script type="text/javascript" src="jquery-1.9.1.min.js"></script>
<script type="text/javascript">
var lProductId=localStorage.getItem("productId");
var lFlashPromotionId=localStorage.getItem("memberId");
var lMemberId=localStorage.getItem("flashPromotionId");
var orderId=localStorage.getItem("orderId");
var timer;
var checkCount = 0;
function checkOrder(){
if(checkCount == 10){
alert("检查秒杀订单生成情况已达最大次数,请稍后再试!");
clearInterval(timer);
return;
}
$.ajax({
type: "post",
headers:{"memberId": lMemberId},//设置请求头
url:"/seckillOrder/checkOrder?" + "orderId="+orderId,
success:function(commonresult){
if(commonresult.code==200){
console.log("秒杀订单已生成!");
$("payImage").attr("hidden",false);
$("showProgress").attr("hidden",true);
}else if(commonresult.code==202){
console.log("秒杀订单还未生成,继续检查!");
checkCount++;
}else{
alert("检查秒杀订单生成情况失败!");
}
},
error:function(data){
alert("检查秒杀订单生成情况异常!");
}
});
}
timer = setInterval(checkOrder,5000);
</script>
</body>
</html>