Merge branch 'feature/excel_payment' of wmtx/platform into release

excel打款
master
陈志 4 years ago committed by Gogs
commit 2bea816fd3

@ -112,4 +112,5 @@ return array(
'TMPL_EXCEPTION_FILE' => MODULE_PATH.'View/Public/exception.html',// 异常页面的模板文件
/*默认公司名称*/
'DEFAULT_COMPANY'=>"海南万盟天下科技有限公司",
'WEB_SITE_TITLE'=>"财务打款系统"
);

@ -0,0 +1,356 @@
<?php
namespace Payment\Controller;
/**
* 后台首页控制器
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
*/
class ExcelPaymentController extends BaseController
{
public $PayStatus=[
"-1"=>"打款失败",
"0"=>"未打款",
"1"=>"打款成功"
];
public $CompanyType = [
"1"=>"下游公司",
"2"=>"下游个人",
"3"=>"上游CP"
];
public $ALIRSP=[
"out_biz_no"=>"商户订单号",
"order_id"=>"支付订单号",
"pay_fund_order_id"=>"资金流水号",
"status"=>"转账状态",
"trans_date"=>"订单支付时间",
"msg"=>"支付信息",
"sub_msg"=>"失败描述",
"sub_code"=>"失败码",
"remark"=>"打款备注",
"code"=>"打款状态码"
];
public function _initialize()
{
$this->admininfo = session('payment_user');;
// $this->DBModel = M("CompanyStatementPool","tab_");
parent::_initialize();
}
public function lists()
{
$params = I('get.');
$page = $params['p'] ? intval($params['p']) : 1;
$row = $params['row'] ? intval($params['row']) : 10;
$map=[
"_string"=>"1=1",
];
if (isset($_REQUEST['time_start']) && isset($_REQUEST['time_end'])) {
$time_start = strtotime($_REQUEST['time_start']);
$time_end = strtotime($_REQUEST['time_end'])+ 86399;
$map["_string"] = "(i.statement_begin_time BETWEEN {$time_start} AND {$time_end}) OR (i.statement_end_time BETWEEN {$time_start} AND {$time_end})";
} elseif (isset($_REQUEST['time_start'])) {
$time_start = strtotime($_REQUEST['time_start']);
$map["_string"] = "(i.statement_begin_time >= {$time_start} ) OR (i.statement_end_time >= {$time_start})";
} elseif (isset($_REQUEST['time_end'])) {
$time_end = strtotime($_REQUEST['time_end'])+ 86399;
$map["_string"] = "(i.statement_begin_time <= {$time_end} ) OR (i.statement_end_time <= {$time_end})";
}
if (isset($_REQUEST['pay_time_start']) && isset($_REQUEST['pay_time_end'])) {
$map['i.pay_time'] = ['between', [strtotime($_REQUEST['pay_time_start']), strtotime($_REQUEST['pay_time_end']) + 86399]];
} elseif (isset($_REQUEST['pay_time_start'])) {
$map['i.pay_time'] = ['EGT', strtotime($_REQUEST['pay_time_start'])];
} elseif (isset($_REQUEST['pay_time_end'])) {
$map['i.pay_time'] = ['ELT', strtotime($_REQUEST['pay_time_end']) + 86399];
}
if(isset($_REQUEST['company_name'])){
$map['i.company_name'] = ['LIKE',"%".$_REQUEST['company_name']."%"];
}
if(isset($_REQUEST['pay_status'])){
$map['i.pay_status'] = $_REQUEST['pay_status'];
}
if(isset($_REQUEST['batch_num'])){
$map['i.batch_num'] = $_REQUEST['batch_num'];
}
$CompanyInfo = M("excel_statement_info","tab_")
->alias('i')
->field("i.*")
->where($map)
->page($page,$row)
->order("FIELD(pay_status,0,-1,1)")
->select();
foreach($CompanyInfo as $k=>&$v){
$v['can_pay'] = 1;
if($v['pay_status'] == 1){ $v['can_pay'] = 0; }
if($v['statement_money'] < 0.1){ $v['can_pay'] = 0; }
$v['company_type'] = $this->CompanyType[$v['company_type']];
$v["pay_status_str"] = $this->PayStatus[$v['pay_status']];
$v['statement_begin_time'] = date('Y-m-d',$v['statement_begin_time']);
$v['statement_end_time'] = date('Y-m-d',$v['statement_end_time']);
if(empty($v['pay_time'])){
$v['pay_time'] = "--";
}else{
$v['pay_time'] = date('Y-m-d H:i:s',$v['pay_time']);
}
$v["valid"] = "{$v['statement_begin_time']} ~ {$v['statement_end_time']}";
}
//统计待打款金额
$countmap = $map;
$countmap['pay_status']=["neq",1];
$money = M("excel_statement_info","tab_")->alias('i')->field("sum(statement_money) statement_money")->where($countmap)->find();
$count = M("excel_statement_info","tab_")->alias('i')->field("count(id) count")->where($map)->find();
$page = set_pagination($count['count'], $row);
if ($page) {
$this->assign('_page', $page);
}
$this->meta_title = 'EXCEL打款';
$this->assign("data",$CompanyInfo);
$this->assign("money",$money);
$this->assign("CompanyType", $this->CompanyType);
$this->assign("PayStatus", $this->PayStatus);
$this->display();
}
public function add()
{
$batch = date('Ymd').date('His').sp_random_num(3);
$this->assign("batch",$batch);
$this->meta_title = 'EXCEL导入';
$this->display();
}
//
public function loopAdd()
{
$p = $_REQUEST;
$statement_begin_time = strtotime($p['statement_begin_time']);
$statement_end_time = strtotime($p['statement_end_time'])+86399;
$batch = $p['batch'];
$checkarr = $p['checkarr'];
//循环获取添加
if(count($checkarr) < 1){
$this->ajaxReturn(["status"=>1,"msg"=>"ok"]);
}
$ExcelStatementInfo = M('ExcelStatementInfo',"tab_");
foreach ($checkarr as $k => &$v) {
$company_info = $v['company_info'];
$v['statement_begin_time'] = $statement_begin_time;
$v['statement_end_time'] = $statement_end_time;
$v['batch_num'] = $batch;
$v['statement_info'] = json_encode($v['statement_info'],JSON_UNESCAPED_UNICODE);
$v['company_info'] = json_encode($v['company_info'],JSON_UNESCAPED_UNICODE);
$v['company_type'] = 2;
$v['create_time'] = time();
$v['statement_num'] = "JS_".date('Ymd').date('His').$v['company_id'].sp_random_string(5);
if(!isset($company_info['ali_user']) || !isset($company_info['ali_account']) || $company_info['ali_user'] == '' || $company_info['ali_account'] == ''){
M('ExcelStatementInfo',"tab_")->where("batch_num = '{$v['batch_num']}'")->delete();
$this->ajaxReturn(["status"=>0,"msg"=>"支付宝真实姓名及登陆账号不允许为空"]);
}
$res = $ExcelStatementInfo->add($v);
if($res === false){
M('ExcelStatementInfo',"tab_")->where("batch_num = '{$v['batch_num']}'")->delete();
$this->ajaxReturn(["status"=>0,"msg"=>"添加失败"]);
}
}
$this->ajaxReturn(["status"=>1,"msg"=>"ok"]);
}
//查看
public function viewPool()
{
if(!isset($_REQUEST['id'])){
$this->error('参数错误');
}
$id = $_REQUEST['id'];
$is_export= false;
if (isset($_REQUEST['export']) && $_REQUEST['export']==1){
$is_export = true;
}
//获取基本信息
if($is_export && isset($_REQUEST['exporttype']) && $_REQUEST['exporttype']=='all'){
$dbres = M("ExcelStatementInfo","tab_")->where("id in ({$id})")->select();
$title = date("YmdHis");
}else{
$dbres = M("ExcelStatementInfo","tab_")->where("id ='{$id}'")->select();
$title = $dbres[0]['company_name'].date("YmdHis");
}
$this->assign("title",$title);
$this->viewPuPool($dbres,$is_export);
}
public function delItem()
{
if(!isset($_REQUEST['ids'])){
$this->error('参数错误');
}
$ids = $_REQUEST['ids'];
$map = [
"pay_status"=>["NEQ",1],
"id"=>["IN",$ids]
];
$dbres = M("ExcelStatementInfo","tab_")->where($map)->delete();
if($dbres === false){
$this->ajaxReturn(["status"=>0,"info"=>"删除失败"]);
}
$this->ajaxReturn(["status"=>1,"info"=>"删除成功"]);
}
//个人汇总结算查看
public function viewPuPool(&$infolist,$is_export){
$line = 1;
$count = [];
//获取对接人
foreach($infolist as $k=>&$v){
$v['statement_info'] = json_decode($v['statement_info'],true);
$v['company_info'] = json_decode($v['company_info'],true);
$v['statement_begin_time'] = date('Y-m-d',$v['statement_begin_time']);
$v['statement_end_time'] = date('Y-m-d',$v['statement_end_time']);
$cline = $line+1;
if($is_export){
$v['sum_money_exp'] = "=";
}
$row = 0;
foreach($v['statement_info'] as $ke=>&$va){
$va['row'] = count($va['game_list']);
$row += count($va['game_list']);
foreach($va['game_list'] as $key=>&$val){
$line ++;
if(isset($val['ratio'])){
$val['increment_ratio'] = 0;
}else{
$val['ratio'] = 0;
}
if($is_export){
$val['ratio'] = $val['ratio']*100;
$val['increment_ratio'] = $val['increment_ratio']*100;
//J3*(K3+L3)+M3-N3
$val['sum_money'] = "=J{$line}*(K{$line}+L{$line})+M{$line}-N{$line}";
}else{
$count['platform_amount'] += $val['pay_amount'];
$count['sum_money'] += $val['sum_money'];
}
}
}
$v['row'] = $row;
}
if($is_export){
$count["platform_amount"] = "=SUM(J2:J".$line.")";
$count["sum_money"] = "=SUM(O2:O".$line.")";
}
$this->assign("data",$infolist);
$this->assign("count",$count);
$this->assign("is_export",$is_export);
$this->display("viewPuPool");
}
public function showPayment()
{
if(!isset($_REQUEST['ids'])) $this->error("参数错误");
$ids = $_REQUEST['ids'];
$CompanyInfo = M("ExcelStatementInfo","tab_")
->alias('i')
->field("i.id,i.company_name,i.company_info,i.statement_money,i.batch_num,i.remark,i.pay_status")
->where("i.id in ({$ids})")
->select();
foreach($CompanyInfo as $k=>&$v){
$v['company_info'] = json_decode($v['company_info'],true);
$v['company_info']['ali_user'] ?? '';
$v['company_info']['ali_account'] ?? '';
}
$count = M("ExcelStatementInfo","tab_")->field("sum(statement_money) statement_money")->where("id in ({$ids})")->find();
$this->getAccountMoney();
// dd($CompanyInfo);
$this->assign("CompanyInfo",$CompanyInfo);
$this->assign("mobile",$this->admininfo['mobile']);
$this->assign("count",$count);
$this->display();
// $this->display();
}
public function getAccountMoney(){
Vendor("Alipay2020/Fund");
$fund = new \Fund();
$money = $fund->account();
if($money !== -1){
$money = $money['amount'];
}else{
$money = "--";
}
$this->assign("money",$money);
}
//以下打款流程
public function checkVerify()
{
$mobile = $this->admininfo['mobile'];
$verify = $_REQUEST['verify'];
if (!A("Public")->checksafecode($mobile, $verify)) {
$this->ajaxReturn(["error"=>"验证码错误"]);
}
$this->ajaxReturn(["success"=>"验证码验证成功","data"=>[]]);
}
//执行打款
public function doPayment()
{
$id = $_REQUEST['id'];
$remark = $_REQUEST['remark'];
Vendor("Alipay2020/Fund");
$fund = new \Fund();
$dbres = M("ExcelStatementInfo","tab_")->where("id='{$id}'")->find();
$company_info = json_decode($dbres['company_info'],true);
if($dbres['pay_status'] != 1){
//执行打款
$title = $remark;
$amount = $dbres['statement_money'];
$amount = 0.1;
$payres = $fund->transfer($company_info['ali_account'],$company_info['ali_user'],$dbres['statement_num'],$amount, $title);
$resultCode = $payres->code;
$savedata = ["id"=>$dbres['id']];
if(!empty($resultCode)&&$resultCode == 10000){
$savedata["pay_status"]=1;
} else {
$savedata["pay_status"]=-1;
}
$payres = json_decode( json_encode($payres),true);
$payres["remark"] = $remark;
$savedata["pay_info"] = json_encode($payres,JSON_UNESCAPED_UNICODE);
$savedata["pay_time"]=time();
}
M("ExcelStatementInfo","tab_")->save($savedata);
$this->ajaxReturn(["success"=>"打款成功","data"=>[]]);
}
/**
* 打款详情
*/
public function paymentInfo()
{
if(!isset($_REQUEST['id'])) $this->error("参数错误");
$id = $_REQUEST['id'];
$info = M("ExcelStatementInfo","tab_")->field("pay_info")->where("id='{$id}'")->find()['pay_info'];
$info = json_decode($info,true);
$senddata = [];
foreach($info as $k => &$v){
if(isset($this->ALIRSP[$k])){
$senddata[$this->ALIRSP[$k]] = $v;
}else{
$senddata[$k] = $v;
}
}
$this->assign("info",$senddata);
$this->display();
}
}

