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

新增线下打款确认
master
陈志 4 years ago committed by Gogs
commit 25a9ea7262

@ -306,6 +306,17 @@ class CompanyStatementController extends ThinkController
}
}
}
public function delStatement(){
if(!isset($_REQUEST['ids'])) $this->error("参数错误");
$ids = $_REQUEST['ids'];
$dbres = $this->DBModel->where("id in ({$ids}) and verify_status = 0")->delete();
addOperationLog(['op_type'=>2,'key'=>$ids,"op_name"=>"删除结算单",'url'=>U('lists')]);
$this->ajaxReturn(array(
'status' => 1,
"info"=>"删除成功"
));
}
//审批通过
public function adminAgree(){
$this->setVerifyStatus(0,1,"admin");
@ -729,9 +740,9 @@ class CompanyStatementController extends ThinkController
}
}
//新增结算
//获取要结算的公司及日期
public function getNewStatement()
{
//获取要结算的公司及日期
$senddata = [
"up_company_id"=>[],
"dowm_company_id"=>[],
@ -745,8 +756,7 @@ class CompanyStatementController extends ThinkController
}else{
$dowm_company_id[]= $v['company_id'];
}
}
;
};
//获取上游
if(empty($up_company_id)){
$upwhere = "1=1";
@ -895,6 +905,7 @@ class CompanyStatementController extends ThinkController
"export"=>"<a class='butn' id='export'>批量导出</a>",
"updateNewStatement"=>"<a class='butn' id='updateNewStatement' style='background-color: green;'>新增结算</a>",
"launch"=>"<a class='butn' id='launch'>对外发起</a>",
"delStatement"=>"<a class='butn' id='delStatement' style='background-color: red;'>批量删除</a>"
];
$resarr = [];
foreach ($mentBtn as $k => $v) {

@ -0,0 +1,254 @@
<?php
namespace Admin\Controller;
/**
* 线下打款
* @author cz
*/
class CompanyStatementOfflineController extends ThinkController
{
public $CompanyType = [
"1"=>"下游公司",
"2"=>"下游个人",
"3"=>"上游公司"
];
public $IsPayment = [
"1"=>"是",
"2"=>"否"
];
public $PayStatus=[
"-1"=>"打款失败",
"0"=>"未打款",
"1"=>"打款成功"
];
public function lists() {
$params = I('get.');
$page = $params['p'] ? intval($params['p']) : 1;
$row = $params['row'] ? intval($params['row']) : 10;
//权限分配
if(!IS_ROOT){
$this->OpAuthList= getModuleControllerAuth();
}
$this->assign('menubtn',$this->menuAuth());
$map = [
"c.verify_status"=>2,
"p.verify_status"=>["GT",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"] = "(c.statement_begin_time BETWEEN {$time_start} AND {$time_end}) OR (c.statement_end_time BETWEEN {$time_start} AND {$time_end}) OR (c.statement_begin_time <= {$time_end} AND c.statement_end_time >= {$time_end})";
} elseif (isset($_REQUEST['time_start'])) {
$time_start = strtotime($_REQUEST['time_start']);
$map["_string"] = "(c.statement_begin_time >= {$time_start} ) OR (c.statement_end_time >= {$time_start})";
} elseif (isset($_REQUEST['time_end'])) {
$time_end = strtotime($_REQUEST['time_end'])+ 86399;
$map["_string"] = "(c.statement_begin_time <= {$time_end} ) OR (c.statement_end_time <= {$time_end})";
}
//其他
if(isset($_REQUEST['company_type'])){
$map['c.company_type'] = $_REQUEST['company_type'];
}
if(isset($_REQUEST['company_name'])){
$map['c.company_name'] =["LIKE","%{$_REQUEST['company_name']}%"];
}
if(isset($_REQUEST['statement_pool_num'])){
$map['p.statement_num'] =["LIKE","%{$_REQUEST['statement_pool_num']}%"];
}
//条件end
$data = M("company_statement_info","tab_")
->alias("c")
->field("c.*,p.statement_num,p.verify_status")
->where($map)
->join("tab_company_statement_pool as p ON c.pool_id = p.id")
->page($page,$row)
->order("id desc")
->select();
foreach($data as $k => &$v) {
$v['statement_begin_time'] = date('Y.m.d',$v['statement_begin_time']);
$v['statement_end_time'] = date('Y.m.d',$v['statement_end_time']);
$v['company_type_str'] = $this->CompanyType[$v['company_type']];
$v["valid"] = "{$v['statement_begin_time']}-{$v['statement_end_time']}";
$v["pay_status_str"] = $this->PayStatus[$v["pay_status"]];
$v["pay_info"] = json_decode($v['pay_info'], true);
if(isset($v['pay_info']['payment_user'])){
$v["payment"]= "{$v['pay_status_str']}({$v['pay_info']['payment_user']})<br>{$v['pay_info']['payment_time']}";
}else{
$v["payment"] = $v["pay_status_str"];
}
$v['oplist'] = $this->OpAuth($v);
}
$count = M("company_statement_info","tab_")->alias("c")->field("count(c.id) count,sum(c.statement_money) statement_money")->join("tab_company_statement_pool as p ON c.pool_id = p.id")->where($map)->find();
// dd($count);
$params['p'] = $page;
$params['row'] = $row;
$page = set_pagination($count['count'], $row, $params);
if ($page) {
$this->assign('_page', $page);
}
// dd($data);
$this->assign('data',$data);
$this->assign('count',$count);
$this->assign('CompanyType',$this->CompanyType);
$this->display();
}
public function doPayment()
{
if(!isset($_REQUEST['ids'])) $this->error("参数错误");
$ids = $_REQUEST['ids'];
//获取所有的母单id
$companyStatementInfo = M("company_statement_info","tab_");
$statementPool = $companyStatementInfo->where("id in ($ids) and pay_status <> 1")->field("pool_id,count(id) count")->group("pool_id")->select();
$poolInfo = [];
foreach ($statementPool as $k => $v) {
$poolInfo[$v['pool_id']] = $v['count'];
}
unset($statementPool);
//修改info
$saveData = [
"pay_type"=>3,
"pay_status"=>1,
"pay_info"=>json_encode(["payment_user"=>$_SESSION['onethink_admin']['user_auth']["username"],"payment_time"=>date("Y-m-d H:i:s")])
];
$ires = $companyStatementInfo->where("id in ($ids)")->save($saveData);
//获取母单未支付完成订单
$poolIds = implode(",",array_keys($poolInfo));
$poolInfo = $companyStatementInfo->where("pool_id in ($poolIds) and pay_status <> 1")->field("pool_id,count(id) count")->group("pool_id")->select();
//全部就打款成功,否则打款中
$companyStatementPool = M("company_statement_pool","tab_");
foreach ($poolInfo as $k => $v) {
if($v['count'] == $poolInfo[$v['pool_id']]){
//打款成功
$this->setOneVerifyStatus(4,"payment",$v['pool_id']);
}else{
//打款中
$this->setOneVerifyStatus(3,"payment",$v['pool_id']);
}
}
$this->ajaxReturn(array(
'status' =>1,
"info"=>"打款确认成功"
));
}
public function viewStatement()
{
if(!isset($_REQUEST['id'])){
$this->error('参数错误');
}
$id = $_REQUEST['id'];
$is_export= false;
if (isset($_REQUEST['export']) && $_REQUEST['export']==1){
$is_export = true;
}
//获取基本信息
$dbres = M("company_statement_info","tab_")->where("id='{$id}'")->select();
$title = $dbres[0]['company_name'];
$this->assign("title",$title);
if($dbres[0]['company_type'] == 3){
//上游
A("CompanyStatementPool")->viewCpPool($dbres,$is_export);
}elseif($dbres[0]['company_type'] == 1){
//下游公司
A("CompanyStatementPool")->viewPcPool($dbres,$is_export);
}else{
A("CompanyStatementPool")->viewPuPool($dbres,$is_export);
}
}
public function export(){
if(!isset($_REQUEST['ids'])) $this->error("参数错误");
$ids = $_REQUEST['ids'];
$dbres = M("company_statement_info","tab_")->where("id in ({$ids})")->select();
$is_export= false;
if (isset($_REQUEST['export']) && $_REQUEST['export']==1){
$is_export = true;
}
if($dbres[0]['company_type'] == 3){
//上游
$this->assign("title","上游公司线下打款");
A("CompanyStatementPool")->viewCpPool($dbres,$is_export);
}elseif($dbres[0]['company_type'] == 1){
//下游公司
$this->assign("title","下游公司线下打款");
A("CompanyStatementPool")->viewPcPool($dbres,$is_export);
}else{
$this->assign("title","下游个人线下打款");
A("CompanyStatementPool")->viewPuPool($dbres,$is_export);
}
}
protected function setOneVerifyStatus($change_status,$op_pre,$id)
{
$dbres = M("company_statement_pool","tab_")->field("id,verify_status,verify_log")->where("id = {$id}")->find();
$dbres['verify_log'] = json_decode($dbres['verify_log'],true);
$dbres['verify_log'][$op_pre.'_user']=$_SESSION['onethink_admin']['user_auth']["username"];
$dbres['verify_log'][$op_pre.'_time']=date("Y-m-d H:i:s");
$dbres['verify_log'] = json_encode($dbres['verify_log']);
$dbres['verify_status']=$change_status;
M("company_statement_pool","tab_")->save($dbres);
}
public function OpAuth($info)
{
$id = $info['id'];
$type = $info['company_type'];
//原始列表
$opBtn = [
"viewStatement"=>"<a class='confirm viewStatement' data-id='{$id}' data-companytype='{$type}'>查看</a>",
];
//操作对应菜单
$optist = ["viewStatement"];
$resarr = [];
foreach ($optist as $k => $v) {
if(IS_ROOT){
$resarr[] = $opBtn[$v];
}else{
if(in_array($v,$this->OpAuthList)){
$resarr[] = $opBtn[$v];
}
}
}
return $resarr;
}
public function menuAuth()
{
$mentBtn = [
"doPayment"=>"<a class='butn' id='doPayment'>打款确认</a>",
"export"=>"<a class='butn' id='export'>批量导出</a>"
];
$resarr = [];
foreach ($mentBtn as $k => $v) {
if(IS_ROOT){
$resarr[] = $v;
}else{
if(in_array($k,$this->OpAuthList)){
$resarr[] = $v;
}
}
}
return $resarr;
}
}

@ -151,24 +151,16 @@ class CompanyStatementPoolController extends ThinkController
if(isset($v['verify_log']['payment_user'])){
if($v['verify_status'] == -2){
$ts = "拒绝打款";
$v["payment"]= "{$ts}({$v['verify_log']['payment_user']}){$symbol} {$v['verify_log']['payment_time']}";
}elseif($v['verify_status'] == 2){
$ts = "待打款";
$v["payment"]= "{$ts}({$v['verify_log']['payment_user']}){$symbol} {$v['verify_log']['payment_time']}";
}elseif($v['verify_status'] == 3){
$ts = "打款中";
$v["payment"]= "{$ts}({$v['verify_log']['payment_user']}){$symbol} {$v['verify_log']['payment_time']}";
}elseif($v['verify_status'] == 4){
if($v['is_payment']==1){
$ts="线上打款成功";
}else{
$ts="线下打款成功";
}
$v["payment"]= "{$ts}({$v['verify_log']['payment_user']}){$symbol} {$v['verify_log']['payment_time']}";
$ts="打款成功";
}elseif($v['verify_status'] == 5){
$ts="无需打款";
$v["payment"]= "{$ts}({$v['verify_log']['payment_user']}){$symbol} {$v['verify_log']['payment_time']}";
}
$v["payment"]= "{$ts}({$v['verify_log']['payment_user']}){$symbol} {$v['verify_log']['payment_time']}";
}else{
$v["payment"] = '--';
}
@ -293,6 +285,7 @@ class CompanyStatementPoolController extends ThinkController
$count["platform_amount"] = "=SUM(J2:J".$line.")";
$count["sum_money"] = "=SUM(P2:P".$line.")";
}
// dd($infolist);
$this->assign("data",$infolist);
$this->assign("count",$count);
$this->assign("is_export",$is_export);
@ -585,11 +578,16 @@ class CompanyStatementPoolController extends ThinkController
$v['company_info'] = json_decode($v['company_info'],true);
$v['company_info']['ali_user'] ?? '';
$v['company_info']['ali_account'] ?? '';
$v['verify_status_str'] = $this->InfoVerifyStatus[ $v['verify_status']];
if($v['verify_status'] == 2){
$v['is_payment'] = 2;
}else{
$v['is_payment'] = 1;
}
$v['verify_status_str'] = $this->PayStatus[$v['pay_status']];
if($v['verify_status'] == 1){
$v['verify_status_str'] = $this->PayStatus[$v['pay_status']];
if($v['pay_status'] == 1){
$v['pay_type'] = $v['pay_type'] == 1 ? "提现" :"线上打款";
$v['verify_status_str'] .= ("/". $v['pay_type']);

@ -644,7 +644,7 @@ class CompanyStatementSetController extends Controller {
$tratio =$this->getTurnoverRatio($game_all_payment,$tmp_game_ratio['ratio'],$tmp_game_ratio['turnover_ratio']);
$tratio += $company_ratio;
}elseif($type == 0){
$tratio = $t_game_ratio['ratio'];
$tratio = $tmp_game_ratio['ratio'];
}else{
//补点
$tratio1 =$this->getTurnoverRatio($game_all_payment,$tmp_game_ratio['ratio'],$tmp_game_ratio['turnover_ratio']);
@ -878,6 +878,8 @@ class CompanyStatementSetController extends Controller {
$game[$v['relation_game_id']]['pay_amount'] = $v['pay_amount'];
}
}
$pcList[$company_id]['game_ids'] = implode(",",array_keys($game));
foreach($list as $k=>$v){
try {
$res[$company_id]["pay_amount"] += $v['pay_amount'];
@ -1075,40 +1077,88 @@ class CompanyStatementSetController extends Controller {
$v['statement_money'] -= $v['server_fee'];
}
}
$promoteCompanyGameRatio = D("CompanyGameRatio")->getPromoteCompanyGameRatio($v['id'],$v['game_ids'],$begintime,$endtime,$company_belong);
foreach($v['list'] as $ke=>$va){
$templist = $va['game_list'];
$va['game_list'] = [];
foreach($templist as $p_id => $p_info){
// dd($p_info);
if($type == 1){
$tratio = getGamePromoteCompanyRadio($v['id'],$p_info['relation_game_id'],$endtime,$p_info['all_pay_amount'],true,$company_belong);
$tratio += $company_ratio;
}elseif($type == 0){
$tratio = getGamePromoteCompanyRadio($v['id'],$p_info['relation_game_id'],$endtime,$p_info['all_pay_amount'],false,$company_belong);
}else{
//补点
$tratio1 = getGamePromoteCompanyRadio($v['id'],$p_info['relation_game_id'],$endtime,$p_info['all_pay_amount'],true,$company_belong);;
$tratio2 = getGamePromoteCompanyRadio($v['id'],$p_info['relation_game_id'],$endtime,$p_info['all_pay_amount'],false,$company_belong);
$tratio = $tratio1-$tratio2+$company_ratio;
if($tratio <= 0){
continue;
$ratioCount = count($promoteCompanyGameRatio[$p_info['relation_game_id']]);
$isMoreRatio = $ratioCount > 1 ? true : false;
if(!$isMoreRatio){
$tmp_game_ratio = $promoteCompanyGameRatio[$p_info['relation_game_id']][0];
if($type == 1){
$tratio =$this->getTurnoverRatio($p_info['all_pay_amount'],$tmp_game_ratio['ratio'],$tmp_game_ratio['turnover_ratio']);
$tratio += $company_ratio;
}elseif($type == 0){
$tratio = $tmp_game_ratio['ratio'];
}else{
//补点
$tratio1 =$this->getTurnoverRatio($p_info['all_pay_amount'],$tmp_game_ratio['ratio'],$tmp_game_ratio['turnover_ratio']);
$tratio2 =$tmp_game_ratio['ratio'];
$tratio = $tratio1-$tratio2+$company_ratio;
if($tratio <= 0){ continue;}
}
}
if($type == 2){
$p_info['increment_ratio']=$tratio;
$tratio -= 0;
if($type == 2){
$p_info['increment_ratio']=$tratio;
}else{
$p_info['ratio']=$tratio;
}
$v['platform_amount'] += $p_info['pay_amount'];
$p_info['sum_money']=round($p_info['pay_amount']*$tratio/100,2); //个人等于 结算金额*比例
$v['pay_amount'] += $p_info['sum_money'];
$v['statement_money'] += $p_info['sum_money'];
$p_info['fax_ratio']=$fax_ratio;
$p_info['statement_begin_time']=$statement_begin_time;
$p_info['statement_end_time']=$statement_end_time;
$p_info['statement_type']=0;
$va['game_list'][] = $p_info;
}else{
$p_info['ratio']=$tratio;
for ($i=0; $i < $ratioCount; $i++) {
$temp_game = [];
$tmp_game_ratio = $promoteCompanyGameRatio[$p_info['relation_game_id']][$i];
if($type == 1){
$tratio =$this->getTurnoverRatio($p_info['all_pay_amount'],$tmp_game_ratio['ratio'],$tmp_game_ratio['turnover_ratio']);
$tratio += $company_ratio;
}elseif($type == 0){
$tratio = $tmp_game_ratio['ratio'];
}else{
//补点
$tratio1 =$this->getTurnoverRatio($p_info['all_pay_amount'],$tmp_game_ratio['ratio'],$tmp_game_ratio['turnover_ratio']);
$tratio2 =$tmp_game_ratio['ratio'];
$tratio = $tratio1-$tratio2+$company_ratio;
if($tratio <= 0){ continue;}
}
$tratio -= 0;
if($type == 2){
$temp_game['increment_ratio']=$tratio;
}else{
$temp_game['ratio']=$tratio;
}
$temp_game['pay_amount'] = $this->getRelationGameIdPromoteSpend($p_info["p_id"],$p_info['relation_game_id'],$tmp_game_ratio['begintime'],$tmp_game_ratio['endtime']);
$temp_game['pay_amount'] -=0;
$v['platform_amount'] += $temp_game['pay_amount'];
$temp_game['sum_money']=round($temp_game['pay_amount']*$tratio/100,2); //个人等于 结算金额*比例
$v['pay_amount'] += $temp_game['sum_money'];
$v['statement_money'] += $temp_game['sum_money'];
$temp_game['fax_ratio']=$fax_ratio-0;
$temp_game['statement_begin_time']=date("Y.m.d",$tmp_game_ratio['begintime']);
$temp_game['statement_end_time']=date("Y.m.d",$tmp_game_ratio['endtime']);
$temp_game['statement_type']=0;
$temp_game['relation_game_id']=$p_info["relation_game_id"];
$temp_game['game_name']=$p_info["game_name"];
$temp_game['game_type_name']=$p_info["game_type_name"];
$temp_game['all_pay_amount']=$p_info["all_pay_amount"];
$va['game_list'][] = $temp_game;
}
}
$v['platform_amount'] += $p_info['pay_amount'];
$p_info['sum_money']=round($p_info['pay_amount']*$tratio/100,2); //个人等于 结算金额*比例
$v['pay_amount'] += $p_info['sum_money'];
$v['statement_money'] += $p_info['sum_money'];
$p_info['fax_ratio']=$fax_ratio;
$p_info['statement_begin_time']=$statement_begin_time;
$p_info['statement_end_time']=$statement_end_time;
$p_info['statement_type']=0;
$va['game_list'][] = $p_info;
}
$v['statement_info'][] = $va;
}
@ -1383,6 +1433,35 @@ class CompanyStatementSetController extends Controller {
$pay_amount = $Spend->alias('s')->field('sum(s.pay_amount) pay_amount')->where($spenMap)->find();
return $pay_amount['pay_amount'] ?? 0;
}
protected function getRelationGameIdPromoteSpend($promote_id,$relation_game_id,$begintime,$endtime)
{
$res = [];
//获取推广员
$Promote = M("Promote","tab_");
$Spend = M("Spend","tab_");
$spenMap = [
"s.pay_status"=>1,
"s.payed_time"=>['between', [$begintime,$endtime]],
];
$Pmap = [
"chain"=>["LIKE","%/{$promote_id}/%"],
"_logic"=>"OR",
"id"=>$promote_id
];
$pres = $Promote->field("group_concat(id) ids,count(id) count")->where($Pmap)->group("company_id")->find();
if($pres['count'] ==0 ){return 0;}
$spenMap['s.promote_id']=["in",$pres['ids']];
//游戏
$game_id = D("Game")->changeRelationGameidToGameid($relation_game_id);
// dd($game_id);
$spenMap['s.game_id'] =['in',$game_id];
//获取支付记录
$pay_amount = $Spend->alias('s')->field('sum(s.pay_amount) pay_amount')->where($spenMap)->find();
return $pay_amount['pay_amount'] ?? 0;
}
/**
* 重算接口

@ -443,7 +443,7 @@
});
});
$("#adminAgree,#adminRefuse,#verifyAgree,#verifyRefuse,#pool,#updateStatement").on("click",function(){
$("#adminAgree,#adminRefuse,#verifyAgree,#verifyRefuse,#pool,#updateStatement,#delStatement").on("click",function(){
var id = $(this).attr("id");
if(id == "adminAgree"){
var opname = "管理员审批通过";
@ -466,6 +466,12 @@
var opst ="[汇总撤销,管理员审批拒绝,未进行审批,管理员审批通过]";
var status = [-3,-2,-1,0,1];
var confirm = true;
}else if(id=="delStatement"){
var opname = "批量删除";
var opurl = "{:U('delStatement')}";
var opst ="[未进行审批]";
var status = [0];
var confirm = true;
}
var confirm = confirm ? confirm :false;
var flag = false;

@ -0,0 +1,402 @@
<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;}
.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">线下打款确认</h3>
<p class="description_text" id="order_url">仅当汇总单审批通过的单子才允许进行打款</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-list-promote search_label_rehab">
<select id="company_type" name="company_type" class="select_gallery" >
<option value="">公司类型</option>
<volist name="CompanyType" id="vo">
<option value="{$key}" <if condition="isset($_GET['company_type']) && $key eq I('company_type')">selected</if> >{$vo}</option>
</volist>
</select>
</div>
<div class="input-list">
<input style="width: 200px;" type="text" name="company_name" class="search-input" value="{:I('company_name')}" placeholder="请输入公司名称搜索">&nbsp;
</div>
<div class="input-list">
<input style="width: 200px;" type="text" name="statement_pool_num" class="search-input" value="{:I('statement_pool_num')}" placeholder="请输入汇总单号">&nbsp;
</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" 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>
<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">
<foreach name="menubtn" item="vo" >
{$vo}
</foreach>
</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 class="tooltip">汇总单号<span class="tooltiptext">汇总单号</span></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']}" name="ids[]" data-companytype="{$data['company_type']}" data-paystatus="{$data['pay_status']}"></td>
<td>{$data.company_name}</td>
<td>{$data.company_type_str}</td>
<td>{$data.valid}</td>
<td>{$data.statement_money}</td>
<td>{$data.platform_amount}</td>
<td>{$data.payment}</td>
<td>{$data.statement_num}</td>
<td>
<foreach name="data.oplist" item="vo" >
{$vo}
</foreach>
</td>
</tr>
</volist>
<tr><td style="line-height: 42px;">合计</td><td colspan="12" style="line-height: 42px;">结算总金额:&nbsp;{$count.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 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__/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(){
var company_id = "{$_GET['company_id']??0}";
$("#company_type").on("change",function(){
var val = $(this).find("option:selected").val();
var type = 0;
if(val == 3){
type = 1
}else{
type = 2;
}
var url = "{:U('Ajax/getCompanyList')}"+"&company_type="+type;
$.get(url,function(data){
var company = data;
var companystr = '<option value="">请选择合作公司</option>';
for (var i in company) {
if(company[i].id == company_id){
companystr += "<option value='" + company[i].id + "' selected='selected'>" + company[i].name + "</option>"
}else{
companystr += "<option value='" + company[i].id + "'>" + company[i].name + "</option>"
}
}
$("#company_id").html(companystr);
$("#company_id").select2();
})
})
$("#company_type").change();
$(".viewStatement").click(function () {
var id = $(this).data("id");
var url = "{:U('viewStatement')}"+"&id="+id
layer.open({
type: 2,
title: "海南万盟天下科技有限公司",
shadeClose: true,
shade: 0.8,
area: ['100%', '100%'],
content: url
});
});
$("#doPayment").on("click",function(){
var id = $(this).attr("id");
var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) {
if($(elem).data("paystatus") == 0){
return $(elem).val();
}
}).get();
if(text.length < 1){
layer.msg("<font style='color:white'>无需要进行确认打款确认操作的数据</font>");
return;
}
text = text.join(",");
if(confirm){
layer.confirm('【警告】确认打款后将不可回退,如需继续请点击确认', {
btn: ['确认','取消'],
title:false
}, function(){
_doAgreeApply();
});
}else{
_doAgreeApply();
}
function _doAgreeApply(){
//执行
$.ajax({
type: "POST",
url: "{:U('doPayment')}",
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;
}
}
});
}
})
$("#export").click(function () {
var company = [];
var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) {
var cid = $(elem).data("companytype");
try {
company[cid].push($(elem).val());
} catch (error) {
company[cid] = [];
company[cid].push($(elem).val());
}
});
company.forEach(function(e){
var ids = e.join(",");
var url ="{:U('export')}"+"&ids="+ids+"&export=1";
var iframeExcel = "<iframe src='"+url+"' width='0px' height='0px' style='z-index:-1;position: absolute;top: -999999px;'></iframe>";
$("body").append(iframeExcel)
});
})
$("#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;
});
$('#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'
})
//回车自动提交
$('.jssearch').find('input').keyup(function(event){
if(event.keyCode===13){
$("#search").click();
}
});
})
</script>
</block>

@ -430,7 +430,7 @@
title: "海南万盟天下科技有限公司",
shadeClose: true,
shade: 0.8,
area: ['80%', '80%'],
area: ['100%', '100%'],
content: url
});
})
@ -442,7 +442,7 @@
title: "海南万盟天下科技有限公司",
shadeClose: true,
shade: 0.8,
area: ['70%', '80%'],
area: ['100%', '100%'],
content: url
});
})

@ -105,8 +105,12 @@
<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>
<th style="border-right: solid 1px #b6cad2;">关联结算汇总单订单号</th>
<th style="border-right: solid 1px #b6cad2;">金额(元)</th>
<th style="border-right: solid 1px #b6cad2;">备注</th>
@ -119,8 +123,19 @@
<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>
<if condition="$vo['is_payment'] eq 1">
<td></td>
<td>{$vo.company_info.ali_user}</td>
<td>{$vo.company_info.ali_account}</td>
<td></td>
<else />
<td></td>
<td>{$vo.company_info.payee_name}</td>
<td>{$vo.company_info.bank_account}</td>
<td>{$vo.company_info.opening_bank}</td>
</if>
<td>{$vo.statement_num}</td>
<td>{$vo.statement_money}</td>
<td>{$vo.remark}</td>
@ -130,7 +145,7 @@
</foreach>
<tr>
<td colspan="2">合计:</td>
<td colspan="6">打款总金额:{$CompanyInfo[0]['all_money']}</td>
<td colspan="8">打款总金额:{$CompanyInfo[0]['all_money']}</td>
</tr>
</tbody>

@ -103,7 +103,7 @@
<th>下游名称</th>
<th>会长账号</th>
<th>下游类型</th>
<th>市场员</th>
<th>市场</th>
<th>下游性质</th>
<th>产品</th>
<th>产品类型</th>

Loading…
Cancel
Save