4.23号功能提交

master
zhengyongxing 4 years ago
parent 1a2f0ab975
commit 83cc2aa6ec

@ -91,6 +91,7 @@ class CompanyStatementOfflineController extends ThinkController
$unPayData = SM("company_statement_info_part","tab_")
->field("sum(statement_money) statement_money,info_id")
->where(["pay_status"=>1])
->group("info_id")
->select();
@ -107,7 +108,7 @@ 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["pay_status"]==2?$handleData[$v['id']]:$v['statement_money']):"0.00");
$v['surplus_amount'] = ($v["pay_check"]==2)?($handleData[$v['id']] ? ($v['statement_money']-$handleData[$v['id']]):$v['statement_money'] ):($v["pay_status"]!=1?($v["pay_status"]==2?($v['statement_money']-$handleData[$v['id']]):$v['statement_money']):"0.00");
$v["pay_info"] = json_decode($v['pay_info'], true);
if(isset($v['pay_info']['payment_user'])){
@ -135,6 +136,16 @@ class CompanyStatementOfflineController extends ThinkController
// $v['pay_check_str'] = "已确认";
}
$isUnPay = SM("company_statement_info_part","tab_")
->field("info_id")
->where(["pay_status"=>0,'info_id'=>$v['id']])
->group("info_id")
->find();
if ($isUnPay) {
$v['pay_status'] = 0;
}
$v['oplist'] = $this->OpAuth($v);
}
//pay_status
@ -169,8 +180,8 @@ class CompanyStatementOfflineController extends ThinkController
->where("i.id in({$id})")
->select();
$temp = $this->addPaymentPartInfo($CompanyInfo);
$temp?$CompanyInfo=$temp:"";
// $temp = $this->addPaymentPartInfo($CompanyInfo);
// $temp?$CompanyInfo=$temp:"";
$all_money = 0;
foreach($CompanyInfo as $k=>&$v){
@ -205,7 +216,7 @@ class CompanyStatementOfflineController extends ThinkController
->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]])
->where(['info_id'=>['in',$id],"pay_status"=>0])
->select();
@ -324,6 +335,18 @@ class CompanyStatementOfflineController extends ThinkController
->where("i.id in({$id})")
->select();
$unPayData = SM("company_statement_info_part","tab_")
->field("sum(statement_money) statement_money,info_id")
->where(["pay_status"=>1])
->group("info_id")
->select();
$handleData = [];
foreach ($unPayData as $key => $value) {
$handleData[$value['info_id']] = $value['statement_money'];
}
$surplurAmount = 0;
$all_money = 0;
foreach($CompanyInfo as $k=>&$v){
if($v['verify_status'] == 2){
@ -337,9 +360,11 @@ class CompanyStatementOfflineController extends ThinkController
$v['company_info']['ali_account'] ?? '';
$all_money += $v['statement_money'];
$surplurAmount += $handleData[$v['id']];
}
$this->assign('surplur_amount',$all_money-$surplurAmount);
$this->assign('all_money',$all_money);
$this->assign("CompanyInfo",$CompanyInfo);
$this->assign("id",$id);
@ -414,6 +439,8 @@ class CompanyStatementOfflineController extends ThinkController
$ydata['pay_amount'] = $v['unpay_amount'];
$ydata['remark'] = $v['remark'];
$ydata['info_id'] = $id;
$ydata['pay_check'] = 0;
$ydata['pay_status'] = 0;
M("company_statement_info_part","tab_")->add($ydata);
}
@ -437,7 +464,7 @@ class CompanyStatementOfflineController extends ThinkController
$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)) {
if ($value['pay_check'] == 1&&$value['pay_status'] == 0) {
$CompanyInfo
->where(['id'=>$value['id']])
->save([
@ -446,16 +473,21 @@ class CompanyStatementOfflineController extends ThinkController
'pay_check_time'=>0
]);
M("company_statement_info_part","tab_")->where(['info_id'=>$value['id']])->delete();
}
if ($value['pay_check'] == 2) {
} 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()
]);
if($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'],'pay_status'=>['neq',1]])->delete();
}
}
@ -485,7 +517,7 @@ class CompanyStatementOfflineController extends ThinkController
//获取母单未支付完成订单
$poolIds = implode(",",array_keys($yPoolInfo));
$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();
// $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();
@ -525,12 +557,32 @@ class CompanyStatementOfflineController extends ThinkController
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']]}";
$saveData['remark'] = "{$value['remark']} {$_SESSION['onethink_admin']['user_auth']['username']}于{$time}已打款{$handleData[$value['id']]},剩余{$unPayAmount}";
SM("company_statement_info_part","tab_")
->where(['info_id'=>$value['id']])
->save(["pay_status"=>1]);
if($value['statement_money'] - $handleData[$value['id']] <=0) {
//打款成功
$companyStatementInfo->where(['id'=>$value['id']])->save([
"pay_check"=>1,
"pay_type"=>3,
"pay_status"=>1,
"pay_info"=>json_encode(["payment_user"=>$_SESSION['onethink_admin']['user_auth']["username"],"payment_time"=>$payment_time]),
"remark"=>$saveData['remark']
]);
} else {
$companyStatementInfo->where(['id'=>$value['id']])->save($saveData);
}
$companyStatementInfo->where(['id'=>$value['id']])->save($saveData);
}
}
$poolInfo = $companyStatementInfo->where("pool_id in ($poolIds) and pay_status <> 1")->field("pool_id,count(id) count")->group("pool_id")->select();
// dump($yPoolInfo);
// dump($poolInfo);die();
//全部就打款成功,否则打款中
$companyStatementPool = SM("company_statement_pool","tab_");
foreach ($poolInfo as $k => $v) {

@ -354,8 +354,13 @@
content: url
});
});
} else {
url = "{:U('setPayment')}"+"&id="+text;
} else if(unpay) {
// url = "{:U('setPayment')}"+"&id="+text;
if (textLength > 1) {
layer.msg("<font style='color: white'>部分确认的单子一次不能处理超过两条</font>");
return;
}
layer.open({
type: 2,
title: "海南万盟天下科技有限公司",
@ -453,7 +458,11 @@
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) || ($(elem).data("paystatus") == 0&&$(elem).data("pay_check") == 2) || ($(elem).data("paystatus") == 2&&$(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)
|| ($(elem).data("paystatus") == 2&&$(elem).data("pay_check") == 2)
){
return $(elem).val();
}

@ -166,7 +166,7 @@
</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>
<td colspan="8"><span>结算总金额:{$all_money}</span><span style="margin-left: 20px">剩余打款金额:</span><span class="surplusAmount">{$surplur_amount}</span></td>
</tr>
</tbody>
@ -321,6 +321,7 @@
});
}
var surplur_amount = "{$surplur_amount}";
function unPayAmountDetail() {
var value = 0;
@ -330,7 +331,7 @@
}).get();
$(".surplusAmount").text(value);
$(".surplusAmount").text((surplur_amount - value).toFixed(2));
}
function cancelPoolAjax(opurl,senddata){

@ -2823,4 +2823,7 @@ CREATE TABLE `tab_business_affairs_award_pool` (
`verify_status` tinyint(1) NOT NULL DEFAULT 0 COMMENT '审核状态 0 未审核 1 审核通过 2 审核拒绝',
`verify_time` int(11) NOT NULL DEFAULT 0 COMMENT '审核时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
ALTER TABLE `tab_company_statement_info`
MODIFY COLUMN `remark` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL COMMENT '备注' AFTER `pay_info`;
Loading…
Cancel
Save