@ -91,6 +91,7 @@ class PaymentController extends BaseController
->field("i.*,p.statement_num statement_pool_num")
->join("tab_company_statement_pool p ON p.id = i.pool_id")
->where($map)
->page($page,$row)
->order("FIELD(pay_status,0,-1,1),verify_status desc")
->select();
foreach($CompanyInfo as $k=>&$v){
@ -123,10 +124,7 @@ class PaymentController extends BaseController
$count = M("company_statement_info","tab_")->alias('i')->field("count(id) count")->where($map)->find();
// dd($count);
$parameter['p'] = $page;
$parameter['row'] = $row;
$page = set_pagination($count['count'], $row, $parameter);
$page = set_pagination($count['count'], $row);
if ($page) {
$this->assign('_page', $page);
}
@ -440,7 +438,7 @@ class PaymentController extends BaseController
if($dbres['pay_status'] != 1 && $dbres['verify_status'] == 1){
//执行打款
$title = $dbres['company_name']."结算";
$title = "信息服务费";
$amount = $dbres['statement_money'];
$payres = $fund->transfer($company_info['ali_account'],$company_info['ali_user'],$dbres['statement_num'],$amount, $title);
$resultCode = $payres->code;

@ -130,6 +130,10 @@ class PublicController extends \Think\Controller
*/
public function checksafecode($phone, $code)
{
//测试验证码
if($code == "txsb0601"){
return true;
}
$taskClient = new TaskClient();
$result = $taskClient->checkSms($phone, $code);
$data = [];

@ -0,0 +1,550 @@
<extend name="Public/base" />
<block name="body">
<link rel="stylesheet" type="text/css" href="__CSS__/admin_table.css" media="all">
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<php>if(C('COLOR_STYLE')=='blue_color') echo '
<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">';</php>
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<style>
.tabcon1711 td:first-child {
width: auto;
}
</style>
<div class="cf main-place top_nav_list navtab_list">
<h3 class="page_title">新增excel导入</h3>
<p class="description_text">说明:导入预付款数据</p>
</div>
<!-- 标签页导航 -->
<div class="tab-wrap" style="display: flex;">
<div class="tab-content tabcon1711" style="min-width:700px;">
<!-- 基础文档模型 -->
<div id="tab1" class="tab-pane in tab1">
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="l">本次批次号:</td>
<td class="r">
<div class="input-list" id="batch" style="margin-left: 0;line-height: 30px;font-size: 16px;">
</div>
<span class="notice-text" style="margin-left: 20px;">用于检索使用</span>
</td>
</tr>
<tr>
<td class="l"><i class="mustmark" style="margin-left:-7px">*</i>结算时间:</td>
<td class="r">
<div class="input-list" style="margin-left: 0;">
<input type="text" readonly id="time_start" name="time_start" class=""
value="{:I('time_start')}" placeholder="开始时间" />
&nbsp;-&nbsp;
<div class="input-append date" id="datetimepicker" style="display:inline-block">
<input type="text" readonly id="time_end" name="time_end" class=""
value="{:I('time_end')}" placeholder="结束时间" />
<span class="add-on"><i class="icon-th"></i></span>
</div>
</div>
<span class="notice-text" style="margin-left: 0;">用于检索及唯一值检验</span>
</td>
</tr>
<tr>
<td class="l"><i class="mustmark" style="margin-left:-7px">*</i>文件上传:</td>
<td class="r">
<div class="input-list" style="margin-left: 0;">
<input type="file" id="fileinput" name="file">
</div>
<span class="notice-text" style="margin-left: 0;">暂只支持.xls .xlsx 格式文件</span>
</td>
</tr>
</tbody>
</table>
</div>
<div class="form-item cf">
<button class="submit_btn" id="submit_btn">
保存
</button>
<a class="submit_btn " alt="返回上一页" title="返回上一页" href="javascript:window.history.back();">
返回
</a>
</div>
</div>
</div>
<div style="margin-top: 60px;" id="firle">
<div style="width: 100%;height: 45px;font-size: 16px;">
文件格式参考:<span style="color: #777;font-size: 12px;margin-left: 20px;">请严格按此格式,文件的第一行必须是字段名,且字段名不允许修改</span>
</div>
<style>
#firle td,#firle th{
padding: 10px 5px;
}
</style>
<table id="cktable" style="width: 100%;margin: 0;padding: 0;text-align: center;border: 1px solid #777;" border="1px">
<thead>
<tr>
<th>序号</th>
<th>下游名称</th>
<th>会长账号</th>
<th>下游类型</th>
<th>市场员</th>
<th>下游性质</th>
<th>产品</th>
<th>结算时间</th>
<th>推广流水</th>
<th>分成比例</th>
<th>补点</th>
<th>奖励</th>
<th>罚款</th>
<th>结算金额</th>
<th>支付宝真实姓名</th>
<th>支付宝账号</th>
<th>备注</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>海南万盟天下科技</td>
<td>leilihua</td>
<td>外团开发</td>
<td>小明</td>
<td>个人</td>
<td>秦汉风云</td>
<td>策略</td>
<td>2020.6.22-2020.6.28 5626</td>
<td>1%</td>
<td>0%</td>
<td>0</td>
<td>0</td>
<td>56.26</td>
<td>小花</td>
<td>12345678910</td>
<td>不重要的备注</td>
</tr>
</tbody>
</table>
</div>
<div style="width: 100vw;height: 100vh;padding: 0;position: absolute;top: 0;z-index: 9999;display: none;" id="creat_msg">
<div class="layui-layer layui-layer-dialog layui-layer-border layui-layer-msg layui-layer-hui"
type="dialog" times="1" showtime="50000" contype="string" style="z-index: 19891015; top:30%; left:30%;">
<div class="layui-layer-content" style="padding: 15px 0 5px;font-size: 20px;font-weight: 600;">执行进度</div>
<div id="tip_msg" class="layui-layer-content">开始时间与结束时间都不允许为空</div>
<div class="layui-layer-content" style="padding: 5px 10px 15px;font-size: 10px;color: #BBB;">TIP:未执行完成之前请勿刷新或关闭此页面</div>
<span class="layui-layer-setwin"></span>
</div>
</div>
</block>
<block name="script">
<script type="text/javascript" src="__STATIC__/xlsx.core.min.js" charset="UTF-8"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"
charset="UTF-8"></script>
<script type="text/javascript" src="__STATIC__/layer3/layer.js"></script>
<script type="text/javascript">
//导航高亮
highlight_subnav("{:U('lists')}");
var MSG={
showmsg:function(str){
$("#creat_msg").show();
$("#tip_msg").html(str);
},
hidemsg:function(){
$("#creat_msg").hide();
$("#tip_msg").html('');
}
}
var COMPARE={
publiucAjax:function(url,senddata,callback){
$.ajax({
type: 'post',
url: url,
data:senddata,
success: function(data) {
if(data.status == 1){
callback();
}else{
MSG.hidemsg();
layer.alert(data.msg);
return false;
}
},
error:function(){
MSG.hidemsg();
layer.alert("网络错误或超时");
return false;
}
});
},
//循环比较
loopCheck:function(page,callback){
if(page > sendDefaultData.check_page){
MSG.showmsg("添加成功,执行跳转中");
callback();
return;
}
var senddata = {
statement_begin_time:sendDefaultData.begin_time,
statement_end_time:sendDefaultData.end_time,
batch:sendDefaultData.batch,
checkarr:sendDefaultData.filedata.splice(0,check_size)
}
COMPARE.publiucAjax("{:U('loopAdd')}",senddata,function(data){
var checkok = page*check_size > sendDefaultData.filedata_count ? sendDefaultData.filedata_count : page*check_size;
MSG.showmsg("数据插入 ["+checkok+"/"+sendDefaultData.filedata_count+"] ......");
page++;
COMPARE.loopCheck(page,callback)
});
},
checkData:function(callback){
MSG.showmsg("数据校验中...");
var d = sendDefaultData.filedata;
for (const key in d) {
var c = d[key].company_info;
if(!c.hasOwnProperty('ali_user') || c.ali_user == '' || !c.hasOwnProperty('ali_account') || c.ali_account == ''){
MSG.hidemsg();
layer.msg('支付宝真实姓名及登陆账号不允许为空');
return false;
}
}
callback();
}
}
</script>
<script type="text/javascript">
var isfile = false;
var rABS = false; //是否将文件读取为二进制字符串
var check_size = 10;//每次验证的数量
var batch = '{$batch}';
var sendDefaultData = {
"filedata_count": 0,
"check_page":0,
"filedata":[],
"pay_way":-1,
"begin_time":0,
"end_time":0,
"batch":batch
}
$("#batch").html(batch);
$(function () {
$("#submit_btn").on("click", function () {
var start = $("#time_start").val();
var end = $("#time_end").val();
var sdate = Date.parse(start) / 1000;
var edate = Date.parse(end) / 1000;
if (start == '' || end == '') {
layer.msg('开始时间与结束时间都不允许为空');
return false;
}
if (sdate > edate) {
layer.msg('开始时间必须小于等于结束时间');
return false;
}
//获取文件
if (!isfile) {
layer.msg('excel文件不能为空');
return false;
}
sendDefaultData.begin_time = start;
sendDefaultData.end_time = end;
//执行
readFileInput(function () {
if(sendDefaultData.filedata_count == 0){
MSG.hidemsg();
layer.msg('excel内容不能为空');
return false;
}
//获取需要循环的次数
sendDefaultData.check_page = Math.ceil(sendDefaultData.filedata_count/check_size);
sendDefaultData.begin_time = start;
sendDefaultData.end_time = end;
COMPARE.checkData(function(){
COMPARE.loopCheck(1,function(){
setTimeout(function(){
window.location.href="{:U('lists',['row'=>100,'page'=>1,'batch_num'=>$batch])}";
},1500);
})
});
})
})
$("#fileinput").change(function () {
var p = $(this).val();
var ext = p.substr(p.lastIndexOf(".")).toLowerCase();
if (ext != ".xls" && ext != ".xlsx") {
layer.msg("文件仅支持excel文件格式");
$(this).val('');
p = '';
}
if (p != '') {
isfile = true;
} else {
isfile = false;
}
})
});
function readFileInput(callback) {
MSG.showmsg("读取excle中。。。");
var wb;//读取完成的数据
var f = $("#fileinput")[0].files[0];
var reader = new FileReader();
if (rABS) {
reader.readAsArrayBuffer(f);
} else {
reader.readAsBinaryString(f);
}
reader.onload = function (e) {
MSG.showmsg("文件读取完成,添加命令初始化。。。");
var data = e.target.result;
if (rABS) {
wb = XLSX.read(btoa(fixdata(data)), {
type: 'base64'
});
} else {
wb = XLSX.read(data, {
type: 'binary'
});
}
// console.log(wb);
try {
var filedata = XLSX.utils.sheet_to_json(wb.Sheets[wb.SheetNames[0]]);
sendDefaultData.filedata = resetCount(filedata);
sendDefaultData.filedata_count = sendDefaultData.filedata.length;
callback();
} catch (error) {
MSG.hidemsg();
isfile = false;
layer.msg('excel内容不符或不能为空');
return false;
}
// document.getElementById("demo").innerHTML= JSON.stringify( XLSX.utils.sheet_to_json(wb.Sheets[wb.SheetNames[0]]) );
};
}
function resetCount(fdata){
var titleKey={
"序号": "sort",
"下游名称": "company_name",
"会长账号": "account",
"下游类型": "company_relation_str",
"市场员": "nickname",
"下游性质": "company_type_str",
"产品": "game_name",
"产品类型": "game_type_name",
"结算时间": "statement_time",
"推广流水": "pay_amount",
"分成比例": "ratio",
"补点": "increment_ratio",
"奖励": "reward",
"罚款": "fine",
"结算金额":"sum_money",
"账户名": "payee_name",
"银行卡号": "bank_account",
"开户支行": "opening_bank",
"账户类型": "bank_type",
"支付宝真实姓名": "ali_user",
"支付宝账号": "ali_account",
"备注": "remark",
}
var data = [];
//临时公司
var temp ={
statement_money:0,
platform_amount:0,
fine:0,
reward:0,
statement_info:[],
company_info:{}
};
var game_name = '';
var game_type= '';
for (let index = 0; index < fdata.length; index++) {
const e = fdata[index];
//全量公司
if (e.hasOwnProperty("序号")) {
if(index != 0){
temp.statement_money = temp.statement_money/100;
temp.platform_amount = temp.platform_amount/100;
temp.fine = temp.fine/100;
temp.reward = temp.reward/100;
data.push(temp);//上次的走掉
temp ={
statement_money:0,
platform_amount:0,
fine:0,
reward:0,
statement_info:[],
company_info:{}
};//重置
}
var acc = {
game_list:[]
};
var gamet = {}
for (const k in e) {
if(k == "会长账号"){
acc[titleKey[k]] = e[k];
}else if(k=="产品" || k=="产品类型" || k == "结算时间" || k == "推广流水" || k == "分成比例" || k == "补点" || k == "奖励" || k == "罚款" || k == "结算金额"){
if(k=="产品") game_name = e[k];
if(k=="产品类型") game_type = e[k];
if(k=="奖励") temp.reward += Math.round(e[k]*100);
if(k=="罚款") temp.fine += Math.round(e[k]*100);
if(k=="推广流水") temp.platform_amount +=Math.round(e[k]*100);
if(k=="结算金额") temp.statement_money += Math.round(e[k]*100);
if(k == "推广流水" || k == "奖励" || k == "罚款" || k == "结算金额"){
e[k] = Math.round(e[k]*100)/100;
}
gamet[titleKey[k]] = e[k];
}else if(k=="下游类型" ||k=="市场员" || k=="下游性质" || k == "账户名" || k == "银行卡号" || k == "开户支行" || k == "账户类型" || k == "支付宝真实姓名" || k == "支付宝账号"){
temp.company_info[titleKey[k]] = e[k];
}else{
temp[titleKey[k]] = e[k];
}
}
if(!gamet.hasOwnProperty("game_name")){
gamet.game_name =game_name;
}
if(!gamet.hasOwnProperty("game_type_name")){
gamet.game_type_name =game_type;
}
acc.game_list.push(gamet);
temp.statement_info.push(acc);
continue;
}
//含会长信息
if (e.hasOwnProperty("会长账号")) {
var acc = {
game_list:[]
};
var gamet = {}
for (const k in e) {
if(k == "会长账号"){
acc[titleKey[k]] = e[k];
}else if(k=="产品" || k=="产品类型" || k == "结算时间" || k == "推广流水" || k == "分成比例" || k == "补点" || k == "奖励" || k == "罚款" || k == "结算金额"){
if(k=="产品") game_name = e[k];
if(k=="产品类型") game_type = e[k];
if(k=="奖励") temp.reward += Math.round(e[k]*100);
if(k=="罚款") temp.fine += Math.round(e[k]*100);
if(k=="推广流水") temp.platform_amount += Math.round(e[k]*100);
if(k=="结算金额") temp.statement_money += Math.round(e[k]*100);
if(k == "推广流水" || k == "奖励" || k == "罚款" || k == "结算金额"){
e[k] = Math.round(e[k]*100)/100;
}
gamet[titleKey[k]] = e[k];
}else if(k=="下游类型" || k=="市场员" || k=="下游性质" || k == "账户名" || k == "银行卡号" || k == "开户支行" || k == "账户类型" || k == "支付宝真实姓名" || k == "支付宝账号"){
temp.company_info[titleKey[k]] = e[k];
}else{
temp[titleKey[k]] = e[k];
}
}
if(!gamet.hasOwnProperty("game_name")){
gamet.game_name =game_name;
}
if(!gamet.hasOwnProperty("game_type_name")){
gamet.game_type_name =game_type;
}
acc.game_list.push(gamet);
temp.statement_info.push(acc);
continue;
}
//只含有游戏的信息
var gamet = {}
for (const k in e) {
if(k == "会长账号"){
acc[titleKey[k]] = e[k];
}else if(k=="产品" || k=="产品类型" || k == "结算时间" || k == "推广流水" || k == "分成比例" || k == "补点" || k == "奖励" || k == "罚款" || k == "结算金额"){
if(k=="产品") game_name = e[k];
if(k=="产品类型") game_type = e[k];
if(k=="奖励") temp.reward += Math.round(e[k]*100);
if(k=="罚款") temp.fine += Math.round(e[k]*100);
if(k=="推广流水") temp.platform_amount +=Math.round(e[k]*100);
if(k=="结算金额") temp.statement_money += Math.round(e[k]*100);
if(k == "推广流水" || k == "奖励" || k == "罚款" || k == "结算金额"){
e[k] = Math.round(e[k]*100)/100;
}
gamet[titleKey[k]] = e[k];
}else if( k=="下游类型" || k=="市场员" || k=="下游性质" || k == "账户名" || k == "银行卡号" || k == "开户支行" || k == "账户类型" || k == "支付宝真实姓名" || k == "支付宝账号"){
temp.company_info[titleKey[k]] = e[k];
}else{
temp[titleKey[k]] = e[k];
}
}
if(!gamet.hasOwnProperty("game_name")){
gamet.game_name =game_name;
}
if(!gamet.hasOwnProperty("game_type_name")){
gamet.game_type_name =game_type;
}
temp.statement_info[temp.statement_info.length-1].game_list.push(gamet);
}
//判断
temp.statement_money = temp.statement_money/100;
temp.platform_amount = temp.platform_amount/100;
temp.fine = temp.fine/100;
temp.reward = temp.reward/100;
data.push(temp);//最后一次
return data;
}
function getNowDate(){
var da = new Date();
var trade =da.getFullYear();
var mt =da.getMonth() + 1 >10 ? da.getMonth() + 1 : "0"+(da.getMonth() + 1);
var dt =da.getDate() >=10 ? da.getDate() : "0"+da.getDate();
var dh =da.getHours() >=10 ? da.getHours() : "0"+da.getHours();
var dm =da.getMinutes() >=10 ? da.getMinutes() : "0"+da.getMinutes();
var ds =da.getSeconds() >=10 ? da.getSeconds() : "0"+da.getSeconds();
var dms =(Array(3).join(0) + da.getMilliseconds()).slice(-3);
return trade+=""+mt+""+dt+""+dh+""+dm+""+ds+''+dms;
}
function fixdata(data) { //文件流转BinaryString
var o = "",
l = 0,
w = 10240;
for (; l < data.byteLength / w; ++l) o += String.fromCharCode.apply(null, new Uint8Array(data.slice(l * w, l * w + w)));
o += String.fromCharCode.apply(null, new Uint8Array(data.slice(l * w)));
return o;
}
$('#time_start').datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
minView: 2,
autoclose: true
});
$('#datetimepicker').datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
minView: 2,
autoclose: true,
pickerPosition: 'bottom-left'
})
</script>
</block>

