Commit 68bfb138 by guanzhenshan

修改平台利润统计的需求

parent 8e16f6e0
......@@ -213,6 +213,11 @@ namespace Bailun.DC.Models.Orders
public decimal amount_refund { get; set; }
/// <summary>
/// 预付款-收钱没发货
/// </summary>
public decimal amount_prepaid { get; set; }
/// <summary>
/// 总支出费用-人民币
/// </summary>
public decimal cost_total { get; set; }
......@@ -268,6 +273,22 @@ namespace Bailun.DC.Models.Orders
public decimal cost_first { get; set; }
/// <summary>
/// 处理费-百伦收取-人民币
/// </summary>
public decimal cost_handle_bailun { get; set; }
/// <summary>
/// 处理费-平台收取-人民币
/// </summary>
public decimal cost_handle_platform { get; set; }
/// <summary>
/// 尾程费-人民币
/// </summary>
public decimal cost_tail { get; set; }
/// <summary>
/// 利润=总收入-总支出
/// </summary>
public decimal profit_total { get; set; }
......
......@@ -15,6 +15,11 @@ namespace Bailun.DC.Models.Orders
public string platform { get; set; }
/// <summary>
/// 站点
/// </summary>
public string website { get; set; }
/// <summary>
/// 订单数
/// </summary>
public int ordercount { get; set; }
......@@ -54,5 +59,25 @@ namespace Bailun.DC.Models.Orders
/// </summary>
public decimal returnamountrate { get; set; }
/// <summary>
/// 头程费
/// </summary>
public decimal cost_first { get; set; }
/// <summary>
/// 尾程费
/// </summary>
public decimal cost_tail { get; set; }
/// <summary>
/// 处理费(百伦)
/// </summary>
public decimal cost_handle_bailun { get; set; }
/// <summary>
/// 处理费(平台)
/// </summary>
public decimal cost_handle_platform { get; set; }
}
}
......@@ -383,6 +383,12 @@ namespace Bailun.DC.Services
{
var m = cn.QueryFirstOrDefault<dc_platform_balance>($"select * from dc_platform_balance where platformcode='{item.platformcode}' and currency='{item.currency}' and delstatus=0 order by day desc limit 1");
if (m.platformcode.ToUpper() != "EBAY" && m.platformcode.ToUpper() != "ALIEXPRESS" && m.amount==item.amount)
{
item.amount = m.amount + m.amount_sales - m.withdraw_amount;
item.amount_rmb = item.amount * item.exchangerate;
}
if (m != null)
{
item.before_balance = m.userable_amount + m.amount_sales - m.withdraw_amount;
......

@{
ViewData["Title"] = "订单明细";
Layout = "~/Pages/Shared/_MainLayout.cshtml";
ViewBag.Nav = new string[] { "订单明细" };
}
<div class="row">
<div class="col-sm-12">
<div class="ibox-content m-b-sm border-bottom">
<form id="toolbar">
<div class="form-inline" style="line-height:40px;">
<div class="form-group">
<label>平台类型:</label>
<select id="platform" name="platform" class="form-control">
<option value="">选择平台</option>
</select>
</div>
<div class="form-group">
<label>站点:</label>
<select id="website" name="website" class="form-control">
<option value="">选择站点</option>
</select>
</div>
<div class="form-group">
<label>付款时间</label>
<input id="start" name="start" type="text" class="form-control" style="width:130px;" value="@(ViewBag.start)" />
<span>至</span>
<input id="end" name="end" type="text" class="form-control" style="width:130px;" value="@(ViewBag.end)" />
</div>
<div class="form-group">
<label>&nbsp;</label>
<input id="orderno" name="orderno" class="form-control" type="text" style="width:150px" value="@(ViewBag.orderno)" placeholder="百伦订单号" />
</div>
<div class="form-group">
<label>&nbsp;</label>
<button type="button" class="btn btn-primary" onclick="list();"><i class="fa fa-search"></i>&nbsp;查询</button>
</div>
</div>
</form>
</div>
<div class="ibox-content m-b-sm border-bottom">
<table id="roletable" style="table-layout:fixed;"></table>
</div>
</div>
</div>
@section css{
<style>
.mules {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
</style>
}
@section scripts{
<script type="text/javascript">
var tb;
$(document).ready(function () {
laydate.render({ elem: '#start' });
laydate.render({ elem: '#end' });
var height = document.body.clientHeight;
$("#roletable").attr("data-height", (height - 170));
listPlatform();
})
function list() {
var columns = [
{
field: 'origin_order_id', title: '平台单号', width: '160', formatter: function (idx, data) {
return '<div class="mules" title="' + data.origin_order_id + '">' + data.origin_order_id + '</div>';
}
},
{
field: 'bailun_order_id', title: '订单号', width: '210', iscount: true, formatter: function (idx,data) {
return '<div class="mules" title="' + data.bailun_order_id + '">' + data.bailun_order_id + '</div>';
}
},
{ field: 'platform_type', title: '平台', width: '100' },
{ field: 'website', title: '站点', width: '90' },
{ field: 'seller_account', title: '销售帐号', width: '110', sortable: false },
//{ field: 'order_currency', title: '订单币种', width: '110', sortable: false, iscount: true },
{
field: 'amount_total', title: '总收入', width: '90', sortable: true, iscount: true
},
{ field: 'amount_product', title: '产品收入', width: '110', sortable: true, iscount: true },
{
field: 'amount_shipping', title: '运费收入', width: '110', sortable: true, iscount: true
},
{ field: 'amount_tax', title: '税费收入', width: '110', sortable: true, iscount: true },
{ field: 'amount_adjustment', title: '调整金额', width: '120', sortable: true, iscount: true },
{ field: 'amount_gift_wrap', title: '礼品包装金额', width: '150', sortable: true, iscount: true },
{ field: 'amount_refund', title: '退款金额', width: '90', sortable: true, iscount: true },
{ field: 'cost_total', title: '总支出', width: '110', sortable: true, iscount: true },
{ field: 'cost_promotion', title: '促销费用', width: '110', sortable: true, iscount: true },
{ field: 'cost_platform_fee', title: '平台费用', width: '100', sortable: true, iscount: true },
{ field: 'cost_product', title: '产品成本', width: '100', sortable: true, iscount: true },
{ field: 'cost_shipping', title: '发货费用', width: '100', sortable: true, iscount: true },
{ field: 'cost_package', title: '包装费用', width: '100', sortable: true, iscount: true },
{ field: 'cost_fba_fee', title: 'FBA费用', width: '100', sortable: true, iscount: true },
{ field: 'cost_paypal_fee', title: 'Paypal费用', width: '120', sortable: true, iscount: true },
{ field: 'cost_refund_commisson', title: '退款佣金费用', width: '130', sortable: true, iscount: true },
{ field: 'cost_handle_bailun', title: '处理费(百伦)', width: '130', sortable: true, iscount: true },
{ field: 'cost_handle_platform', title: '处理费(平台)', width: '130', sortable: true, iscount: true },
{ field: 'cost_first', title: '头程费', width: '100', sortable: true, iscount: true },
{ field: 'cost_tail', title: '尾程费', width: '100', sortable: true, iscount: true },
{ field: 'profit_total', title: '利润', width: '100', sortable: true, iscount: true },
{ field: 'profit_rate', title: '利润率', width: '100', sortable: true },
{ field: 'create_time', title: '下单时间', width: '150', sortable: true },
{ field: 'paid_time', title: '付款时间', width: '150', sortable: true }
];
var url = '@Url.Content("~/Reports/Orders/ListOrderDetailJson")' + '?' + $("#toolbar").serialize();
if (tb == undefined) {
tb = OnlyTable("roletable", columns, url, "", {
showfooter: true, loadsuccess: function (d) {
//替换汇总行的相关列值
var tr = $('.fixed-table-footer').find('tr');
for (var c in columns) {
var key = columns[c].field;
if (columns[c].iscount) {
for (var v in d.count_row) {
if (key == v) {
tr.find('td').eq(c).children('div').first().html(d.count_row[v]);
break;
}
}
}
}
}
});
}
else {
tb.bootstrapTable('refresh', { url: url });
}
}
function listPlatform() {
var lindex = layer.load();
$.submit({
url: '@Url.Content("~/Reports/Orders/ListPlatform")',
type:'POST',
paramData: '',
func: function (result) {
layer.close(lindex);
if (result != null && result != undefined) {
$('#platform').html('<option value="">选择平台</option>');
for (var i = 0; i < result.length; i++) {
$('#platform').append('<option value="' + result[i] + '">' + result[i]+'</option>');
}
$('#platform').val('@ViewBag.platform');
listWebsite();
}
}
})
}
function listWebsite() {
var lindex = layer.load();
$.submit({
url: '@Url.Content("~/Reports/Orders/ListWebSite")',
type:'POST',
paramData: 'platform=' + $('#platform').val(),
func: function (result) {
layer.close(lindex);
if (result != null && result != undefined) {
$('#website').html('<option value="">选择平台</option>');
for (var i = 0; i < result.length; i++) {
$('#website').append('<option value="' + result[i] + '">' + result[i]+'</option>');
}
$('#website').val('@ViewBag.website');
list();
}
}
})
}
</script>
}
......@@ -9,7 +9,6 @@
<div class="col-sm-12">
<div class="ibox-content m-b-sm border-bottom">
<form id="toolbar">
<input id="platform" name="platform" type="hidden" value="@ViewBag.platform" />
<div class="form-inline" style="line-height:40px;">
<div class="form-group">
<label>平台类型:</label>
......@@ -39,6 +38,10 @@
<th>销售额</th>
<th>客单价</th>
<th>平台费</th>
<th>头程费</th>
<th>尾程费</th>
<th>处理费(百伦)</th>
<th>处理费(平台)</th>
<th>利润</th>
<th>利润率%</th>
<th>退款</th>
......@@ -87,17 +90,30 @@
if (result && result.length > 0) {
$('#tb').html('');
for (var i = 0; i < result.length; i++) {
var s = '<tr><td>' + result[i].platform + '</td>';
s += '<td>' + result[i].ordercount + '</td>';
s += '<td>' + result[i].saleamount + '</td>';
s += '<td>' + result[i].customerprice + '</td>';
s += '<td>' + result[i].platformfee + '</td>';
s += '<td>' + result[i].profit + '</td>';
s += '<td>' + result[i].profitrate + '</td>';
s += '<td>' + result[i].returnamount + '</td>';
s += '<td>' + result[i].returnamountrate + '</td>';
var s = '<tr><td class="platform"><a href="javascript:;" onclick="ShowWebsite(\'' + result[i].platform+'\');">' + result[i].platform + '</a></td>';
s += '<td title="' + result[i].platform+'">' + result[i].ordercount + '</td>';
s += '<td title="' + result[i].platform +'">' + result[i].saleamount + '</td>';
s += '<td title="' + result[i].platform +'">' + result[i].customerprice + '</td>';
s += '<td title="' + result[i].platform +'">' + result[i].platformfee + '</td>';
s += '<td title="' + result[i].platform +'">' + result[i].cost_first + '</td>';
s += '<td title="' + result[i].platform +'">' + result[i].cost_tail + '</td>';
s += '<td title="' + result[i].platform +'">' + result[i].cost_handle_bailun + '</td>';
s += '<td title="' + result[i].platform +'">' + result[i].cost_handle_platform + '</td>';
s += '<td title="' + result[i].platform +'">' + result[i].profit + '</td>';
s += '<td title="' + result[i].platform +'">' + result[i].profitrate + '</td>';
s += '<td title="' + result[i].platform +'">' + result[i].returnamount + '</td>';
s += '<td title="' + result[i].platform +'">' + result[i].returnamountrate + '</td>';
$('#tb').append(s);
}
$('#tb').find('td').each(function () {
$(this).css('cursor', 'pointer');
var platformcode = $(this).attr('title');
$(this).click(function () {
layer_show(platformcode + " " + $('#start').val() + "至" + $('#end').val() + ' 订单明细', '@Url.Content("~/Reports/Orders/ListOrderDetail?platform=")' + platformcode + '&start=' + $('#start').val() + '&end=' + $('#end').val(), '90%', '90%');
})
})
}
else {
layer.alert('出现异常,请重试!');
......@@ -122,6 +138,18 @@
}
})
}
function ShowWebsite(platform) {
if (platform == '总计') {
return false;
}
var start = $('#start').val();
var end = $('#end').val();
layer_show(platform + ' 按站点统计', '@Url.Content("~/Reports/Orders/PlatformProfitCountByWebSite?platform=")' + platform + '&start=' + start + '&end=' + end, '90%', '90%');
}
</script>
......

