💄添加费率修改为简单模式

This commit is contained in:
sunxiaolong
2023-11-27 03:51:20 +08:00
parent 66ad4dc535
commit 5813a482de
13 changed files with 231 additions and 37 deletions

View File

@@ -793,9 +793,9 @@ func (c *GetController) GetOrder() {
orderDataJSON.StartIndex = c.Offset
orderDataJSON.OrderList = order.GetOrderByMap(params, c.DisplayCount, c.Offset)
orderDataJSON.SuccessRate = order.GetSuccessRateByMap(params)
//orderDataJSON.SuccessRate = order.GetSuccessRateByMap(params)
params["status"] = common.SUCCESS
orderDataJSON.AllAmount = order.GetAllAmountByMap(params)
//orderDataJSON.AllAmount = order.GetAllAmountByMap(params)
c.GenerateJSON(orderDataJSON)
}

View File

@@ -180,15 +180,15 @@ type ProductDataJSON struct {
}
type OrderDataJSON struct {
Msg string
Code int
StartIndex int
DisplayCount int
CurrentPage int
TotalPage int
OrderList []order.OrderInfo
AllAmount float64
SuccessRate string
Msg string
Code int
StartIndex int
DisplayCount int
CurrentPage int
TotalPage int
OrderList []order.OrderInfo
//AllAmount float64
//SuccessRate string
NotifyUrl string
OrderProfitSummary order.ProfitSummary `json:"OrderProfitSummary"`
}

View File