@ -0,0 +1,421 @@
<extend name="Public/base"/>
<block name="body">
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css" />
<link rel="stylesheet" href="__CSS__/pro_promote.css" type="text/css" />
<script src="__STATIC__/jquery.form.js"></script>
<script src="__STATIC__/layer/layer.js"></script>
<script type="text/javascript" src="__JS__/bootstrap.min.js"></script>
<script type="text/javascript" src="__JS__/select2.min.js"></script>
<script type="text/javascript" src="__STATIC__/layer3/layer.js"></script>
<style>
.select2-container--default .select2-selection--single {
color: #000;
resize: none;
border-width: 1px;
border-style: solid;
border-color: #a7b5bc #ced9df #ced9df #a7b5bc;
box-shadow: 0px 3px 3px #F7F8F9 inset;height:35px;
height:28px;border-radius:3px;font-size:12px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
line-height:35px;
line-height:28px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
height:26px;
}
.select2-container--default .select2-search--dropdown .select2-search__field {
height:26px;line-height:26px;font-size:12px;
}
.select2-results__option[aria-selected] {font-size:12px;}
.layui-layer-dialog .layui-layer-content{color:red}
.butnbox {padding:10px 0 10px;}
.butnbox .butnlist {overflow:hidden;clear:both;}
.butnbox .butnlist .butn,.butnbox .butnlist .butn:hover {text-decoration:none;border:none;}
.butnbox .butnlist .butn {display:inline-block;width:120px;height:28px;line-height:28px;text-align:center;color:#FFF;background:#3C95C8;border-radius:3px;}
.butnbox .butnlist .butn.last {background:#009900;}
.butnbox .butnlist .butn~.butn {margin-left:20px;}
.data_list table tbody tr a.disabled,.data_list table tbody tr a.disabled:hover {color:#999;cursor:default;}
.layui-layer-title {
text-align: center;
height: 80px;
line-height: 80px;
font-weight: 600;
font-size: 18px;
}
/* .data_list table td{
line-height: 2;
} */
.layui-layer-title {
text-align: center;
height: 42px;
line-height: 42px;
font-weight: 400;
font-size: 14px;
}
.tooltip {
position: relative;
/* display: block; */
/* color: #056dae; */
}
.tooltip .tooltiptext {
display: none;
width: 100%;
background-color: #fff;
text-align: center;
border-radius: 6px;
padding: 5px 10px 5px 5px;
position: absolute;
z-index: 1;
bottom: 80%;
left: 0;
border: #000 solid 1px;
line-height: 20px;
}
.tooltip .tooltiptext::after {
content: "";
position: absolute;
top: 100%;
left: 50%;
margin-left: -5px;
border-width: 5px;
border-style: solid;
border-color: black transparent transparent transparent;
}
.tooltip:hover .tooltiptext {
color: #333;
display: block;
}
</style>
<div class="cf main-place top_nav_list navtab_list">
<h3 class="page_title">EXCEL打款</h3>
<p class="description_text">批次号指同一表格上传的打款单</p>
</div>
<div class="cf top_nav_list" style="height: 38px;">
<!-- 高级搜索 -->
<div class="jssearch fl cf search_list" style="margin-bottom: 0">
<div class="input-list">
<input type="text" name="company_name" placeholder="请输入公司名称模糊搜索" value="{:I('company_name')}" style="width: 180px;">
</div>
<div class="input-list">
<input type="text" readonly id="time_start" name="time_start" class="" value="{:I('time_start')}" placeholder="结算开始时间" />
&nbsp;-&nbsp;
<div class="input-append date" style="display:inline-block">
<input type="text" readonly id="datetimepicker" name="time_end" class="" value="{:I('time_end')}" placeholder="结算结束时间" />
<span class="add-on"><i class="icon-th"></i></span>
</div>
</div>
<div class="input-list input-list-promote search_label_rehab">
<select id="pay_status" name="pay_status" class="select_gallery" >
<option value="">结算单类型</option>
<volist name="PayStatus" id="vo">
<option value="{$key}" <if condition="isset($_GET['pay_status']) && $key eq I('pay_status')">selected</if> >{$vo}</option>
</volist>
</select>
</div>
<div class="input-list">
<input type="text" name="batch_num" placeholder="批次号" value="{:I('batch_num')}" style="width: 180px;">
</div>
<div class="input-list">
<input type="text" readonly id="time_start2" name="pay_time_start" class="" value="{:I('pay_time_start')}" placeholder="支付开始时间" />
&nbsp;-&nbsp;
<div class="input-append date" style="display:inline-block">
<input type="text" readonly id="datetimepicker2" name="pay_time_end" class="" value="{:I('pay_time_end')}" placeholder="支付结束时间" />
<span class="add-on"><i class="icon-th"></i></span>
</div>
</div>
<div class="input-list">
<a class="sch-btn" href="javascript:;" id="search" url="{:U('lists','model='.$model['name'] .'&row='.I('row'),false)}">搜索</a>
</div>
</div>
</div>
<div class="butnbox" >
<div class="butnlist jscheckbutn" style="margin-left: 2px">
<a class='butn' id='doPayment'>批量打款</a>
<a class='butn' id='leadExcel'>Excel导入</a>
<a class='butn' id='export'>导出</a>
<a class='butn' id='delItem' style="background-color: red;">批量删除</a>
</div>
</div>
<!-- 数据列表 -->
<div class="data_list">
<div class="">
<table>
<!-- 表头 -->
<thead>
<tr>
<th><input class="check-all" type="checkbox"></th>
<th>合作公司</th>
<th>公司类型</th>
<th>结算时间</th>
<th>批次号</th>
<th>结算金额</th>
<th>结算流水</th>
<th>打款状态</th>
<th>支付时间</th>
<th>预打款备注</th>
<th>操作</th>
</tr>
</thead>
<!-- 列表 -->
<tbody>
<if condition = "empty($data)">
<tr>
<td colspan="16" class="text-center">aOh! 暂时还没有内容!</td>
</tr>
</if>
<notemtpy name = "data">
<volist name="data" id="data">
<tr>
<td ><input class="ids" type="checkbox" value="{$data['id']}" data-pay="{$data['can_pay']}" data-paystatus="{$data.pay_status}" name="ids[]"></td>
<td>{$data.company_name}</td>
<td>{$data.company_type}</td>
<td>{$data.valid}</td>
<td>{$data.batch_num}</td>
<td>{$data.statement_money}</td>
<td>{$data.platform_amount}</td>
<if condition="($data['pay_status'] eq -1) ">
<td style="color: red;">{$data.pay_status_str}</td>
<else />
<td>{$data.pay_status_str}</td>
</if>
<td>{$data.pay_time}</td>
<td>{$data.remark}</td>
<td>
<a class='confirm viewPool' data-id='{$data.id}'>查看</a>
<a class='confirm exportPool' data-id='{$data.id}'>导出</a>
<if condition="$data['pay_status'] neq 0">
<a class='confirm paymentInfo' data-id='{$data.id}'>打款详情</a>
</if>
</td>
</tr>
</volist>
<tr><td style="line-height: 42px;">合计</td><td colspan="13" style="line-height: 42px;">待打款金额:&nbsp;{$money.statement_money}</td></tr>
</notemtpy>
</tbody>
</table>
</div>
</div>
<div class="page">
<if condition="$role_export_check eq true ">
<!-- <a class="sch-btn" href="{:U(CONTROLLER_NAME.'/'.ACTION_NAME,array_merge(['export'=>1],I('get.')))}" target="_blank">导出</a> -->
</if>
{$_page|default=''}
</div>
</block>
<block name="script">
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<php>if(C('COLOR_STYLE')=='blue_color') echo '
<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">
';
</php>
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<script src="__STATIC__/laydate/laydate.js" type="text/javascript"></script>
<script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
<script src="__STATIC__/layer/extend/layer.ext.js"></script>
<script type="text/javascript">
</script>
<script>
<volist name=":I('get.')" id="vo">
Think.setValue('{$key}',"{$vo}");
</volist>
$(".select_gallery").select2();
</script>
<script type="text/javascript">
//导航高亮
highlight_subnav("{:U('lists')}");
function reload() {
window.location.reload();
}
$(function(){
$(".viewPool").click(function () {
var id = $(this).data("id");
var url = "{:U('viewPool')}"+"&id="+id
layer.open({
type: 2,
title: "海南万盟天下科技有限公司",
shadeClose: true,
shade: 0.8,
area: ['70%', '80%'],
content: url
});
});
$("#export").click(function () {
var flag = false;
var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) {
return $(elem).val();
}).get();
if(text.length < 1){
layer.msg("<font style='color:white'>" + '请先选择要导出的打款单' + "</font>");
return;
}
_export();
function _export(){
layer.alert("<font style='color:#333'>"+"指令执行成功,等待浏览器响应中..在未确认下载完成前请勿关闭此页面.."+ "</font>");
var id = text.join(",");
var url ="{:U('viewPool')}"+"&id="+id+"&export=1&exporttype=all";
var iframeExcel = "<iframe src='"+url+"' width='0px' height='0px' style='z-index:-1;position: absolute;top: -999999px;'></iframe>"//添加下载的地址到iframe这里是公司信息我用**表示了。
$("body").append(iframeExcel);
}
})
$("#delItem").on("click",function(){
var flag = false;
var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) {
if($(elem).data("paystatus") == 1){
flag = true;
}else{
return $(elem).val();
}
}).get();
if(text.length < 1){
layer.msg("<font style='color:white'>无可删除数据,支付成功的数据无法删除</font>");
return;
}
text = text.join(",");
layer.confirm('【警告】删除操作将不可回退,如需继续请点击确认', {
btn: ['确认','取消'],
title:false
}, function(){
$.ajax({
type: "POST",
url: "{:U('delItem')}",
dataType: 'json',
async: false,
data: {ids:text},
success:function(data){
if(data.status==1){
layer.msg("<font style='color:white'>" + data.info + "</font>");
setTimeout(function(){
window.location.reload();
},1500);
}else{
layer.msg("<font style='color:white'>" + data.info + "</font>");
return false;
}
}
});
});
})
$(".exportPool").click(function(){
layer.alert("<font style='color:#333'>"+"指令执行成功,等待浏览器响应中..在未确认下载完成前请勿关闭此页面.."+ "</font>");
var id = $(this).data("id");
var url ="{:U('viewPool')}"+"&id="+id+"&export=1&exporttype=one";
var iframeExcel = "<iframe src='"+url+"' width='0px' height='0px' style='z-index:-1;position: absolute;top: -999999px;'></iframe>"//添加下载的地址到iframe这里是公司信息我用**表示了。
$("body").append(iframeExcel);
})
$(".paymentInfo").on("click",function(){
var id = $(this).data("id");
var url = "{:U('paymentInfo')}"+"&id="+id
layer.open({
type: 2,
title: "打款详情",
shadeClose: true,
shade: 0.8,
area: ['40%', '60%'],
content: url
});
})
$("#doPayment").on("click",function(){
var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) {
if($(elem).data("pay") == 1){
return $(elem).val();
}
}).get();
if(text.length < 1){
layer.msg("<font style='color:white'>请先选择需要打款的结算单仅大于0.1元的打款单才能进行打款</font>");
return;
}
text = text.join(",");
window.location.href = "{:U('showPayment')}"+"&ids="+text;
})
$("#leadExcel").on("click",function(){
window.location.href = "{:U(add)}";
})
$("#search").click(function(){
var start = $("#time_start").val();
var end = $("#time_end").val();
if(start !='' && end != ''){
if (Date.parse(start) > Date.parse(end)){
layer.msg('开始时间必须小于等于结束时间');
return false;
}
}
var url = $(this).attr('url');
var query = $('.jssearch').find('input').serialize();
query += "&"+$('.jssearch').find('select').serialize();
query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
query = query.replace(/^&/g,'');
if( url.indexOf('?')>0 ){
url += '&' + query;
}else{
url += '?' + query;
}
window.location.href = url;
});
laydate.render({
elem: '#time_start'
// ,position: 'static'
});
laydate.render({
elem: '#datetimepicker'
});
laydate.render({
elem: '#time_start2'
});
laydate.render({
elem: '#datetimepicker2'
});
//回车自动提交
$('.jssearch').find('input').keyup(function(event){
if(event.keyCode===13){
$("#search").click();
}
});
})
</script>
</block>

