Files
kami_merchant/static/js/index.js
danial d512ea17a9 feat(index): 添加昨日跑量数据展示
- 在 index.go 中增加昨日跑量相关数据的计算和存储
- 在 index.html 中添加昨日跑量数据的显示区域- 在 index.js 中更新数据加载逻辑,加载并显示昨日跑量数据
2025-06-23 22:58:13 +08:00

110 lines
5.4 KiB
JavaScript

let index = {
getAccountInfo: function () {
$.ajax({
type: "GET",
url: "/index/loadInfo/",
success: function (result) {
$("#balanceAmt").text(result["balanceAmt"]);
$("#settAmount").text(result["settAmount"]);
$("#freezeAmt").text(result["freezeAmt"]);
$("#amountFrozen").text(result["amountFrozen"])
$("#yesterdayAmount").text(result["yesterdayAmount"])
},
error: function (XMLHttpRequest) {
toastr.info('something is wrong, code: ' + XMLHttpRequest.status)
}
})
},
getOrdersInfo: function () {
$.ajax({
type: "GET",
url: "/index/loadOrders",
success: function (result) {
$("#orders").text(result["orders"]);
$("#suc_orders").text(result["suc_orders"]);
$("#suc_rate").text((result["suc_rate"] * 100).toFixed(2) + "%")
},
error: function (XMLHttpRequest) {
toastr.info('something is wrong, code: ' + XMLHttpRequest.status)
}
})
},
get_account_balance: function () {
$.ajax({
type: "GET",
url: "/withdraw/balance",
success: function (resp) {
$("#balance").val(resp.balance);
$("#sett_fee").html(resp.fee)
},
error: function (XMLHttpRequest) {
toastr.info('something is wrong, code: ' + XMLHttpRequest.status)
}
})
},
loadTradeRecord: function () {
$.ajax({
type: "GET",
url: "/index/load_count_order",
success: function (res) {
let con = "";
$.each(res, function (index, item) {
if (item.PayWayName === "") {
return true
}
con += `<div class="project"><div class="row bg-white has-shadow"><div class="left-col d-flex align-items-center justify-content-between"><small>` + (index + 1) + `</small></div><div class="left-col d-flex align-items-center justify-content-between"><small>` + item.PayWayName + `</small></div><div class="left-col d-flex align-items-center justify-content-between"><small>` + item.OrderCount + `</small></div><div class="left-col d-flex align-items-center justify-content-between"><small>` + item.SucOrderCount + `</small></div><div class="left-col d-flex align-items-center justify-content-between"><small>` + (item.SucRate * 100).toFixed(2) + `%</small></div></div></div>`
});
$("#your_showtime").html(con)
},
error: function (XMLHttpRequest) {
toastr.info('something is wrong, code: ' + XMLHttpRequest.status)
}
})
},
loadPayWay: function () {
$.ajax({
type: "GET",
url: "/index/pay_way",
success: function (res) {
let con = "";
$.each(res.ways, function (index, item) {
if (item.name === "") {
return true
}
con += `<div class="project">
<div class="row bg-white has-shadow">
<div class="left-col col-lg-1 d-flex align-items-center justify-content-between">
<small>` +
(index + 1) +
`</small></div><div class="left-col col-1 d-flex align-items-center justify-content-between"><small>` +
item.name +
`</small></div><div class="left-col col-1 d-flex align-items-center justify-content-between"><small>` +
item.rate +
`</small></div><div class="left-col col-1 d-flex align-items-center justify-content-between"><small>` +
item.todaySucAmount +
`</small></div><div class="left-col col-1 d-flex align-items-center justify-content-between"><small>` +
item.todaySucRate +
`</small></div><div class="left-col col-1 d-flex align-items-center justify-content-between"><small>` +
item.yesterdaySucAmount +
`</small></div><div class="left-col col-1 d-flex align-items-center justify-content-between"><small>` +
item.yesterdaySucRate +
`</small></div><div class="left-col col-1 d-flex align-items-center justify-content-between"><small>` +
item.totalSucAmount +
`</small></div><div class="left-col col-1 d-flex align-items-center justify-content-between"><small>` +
item.totalSucRate +
`%</small>
</div>
</div>
</div>`
});
$("#your_showtime").html(con)
const totalRow = `今日跑量:${res.totalSummary.todaySucAmount} 昨日跑量:${res.totalSummary.yesterdaySucAmount} 总跑量:${res.totalSummary.totalSucAmount},总成率:${res.totalSummary.totalSucRate}%`
$("#total_showtime_row").html(totalRow)
},
error: function (XMLHttpRequest) {
toastr.info('something is wrong, code: ' + XMLHttpRequest.status)
}
})
},
};