更新配置文件,调整前端展示数据,优化 JS 代码结构,提升代码可读性和维护性。
This commit is contained in:
@@ -29,6 +29,7 @@ func (c *Index) ShowUI() {
|
||||
// LoadUserAccountInfo 加载用户账户金额信息
|
||||
func (c *Index) LoadUserAccountInfo() {
|
||||
us := c.GetSession(enum.UserSession)
|
||||
ctx := c.Ctx.Request.Context()
|
||||
u := us.(merchant2.MerchantInfo)
|
||||
|
||||
ac := account.GetAccountByUid(u.MerchantUid)
|
||||
@@ -36,12 +37,53 @@ func (c *Index) LoadUserAccountInfo() {
|
||||
info := make(map[string]any)
|
||||
// 账户余额
|
||||
info["balanceAmt"] = pubMethod.FormatFloat64ToString(ac.Balance)
|
||||
// // 可用余额
|
||||
// info["settAmount"] = pubMethod.FormatFloat64ToString(ac.WaitAmount)
|
||||
// // 冻结金额
|
||||
// info["freezeAmt"] = pubMethod.FormatFloat64ToString(ac.FreezeAmount)
|
||||
// // 押款金额
|
||||
// info["amountFrozen"] = pubMethod.FormatFloat64ToString(ac.LoanAmount)
|
||||
|
||||
type TotalSummary struct {
|
||||
TodayAmount float64 `json:"todayAmount"` // 今日订单金额
|
||||
TodayNum int `json:"todayNum"` // 今日订单数
|
||||
TodaySucNum int `json:"todaySucNum"` // 今日成功订单数
|
||||
TodaySucAmount float64 `json:"todaySucAmount"` // 今日成功订单金额
|
||||
YesterdayAmount float64 `json:"yesterdayAmount"` // 昨日订单金额
|
||||
YesterdayNum int `json:"yesterdayNum"` // 昨日订单数
|
||||
YesterdaySucNum int `json:"yesterdaySucNum"` // 昨日成功订单数
|
||||
YesterdaySucAmount float64 `json:"yesterdaySucAmount"` // 昨日成功订单金额
|
||||
TodaySucRate float64 `json:"todaySucRate"` // 今日成功率
|
||||
YesterdaySucRate float64 `json:"yesterdaySucRate"` // 昨日成功率
|
||||
TotalAmount float64 `json:"totalAmount"` // 总订单金额
|
||||
TotalNum int `json:"totalNum"` // 总订单数
|
||||
TotalSucNum int `json:"totalSucNum"` // 总成功订单数
|
||||
TotalSucRate float64 `json:"totalSucRate"` // 总成功率
|
||||
TotalSucAmount float64 `json:"totalSucAmount"` // 总成功订单金额
|
||||
}
|
||||
|
||||
totalSummary := TotalSummary{}
|
||||
|
||||
totalSummaryList := order2.GetSummaryByMerchant(ctx, u.MerchantUid)
|
||||
if len(totalSummaryList) > 0 {
|
||||
totalSummary.TodayAmount = totalSummaryList[0].TotalAmount
|
||||
totalSummary.TodayNum = totalSummaryList[0].TotalNum
|
||||
totalSummary.TodaySucNum = totalSummaryList[0].SuccessNum
|
||||
totalSummary.TodaySucAmount = totalSummaryList[0].SuccessAmount
|
||||
totalSummary.TodaySucRate = totalSummaryList[0].Rate
|
||||
}
|
||||
for _, v := range totalSummaryList {
|
||||
totalSummary.TotalAmount += v.TotalAmount
|
||||
totalSummary.TotalNum += v.TotalNum
|
||||
totalSummary.TotalSucNum += v.SuccessNum
|
||||
totalSummary.TotalSucAmount += v.SuccessAmount
|
||||
}
|
||||
|
||||
if totalSummary.TotalNum != 0 {
|
||||
totalSummary.TotalSucRate = mathutil.RoundToFloat(float64(totalSummary.TotalSucNum)/float64(totalSummary.TotalNum)*100, 2)
|
||||
}
|
||||
|
||||
// 可用余额
|
||||
info["settAmount"] = pubMethod.FormatFloat64ToString(totalSummary.TotalSucAmount)
|
||||
// 冻结金额
|
||||
info["freezeAmt"] = pubMethod.FormatFloat64ToString(totalSummary.TotalSucAmount)
|
||||
// 押款金额
|
||||
info["amountFrozen"] = pubMethod.FormatFloat64ToString(totalSummary.TotalSucRate)
|
||||
|
||||
c.Data["json"] = info
|
||||
c.ServeJSON(true)
|
||||
}
|
||||
|
||||
@@ -84,6 +84,45 @@
|
||||
<div class="number"><strong id="balanceAmt">0.00</strong></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xl-3 col-sm-4">
|
||||
<div class="item d-flex align-items-center">
|
||||
<div class="icon bg-green"><i class="icon icon-presentation"></i></div>
|
||||
<div class="title"><span>今日跑量<br><small> </small></span>
|
||||
<div class="progress">
|
||||
<div role="progressbar" style="width: 80%; height: 4px;" aria-valuenow="55"
|
||||
aria-valuemin="0" aria-valuemax="100" class="progress-bar bg-green">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="number"><strong id="settAmount">0.00</strong></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xl-3 col-sm-4">
|
||||
<div class="item d-flex align-items-center">
|
||||
<div class="icon bg-green"><i class="icon icon-presentation"></i></div>
|
||||
<div class="title"><span>总跑量<br><small> </small></span>
|
||||
<div class="progress">
|
||||
<div role="progressbar" style="width: 80%; height: 4px;" aria-valuenow="55"
|
||||
aria-valuemin="0" aria-valuemax="100" class="progress-bar bg-green">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="number"><strong id="freezeAmt">0.00</strong></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xl-3 col-sm-4">
|
||||
<div class="item d-flex align-items-center">
|
||||
<div class="icon bg-green"><i class="icon icon-presentation"></i></div>
|
||||
<div class="title"><span>成功率<br><small> </small></span>
|
||||
<div class="progress">
|
||||
<div role="progressbar" style="width: 80%; height: 4px;" aria-valuenow="55"
|
||||
aria-valuemin="0" aria-valuemax="100" class="progress-bar bg-green">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="number"><strong id="amountFrozen">0.00</strong></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@@ -92,7 +131,7 @@
|
||||
<div class="container-fluid">
|
||||
<h2 class="no-margin-bottom">通道配置
|
||||
<small style="font-size: 0.7em;">
|
||||
<a href="/index/show_pay_way_ui">>>>> 查看详情</a></small>
|
||||
<a href="/index/show_pay_way_ui"> 查看通道配置</a></small>
|
||||
<small style="font-size: 0.7em;"> 总订单数:
|
||||
<label id="orders">0</label></small>
|
||||
<small style="font-size: 0.7em;"> 总成功订单数:
|
||||
|
||||
Reference in New Issue
Block a user