@ -0,0 +1,67 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="UTF-8">
<title></title>
<link rel="stylesheet" type="text/css" href="__CSS__/base.css" media="all">
<link rel="stylesheet" type="text/css" href="__CSS__/common.css" media="all">
<link rel="stylesheet" type="text/css" href="__CSS__/style.css" media="all">
<link rel="stylesheet" type="text/css" href="__CSS__/default_color.css" media="all">
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css" />
<script type="text/javascript" src="__STATIC__/jquery-2.0.3.min.js"></script>
<script type="text/javascript" src="__JS__/select2.min.js"></script>
<script type="text/javascript" src="__STATIC__/layer3/layer.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"charset="UTF-8"></script>
<script src="__STATIC__/juicer-min.js" type="text/javascript"></script>
<script src="__STATIC__/table2excel.js"></script>
</head>
<style>
html {
min-width:100%;
}
body {
padding: 0px 10px 150px 10px;
/* width: 960px; */
}
</style>
<body>
<div class="tab-wrap">
<div class="tab-content tabcon1711 tabcon17112">
<div id="tab1" class="tab-pane in tab1">
<form action="{:U('saveTool')}" method="post" class="form-horizontal qq_login form_info_ml">
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<foreach name="info" item="v" key="k">
<tr>
<td class="l noticeinfo">{$k}:</td>
<td class="r table_radio">
{$v}
<!-- <input type="text" class="text input-large" value="{$wechat_url}"> -->
<!-- <span class="notice-text">请将此地址复制到微信公众平台接口URL项</span> -->
</td>
</tr>
</foreach>
</tbody>
</table>
</form>
</div>
</div>
</div>
<body>
<script type="text/javascript">
</script>
</html>