@@ -14,9 +14,7 @@ func main() {
web.Run()
}
/**
** 注册日志信息
*/
// RegisterLogs 注册日志信息
func RegisterLogs() {
_ = logs.SetLogger(logs.AdapterFile,
`{

View File

@@ -1,3 +1,5 @@
package agent
/***************************************************
** @Desc : This file for ...
** @Time : 2019/12/17 17:50
@@ -7,7 +9,6 @@
** @Last Modified time: 2019/12/17 17:50
** @Software: GoLand
****************************************************/
package agent
type AgentProfit struct {
}

View File

@@ -1,3 +1,5 @@
package merchant
/***************************************************
** @Desc : This file for ...
** @Time : 2019/9/28 16:47
@@ -7,7 +9,6 @@
** @Last Modified time: 2019/9/28 16:47
** @Software: GoLand
****************************************************/
package merchant
import (
"github.com/beego/beego/v2/client/orm"

View File

@@ -1,3 +1,5 @@
package merchant
/***************************************************
** @Desc : This file for ...
** @Time : 2019/11/22 13:07
@@ -7,7 +9,6 @@
** @Last Modified time: 2019/11/22 13:07
** @Software: GoLand
****************************************************/
package merchant
import (
"github.com/beego/beego/v2/client/orm"

View File

@@ -1,3 +1,5 @@
package notify
/***************************************************
** @Desc : This file for ...
** @Time : 2019/11/20 13:13
@@ -7,7 +9,6 @@
** @Last Modified time: 2019/11/20 13:13
** @Software: GoLand
****************************************************/
package notify
import (
"github.com/beego/beego/v2/client/orm"

View File

@@ -10,6 +10,7 @@ type Summary struct {
MerchantIncome float64 `json:"merchantIncome"` // 商户收入
AgencyIncome float64 `json:"agencyIncome"` // 代理收入
ChannelCost float64 `json:"channelCost"` // 通道成本
SucceedRate float64 `json:"succeedRate"` // 订单成功率
}
type ProfitSummary struct {

View File

@@ -41,7 +41,7 @@ func init() {
beego.Router("/payfor_record.html", &controllers.PageController{}, "*:PayforRecordPage")
beego.Router("/confirm.html", &controllers.PageController{}, "*:ConfirmPage")
beego.Router("/self_notify.html", &controllers.PageController{}, "*:SelfNotifyPage")
beego.Router("/self_plus_sub.html", &controllers.PageController{}, "*:SelfPlusSubPage")
//beego.Router("/self_plus_sub.html", &controllers.PageController{}, "*:SelfPlusSubPage")
beego.Router("/agent_to_merchant.html", &controllers.PageController{}, "*:AgentToMerchantPage")
beego.Router("/platform_profit.html", &controllers.PageController{}, "*:PlatFormProfitPage")
beego.Router("/agent_profit.html", &controllers.PageController{}, "*:AgentProfitPage")

View File

@@ -108,7 +108,7 @@ func QueryTotalSummary() order.Summary {
totalNum += 1
allAmount += v.ShowAmount //订单总金额
if v.Status != "success" {
if v.Status != common.SUCCESS {
continue
}
@@ -125,6 +125,7 @@ func QueryTotalSummary() order.Summary {
PaidNum: succeedNum,
PaidAmount: math.Round(succeedPaidAmount*100) / 100,
PlatformIncome: math.Round(platformAll*100) / 100,
SucceedRate: math.Round(float64(succeedNum)/float64(totalNum)*100*100) / 100,
}
}
@@ -156,12 +157,21 @@ func QuerySummaryByOrderInfo(infoInfoList []order.OrderInfo) order.Summary {
TodaySuccessNum += 1
}
succeedRate := 0.0
if totalNum != 0 {
succeedRate = math.Round(float64(TodaySuccessNum)/float64(totalNum)*100*100) / 100
} else {
succeedRate = 0
}
return order.Summary{
TotalNum: totalNum,
TotalAmount: math.Round(todayAllAmount*100) / 100,
PaidNum: TodaySuccessNum,
PlatformIncome: math.Round(todayPlatformAll*100) / 100,
AgencyIncome: todayAgentAll,
SucceedRate: succeedRate,
}
}
@@ -195,11 +205,20 @@ func QueryTodaySummary() order.Summary {
TodaySuccessNum += 1
}
succeedRate := 0.0
if totalNum != 0 {
succeedRate = math.Round(float64(TodaySuccessNum)/float64(totalNum)*100*100) / 100
} else {
succeedRate = 0
}
return order.Summary{
TotalNum: totalNum,
TotalAmount: math.Round(todayAllAmount*100) / 100,
PaidNum: TodaySuccessNum,
PlatformIncome: math.Round(todayPlatformAll*100) / 100,
AgencyIncome: todayAgentAll,
SucceedRate: succeedRate,
}
}

View File

@@ -372,7 +372,7 @@
</a>
<div class="second-menu">
<a href="#" onclick="loadMainContent('/self_notify.html')"><span>批量给下游回调</span></a>
<a href="#" onclick="loadMainContent('/self_plus_sub.html')"><span>自定义加减款</span></a>
<!-- <a href="#" onclick="loadMainContent('/self_plus_sub.html')"><span>自定义加减款</span></a>-->
</div>
</div>
<div>

View File

@@ -293,11 +293,11 @@
<div class="row">
<div class="col-md-4">
<span>单通道:</span>
<input type="text" readonly="true" id="single-road" value="" placeholder="">
<input type="text" readonly id="single-road" value="" placeholder="">
</div>
<div class="col-md-3">
<span style="width: 150px;">平台净利率:</span>
<input style="width: 60px;" type="text" id="single-road-platform-fee" placeholder="例:0.3">
<input style="width: 60px;" type="text" readonly id="single-road-platform-fee" placeholder="例:0.3">
</div>
<div class="col-md-4">
<span style="width: 150px;">代理净利率:</span>
@@ -423,6 +423,64 @@
</div>
</div>
</div>
<div class="modal fade" id="platform-rate-list" tabindex="-2" role="dialog" aria-labelledby="myModalLabelData"
data-keyboard="false" data-backdrop="static">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<div class="left">
费率修改
</div>
<div class="right">
<button class="btn btn-default btn-sm" onclick="addElement()">
添加元素
</button>
</div>
</div>
<div class="modal-body modal-body-roll-rate-road menu-table">
<table class="platform-rate-table">
<thead>
<tr>
<th>
面值
</th>
<th>
净利率
</th>
<th>
操作
</th>
</tr>
</thead>
<tbody>
<tr class="platformMM" hidden>
<td>
<label>
<input placeholder="输入面值" id="platformM">
</label>
</td>
<td>
<label>
<input placeholder="输入折扣" id="platformV">
</label>
</td>
<td>
<button class="btn btn-primary btn-xs" onclick="confirmElement()">确定</button>
</td>
</tr>
</tbody>
</table>
<div class="error-msg" style="color: red"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default cancel-single-roll-two" data-dismiss="modal">关闭
</button>
</div>
</div>
</div>
</div>
{{/*展示代理商,配置商户*/}}
</div>
@@ -641,14 +699,14 @@
let merchant = res.MerchantList[0];
$("#merchant-edit-merchant-name").val(merchant.MerchantName);
$("#merchant-edit-merchant-no").val(merchant.MerchantUid);
if (merchant.AutoSettle == "yes") {
if (merchant.AutoSettle === "yes") {
$("input[type=radio][name=auto-settle-radio][value=yes]").prop("checked", true);
$("input[type=radio][name=auto-settle-radio][value=no]").prop('checked', false);
} else {
$("input[type=radio][name=auto-settle-radio][value=no]").prop("checked", true);
$("input[type=radio][name=auto-settle-radio][value=yes]").prop("checked", false);
}
if (merchant.AutoPayFor == "yes") {
if (merchant.AutoPayFor === "yes") {
$("input[type=radio][name=auto-payfor-radio][value=yes]").prop("checked", true);
$("input[type=radio][name=auto-payfor-radio][value=no]").prop('checked', false);
} else {
@@ -760,9 +818,9 @@
},
success: function (res) {
if (res.Code == 404) {
if (res.Code === 404) {
window.parent.location = "/login.html";
} else if (res.Code == -1) {
} else if (res.Code === -1) {
alert("更新失败")
} else {
showMerchantAjax(getMerchantCutPageValues());
@@ -848,13 +906,90 @@
});
// 支付单通到配置处理函数 end
$("#single-road-platform-fee").click(() => {
$("#platform-rate-list").modal();
// 删除原有元素
$(".platform-value").remove();
const items = JSON.parse($("#single-road-platform-fee").val())
if (items !== undefined || items !== "") {
let tags = "";
for (const item in items) {
let tag = `<tr class="platform-value platform-value-${item}">`
tag += `<td>${item}</td>`
tag += `<td>${items[item]}</td>`
tag += `<td><button class="btn btn-danger btn-xs" onclick="deleteItem('${item}')">删除</button></td>`
tag += `</tr>`
tags += tag;
}
$(".platformMM").before(
tags
)
}
});
function deleteItem(value) {
// 移除元素
$(`.platform-value-${value}`).remove();
const items = JSON.parse($("#single-road-platform-fee").val())
// 删除元素
delete items[value];
$("#single-road-platform-fee").val(JSON.stringify(items));
}
function addElement() {
$(".platformMM").show()
}
function confirmElement() {
const mm = $("#platformM").val();
const value = $("#platformV").val();
if (mm === "" || value === "") {
$(".error-msg").text("填写信息错误,请补充完整;")
return
}
try {
const mmInt = parseInt(mm)
const mmFloat = parseFloat(value);
const items = JSON.parse($("#single-road-platform-fee").val())
for (const item in items) {
if (item === mm) {
$(".error-msg").text("填写面值已存在,请先删除;")
return
}
}
let tag = `<tr class="platform-value platform-value-${mm}">`
tag += `<td>${mm}</td>`
tag += `<td>${mmFloat}</td>`
tag += `<td><button class="btn btn-danger btn-xs" onclick="deleteItem('${mm}')">删除</button></td>`
tag += `</tr>`
$(".platformMM").before(tag)
// 删除元素
items[mm] = mmFloat;
$("#single-road-platform-fee").val(JSON.stringify(items));
$("#platformM").val("");
$("#platformV").val("");
$(".platformMM").hide()
} catch (e) {
console.error(e)
$(".error-msg").text("填写信息错误,请补充完整;")
}
}
//支付轮询通道处理开始
function rollPool(e) {
let ar = $(e).text().trim().split(/\s+/);
let sr = ar[1];
$("#roll-pool-road").val(sr);
$(".cancel-single-roll").trigger('click');
if (ar[0] == "不选择") {
if (ar[0] === "不选择") {
$("#roll-road-platform-fee").val("");
$("#roll-road-agent-fee").val("");
}
@@ -1148,6 +1283,7 @@
let dataJSON = getMerchantCutPageValues();
showMerchantAjax(dataJSON);
});
//当每页显示数更改后,执行的操作
$("#display_count").change(function () {
let dataJSON = getMerchantCutPageValues();
@@ -1225,7 +1361,9 @@
$(".merchant-edit").hide();
showMerchantAjax(getMerchantCutPageValues());
});
$(".cancel-single-roll-two").click(() => {
$("#roll-or-road-list").hide()
})
$(".totp-save").click(function (event) {// 获取secret
const totpCode = $("#totp-d-value").val();
const merchantUid = $("#totp-merchant-value").val();
@@ -1257,4 +1395,28 @@
})
</script>
</body>
<style>
table {
table-layout: auto;
width: 120px;
}
td {
height: 40px;
text-align: center;
}
.modal-header {
display: flex;
justify-content: space-between;
align-items: center;
}
.modal-header > .left {
flex: 1;
}
</style>
</html>

View File

@@ -124,15 +124,15 @@
<button type="button" class="btn btn-default" id="order-search">搜索</button>
<button onclick='loadMainContent("/order_info.html")' type="button" class="btn btn-default">刷新</button>
<label class="color-red" style="font-size: 16px;">
交易金额:
<span id="order-all-amount"></span>
</label>
<!-- <label class="color-red" style="font-size: 16px;">-->
<!-- 交易金额:-->
<!-- <span id="order-all-amount"></span>-->
<!-- </label>-->
<label class="color-red" style="font-size: 16px;">
成功率:
<span id="success-rate"></span>
</label>
<!-- <label class="color-red" style="font-size: 16px;">-->
<!-- 成功率:-->
<!-- <span id="success-rate"></span>-->
<!-- </label>-->
</div>
<!-- <div>-->
<!-- 今日订单数:-->
@@ -180,6 +180,10 @@
平台利润:
<span id="platformProfit"></span>
</div>
<div class="col-sm-2 color-red" style="font-weight: normal;">
成功率:
<span id="totalSucceedRate"></span>%
</div>
<!-- <div class="color-red" style="font-weight: normal;">-->
<!-- 代理利润:-->
<!-- <span id="agentProfit"></span>-->
@@ -207,6 +211,10 @@
今日平台利润:
<span id="TodayPlatformProfit"></span>
</div>
<div class="col-sm-2 color-red" style="font-weight: normal;">
订单成功率:
<span id="todaySucceedRate"></span>%
</div>
<!-- <div class="color-red" style="font-weight: normal;">-->
<!-- 今日代理润:-->
<!-- <span id="TodayAgentProfit"></span>-->
@@ -553,6 +561,7 @@
$("#succeedTotalNum").html(res.OrderProfitSummary.totalProfit.paidNum)
$("#SucceedPaidAmount").html(res.OrderProfitSummary.totalProfit.paidAmount)
$("#platformProfit").html(res.OrderProfitSummary.totalProfit.platformIncome)
$("#totalSucceedRate").html(res.OrderProfitSummary.totalProfit.succeedRate)
$("#TodaySuccessNum").html(res.OrderProfitSummary.todayProfit.paidNum);
$("#TodayAllAmount").html(res.OrderProfitSummary.todayProfit.totalAmount);
@@ -560,6 +569,7 @@
$("#TodayPlatformProfit").html(res.OrderProfitSummary.todayProfit.platformIncome);
$("#TodayAgentProfit").html(res.OrderProfitSummary.todayProfit.agencyIncome);
$("#TodayAllNum").html(res.OrderProfitSummary.todayProfit.totalNum);
$("#todaySucceedRate").html(res.OrderProfitSummary.todayProfit.succeedRate)
}
function orderRoll(bankOrderId) {