mirror of
https://gitee.com/coder-xiaomo/flashsale
synced 2025-09-11 14:31:40 +08:00
交易下单3-下单部分
This commit is contained in:
@@ -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() {
|
||||
|
Reference in New Issue
Block a user