4.23号功能提交

master
zhengyongxing 4 years ago
parent f2e56125fe
commit 671419882f

@ -19,7 +19,8 @@ class CompanyStatementOfflineController extends ThinkController
public $PayStatus=[
"-1"=>"打款失败",
"0"=>"未打款",
"1"=>"打款成功"
"1"=>"打款成功",
"2"=>"部分打款"
];
public function lists() {
@ -87,6 +88,16 @@ class CompanyStatementOfflineController extends ThinkController
->page($page,$row)
->order("id desc")
->select();
$unPayData = SM("company_statement_info_part","tab_")
->field("sum(statement_money) statement_money,info_id")
->group("info_id")
->select();
$handleData = [];
foreach ($unPayData as $key => $value) {
$handleData[$value['info_id']] = $value['statement_money'];
}
foreach($data as $k => &$v) {
@ -96,6 +107,8 @@ class CompanyStatementOfflineController extends ThinkController
$v["valid"] = "{$v['statement_begin_time']}-{$v['statement_end_time']}";
$v["pay_status_str"] = $this->PayStatus[$v["pay_status"]];
$v['surplus_amount'] = ($v["pay_check"]==2)?($handleData[$v['id']] ?? $v['statement_money']):($v["pay_status"]!=1?$v['statement_money']:"0.00");
$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']}";
@ -110,7 +123,15 @@ class CompanyStatementOfflineController extends ThinkController
->field("username")
->where(['id'=>$v['pay_check_member_id']])
->find();
$v['pay_check_str'] = $member['username'].(($v['pay_check'] == 1)?'已确认':'未确认')."<br>".date('Y-m-d H:i:s', $v['pay_check_time']);;
if ($v['pay_check'] == 1) {
$pay_check = '已确认';
} elseif($v['pay_check'] == 2) {
$pay_check = '部分确认';
} else {
$pay_check = '未确认';
}
$v['pay_check_str'] = $member['username'].$pay_check."<br>".date('Y-m-d H:i:s', $v['pay_check_time']);;
// $v['pay_check_str'] = "已确认";
}
@ -143,11 +164,14 @@ class CompanyStatementOfflineController extends ThinkController
$id = $_REQUEST['id'];
$CompanyInfo = M("company_statement_info","tab_")
->alias('i')
->field("i.id,i.pool_id,i.company_name,i.company_info,i.statement_money,i.remark,i.pay_status,i.verify_status,p.statement_num,i.statement_money")
->field("i.id,i.pool_id,i.company_name,i.company_info,i.statement_money,i.remark,i.pay_status,i.verify_status,p.statement_num,i.statement_money,i.pay_check")
->join("tab_company_statement_pool p ON p.id = i.pool_id")
->where("i.id in({$id})")
->select();
$temp = $this->addPaymentPartInfo($CompanyInfo);
$temp?$CompanyInfo=$temp:"";
$all_money = 0;
foreach($CompanyInfo as $k=>&$v){
if($v['verify_status'] == 2){
@ -170,18 +194,177 @@ class CompanyStatementOfflineController extends ThinkController
$this->display();
}
public function addPaymentPartInfo($CompanyInfo) {
if ($CompanyInfo[0]['pay_check'] !=2) {
return [];
}
$id = array_column($CompanyInfo,"id");
$data = M("company_statement_info_part","tab_")
->alias('i')
->field("i.id,i.pool_id,i.company_name,i.company_info,i.statement_money,i.remark,i.pay_status,i.verify_status,p.statement_num,i.statement_money,info_id")
->join("tab_company_statement_pool p ON p.id = i.pool_id")
->where(['info_id'=>['in',$id]])
->select();
foreach ($data as $key => $value) {
$data[$key]['id'] = $value['id']."-".$value['info_id'];
}
return $data;
}
//修改打款设置
public function editPayment(){
// dump($_SESSION);die();
if(!isset($_REQUEST['info'])) $this->error("参数错误");
$info = $_REQUEST['info'];
$keys = '';
$saveKey = [];
// dump($info);die();
$CompanyInfo = M("company_statement_info","tab_");
//循环保存
foreach($info as $k=>$v){
// dump(explode('-',$k));die();
$exKeys = explode('-',$k);
if (count($exKeys) > 1) {
$keys = $exKeys;
if (!$saveKey[$keys[1]]) {
$saveKey[$keys[1]] = 1;
$ydata = $CompanyInfo->where("id= '{$keys[1]}'")->find();
$company_info = json_decode($ydata['company_info'],true);
if($ydata['verify_status'] == 2){
$company_info['payee_name'] = $v['payee_name'];
$company_info['bank_account'] = $v['bank_account'];
$company_info['opening_bank'] = $v['opening_bank'];
}else{
$company_info['ali_user'] = $v['ali_user'];
$company_info['ali_account'] = $v['ali_account'];
}
$savedata = [
"pay_check"=>1,
"pay_check_member_id"=> $_SESSION['onethink_admin']['user_auth']['uid'],
"id"=>$keys[1],
"pay_check_time"=>time()
];
$CompanyInfo->save($savedata);
}
$ydata = M("company_statement_info_part","tab_")->where("id= '{$keys[0]}'")->find();
$company_info = json_decode($ydata['company_info'],true);
if($ydata['verify_status'] == 2){
$company_info['payee_name'] = $v['payee_name'];
$company_info['bank_account'] = $v['bank_account'];
$company_info['opening_bank'] = $v['opening_bank'];
}else{
$company_info['ali_user'] = $v['ali_user'];
$company_info['ali_account'] = $v['ali_account'];
}
$savedata = [
"company_info"=>json_encode($company_info,JSON_UNESCAPED_UNICODE),
"remark"=>$v['remark'],
"pay_check"=>1,
"pay_check_member_id"=> $_SESSION['onethink_admin']['user_auth']['uid'],
"id"=>$keys[0],
"pay_check_time"=>time()
];
M("company_statement_info_part","tab_")->save($savedata);
} else {
$ydata = $CompanyInfo->where("id= '{$keys[1]}'")->find();
$company_info = json_decode($ydata['company_info'],true);
if($ydata['verify_status'] == 2){
$company_info['payee_name'] = $v['payee_name'];
$company_info['bank_account'] = $v['bank_account'];
$company_info['opening_bank'] = $v['opening_bank'];
}else{
$company_info['ali_user'] = $v['ali_user'];
$company_info['ali_account'] = $v['ali_account'];
}
$savedata = [
"company_info"=>json_encode($company_info,JSON_UNESCAPED_UNICODE),
"remark"=>$v['remark'],
"pay_check"=>1,
"pay_check_member_id"=> $_SESSION['onethink_admin']['user_auth']['uid'],
"id"=>$k,
"pay_check_time"=>time()
];
$CompanyInfo->save($savedata);
}
}
$this->ajaxReturn(array(
'status' => 1,
"info"=>"打款信息编辑成功"
));
}
//打款设置
public function setPartPayment(){
if(!isset($_REQUEST['id'])) $this->error("参数错误");
$id = $_REQUEST['id'];
$CompanyInfo = M("company_statement_info","tab_")
->alias('i')
->field("i.id,i.pool_id,i.company_name,i.company_info,i.statement_money,i.remark,i.pay_status,i.verify_status,p.statement_num,i.statement_money")
->join("tab_company_statement_pool p ON p.id = i.pool_id")
->where("i.id in({$id})")
->select();
$all_money = 0;
foreach($CompanyInfo as $k=>&$v){
if($v['verify_status'] == 2){
$v['is_payment'] = 2;
}else{
$v['is_payment'] = 1;
}
$v['company_info'] = json_decode($v['company_info'],true);
$v['company_info']['ali_user'] ?? '';
$v['company_info']['ali_account'] ?? '';
$all_money += $v['statement_money'];
}
$this->assign('all_money',$all_money);
$this->assign("CompanyInfo",$CompanyInfo);
$this->assign("id",$id);
$this->display();
}
//修改打款设置
public function editPartPayment(){
if (count($_REQUEST['info']) < 2) {
$this->error("未添加剩余打款金额");
}
if(!isset($_REQUEST['info'])) $this->error("参数错误");
$info = $_REQUEST['info'];
$ydata = [];
$company_info = [];
$CompanyInfo = M("company_statement_info","tab_");
//循环保存
foreach($info as $k=>$v){
$ydata = $CompanyInfo->where("id= '{$k}'")->find();
$company_info = json_decode($ydata['company_info'],true);
if($ydata['verify_status'] == 2){
$company_info['payee_name'] = $v['payee_name'];
@ -194,14 +377,45 @@ class CompanyStatementOfflineController extends ThinkController
$savedata = [
"company_info"=>json_encode($company_info,JSON_UNESCAPED_UNICODE),
"remark"=>$v['remark'],
"pay_check"=>1,
"pay_check"=>2,
"pay_check_member_id"=> $_SESSION['onethink_admin']['user_auth']['uid'],
"id"=>$k,
"pay_check_time"=>time()
];
$CompanyInfo->save($savedata);
unset($info[$k]);
break;
}
// array_pop($info);
$id = $ydata["id"];
unset($ydata["id"]);
$sumUnPayAmount = array_sum(array_column($info,'unpay_amount'));
if ($sumUnPayAmount > $ydata['statement_money'] ) {
$this->error("剩余打款金额超过结算金额");
}
foreach ($info as $k=>$v) {
if($ydata['verify_status'] == 2){
$company_info['payee_name'] = $v['payee_name'];
$company_info['bank_account'] = $v['bank_account'];
$company_info['opening_bank'] = $v['opening_bank'];
}else{
$company_info['ali_user'] = $v['ali_user'];
$company_info['ali_account'] = $v['ali_account'];
}
$ydata['company_info'] = json_encode($company_info,JSON_UNESCAPED_UNICODE);
$ydata['statement_money'] = $v['unpay_amount'];
$ydata['pay_amount'] = $v['unpay_amount'];
$ydata['remark'] = $v['remark'];
$ydata['info_id'] = $id;
M("company_statement_info_part","tab_")->add($ydata);
}
$this->ajaxReturn(array(
@ -220,13 +434,33 @@ class CompanyStatementOfflineController extends ThinkController
$CompanyInfo = M("company_statement_info","tab_");
$CompanyInfo
->where(['id'=>['in',$ids]])
->save([
'pay_check'=>0,
'pay_check_member_id'=>0,
'pay_check_time'=>0
]);
$data = $CompanyInfo->where(['id'=>['in',$ids]])->select();
foreach ($data as $key => $value) {
if ($value['pay_check'] == 2||($value['pay_check'] == 1&&$value['pay_status'] == 0)) {
$CompanyInfo
->where(['id'=>$value['id']])
->save([
'pay_check'=>0,
'pay_check_member_id'=>0,
'pay_check_time'=>0
]);
M("company_statement_info_part","tab_")->where(['info_id'=>$value['id']])->delete();
} elseif($value['pay_check'] == 1&&$value['pay_status'] == 2) {
$CompanyInfo
->where(['id'=>$value['id']])
->save([
'pay_check'=>2,
'pay_check_member_id'=>$_SESSION['onethink_admin']['user_auth']['uid'],
'pay_check_time'=>time()
]);
}
}
$this->ajaxReturn(array(
'status' => 1,
@ -251,15 +485,51 @@ class CompanyStatementOfflineController extends ThinkController
//获取母单未支付完成订单
$poolIds = implode(",",array_keys($yPoolInfo));
$poolInfo = $companyStatementInfo->where("pool_id in ($poolIds) and pay_status <> 1")->field("pool_id,count(id) count")->group("pool_id")->select();
//修改info
$poolInfo = $companyStatementInfo->where("pool_id in ($poolIds) and pay_status <> 1 and pay_check !=2")->field("pool_id,count(id) count")->group("pool_id")->select();
$info_id = $companyStatementInfo->field("id")->where("id in ($ids) and pay_check !=2")->select();
$unPayInfoId = $companyStatementInfo->field("id")->where("id in ($ids) and pay_check =2")->select();
$info_id = array_column($info_id,"id");
$unPayInfoId = array_column($unPayInfoId,"id");
//支付确认的部分
$saveData = [
"pay_type"=>3,
"pay_status"=>1,
"pay_info"=>json_encode(["payment_user"=>$_SESSION['onethink_admin']['user_auth']["username"],"payment_time"=>$payment_time])
];
$ires = $companyStatementInfo->where("id in ($ids)")->save($saveData);
if($info_id) {
$companyStatementInfo->where(['id'=>['in',$info_id]])->save($saveData);
}
//支付未确认的部分
$saveData = [
"pay_type"=>3,
"pay_status"=>2,
"pay_info"=>json_encode(["payment_user"=>$_SESSION['onethink_admin']['user_auth']["username"],"payment_time"=>$payment_time])
];
$unPayData = SM("company_statement_info_part","tab_")
->field("sum(statement_money) statement_money,info_id")
->group("info_id")
->select();
$handleData = [];
foreach ($unPayData as $key => $value) {
$handleData[$value['info_id']] = $value['statement_money'];
}
if ($unPayInfoId) {
$unPayData = $companyStatementInfo->where(['id'=>['in',$unPayInfoId]])->select();
foreach ($unPayData as $key => $value) {
$time = date("Y-m-d H:i:s",time());
$unPayAmount = $value['statement_money']-$handleData[$value['id']];
$saveData['remark'] = "{$value['remark']},{$_SESSION['onethink_admin']['user_auth']['username']}于{$time}已打款{$unPayAmount},剩余{$handleData[$value['id']]}";
$companyStatementInfo->where(['id'=>$value['id']])->save($saveData);
}
}
//全部就打款成功,否则打款中
$companyStatementPool = SM("company_statement_pool","tab_");

@ -168,6 +168,7 @@
<th>公司类型</th>
<th>结算时间</th>
<th>结算金额</th>
<th>剩余未打款金额</th>
<th>结算流水</th>
<th>打款信息确认状态</th>
<th>打款状态</th>
@ -192,6 +193,7 @@
<td>{$data.company_type_str}</td>
<td>{$data.valid}</td>
<td>{$data.statement_money}</td>
<td>{$data.surplus_amount}</td>
<td>{$data.platform_amount}</td>
<td>{$data.pay_check_str}</td>
<td>{$data.payment}</td>
@ -277,10 +279,19 @@
$("#setPayment").on('click',function(){
var tip = 0;
var unpay = false;
var pay = false;
var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) {
if($(elem).data("pay_check") == 0){
if ($(elem).data("pay_check") == 2) {
unpay = true;
}
if ($(elem).data("pay_check") == 0) {
pay = true;
}
if($(elem).data("pay_check") == 0 || ($(elem).data("pay_check") == 2&&$(elem).data("paystatus")==2)){
return $(elem).val();
} else {
tip = 1;
@ -293,6 +304,8 @@
return;
}
var textLength = text.length;
text = text.join(",");
if (!text) {
@ -300,16 +313,56 @@
return;
}
var url = "{:U('setPayment')}"+"&id="+text
layer.open({
type: 2,
title: "海南万盟天下科技有限公司",
shadeClose: true,
shade: 0.8,
area: ['100%', '100%'],
content: url
});
if(unpay && pay) {
layer.msg("<font style='color: white'>部分确认的打款单不能与确认的打款单一起确认</font>");
return;
}
var url = "{:U('setPartPayment')}"+"&id="+text;
if(!unpay && pay) {
layer.confirm('【提示】是否全部打款', {
btn: ['是','否'],
title:false
}, function(){
layer.closeAll();
url = "{:U('setPayment')}"+"&id="+text;
layer.open({
type: 2,
title: "海南万盟天下科技有限公司",
shadeClose: true,
shade: 0.8,
area: ['100%', '100%'],
content: url
});
}, function(){
if (textLength > 1) {
layer.msg("<font style='color: white'>部分确认的单子一次不能处理超过两条</font>");
return;
}
layer.open({
type: 2,
title: "海南万盟天下科技有限公司",
shadeClose: true,
shade: 0.8,
area: ['100%', '100%'],
content: url
});
});
} else {
url = "{:U('setPayment')}"+"&id="+text;
layer.open({
type: 2,
title: "海南万盟天下科技有限公司",
shadeClose: true,
shade: 0.8,
area: ['100%', '100%'],
content: url
});
}
});
$(".viewStatement").click(function () {
@ -336,7 +389,11 @@
return $(elem).val();
}
if ($(elem).data("pay_check") != 1) {
if($(elem).data("pay_check") == 2 && $(elem).data("paystatus") == 0){
return $(elem).val();
}
if ($(elem).data("pay_check") == 0) {
tip = 1;
}
@ -345,7 +402,7 @@
}
}).get();
console.log(text);
if(tip == 1) {
layer.msg("<font style='color: white'>请选择打款信息已确认的单子</font>");
return;
@ -356,6 +413,12 @@
return;
}
if (text.length<1) {
layer.msg("<font style='color: white'>未选择达到条件的结算单</font>");
return;
}
text = text.join(",");
layer.confirm('【提示】是否确认打款信息撤回', {
@ -388,16 +451,16 @@
var pay_check_tip = 0;
var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) {
if($(elem).data("paystatus") == 0&&$(elem).data("pay_check") == 1){
if(($(elem).data("paystatus") == 0&&$(elem).data("pay_check") == 1) || ($(elem).data("paystatus") == 0&&$(elem).data("pay_check") == 2) || ($(elem).data("paystatus") == 2&&$(elem).data("pay_check") == 1)){
return $(elem).val();
}
if ($(elem).data("pay_check") != 1) {
if ($(elem).data("pay_check") == 0) {
pay_check_tip = 1;
}
}).get();
// console.log(text);return;
if (pay_check_tip == 1) {
layer.msg("<font style='color:white'>请选择打款信息已经确认的单子</font>");
return;

@ -0,0 +1,347 @@
<!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>
</head>
<style>
html {
min-width: 100%;
}
body {
padding: 0px 10px 150px;
/* width: 960px; */
margin: auto;
}
.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;
}
</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: 20px;">
<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>
<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" >
<if condition="$vo['pay_status'] neq 1">
<tr>
<td>{$key-0+1}</td>
<td>{$vo.company_name}</td>
<if condition="$vo['is_payment'] eq 1">
<td></td>
<td><input type="text" class="txt paymentset" data-id="{$vo.id}" name="ali_user" value="{$vo.company_info.ali_user}" placeholder="支付宝真实名称"></td>
<td><input type="text" class="txt paymentset" data-id="{$vo.id}" name="ali_account" value="{$vo.company_info.ali_account}" placeholder="支付宝账号"></td>
<td></td>
<else />
<td></td>
<td><input type="text" class="txt paymentset" data-id="{$vo.id}" name="payee_name" value="{$vo.company_info.payee_name}" placeholder="银行帐户名"></td>
<td><input type="text" class="txt paymentset" data-id="{$vo.id}" name="bank_account" value="{$vo.company_info.bank_account}" placeholder="银行帐号"></td>
<td><input type="text" class="txt paymentset" data-id="{$vo.id}" name="opening_bank" value="{$vo.company_info.opening_bank}" placeholder="开户行"></td>
</if>
<td>{$vo.statement_num}</td>
<td>{$vo.statement_money}</td>
<td><input type="text" class="txt paymentset" data-id="{$vo.id}" name="remark" value="{$vo.remark}" placeholder="备注"></td>
<td><a class="add_one" href="#">新增</a></td>
</tr>
<else />
<tr>
<td>{$key-0+1}</td>
<td>{$vo.company_name}</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>
<td><a class="add_one" href="#">新增</a></td>
</tr>
</if>
</foreach>
<tr id="sum">
<td colspan="2">合计:</td>
<td colspan="8"><span>结算总金额:{$all_money}</span><span style="margin-left: 20px">剩余打款金额:</span><span class="surplusAmount">0</span></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="search_list" style="display:flex;justify-content:flex-end;width:100%;margin-top: 30px;">
<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="display: none">
<table>
<thead>
</thead>
<tbody id="add_item">
<foreach name="CompanyInfo" item="vo" >
<if condition="$vo['pay_status'] neq 1">
<tr>
<td class="index_num">2</td>
<td>{$vo.company_name}</td>
<if condition="$vo['is_payment'] eq 1">
<td></td>
<td><input type="text" class="txt paymentset" data-id="{$vo.id}" name="ali_user" value="{$vo.company_info.ali_user}" placeholder="支付宝真实名称"></td>
<td><input type="text" class="txt paymentset" data-id="{$vo.id}" name="ali_account" value="{$vo.company_info.ali_account}" placeholder="支付宝账号"></td>
<td></td>
<else />
<td></td>
<td><input data-index_num="2" type="text" class="txt paymentset" data-id="{$vo.id}" name="payee_name" value="{$vo.company_info.payee_name}" placeholder="银行帐户名"></td>
<td><input data-index_num="2" type="text" class="txt paymentset" data-id="{$vo.id}" name="bank_account" value="{$vo.company_info.bank_account}" placeholder="银行帐号"></td>
<td><input data-index_num="2" type="text" class="txt paymentset" data-id="{$vo.id}" name="opening_bank" value="{$vo.company_info.opening_bank}" placeholder="开户行"></td>
</if>
<td>{$vo.statement_num}</td>
<td><input data-index_num="2" value="0" style="width: 80px;" type="number" data-id="{$vo.id}" name="unpay_amount" class="unpay_amount"></td>
<td><input data-index_num="2" type="text" class="txt paymentset unPayRemark" data-id="{$vo.id}" name="remark" value="" placeholder="备注"></td>
<td><a class="del" href="#">删除</a></td>
</tr>
</if>
</foreach>
</tbody>
</table>
</div>
<script>
$("#setPayment").on("click",function(){
var sendObj = {};
var url = "{:U('editPartPayment')}";
$("input[name='ali_user'],input[name='ali_account'],input[name='remark'],input[name='payee_name'],input[name='bank_account'],input[name='opening_bank'],input[name='unpay_amount']").map(function(index,elem) {
var index_num = $(elem).data("index_num");
var id = $(elem).data("id");
var e = $(elem).attr("name");
var v = $(elem).val();
if (!index_num) {
if(id in sendObj){
sendObj[id][e] = v;
}else{
sendObj[id] = {};
sendObj[id][e] = v;
}
} else {
var parent = $(elem).parent().parent().parent().attr('id');
if (parent!="add_item") {
if(index_num+id in sendObj){
if (!(e in sendObj[index_num+id])) {
sendObj[index_num+id][e] = v;
}
}else{
sendObj[index_num+id] = {};
sendObj[index_num+id][e] = v;
}
}
}
});
layer.confirm("若支付宝账号及真实姓名不全的公司,将无法进行打款。请认真核对,点击取消返回",{title:false}, function(index){
$.ajax({
type: "POST",
url: url,
dataType: 'json',
async: false,
data: {info:sendObj},
success:function(data){
layer.close(index);
if(data.status==1){
layer.msg("<font style='color:white'>" + data.info + "</font>");
setTimeout(function(){
window.parent.reload();
},1000);
}else{
layer.msg("<font style='color:white'>" + data.info + "</font>");
return false;
}
}
});
});
});
$(".add_one").on("click",function(){
// $(this).parent().parent().html();
$("#sum").before($("#add_item").html());
var index_num = parseInt($("#add_item").find(".index_num").text());
$("#add_item").find(".index_num").text(index_num+1);
$("#add_item").find(".unpay_amount").attr("data-index_num",index_num+1);
$("#add_item").find(".unPayRemark").attr("data-index_num",index_num+1);
$("#add_item").find("[name=payee_name]").attr("data-index_num",index_num+1);
$("#add_item").find("[name=bank_account]").attr("data-index_num",index_num+1);
$("#add_item").find("[name=opening_bank]").attr("data-index_num",index_num+1);
addDel();
unPayAmount();
});
//删除事件
function addDel() {
$(".del").off("click");
$(".del").on("click",function() {
$(this).parent().parent().remove();
unPayAmountDetail();
});
}
//计算剩余打款金额
function unPayAmount() {
$(".unpay_amount").off("blur");
$(".unpay_amount").on("blur",function () {
unPayAmountDetail();
});
}
function unPayAmountDetail() {
var value = 0;
$(".unpay_amount").map(function(index,elem) {
value += parseFloat($(elem).val());
}).get();
$(".surplusAmount").text(value);
}
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>
</body>
</html>
Loading…
Cancel
Save