<table border="1">
<tr>
<th>订单ID</th>
<th>用户ID</th>
<th>订单编号</th>
<th>订单价格</th>
<th>是否付款</th>
<th>发票抬头</th>
<th>创建时间</th>
<th>更新时间</th>
</tr>
</table>
<script src="./jquery-1.12.4.js"></script>
const baseUrl = 'http://timemeetyou.com:8889/api/private/v1/';
getOrderList();
function getOrderList() {
$.ajax({
url: `${baseUrl}orders`,
method: 'get',
data: {
pagenum: 1,
pagesize: 10,
},
headers: {
Authorization: window.localStorage.getItem('token')
},
success: function (res) {
res.data.goods.forEach(function (item) {
$('table').append(`
<tr>
<td>${item.order_id}</td>
<td>${item.user_id}</td>
<td>${item.order_number}</td>
<td>${item.order_price}</td>
<td>${item.order_pay}</td>
<td>${item.order_fapiao_title}</td>
<td>${rq(item.create_time)}</td>
<td>${rq(item.update_time)}</td>
</tr>
`)
});
}
})
}
function rq(hm) {
let d = new Date(hm);
let rqStr = d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate();
return rqStr
}