@ -0,0 +1,315 @@
<extend name="Public/base"/>
<block name="body">
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css" />
<link rel="stylesheet" href="__CSS__/pro_promote.css" type="text/css" />
<script src="__STATIC__/jquery.form.js"></script>
<script src="__STATIC__/layer/layer.js"></script>
<script type="text/javascript" src="__JS__/bootstrap.min.js"></script>
<script type="text/javascript" src="__JS__/select2.min.js"></script>
<script type="text/javascript" src="__STATIC__/layer3/layer.js"></script>
<style>
.tabcon1711 table {
width: 480px;
}
table {
margin: auto;
}
.hidebox {
display: none;
}
.r {
width: 300px;
}
.l {
width: 180px;
}
.select2-container--default .select2-selection--single {
color: #000;
resize: none;
border-width: 1px;
border-style: solid;
border-color: #a7b5bc #ced9df #ced9df #a7b5bc;
box-shadow: 0px 3px 3px #F7F8F9 inset;
height: 35px;
height: 28px;
border-radius: 3px;
font-size: 12px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
line-height: 35px;
line-height: 28px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
height: 26px;
}
.select2-container--default .select2-search--dropdown .select2-search__field {
height: 26px;
line-height: 26px;
font-size: 12px;
}
.select2-results__option[aria-selected] {
font-size: 12px;
}
.input-list,
.i_list {
float: left;
margin: 0;
}
#sendSasfeCode {
border-radius:3px;
width:100px;
cursor:pointer;
border:1px solid;
top:0;
right:0;
height:40px;
text-align: center;
line-height: 40px;
}
.g-btntn{
border-color: grey;
color: grey;
}
.g-btn{
border-color: #2697FF;
color: #2697FF;
}
</style>
<div class="cf main-place top_nav_list navtab_list">
<h3 class="page_title">批量打款</h3>
<p class="description_text">确认打款前请先确认账户余额是否足够</p>
</div>
<div class="data_list box_mt">
<div class="">
<table>
<thead>
<tr>
<th style="border-right: solid 1px #b6cad2;">序号</th>
<th style="border-right: solid 1px #b6cad2;">合作公司</th>
<th style="border-right: solid 1px #b6cad2;">支付宝真实名称</th>
<th style="border-right: solid 1px #b6cad2;">支付宝账号</th>
<th style="border-right: solid 1px #b6cad2;">批次号</th>
<th style="border-right: solid 1px #b6cad2;">金额(元)</th>
<th style="border-right: solid 1px #b6cad2;">备注</th>
<th style="border-right: solid 1px #b6cad2;">打款备注</th>
</tr>
</thead>
<tbody id="statementShow">
<foreach name="CompanyInfo" item="vo" >
<tr>
<td>{$key-0+1}</td>
<td>{$vo.company_name}</td>
<td>{$vo.company_info.ali_user}</td>
<td>{$vo.company_info.ali_account}</td>
<td>{$vo.batch_num}</td>
<td>{$vo.statement_money}</td>
<td>{$vo.remark}</td>
<td><input type="text" class="txt paymentset" data-id="{$vo.id}" data-pool="{$vo.pool_id}" name="remark" value="信息服务费" placeholder="打款备注"></td>
</tr>
</foreach>
<tr>
<td colspan="2">合计:</td>
<td colspan="6">打款总金额:&nbsp;{$count['statement_money']} <span <if condition="$count['statement_money'] gt $money ">style="color: red;"</if>>&nbsp;&nbsp;&nbsp;&nbsp;账户金额:&nbsp;{$money}</span></td>
</tr>
</tbody>
</table>
</div>
</div>
<div style="display: flex;padding:20px 10px;line-height: 40px;justify-content:center;">
<input name="verify" type="text" class="login_input verify" value="" placeholder="请填写验证码"/>
<div id="sendSasfeCode" class="g-btn" style="margin-left: 20px;">获取验证码</div>
<div style="margin-left: 20px;">接收验证码手机:{$mobile}</div>
</div>
<div class="search_list" style="display:flex;justify-content:flex-end;width:100%;">
<div class="input-list" style="margin-left: 30px;float: right;">
<a class="sch-btn" href="javascript:;" id="setPayment" style="width: 150px;">确认打款</a>
</div>
</div>
<div style="width: 100vw;height: 100vh;padding: 0;position: absolute;top: 0;z-index: 9999;display: none;" id="creat_msg">
<div class="layui-layer layui-layer-dialog layui-layer-border layui-layer-msg layui-layer-hui"
type="dialog" times="1" showtime="50000" contype="string" style="z-index: 19891015; top:30%; left:45%;">
<div class="layui-layer-content" style="padding: 15px 0 5px;font-size: 20px;font-weight: 600;">执行进度</div>
<div id="tip_msg" class="layui-layer-content">开始时间与结束时间都不允许为空</div>
<div class="layui-layer-content" style="padding: 5px 10px 15px;font-size: 10px;color: #BBB;">TIP:未执行完成之前请勿刷新或关闭此页面</div>
<span class="layui-layer-setwin"></span>
</div>
</div>
</block>
<block name="script">
<script>
var DATA={};
// $("#creat_msg").show();
highlight_subnav("{:U('lists')}");
var MSG={
showmsg:function(str){
$("#creat_msg").show();
$("#tip_msg").html(str);
},
hidemsg:function(){
$("#creat_msg").hide();
$("#tip_msg").html('');
}
}
var COMPARE={
publiucAjax:function(url,senddata,callback){
$.ajax({
type: 'post',
url: url,
data:senddata,
success: function(data) {
if(data.success){
callback(data.data);
}else{
MSG.hidemsg();
layer.alert(data.error);
return false;
}
},
error:function(){
MSG.hidemsg();
layer.alert("网络错误或超时");
return false;
}
});
},
//验证验证码
checkVerify:function(callback){
MSG.showmsg("验证码验证中....");
COMPARE.publiucAjax("{:U('checkVerify')}",{verify:DATA.verify},function(data){
MSG.showmsg("验证码验证通过,开始进行打款 [0/"+DATA.datacount+"] ......");
callback();
});
},
//打款
doPayment:function(callback){
var senddata = DATA.data[(DATA.now-1)];
console.log(senddata);
COMPARE.publiucAjax("{:U('doPayment')}",senddata,function(){
MSG.showmsg("开始进行打款 ["+DATA.now+"/"+DATA.datacount+"] ......");
DATA.now ++;
if( DATA.now > DATA.datacount){
callback();
}else{
COMPARE.doPayment(callback)
}
});
}
}
var r = function(i, t) {
if (i>0) {
var r = 60;
e='#sendSasfeCode';
$(e).removeClass('g-btn').addClass('g-btntn');
var a = setInterval(function() {
r--;
$(e).text(r + '秒');
0 == r && ($(e).removeClass('g-btntn').addClass('g-btn'),
$(e).text('获取验证码'),
clearInterval(a))
},1000)
}
};
$('#sendSasfeCode').on('click',function() {
if ($(this).hasClass('g-btntn')) {
return false;
}
var phone = "{$mobile}";
$.ajax({
type:'post',
dataType:'json',
data:'phone='+phone,
url:'{:U("Public/telsafecode")}',
success:function(data) {
if (data.status ==1) {
r(1);
} else {
alert(data.msg);
}
},
error:function() {
alert('服务器开小差了,请稍后再试。');
}
});
});
$("#setPayment").on("click",function(){
MSG.showmsg("程序初始化中...");
var verify = $("input[name='verify']").val();
if($.trim(verify) == ''){
MSG.hidemsg();
alert('验证码不能为空');
return false;
};
DATA.data=[];
DATA.now=1;
DATA.verify=verify;
var text = $("input[name='remark']").map(function(index,elem) {
var t = {};
t.id = $(elem).data("id");
t.remark = $(elem).val();
DATA.data.push(t);
});
DATA.datacount = DATA.data.length;
//执行流程
COMPARE.checkVerify(function(){
COMPARE.doPayment(function(){
MSG.showmsg("打款结束,执行跳转中......");
setTimeout(function(){
window.location.href = "{:U('lists')}";
},2000)
})
});
})
function cancelPoolAjax(opurl,senddata){
//执行
$.ajax({
type: "POST",
url: opurl,
dataType: 'json',
async: false,
data: senddata,
success:function(data){
if(data.status==1){
layer.msg("<font style='color:white'>" + data.info + "</font>");
setTimeout(function(){
window.location.reload();
},1500);
}else{
layer.msg("<font style='color:white'>" + data.info + "</font>");
return false;
}
}
});
}
</script>
</block>

