|
@@ -0,0 +1,349 @@
|
|
|
+<?php defined('InShopNC') or exit('Access Invalid!'); ?>
|
|
|
+<style>
|
|
|
+ .page .fixed-bar .item-title h3 {
|
|
|
+ margin-top:18px !important;
|
|
|
+ margin-bottom:10px !important;
|
|
|
+ font-weight:700 !important;
|
|
|
+ }
|
|
|
+ .tab-base li span {
|
|
|
+ font-size:12px !important;
|
|
|
+ }
|
|
|
+ .layui-form-select .layui-input {
|
|
|
+ height:26px;
|
|
|
+ }
|
|
|
+ input::placeholder{
|
|
|
+ color:#333;
|
|
|
+ }
|
|
|
+ .row_q ul li {
|
|
|
+ height: 30px;
|
|
|
+ line-height: 30px;
|
|
|
+ }
|
|
|
+ .row_w {
|
|
|
+ float: left;
|
|
|
+ margin-right: 40px;
|
|
|
+ }
|
|
|
+</style>
|
|
|
+<div class="page">
|
|
|
+ <div class="fixed-bar">
|
|
|
+ <div class="item-title">
|
|
|
+ <h3>带票对账统计</h3>
|
|
|
+ <ul class="tab-base">
|
|
|
+ <li><a href="index.php?act=refill_tax_stats&op=index&tax_type=provider"><span>上游对账记录</span></a></li>
|
|
|
+ <li><a href="JavaScript:void(0);" class="current"><span>下游对账记录</span></a></li>
|
|
|
+ <li><a href="index.php?act=refill_tax_stats&op=refill_tax_subject&tax_type=provider"><span>上游带票控制</span></a></li>
|
|
|
+ <li><a href="index.php?act=refill_tax_stats&op=refill_tax_subject&tax_type=merchant"><span>下游带票控制</span></a></li>
|
|
|
+ </ul>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="fixed-empty"></div>
|
|
|
+ <form method="get" name="formSearch" id="formSearch" class="layui-form">
|
|
|
+ <input type="hidden" value="refill_tax_stats" name="act">
|
|
|
+ <input type="hidden" value="index" name="op">
|
|
|
+ <input type="hidden" value="merchant" name="tax_type">
|
|
|
+ <input type="hidden" name="cid" value=""/>
|
|
|
+ <input type="hidden" name="default_no_mch" value="<?php echo $_GET['cid']; ?>"/>
|
|
|
+ <table class="tb-type1 noborder search">
|
|
|
+ <tbody>
|
|
|
+ <tr>
|
|
|
+ <th><label for="query_start_time">统计时间</label></th>
|
|
|
+ <td>
|
|
|
+ <input class="txt date" type="text" value="<?php echo $_GET['query_start_time']; ?>"
|
|
|
+ id="startTime" name="query_start_time" autocomplete="off" style="width:120px" />
|
|
|
+ <label for="query_start_time">~</label>
|
|
|
+ <input class="txt date" type="text" value="<?php echo $_GET['query_end_time']; ?>"
|
|
|
+ id="endTime" name="query_end_time" autocomplete="off" style="width:120px" />
|
|
|
+ </td>
|
|
|
+ <th><label>统计日期类型</label></th>
|
|
|
+ <td>
|
|
|
+ <select name="order_time_type" id="order_time_type">
|
|
|
+ <option value="">请选择...</option>
|
|
|
+ <option value="notify_time" <?php if($_GET['order_time_type'] == 'notify_time'){ echo 'selected';}?>>回调日期</option>
|
|
|
+ <option value="order_time" <?php if($_GET['order_time_type'] == 'order_time'){ echo 'selected';}?>>下单日期</option>
|
|
|
+ </select>
|
|
|
+ </td>
|
|
|
+ <th><label>商户名称</label></th>
|
|
|
+ <td>
|
|
|
+ <div id="selest_nc"></div>
|
|
|
+ </td>
|
|
|
+ <td><a href="javascript:void(0);" id="ncsubmit" class="btn-search "
|
|
|
+ title="<?php echo $lang['nc_query']; ?>"> </a>
|
|
|
+ </td>
|
|
|
+
|
|
|
+ </tr>
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+ </form>
|
|
|
+ <table class="table tb-type2" id="prompt">
|
|
|
+ <tbody>
|
|
|
+ <tr class="space odd">
|
|
|
+ <th colspan="12"><div class="title">
|
|
|
+ <h5>总量统计</h5>
|
|
|
+ <span class="arrow"></span></div></th>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <td class="row_q">
|
|
|
+ <ul class="row_w">
|
|
|
+ <li>回调日期统计</li>
|
|
|
+ <li class="lineLi" style="color:#000;">总计成功订单量: <?php echo $output['total_stats']['notify_time']['success_count_total'] ?? 0?></li>
|
|
|
+ <li class="lineLi" style="color:#000;">总计充值中订单量: <?php echo $output['total_stats']['notify_time']['send_count_total'] ?? 0?></li>
|
|
|
+ <li class="lineLi" style="color:#000;">总计成功订单金额:<?php echo $output['total_stats']['notify_time']['success_refill_amounts_total'] ?? 0?></li>
|
|
|
+ <li class="lineLi" style="color:#000;">总计下游扣款金额:<?php echo $output['total_stats']['notify_time']['success_mch_amounts_toatl'] ?? 0?></li>
|
|
|
+ <li class="lineLi" style="color:#000;">总计上游扣款金额:<?php echo $output['total_stats']['notify_time']['success_channel_amounts_total'] ?? 0?></li>
|
|
|
+ </ul>
|
|
|
+ <ul>
|
|
|
+ <li>下单日期统计</li>
|
|
|
+ <li class="lineLi" style="color:#000;">总计成功订单量: <?php echo $output['total_stats']['order_time']['success_count_total'] ?? 0?></li>
|
|
|
+ <li class="lineLi" style="color:#000;">总计充值中订单量: <?php echo $output['total_stats']['order_time']['send_count_total'] ?? 0?></li>
|
|
|
+ <li class="lineLi" style="color:#000;">总计成功订单金额:<?php echo $output['total_stats']['order_time']['success_refill_amounts_total'] ?? 0?></li>
|
|
|
+ <li class="lineLi" style="color:#000;">总计下游扣款金额:<?php echo $output['total_stats']['order_time']['success_mch_amounts_toatl'] ?? 0?></li>
|
|
|
+ <li class="lineLi" style="color:#000;">总计上游扣款金额:<?php echo $output['total_stats']['order_time']['success_channel_amounts_total'] ?? 0?></li>
|
|
|
+ </ul>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+ <form method="post" id="merchant_name_form">
|
|
|
+ <input type="hidden" name="form_submit" value="ok"/>
|
|
|
+ <table class="table tb-type2">
|
|
|
+ <thead>
|
|
|
+ <tr class="thead">
|
|
|
+ <th>统计日期</th>
|
|
|
+ <th>主体名称</th>
|
|
|
+ <th>主体ID</th>
|
|
|
+ <th class="align-right">成功订单数</th>
|
|
|
+ <th class="align-right">成功金额</th>
|
|
|
+ <th class="align-right">下游金额</th>
|
|
|
+ <th class="align-right">充值中数量</th>
|
|
|
+ <th class="align-left">统计日期类型</th>
|
|
|
+ <th class="align-center">操作</th>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ <tbody>
|
|
|
+ <?php if (!empty($output['stats_list']) && is_array($output['stats_list'])) { ?>
|
|
|
+ <?php foreach ($output['stats_list'] as $k => $v) { ?>
|
|
|
+ <tr class="trFlex">
|
|
|
+ <td><?php echo $v['time_text']; ?></td>
|
|
|
+ <td><?php echo $v['cname']; ?></td>
|
|
|
+ <td><?php echo $v['cid']; ?></td>
|
|
|
+ <td class="align-right"><?php echo $v['success_count']; ?></td>
|
|
|
+ <td class="align-right"><?php echo $v['success_refill_amounts']; ?></td>
|
|
|
+ <td class="align-right"><?php echo $v['success_mch_amounts']; ?></td>
|
|
|
+ <td class="align-right">
|
|
|
+ <?php if($v['send_count'] != 0){?>
|
|
|
+ <span style="color: #f30707">
|
|
|
+ <?php }?>
|
|
|
+ <?php echo $v['send_count']; ?>
|
|
|
+ </span>
|
|
|
+ </td>
|
|
|
+ <td class="align-left"><?php echo $output['order_time_type_text'][$v['order_time_type']]; ?></td>
|
|
|
+ <td class="align-center w200">
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ <?php } ?>
|
|
|
+ <?php } else { ?>
|
|
|
+ <tr class="no_data">
|
|
|
+ <td colspan="19"><?php echo $lang['nc_no_record']; ?></td>
|
|
|
+ </tr>
|
|
|
+ <?php } ?>
|
|
|
+ </tbody>
|
|
|
+ <tfoot>
|
|
|
+ <tr class="tfoot">
|
|
|
+ <td></td>
|
|
|
+ <td colspan="19">
|
|
|
+ <div class="pagination"><?php echo $output['show_page']; ?></div>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ </tfoot>
|
|
|
+ </table>
|
|
|
+ </form>
|
|
|
+</div>
|
|
|
+<script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/js/jquery.edit.js" charset="utf-8"></script>
|
|
|
+<script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/laydate/laydate.js"></script>
|
|
|
+<script type="text/javascript" src="<?php echo ADMIN_TEMPLATES_URL;?>/js/xm-select.js"></script>
|
|
|
+<script type="text/javascript" src="<?php echo ADMIN_TEMPLATES_URL;?>/layui/layui.js"></script>
|
|
|
+<link rel="stylesheet" type="text/css"
|
|
|
+ href="<?php echo ADMIN_TEMPLATES_URL; ?>/layui/css/layui.css"/>
|
|
|
+<script>
|
|
|
+ $(function () {
|
|
|
+ $("#ncreload").click(function () {
|
|
|
+ $('input[name="reload"]').val('1');
|
|
|
+ select_set()
|
|
|
+ $('#formSearch').submit();
|
|
|
+ })
|
|
|
+ $('#ncsubmit').click(function () {
|
|
|
+ select_set()
|
|
|
+ $('#formSearch').submit();
|
|
|
+ });
|
|
|
+ function select_set(){
|
|
|
+ let selectArr = selest_nc.getValue();
|
|
|
+ let selectStr = ''
|
|
|
+ for (let i = 0; i < selectArr.length; i++) {
|
|
|
+ selectStr += selectArr[i].value+','
|
|
|
+ }
|
|
|
+ selectStr = selectStr.substr(0, selectStr.length-1)
|
|
|
+ $('input[name="cid"]').val(selectStr);
|
|
|
+ console.log("selectStr", selectStr);
|
|
|
+ }
|
|
|
+ // 日期选择器
|
|
|
+ laydate.render({
|
|
|
+ elem: '#startTime',
|
|
|
+ type: 'datetime'
|
|
|
+ });
|
|
|
+ laydate.render({
|
|
|
+ elem: '#endTime',
|
|
|
+ type: 'datetime'
|
|
|
+ });
|
|
|
+ // 表格hover时背景
|
|
|
+ $('.trFlex').each(function () {
|
|
|
+ $(this).hover(function () {
|
|
|
+ $(this)[0].style.backgroundColor = '#cbe9f3'
|
|
|
+ },function() {
|
|
|
+ $(this)[0].style.backgroundColor = '#fff'
|
|
|
+ })
|
|
|
+ })
|
|
|
+ function JSONToExcelConvertor(JSONData, FileName, ShowLabel, headData) {
|
|
|
+ //先转化json
|
|
|
+ let arrData = typeof JSONData != 'object' ? JSON.parse(JSONData) : JSONData;
|
|
|
+ let excel = '<table>';
|
|
|
+ // 标题
|
|
|
+ for (const key in headData) {
|
|
|
+ var head = "<tr>";
|
|
|
+ var td = "<td colspan='12' style='font-size:16px;'>"+ headData[key] + '</td>';
|
|
|
+ excel += td + "</tr>";
|
|
|
+ }
|
|
|
+ //设置表头
|
|
|
+ var row = "<tr>";
|
|
|
+ for (var i = 0, l = ShowLabel.length; i < l; i++) {
|
|
|
+ row += "<th style='font-size:14px;'>" + ShowLabel[i].value + '</th>';
|
|
|
+ }
|
|
|
+ //换行
|
|
|
+ excel += row + "</tr>";
|
|
|
+ //设置数据
|
|
|
+ for (var i = 0; i < arrData.length; i++) {
|
|
|
+ var row = "<tr>";
|
|
|
+ let code = i+1
|
|
|
+ row += "<td>" +code+ "</td>"
|
|
|
+ row += '<td style=font-size:14px;'+ 'mso-number-format:"\@"'+ '>' + arrData[i].time_text + '</td>';
|
|
|
+ row += '<td style=font-size:14px;'+ 'mso-number-format:"\@"'+ '>' + arrData[i].cname + '</td>';
|
|
|
+ row += '<td style=font-size:14px;'+ 'mso-number-format:"\@"'+ '>' + arrData[i].cid + '</td>';
|
|
|
+ row += '<td style=font-size:14px;'+ 'mso-number-format:"\@"'+ '>' + arrData[i].success_count + '</td>';
|
|
|
+ row += '<td style=font-size:14px;'+ 'mso-number-format:"\@"'+ '>' + arrData[i].success_refill_amounts + '</td>';
|
|
|
+ row += '<td style=font-size:14px;'+ 'mso-number-format:"\@"'+ '>' + arrData[i].success_mch_amounts + '</td>';
|
|
|
+ row += '<td style=font-size:14px;'+ 'mso-number-format:"\@"'+ '>' + arrData[i].success_channel_amounts + '</td>';
|
|
|
+ row += '<td style=font-size:14px;'+ 'mso-number-format:"\@"'+ '>' + arrData[i].profit_amounts + '</td>';
|
|
|
+ row += '<td style=font-size:14px;'+ 'mso-number-format:"\@"'+ '>' + arrData[i].order_count + '</td>';
|
|
|
+ row += '<td style=font-size:14px;'+ 'mso-number-format:"\@"'+ '>' + arrData[i].cancel_count + '</td>';
|
|
|
+ row += '<td style=font-size:14px;'+ 'mso-number-format:"\@"'+ '>' + arrData[i].success_ratio + '</td>';
|
|
|
+ excel += row + "</tr>";
|
|
|
+ }
|
|
|
+ excel += "</table>";
|
|
|
+ var excelFile = "<html xmlns:o='urn:schemas-microsoft-com:office:office' xmlns:x='urn:schemas-microsoft-com:office:excel' xmlns='http://www.w3.org/TR/REC-html40'>";
|
|
|
+ excelFile += '<meta http-equiv="content-type" content="application/vnd.ms-excel; charset=UTF-8">';
|
|
|
+ excelFile += '<meta http-equiv="content-type" content="application/vnd.ms-excel';
|
|
|
+ excelFile += '; charset=UTF-8">';
|
|
|
+ excelFile += "<head>";
|
|
|
+ excelFile += "<!--[if gte mso 9]>";
|
|
|
+ excelFile += "<xml>";
|
|
|
+ excelFile += "<x:ExcelWorkbook>";
|
|
|
+ excelFile += "<x:ExcelWorksheets>";
|
|
|
+ excelFile += "<x:ExcelWorksheet>";
|
|
|
+ excelFile += "<x:Name>";
|
|
|
+ excelFile += "{worksheet}";
|
|
|
+ excelFile += "</x:Name>";
|
|
|
+ excelFile += "<x:WorksheetOptions>";
|
|
|
+ excelFile += "<x:DisplayGridlines/>";
|
|
|
+ excelFile += "</x:WorksheetOptions>";
|
|
|
+ excelFile += "</x:ExcelWorksheet>";
|
|
|
+ excelFile += "</x:ExcelWorksheets>";
|
|
|
+ excelFile += "</x:ExcelWorkbook>";
|
|
|
+ excelFile += "</xml>";
|
|
|
+ excelFile += "<![endif]-->";
|
|
|
+ excelFile += "</head>";
|
|
|
+ excelFile += "<body>";
|
|
|
+ excelFile += excel;
|
|
|
+ excelFile += "</body>";
|
|
|
+ excelFile += "</html>";
|
|
|
+ var uri = 'data:application/vnd.ms-excel;charset=utf-8,' + encodeURIComponent(excelFile);
|
|
|
+ var link = document.createElement("a");
|
|
|
+ link.href = uri;
|
|
|
+ link.style = "visibility:hidden";
|
|
|
+ link.download = FileName + ".xls";
|
|
|
+ document.body.appendChild(link);
|
|
|
+ link.click();
|
|
|
+ document.body.removeChild(link);
|
|
|
+ }
|
|
|
+ $('#ncexport').click(function () {
|
|
|
+ let selectArr = selest_nc.getValue();
|
|
|
+ let selectStr = ''
|
|
|
+ for (let i = 0; i < selectArr.length; i++) {
|
|
|
+ selectStr += selectArr[i].value+','
|
|
|
+ }
|
|
|
+ selectStr = selectStr.substr(0, selectStr.length-1)
|
|
|
+
|
|
|
+ let starTime = new Date($('input[name="query_start_time"]').val()).getTime()/1000;
|
|
|
+ let endTime = new Date($('input[name="query_end_time"]').val()).getTime()/1000;
|
|
|
+ let cid = selectStr
|
|
|
+ let order_time_type = $('#order_time_type').val()
|
|
|
+ $.get('index.php?act=orderstats&op=ExportData&type=merchant', {
|
|
|
+ query_start_time: starTime,
|
|
|
+ query_end_time: endTime,
|
|
|
+ cid: cid,
|
|
|
+ order_time_type:order_time_type
|
|
|
+ }, function (data) {
|
|
|
+ data = JSON.parse(data)
|
|
|
+ if (data && data.data) {
|
|
|
+ let time = ''
|
|
|
+ let head = ''
|
|
|
+ let admin_name = '<?php echo ADMIN_NAME;?>'
|
|
|
+ if (admin_name === 'YEZI') {
|
|
|
+ head = ['北京椰子电子商务有限责任公司']
|
|
|
+ } else {
|
|
|
+ head = ['北京椰林网络科技有限责任公司']
|
|
|
+ }
|
|
|
+ if (starTime && endTime) {
|
|
|
+ time = '统计时间:'+$('input[name="query_start_time"]').val()+' - '+$('input[name="query_end_time"]').val()
|
|
|
+ } else if (starTime) {
|
|
|
+ time = '统计时间:'+$('input[name="query_start_time"]').val()
|
|
|
+ }
|
|
|
+ if (time) {
|
|
|
+ head.push(time)
|
|
|
+ }
|
|
|
+ head.push('总计成功订单数量:' + parseInt(data.total_stats.success_count_total))
|
|
|
+ head.push('总计成功订单金额:' + parseFloat(data.total_stats.success_refill_amounts_total))
|
|
|
+ head.push('总计下游扣款金额:' + parseFloat(data.total_stats.success_mch_amounts_toatl))
|
|
|
+ head.push('总计上游扣款金额:' + parseFloat(data.total_stats.success_channel_amounts_total))
|
|
|
+ head.push('总计利润金额:' + parseFloat(data.total_stats.profit_amounts_total))
|
|
|
+ let title = [{value: "序号"},{value: "统计日期"},{value: "主体名称"},{value: "主体ID"},{value: "成功订单数"},{value: "成功金额"},{value: "下游金额"},{value: "上游金额"},{value: "利润"},{value: "订单总量"}, {value: "失败订单数量"},{value: "成功占比"}]
|
|
|
+ JSONToExcelConvertor(data.data, '下游对账记录', title, head)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ //多选
|
|
|
+ let selest_nc
|
|
|
+ let default_no_mch = $('input[name="default_no_mch"]').val().split(',');
|
|
|
+ $.get('index.php?act=refill_tax_stats&op=merchant_data', function (data) {
|
|
|
+ data = JSON.parse(data)
|
|
|
+ if (default_no_mch) {
|
|
|
+ for (let index = 0; index < default_no_mch.length; index++) {
|
|
|
+ for (let j = 0; j < data.length; j++) {
|
|
|
+ if (default_no_mch[index] === data[j].value) {
|
|
|
+ data[j].selected = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ selest_nc = xmSelect.render({
|
|
|
+ el: '#selest_nc',
|
|
|
+ size: 'mini',
|
|
|
+ filterable: true,
|
|
|
+ style: {
|
|
|
+ minHeight: '27px',
|
|
|
+ lineHeight: '27px',
|
|
|
+ marginLeft: '4px',
|
|
|
+ width: '250px'
|
|
|
+ },
|
|
|
+ data: data
|
|
|
+ })
|
|
|
+ })
|
|
|
+ });
|
|
|
+</script>
|