52 lines
2.4 KiB
HTML
52 lines
2.4 KiB
HTML
|
|
<div class="layui-card" style="margin:20px;">
|
|
<div class="layui-card-header">收益账本(开发者分红)</div>
|
|
<div class="layui-card-body">
|
|
<div class="layui-row" id="summary" style="margin-bottom:12px;"></div>
|
|
<table class="layui-hide" id="dataTable" lay-filter="dataTable"></table>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
layui.use(['table', 'jquery'], function () {
|
|
var table = layui.table, $ = layui.jquery;
|
|
var summaryData = null;
|
|
table.render({
|
|
elem: '#dataTable',
|
|
url: '{:url("/appmall/backend/revenue/index")}',
|
|
page: true,
|
|
// Result::success 返回 code:0 / message / data:{list,summary} / count
|
|
response: { statusName: 'code', msgName: 'message', countName: 'count', dataName: 'data' },
|
|
parseData: function (res) {
|
|
summaryData = (res.data && res.data.summary) ? res.data.summary : null;
|
|
return {
|
|
code: res.code,
|
|
msg: res.message,
|
|
count: res.count || 0,
|
|
data: (res.data && res.data.list) ? res.data.list : []
|
|
};
|
|
},
|
|
cols: [[
|
|
{field: 'id', title: 'ID', width: 70},
|
|
{field: 'developer_id', title: '开发者ID', width: 100},
|
|
{field: 'aid', title: '商品ID', width: 90},
|
|
{field: 'uid', title: '购买用户', width: 90},
|
|
{field: 'amount', title: '订单金额', width: 100},
|
|
{field: 'commission', title: '平台抽成', width: 100},
|
|
{field: 'income', title: '开发者收益', width: 110, templet: function(d){return '<b>'+d.income+'</b>';}},
|
|
{field: 'status', title: '结算', width: 90, templet: function(d){return d.status==1?'<span class="layui-badge layui-bg-green">已结算</span>':'<span class="layui-badge">待结算</span>';}},
|
|
{field: 'create_at', title: '时间', width: 170, templet: function(d){return layui.util.toDateString(d.create_at*1000);}}
|
|
]],
|
|
done: function () {
|
|
if (summaryData) {
|
|
$('#summary').html(
|
|
'总销售额:<b>' + summaryData.total_amount + '</b> | ' +
|
|
'平台抽成:<b>' + summaryData.total_commission + '</b> | ' +
|
|
'开发者收益:<b style="color:#16a34a;">' + summaryData.total_income + '</b>'
|
|
);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
</script>
|