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

交易下单3-下单部分

This commit is contained in:
2022-03-03 23:37:17 +08:00
parent e3917d1ff1
commit 49d3380c40
6 changed files with 109 additions and 8 deletions

View File

@@ -29,7 +29,7 @@
</div>
</div>
<div class="from-group">
<img id="imgUrl" src="" style="width: 200px; height: auto;"/>
<img id="imgUrl" src="" style="width: 200px; height: auto;"/>
</div>
<div class="from-group">
<label class="control-label">库存</label>
@@ -43,7 +43,10 @@
<label class="control-label" id="sales">
</div>
</div>
<div>
<div class="form-actions">
<button class="btn blue" id="createorder" type="submit">
下单
</button>
<a href="listitem.html">返回</a>
</div>
</div>
@@ -82,6 +85,29 @@
alert("获取信息失败,原因为" + data.responseText);
}
})
// 下单
$("#createorder").on("click", function () {
$.ajax({
type: "POST",
url: "http://localhost:8090/order/createorder",
data: {
"itemId": g_itemVO.id,
"amount": 1, // 暂时写死买1件
},
xhrFields: {withCredentials: true},
success: function (data) {
if (data.status == "success") {
// TODO
} else {
alert("下单失败,原因为" + data.data.errMsg);
}
},
error: function (data) {
alert("下单失败,原因为" + data.responseText);
}
})
});
})
function reloadDom() {