405 lines
18 KiB
Plaintext
405 lines
18 KiB
Plaintext
@{
|
||
ViewBag.Title = "Exec";
|
||
Layout = "~/Views/Shared/_Layout.cshtml";
|
||
}
|
||
|
||
<div class="x-body">
|
||
|
||
<div id="mytoolbar">
|
||
@if (ViewBag.userRightId != null && ViewBag.userRightId.StartsWith("AUDIT"))
|
||
{
|
||
<div class="layui-inline">
|
||
执行日期:
|
||
<div class="layui-inline">
|
||
<input class="layui-input" placeholder="开始日" name="txt_stime" id="stime" style="width:120px;">
|
||
</div>
|
||
<div class="layui-inline">
|
||
<input class="layui-input" placeholder="截止日" name="txt_etime" id="etime" style="width:120px;">
|
||
</div>
|
||
数据日期:
|
||
<div class="layui-inline">
|
||
<input class="layui-input" placeholder="开始日" name="txt_btime" id="btime" style="width:120px;">
|
||
</div>
|
||
<div class="layui-inline">
|
||
<input class="layui-input" placeholder="截止日" name="txt_ftime" id="ftime" style="width:120px;">
|
||
</div>
|
||
<div class="layui-inline">
|
||
<span style="padding:20px;"></span>
|
||
<button class="layui-btn" data-method="exec2">结算</button>
|
||
<span style="padding:20px;"></span>
|
||
<button class="layui-btn" data-method="exec">当前预估结算</button>
|
||
<span style="padding:20px;"></span>
|
||
<button class="layui-btn" data-method="Gen_modulePrice">基础数据生成</button>
|
||
<span style="padding:20px;"></span>
|
||
</div>
|
||
|
||
</div>
|
||
}
|
||
<div class="layui-inline">
|
||
<button class="layui-btn " id="export">
|
||
导出选择
|
||
<i class="layui-icon layui-icon-more-vertical layui-font-14 layuicl"></i>
|
||
</button>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
|
||
|
||
|
||
<hr>
|
||
<div>
|
||
<ul class="layui-nav" lay-filter="docDemoNavBrief">
|
||
<li class="layui-nav-item layui-this"><a href="javascript:;" id="monkey">当月</a></li>
|
||
<li class="layui-nav-item "><a href="javascript:;" id="1">总数据</a></li>
|
||
@foreach (var item in ViewBag.AuditItems[0].childItemTrees)
|
||
{
|
||
if (item.childItemTrees.Count == 0)
|
||
{
|
||
<li class="layui-nav-item"><a href="javascript:;" id="@item.itemid">@item.item</a></li>
|
||
}
|
||
else
|
||
{
|
||
<li class="layui-nav-item">
|
||
<a href="javascript:;" id="@item.itemid">
|
||
@item.item
|
||
</a>
|
||
<dl class="layui-nav-child">
|
||
@foreach (var childitem in item.childItemTrees)
|
||
{
|
||
<dd><a href="javascript:;" id="@childitem.itemid">@childitem.item</a></dd>
|
||
|
||
foreach (var threechilditem in childitem.childItemTrees)
|
||
{
|
||
<dd><a href="javascript:;" id="@threechilditem.itemid"> @threechilditem.item</a></dd>
|
||
}
|
||
}
|
||
</dl>
|
||
</li>
|
||
}
|
||
}
|
||
</ul>
|
||
</div>
|
||
|
||
<hr>
|
||
<blockquote class="layui-elem-quote">说明</blockquote>
|
||
<span class="layui-word-aux">当月收入净收款比:当月收入/实际收款净额(实际收款-实际退款)</span>
|
||
<span class="layui-word-aux">成本占比:成本/订单金额</span>
|
||
<span class="layui-word-aux">退款占比: 实际退款/实际收款</span>
|
||
<span class="layui-word-aux">渠道消费占比:渠道消费/实际收款</span>
|
||
<div class="layui-tab-content">
|
||
<table class="layui-hide" id="table1"></table>
|
||
</div>
|
||
</div>
|
||
|
||
<script type="text/html" id="toolbarDemo">
|
||
<div class="layui-form" id="itemCheck">
|
||
<input type="checkbox" lay-filter="icheck" id="@ViewBag.AuditItems[0].itemid" title="@ViewBag.AuditItems[0].item" checked>
|
||
@foreach (var item in ViewBag.AuditItems[0].childItemTrees)
|
||
{
|
||
if (item.childItemTrees.Count > 0)
|
||
{
|
||
<input type="checkbox" lay-filter="icheck" id="@item.itemid" title="@item.item">
|
||
foreach (var childitem in item.childItemTrees)
|
||
{
|
||
if (childitem.childItemTrees.Count > 0)
|
||
{
|
||
<input type="checkbox" lay-filter="icheck" id="@childitem.itemid" title="@childitem.item">
|
||
}
|
||
}
|
||
}
|
||
|
||
}
|
||
</div>
|
||
|
||
</script>
|
||
|
||
<script>
|
||
var form;
|
||
layui.use(['table', 'layer', 'laydate', 'element', 'form'], function () {
|
||
var layer = layui.layer;
|
||
var laydate = layui.laydate;
|
||
var table = layui.table;
|
||
form = layui.form;
|
||
var element = layui.element;
|
||
var dropdown = layui.dropdown
|
||
var $ = layui.jquery;
|
||
var date = new Date();
|
||
//var st = date.getFullYear() + '-' + date.getMonth() + '-01';
|
||
var st = "2022-03-01";
|
||
var et = new Date(date.getFullYear() + '-' + (date.getMonth() + 1) + '-01');
|
||
laydate.render({ elem: '#stime', value: st });
|
||
laydate.render({ elem: '#etime', value: et });
|
||
laydate.render({ elem: '#btime', value: st });
|
||
laydate.render({ elem: '#ftime', value: et });
|
||
|
||
dropdown.render({
|
||
elem: '#export'
|
||
, trigger: 'hover'
|
||
, data: [{
|
||
title: '导出结算数据'
|
||
, id: 'income'
|
||
}, {
|
||
title: '导出资源结算数据'
|
||
, id: 'qc'
|
||
}, {
|
||
title: '导出结算预收数据'
|
||
, id: 'act'
|
||
}, {
|
||
title: '导出当前预估数据'
|
||
, id: 'cur'
|
||
}]
|
||
, click: function (data, othis) {
|
||
|
||
var eTime = $("#etime").val();
|
||
var fTime = $("#ftime").val();
|
||
|
||
$.r_post('/Performance/Export', { eTime, fTime, 'queryType': data.id }, function (rsp) {
|
||
if (rsp.result) {
|
||
layer.open({
|
||
type: 1
|
||
, title: false //不显示标题栏
|
||
, closeBtn: true
|
||
, area: '500px;'
|
||
, resize: true
|
||
, shade: 0.8
|
||
, id: 'LAY_layuipro' //设定一个id,防止重复弹出
|
||
, btn: ['立即下载', '取消']
|
||
, btnAlign: 'c'
|
||
, moveType: 1 //拖拽模式,0或者1
|
||
, content: '<div style="padding: 50px; line-height: 22px; background-color: #393D49; color: #fff; font-weight: 500;">' + rsp.result.retmsg.filemsg + '</div>'
|
||
, yes: function (index, layero) {
|
||
var btn = layero.find('.layui-layer-btn');
|
||
btn.find('.layui-layer-btn0').attr({
|
||
href: rsp.result.retmsg.filepath
|
||
, target: '_blank'
|
||
});
|
||
}
|
||
});
|
||
|
||
}
|
||
else {
|
||
layer.msg("操作失败了!", { icon: 2, time: 0 });
|
||
}
|
||
}, "json");
|
||
}
|
||
});
|
||
|
||
element.on('nav(docDemoNavBrief)', function (elem) {
|
||
id = this.getAttribute('id');
|
||
var ids = [0, 1, 2, 41, 23];
|
||
console.log(id);
|
||
console.log(ids);
|
||
if (id == 'monkey') {
|
||
$('#itemCheck').show();
|
||
$.r_post('/Performance/Query', { 'itemId': 0, 'queryType': 'income' }, function (trsp) {
|
||
auditItemResults = trsp.resultmonkey.auditItemResults.filter(r => r["income"] != 0)
|
||
table.render({
|
||
id: "table1",//列表别名ID
|
||
elem: "#table1",//表ID
|
||
even: true,
|
||
toolbar: "#toolbarDemo",
|
||
defaultToolbar: ['exports', { title: '刷新', layEvent: 'LAYRefresh', icon: 'layui-icon-refresh' }],
|
||
height: 900,
|
||
limit: Number.MAX_VALUE,
|
||
cols: [[
|
||
{ field: 'item', title: '渠道', width: 130, templet: '#itemTpl' }
|
||
, { field: 'income', title: '收入', style: 'color:red', sort: true }
|
||
, { field: 'monIncome', title: '当月收入', sort: true }
|
||
, { field: 'monIncomeper', title: '当月收入净收款比', sort: true }
|
||
, { field: 'depositreceived', title: '预收' }
|
||
, { field: 'depConsume', title: '渠道推广消费', sort: true }
|
||
, { field: 'consumeper', title: '推广消费占比', sort: true }
|
||
, { field: 'modulePrice', title: '订单金额', style: 'color:red', sort: true }
|
||
, { field: 'actualRefundprice', title: '实际退款', sort: true }
|
||
, { field: 'orderRefundprice', title: '总退款', style: 'color:blue', sort: true }
|
||
, { field: 'refundper', title: '退款比例', width: 90, sort: true }
|
||
, { field: 'payprice', title: '实际收款', style: 'color:red', sort: true }
|
||
, { field: 'checkCostprice', title: '当月成本', style: 'color:blue', sort: true }
|
||
, { field: 'costper', title: '成本占比', width: 90, sort: true }
|
||
]],
|
||
//data: auditItemResults.filter(r => r["parentId"] == 1 || r["parentId"] == 0),
|
||
data: auditItemResults.filter(r => ids.some(function (elem, index, arr) { return elem == r["parentId"] })),
|
||
done: function (res, curr, count) {
|
||
$('.layui-elem-quote').text(trsp.resultmonkey.remark);
|
||
$('.layui-table-tool').css("position", "unset");
|
||
ids.forEach(function (i) {
|
||
var mychek = $('#itemCheck input#' + i);
|
||
$(mychek).prop("checked", true);
|
||
});
|
||
form.render("checkbox");
|
||
}
|
||
|
||
});
|
||
|
||
form.on('checkbox(icheck)', function (data) {
|
||
ids = [0]
|
||
$('#itemCheck input:checked').each(function (i, j) {
|
||
ids.push(j.id);
|
||
});
|
||
table.reloadData('table1', {
|
||
data: auditItemResults.filter(r => ids.some(function (elem, index, arr) { return elem == r["parentId"] }))
|
||
});
|
||
|
||
});
|
||
|
||
});
|
||
} else {
|
||
$('#itemCheck').hide();
|
||
$.r_post('/Performance/Query', { 'itemId': id, 'queryType': 'income' }, function (trsp) {
|
||
|
||
auditItemResults = trsp.result.auditItemResults.filter(r => r["income"] != 0)
|
||
table.render({
|
||
id: "table1",//列表别名ID
|
||
elem: "#table1",//表ID
|
||
even: true,
|
||
toolbar: true,
|
||
defaultToolbar: ['exports', { title: '刷新', layEvent: 'LAYRefresh', icon: 'layui-icon-refresh' }],
|
||
height: 900,
|
||
limit: Number.MAX_VALUE,
|
||
cols: [[
|
||
{ field: 'mon', title: '月份', width: 80 }
|
||
, { field: 'income', title: '收入', style: 'color:red' }
|
||
, { field: 'monIncome', title: '当月收入' }
|
||
, { field: 'monIncomeper', title: '当月收入净收款比', sort: true }
|
||
, { field: 'depositreceived', title: '预收' }
|
||
, { field: 'depConsume', title: '渠道推广消费' }
|
||
, { field: 'consumeper', title: '推广消费占比' }
|
||
, { field: 'modulePrice', title: '订单金额', style: 'color:red' }
|
||
, { field: 'actualRefundprice', title: '实际退款' }
|
||
, { field: 'orderRefundprice', title: '总退款', style: 'color:blue' }
|
||
, { field: 'refundper', title: '退款比例', width: 90 }
|
||
, { field: 'payprice', title: '实际收款', style: 'color:red' }
|
||
, { field: 'checkCostprice', title: '当月成本', style: 'color:blue' }
|
||
, { field: 'costper', title: '成本占比', width: 90 }
|
||
|
||
]],
|
||
data: auditItemResults,
|
||
done: function (res, curr, count) {
|
||
$('.layui-elem-quote').text(trsp.result.remark);
|
||
$('.layui-table-tool').css("position", "unset");
|
||
}
|
||
|
||
});
|
||
});
|
||
|
||
}
|
||
|
||
});
|
||
|
||
var active = {
|
||
exec: function () {
|
||
var sTime = $("#stime").val();
|
||
var eTime = $("#etime").val();
|
||
var btime = $("#btime").val();
|
||
var ftime = $("#ftime").val();
|
||
//console.log(sTime);
|
||
//console.log(eTime);
|
||
$.r_post('/Performance/Exec', { sTime, eTime, btime, ftime }, function (rsp) {
|
||
if (rsp.result) {
|
||
layer.msg("操作成功!", { icon: 1, time: 0 });
|
||
}
|
||
else {
|
||
if (rsp.retmsg != "") {
|
||
layer.msg(rsp.retmsg, { icon: 2, time: 0 });
|
||
}
|
||
else {
|
||
layer.msg("操作失败了!", { icon: 2, time: 0 });
|
||
}
|
||
}
|
||
}, "json");
|
||
},
|
||
exec2: function () {
|
||
var sTime = $("#stime").val();
|
||
var eTime = $("#etime").val();
|
||
var btime = $("#btime").val();
|
||
var ftime = $("#ftime").val();
|
||
//console.log(sTime);
|
||
//console.log(eTime);
|
||
$.r_post('/Performance/Exec2', { sTime, eTime, btime, ftime }, function (rsp) {
|
||
if (rsp.result) {
|
||
layer.msg("操作成功!", { icon: 1, time: 0 });
|
||
}
|
||
else {
|
||
if (rsp.retcode == 100) {
|
||
layer.open({
|
||
content: '已经结算过了,请确认是否清除数据,重新结算,请谨慎操作!',
|
||
btn: ['清除数据重新结算', '取消'],
|
||
yes: function (index, layero) {
|
||
$.r_post('/Performance/FlushExec2', { sTime, eTime, btime, ftime }, function (rsp) {
|
||
if (rsp.result) {
|
||
layer.msg("操作成功!", { icon: 1, time: 0 });
|
||
}
|
||
else {
|
||
if (rsp.retmsg != "") {
|
||
|
||
layer.msg(rsp.retmsg, { icon: 2, time: 0 });
|
||
}
|
||
else {
|
||
layer.msg("操作失败了!", { icon: 2, time: 0 });
|
||
}
|
||
}
|
||
}, "json");
|
||
layer.close(index);
|
||
}
|
||
});
|
||
|
||
} else {
|
||
|
||
if (rsp.retmsg != "") {
|
||
|
||
layer.msg(rsp.retmsg, { icon: 2, time: 0 });
|
||
}
|
||
else {
|
||
layer.msg("操作失败了!", { icon: 2, time: 0 });
|
||
}
|
||
}
|
||
}
|
||
}, "json");
|
||
},
|
||
Gen_modulePrice: function () {
|
||
|
||
var btime = $("#btime").val();
|
||
var ftime = $("#ftime").val();
|
||
|
||
layer.open({
|
||
content: '请确认是否从:' + btime + '开始生成数据,请谨慎操作!',
|
||
btn: ['确认生成', '取消'],
|
||
yes: function (index, layero) {
|
||
$.r_post('/Performance/GenModule', { btime, ftime }, function (rsp) {
|
||
if (rsp.result) {
|
||
layer.msg("操作成功!", { icon: 1, time: 0 });
|
||
}
|
||
else {
|
||
if (rsp.retmsg != "") {
|
||
|
||
layer.msg(rsp.retmsg, { icon: 2, time: 0 });
|
||
}
|
||
else {
|
||
layer.msg("操作失败了!", { icon: 2, time: 0 });
|
||
}
|
||
}
|
||
}, "json");
|
||
layer.close(index);
|
||
}
|
||
});
|
||
|
||
}
|
||
};
|
||
|
||
$('.layui-btn').on('click', function () {
|
||
var othis = $(this), method = othis.data('method');
|
||
active[method] ? active[method].call(this, othis) : '';
|
||
});
|
||
|
||
$('#monkey').click();
|
||
});
|
||
</script>
|
||
|
||
<script type="text/html" id="itemTpl">
|
||
<span style="padding-left: {{=12*(d.level-1) }}px;"></span>
|
||
<span class="mspan">{{=d.item}} </span>
|
||
|
||
</script>
|
||
|