12月功能提交

master
zhengyongxing 4 years ago
parent a0150c300f
commit 309b195986

@ -1917,6 +1917,7 @@ class CompanyStatementPoolController extends ThinkController
} else { } else {
$save['statement_money'] = $amount; $save['statement_money'] = $amount;
} }
$save['final_statement_money'] = $save['statement_money'];
// $setStatementInfo = json_decode($svalue['statement_info'],true); // $setStatementInfo = json_decode($svalue['statement_info'],true);
// foreach ($setStatementInfo as $sskey => $ssvalue) { // foreach ($setStatementInfo as $sskey => $ssvalue) {
// //
@ -1946,6 +1947,7 @@ class CompanyStatementPoolController extends ThinkController
$save['company_info'] = $svalue['company_info']; $save['company_info'] = $svalue['company_info'];
$save['statement_num'] = "JS_" . date("YmdHis", time()) . $save['company_id'] . sp_random_string(5); $save['statement_num'] = "JS_" . date("YmdHis", time()) . $save['company_id'] . sp_random_string(5);
$save['statement_money'] = $statement_money; $save['statement_money'] = $statement_money;
$save['final_statement_money'] = $save['statement_money'];
$save['statement_info_id'] = $svalue['id']; $save['statement_info_id'] = $svalue['id'];
$save['fine'] = $svalue['fine']; $save['fine'] = $svalue['fine'];
$save['reward'] = $svalue['reward']; $save['reward'] = $svalue['reward'];
@ -1984,6 +1986,7 @@ class CompanyStatementPoolController extends ThinkController
} else { } else {
$save['statement_money'] = $amount; $save['statement_money'] = $amount;
} }
$save['final_statement_money'] = $save['statement_money'];
$setStatementInfo = json_decode($svalue['statement_info'],true); $setStatementInfo = json_decode($svalue['statement_info'],true);
foreach ($setStatementInfo as $sskey => $ssvalue) { foreach ($setStatementInfo as $sskey => $ssvalue) {
@ -2013,6 +2016,7 @@ class CompanyStatementPoolController extends ThinkController
$save['company_info'] = $svalue['company_info']; $save['company_info'] = $svalue['company_info'];
$save['statement_num'] = "JS_" . date("YmdHis", time()) .$svalue['company_id'] . sp_random_string(5); $save['statement_num'] = "JS_" . date("YmdHis", time()) .$svalue['company_id'] . sp_random_string(5);
$save['statement_money'] = $svalue['statement_money']; $save['statement_money'] = $svalue['statement_money'];
$save['final_statement_money'] = $save['statement_money'];
$save['statement_info_id'] = $svalue['id']; $save['statement_info_id'] = $svalue['id'];
$save['fine'] = $svalue['fine']; $save['fine'] = $svalue['fine'];

@ -837,7 +837,7 @@ class PaymentController extends BaseController
$CompanyInfo = M("pay_statement_info","tab_") $CompanyInfo = M("pay_statement_info","tab_")
->alias('i') ->alias('i')
->field("i.id,c.pool_id,i.company_name,i.company_info,i.statement_money,p.statement_num,i.remark,i.pay_status") ->field("i.id,c.pool_id,i.company_name,i.company_info,i.statement_money,p.statement_num,i.remark,i.pay_status,i.final_statement_money")
->join("left join tab_company_statement_info c ON c.id = i.statement_info_id") ->join("left join tab_company_statement_info c ON c.id = i.statement_info_id")
->join("left join tab_company_statement_pool p ON p.id = c.pool_id") ->join("left join tab_company_statement_pool p ON p.id = c.pool_id")
->where("i.id in ({$ids})") ->where("i.id in ({$ids})")
@ -848,7 +848,7 @@ class PaymentController extends BaseController
$v['company_info']['ali_account'] ?? ''; $v['company_info']['ali_account'] ?? '';
} }
$count = M("pay_statement_info","tab_")->field("sum(statement_money) statement_money")->where("id in ({$ids})")->find(); $count = M("pay_statement_info","tab_")->field("sum(final_statement_money) statement_money")->where("id in ({$ids})")->find();
$this->getAccountMoney(); $this->getAccountMoney();
// dd($CompanyInfo); // dd($CompanyInfo);
@ -903,7 +903,8 @@ class PaymentController extends BaseController
if ($dbres['pay_status'] != 1 && $dbres['verify_status'] == 1) { if ($dbres['pay_status'] != 1 && $dbres['verify_status'] == 1) {
//执行打款 //执行打款
$title = "信息服务费"; $title = "信息服务费";
$amount = $dbres['statement_money']; $amount = $dbres['final_statement_money'];
$payres = $fund->transfer($company_info['ali_account'], $company_info['ali_user'], $dbres['statement_num'], $amount, $title); $payres = $fund->transfer($company_info['ali_account'], $company_info['ali_user'], $dbres['statement_num'], $amount, $title);
$resultCode = $payres->code; $resultCode = $payres->code;
$savedata = ["id"=>$dbres['id']]; $savedata = ["id"=>$dbres['id']];
@ -925,7 +926,7 @@ class PaymentController extends BaseController
if ($savedata["pay_status"] == -1) { if ($savedata["pay_status"] == -1) {
//支付详单bug修改 //支付详单bug修改
$this->setPayVerifyStatus(-1,$savedata["pay_type"],$id); $this->setPayVerifyStatus(-1,$savedata["pay_type"],$id);
$this->ajaxReturn(["success"=>"打款成功","data"=>["status"=>0],'amount'=>$dbres['statement_money']]); $this->ajaxReturn(["success"=>"打款成功","data"=>["status"=>0],'amount'=>$dbres['final_statement_money']]);
} }
//支付详单bug修改 //支付详单bug修改
@ -1079,6 +1080,35 @@ class PaymentController extends BaseController
'statement_money'=>['elt',0] 'statement_money'=>['elt',0]
]) ])
->save(['pay_status'=>1,'pay_time'=>time(),'pay_type'=>2,'pay_info'=>$pay_info]); ->save(['pay_status'=>1,'pay_time'=>time(),'pay_type'=>2,'pay_info'=>$pay_info]);
$pay_statement_info = M("pay_statement_info","tab_")
->where([
'statement_info_id'=>['in',$value['id']]
])
->order("statement_money ASC")
->select();
$subtraction = 0;
foreach ($pay_statement_info as $sk => $sv) {
if ($sv['statement_money'] < 0) {
$subtraction += -($sv['statement_money']);
} elseif($sv['statement_money'] > 0 && $subtraction > 0) {
if($sv['statement_money'] >= $subtraction) {
$sv['final_statement_money'] = $sv['statement_money']-$subtraction;
$subtraction = 0;
} else {
$sv['final_statement_money'] = 0;
$subtraction =-$sv['final_statement_money'];
}
}
M("pay_statement_info","tab_")
->where([
'id'=>$sv['id']
])->save($sv);
}
} }
} }

@ -148,7 +148,7 @@
<td>{$vo.company_info.ali_user}</td> <td>{$vo.company_info.ali_user}</td>
<td>{$vo.company_info.ali_account}</td> <td>{$vo.company_info.ali_account}</td>
<td>{$vo.statement_num}</td> <td>{$vo.statement_num}</td>
<td>{$vo.statement_money}</td> <td>{$vo.final_statement_money}</td>
<td>{$vo.remark}</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> <td><input type="text" class="txt paymentset" data-id="{$vo.id}" data-pool="{$vo.pool_id}" name="remark" value="" placeholder="打款备注"></td>
</tr> </tr>

Loading…
Cancel
Save