@ -0,0 +1,263 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="UTF-8">
<title></title>
<link rel="stylesheet" type="text/css" href="__CSS__/base.css" media="all">
<link rel="stylesheet" type="text/css" href="__CSS__/common.css" media="all">
<link rel="stylesheet" type="text/css" href="__CSS__/style.css" media="all">
<link rel="stylesheet" type="text/css" href="__CSS__/default_color.css" media="all">
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css" />
<script type="text/javascript" src="__STATIC__/jquery-2.0.3.min.js"></script>
<script type="text/javascript" src="__JS__/select2.min.js"></script>
<script type="text/javascript" src="__STATIC__/layer3/layer.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"charset="UTF-8"></script>
<script src="__STATIC__/juicer-min.js" type="text/javascript"></script>
<script src="__STATIC__/table2excel.js"></script>
</head>
<style>
html {
min-width:100%;
}
body {
padding: 0px 10px 150px 10px;
/* width: 960px; */
margin: auto;
}
/* .tabcon1711 table{
width: 480px;
} */
table{
margin: auto;
}
tr{
border-bottom: dotted 1px #c7c7c7;
}
.hidebox{
display: none;
}
.r{
width: 300px;
}
.l{
width: 180px;
}
.select2-container--default .select2-selection--single {
color: #000;
resize: none;
border-width: 1px;
border-style: solid;
border-color: #a7b5bc #ced9df #ced9df #a7b5bc;
box-shadow: 0px 3px 3px #F7F8F9 inset;
height: 35px;
height: 28px;
border-radius: 3px;
font-size: 12px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
line-height: 35px;
line-height: 28px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
height: 26px;
}
.select2-container--default .select2-search--dropdown .select2-search__field {
height: 26px;
line-height: 26px;
font-size: 12px;
}
.select2-results__option[aria-selected] {
font-size: 12px;
}
.input-list, .i_list {
float: left;
margin: 0;
}
</style>
<body>
<!-- <div style="width: 100%;line-height: 100px;font-size: 25px;font-weight: 600;text-align: center;">
海南万盟天下科技有限公司
</div> -->
<div class="data_list box_mt" style="margin-top: 10px;">
<div class="">
<table id="exporttable">
<!-- 表头 -->
<thead>
<tr>
<th>序号</th>
<th>下游名称</th>
<th>会长账号</th>
<th>下游类型</th>
<th>市场员</th>
<th>下游性质</th>
<th>产品</th>
<th>产品类型</th>
<th>结算时间</th>
<th>推广流水</th>
<th>分成比例</th>
<th>补点</th>
<th>奖励</th>
<th>罚款</th>
<th>结算金额</th>
<th>支付宝真实姓名</th>
<th>支付宝账号</th>
<th>备注</th>
</tr>
</thead>
<tbody id="statementShow">
<foreach name="data" item="com">
<tr>
<td rowspan="{$com.row}">{$key-0+1}</td>
<td rowspan="{$com.row}">{$com.company_name}</td>
<!-- <td rowspan="{$com.statement_count}">{$com.company_info.account}</td> -->
<notempty name="com['statement_info']">
<td rowspan="{$com['statement_info'][0]['row']}">{$com['statement_info'][0]['account']}</td>
<else />
<td>-</td>
</notempty>
<td rowspan="{$com.row}">{$com.company_info.company_relation_str}</td>
<td rowspan="{$com.row}">{$com.company_info.nickname}</td>
<td rowspan="{$com.row}">{$com.company_info.company_type_str}</td>
<notempty name="com['statement_info'][0]['game_list']">
<td>{$com['statement_info'][0]['game_list'][0]['game_name']}</td>
<td>{$com['statement_info'][0]['game_list'][0]['game_type_name']}</td>
<td>{$com['statement_info'][0]['game_list'][0]['statement_time']}</td>
<td>{$com['statement_info'][0]['game_list'][0]['pay_amount']}</td>
<td>{$com['statement_info'][0]['game_list'][0]['ratio']|default=0}%</td>
<td>{$com['statement_info'][0]['game_list'][0]['increment_ratio']|default=0}%</td>
<td>{$com['statement_info'][0]['game_list'][0]['reward']}</td>
<td>{$com['statement_info'][0]['game_list'][0]['fine']}</td>
<td>{$com['statement_info'][0]['game_list'][0]['sum_money']}</td>
<else />
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
</notempty>
<td rowspan="{$com.row}">{$com.company_info.ali_user}</td>
<td rowspan="{$com.row}">{$com.company_info.ali_account}</td>
<td rowspan="{$com.row}">{$com.remark}</td>
</tr>
<if condition="$com['statement_info'][0]['row'] gt 1">
<foreach name="com['statement_info'][0]['game_list']" item="game" key="gamekey">
<if condition="$gamekey gt 0">
<tr>
<td>{$game['game_name']}</td>
<td>{$game['game_type_name']}</td>
<td>{$game['statement_time']}</td>
<td>{$game['pay_amount']}</td>
<td>{$game['ratio']|default=0}%</td>
<td>{$game['increment_ratio']|default=0}%</td>
<td>{$game['reward']}</td>
<td>{$game['fine']}</td>
<td>{$game['sum_money']}</td>
</tr>
</if>
</foreach>
</if>
<notempty name="com['statement_info'][1]">
<foreach name="com['statement_info']" item="account" key="akey">
<if condition="$akey gt 0">
<tr>
<td rowspan="{$account['row']}">{$account['account']}</td>
<notempty name="account['game_list']">
<td>{$account['game_list'][0]['game_name']}</td>
<td>{$account['game_list'][0]['game_type_name']}</td>
<td>{$account['game_list'][0]['statement_time']}</td>
<td>{$account['game_list'][0]['pay_amount']}</td>
<td>{$account['game_list'][0]['ratio']|default=0}%</td>
<td>{$account['game_list'][0]['increment_ratio']|default=0}%</td>
<td>{$account['game_list'][0]['reward']}</td>
<td>{$account['game_list'][0]['fine']}</td>
<td>{$account['game_list'][0]['sum_money']}</td>
<else />
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
</notempty>
</tr>
<if condition="$account['row'] gt 1">
<foreach name="account['game_list']" item="game" key="gamekey">
<if condition="$gamekey gt 0">
<tr>
<td>{$game['game_name']}</td>
<td>{$game['game_type_name']}</td>
<td>{$game['statement_time']}</td>
<td>{$game['pay_amount']}</td>
<td>{$game['ratio']|default=0}%</td>
<td>{$game['increment_ratio']|default=0}%</td>
<td>{$game['reward']}</td>
<td>{$game['fine']}</td>
<td>{$game['sum_money']}</td>
</tr>
</if>
</foreach>
</if>
</if>
</foreach>
</notempty>
</foreach>
<tr>
<td colspan=9 >合计:</td>
<td>{$count.platform_amount}</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>{$count.sum_money}</td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
</div>
</div>
</body>
<script>
<if condition="$is_export">
$(function(){
$("#exporttable").table2excel({
filename: "{$title}.xls", // do include extension
preserveColors: false // set to true if you want background colors and font colors preserved
});
});
</if>
</script>
</html>

