1
0
mirror of https://gitee.com/coder-xiaomo/flashsale synced 2025-09-10 22:11:39 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee

抢购3-promoItemPrice拼写错误就整;前端页面;修Bug

This commit is contained in:
2022-03-05 15:47:04 +08:00
parent e77065df5d
commit bad79611bf
7 changed files with 76 additions and 32 deletions

View File

@@ -11,6 +11,12 @@
<body class="login">
<div class="content">
<h3 class="form-title">商品详情</h3>
<div id="promoStartDateContainer" class="from-group">
<label style="color: blue;" id="promoStatus" class="control-label"></label>
<div>
<label style="color: red;" class="control-label" id="promoStartDate">
</div>
</div>
<div class="from-group">
<div>
<label class="control-label" id="title">
@@ -28,6 +34,12 @@
<label class="control-label" id="price">
</div>
</div>
<div id="promoPriceContainer" class="from-group">
<label class="control-label">秒杀价格</label>
<div>
<label style="color: red;" class="control-label" id="promoPrice">
</div>
</div>
<div class="from-group">
<img id="imgUrl" src="" style="width: 200px; height: auto;"/>
</div>
@@ -77,6 +89,7 @@
if (data.status == "success") {
g_itemVO = data.data;
reloadDom();
setInterval(reloadDom, 300);
} else {
alert("获取信息失败,原因为" + data.data.errMsg);
}
@@ -122,6 +135,28 @@
$("#price").text(g_itemVO.price);
$("#imgUrl").attr("src", g_itemVO.imgUrl);
$("#sales").text(g_itemVO.sales);
if (g_itemVO.promoStatus == 1) {
// 秒杀活动还未开始
var startTime = g_itemVO.startDate.replace(new RegExp("-", "gm"), "/");
startTime = new Date(startTime).getTime();
var nowTime = Date.parse(new Date());
var delta = (startTime - nowTime) / 1000;
if (delta < 1) {
// 活动开始了
g_itemVO.promoStatus = 2;
reloadDom();
}
$("#promoStartDate").text("秒杀活动将于 " + g_itemVO.startDate + " 开始" +
"倒计时:" + delta + "s");
$("#promoPrice").text(g_itemVO.promoPrice);
$("#createorder").attr("disabled", true);
} else if (g_itemVO.promoStatus == 2) {
$("#promoStartDate").text("秒杀正在进行中");
$("#promoPrice").text(g_itemVO.promoPrice);
$("#createorder").attr("disabled", false);
}
}
</script>
</body>