Files
kami_merchant/static/js/index.js

109 lines
5.3 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"])
},
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.todayAmount +
`</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.yesterdayAmount +
`</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.totalAmount +
`</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.todayAmount} 昨日跑量:${res.totalSummary.yesterdayAmount} 总跑量:${res.totalSummary.totalAmount},总成率:${res.totalSummary.totalSucRate}%`
$("#total_showtime_row").html(totalRow)
},
error: function (XMLHttpRequest) {
toastr.info('something is wrong, code: ' + XMLHttpRequest.status)
}
})
},
};