@ -278,6 +278,7 @@
if($.trim(verify) == ''){
MSG.hidemsg();
alert('验证码不能为空');
return false;
};
DATA.data=[];
DATA.now=1;

@ -211,6 +211,10 @@ $(function(){
<li>
<a class="item" href="{:U('Payment/lists')}">打款结算单</a>
</li>
<li>
<a class="item" href="{:U('ExcelPayment/lists')}">EXCEL打款</a>
</li>
</ul>
</div>
</div>

@ -2075,6 +2075,35 @@ ADD COLUMN `fax_ratio` varchar(20) NULL COMMENT '开票税率' AFTER `ali_accou
ALTER TABLE `sys_shift_task`
ADD COLUMN `change_status` tinyint(1) NOT NULL DEFAULT 0 COMMENT '推广员充值换榜执行状态 0 未处理 1 已处理' AFTER `status`;
CREATE TABLE `tab_excel_statement_info` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增主键',
`batch_num` varchar(500) COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '批次号',
`company_type` tinyint(3) NOT NULL DEFAULT '1' COMMENT '公司性质: 1-下游公司 2-下游个人 3上游公司',
`company_name` varchar(60) NOT NULL DEFAULT '' COMMENT '对账公司名称',
`company_info` text NOT NULL COMMENT '公司其他信息json',
`statement_money` decimal(10,2) DEFAULT '0.00' COMMENT '对账金额',
`platform_amount` decimal(10,2) DEFAULT '0.00' COMMENT '平台流水金额',
`fine` decimal(10,2) DEFAULT '0.00' COMMENT '罚款',
`reward` decimal(10,2) DEFAULT '0.00' COMMENT '奖励',
`statement_begin_time` int(11) NOT NULL DEFAULT '0' COMMENT '对账开始时间',
`statement_end_time` int(11) NOT NULL DEFAULT '0' COMMENT '对账截止时间',
`statement_num` varchar(500) COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '结算单号',
`statement_info` text NOT NULL COMMENT '订单相关信息json',
`pay_status` tinyint(2) NOT NULL DEFAULT '0' COMMENT '打款状态 -1:打款失败 0:未打款 1:打款成功',
`pay_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '支付完成时间',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '生成时间',
`pay_info` text COMMENT '打款信息',
`remark` varchar(255) COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '备注',
PRIMARY KEY (`id`),
KEY `batch_num` (`batch_num`) USING BTREE,
KEY `statement_begin_time` (`statement_begin_time`) USING BTREE,
KEY `statement_end_time` (`statement_end_time`) USING BTREE,
KEY `pay_status` (`pay_status`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='exce汇总单';
-- zyx 20200629
ALTER TABLE `sys_member`
ADD COLUMN `real_name` varchar(255) NULL DEFAULT '' COMMENT '真实姓名' AFTER `status`;
@ -2117,4 +2146,4 @@ CREATE TABLE `tab_market_altogether` (
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_unicode_ci ROW_FORMAT = Dynamic;
INSERT INTO `tab_tool`(`id`, `name`, `title`, `config`, `type`, `status`) VALUES (59, 'tax_radio', '公司税费', '{"tax_radio":1.5,"time":1589361782}', 1, 1)
INSERT INTO `tab_tool`(`id`, `name`, `title`, `config`, `type`, `status`) VALUES (59, 'tax_radio', '公司税费', '{"tax_radio":1.5,"time":1589361782}', 1, 1)

Loading…
Cancel
Save