@{
ViewData["Title"] = "平台站点利润统计";
Layout = "~/Pages/Shared/_MainLayout.cshtml";
ViewBag.Nav = new string[] { "统计", "平台利润统计", ViewBag.platform, "站点利润" };
}
<div class="row">
<div class="col-sm-12">
<div class="ibox-content m-b-sm border-bottom">
<form id="toolbar">
<div class="form-inline" style="line-height:40px;">
<div class="form-group">
<label>平台类型:</label>
@*<select id="platform" name="platform" class="form-control">
<option value="">选择平台</option>
</select>*@
<input id="platform" name="platform" class="form-control" style="width:130px" value="@ViewBag.platform" readonly />
</div>
<div class="form-group">
<label>付款时间</label>
<input id="start" name="start" type="text" class="form-control" style="width:130px;" value="@(ViewBag.start)" readonly />
<span>至</span>
<input id="end" name="end" type="text" class="form-control" style="width:130px;" value="@(ViewBag.end)" readonly />
</div>
</div>
</form>
</div>
<div class="ibox-content m-b-sm border-bottom">
<table id="roletable" style="table-layout:fixed;"></table>
</div>
</div>
</div>
@section css{
<style>
.mules {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
</style>
}
@section scripts{
<script type="text/javascript">
var tb;
$(document).ready(function () {
laydate.render({ elem: '#start' });
laydate.render({ elem: '#end' });
//var height = document.body.clientHeight;
//$("#roletable").attr("data-height", (height - 170));
list();
//listPlatform();
})
function list() {
var columns = [
{ field: 'platform', title: '平台', width: '100' },
{ field: 'website', title: '站点', width: '90', iscount: true },
{ field: 'ordercount', title: '订单数', width: '100', sortable: true, iscount: true },
{ field: 'saleamount', title: '销售额', width: '90', sortable: true, iscount: true },
{
field: 'customerprice', title: '客单价', width: '90', sortable: true, iscount: true
},
{ field: 'platformfee', title: '平台费', width: '90', sortable: true, iscount: true },
{
field: 'cost_first', title: '头程费', width: '90', sortable: true, iscount: true
},
{ field: 'cost_tail', title: '尾程费', width: '100', sortable: true, iscount: true },
{ field: 'cost_handle_bailun', title: '处理费(百伦)', width: '120', sortable: true, iscount: true },
{ field: 'cost_handle_platform', title: '处理费(平台)', width: '120', sortable: true, iscount: true },
{ field: 'profit', title: '利润', width: '90', sortable: true, iscount: true },
{ field: 'profitrate', title: '利润率%', width: '110', sortable: true },
{ field: 'returnamount', title: '退款额', width: '110', sortable: true, iscount: true },
{ field: 'returnamountrate', title: '退款率%', width: '100', sortable: true }
];
var url = '@Url.Content("~/Reports/Orders/PlatformProfitCountByWebSiteJson")' + '?' + $("#toolbar").serialize();
if (tb == undefined) {
tb = OnlyTable("roletable", columns, url, "", {
showfooter: true, loadsuccess: function (d) {
//替换汇总行的相关列值
var tr = $('.fixed-table-footer').find('tr');
for (var c in columns) {
var key = columns[c].field;
if (columns[c].iscount) {
for (var v in d.count_row) {
if (key == v) {
tr.find('td').eq(c).children('div').first().html(d.count_row[v]);
break;
}
}
}
}
}
});
}
else {
tb.bootstrapTable('refresh', { url: url });
}
}
function listPlatform() {
$.submit({
url: '@Url.Content("~/Reports/Orders/ListPlatform")',
type:'POST',
paramData: '',
func: function (result) {
if (result != null && result != undefined) {
$('#platform').html('<option value="">选择平台</option>');
for (var i = 0; i < result.length; i++) {
$('#platform').append('<option value="' + result[i] + '">' + result[i]+'</option>');
}
}
}
})
}
function ShowWebsite(platform) {
if (platform == '总计') {
return false;
}
var start = $('#start').val();
var end = $('#end').val();
layer_show(platform+' 按站点统计', '@Url.Content("~/Reports/Orders/")', '90%', '90%');
}
</script>
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment