优化结算单确认

master
chenzhi 4 years ago
parent b7409ab069
commit f4be3972b2

@ -80,58 +80,40 @@ class PublicController extends \Think\Controller
if (!$this->checksafecode($mobile, $verify)) {
$this->error('验证码错误');
}
$promote = M('promote_company', 'tab_')->where(['contact_phone' => $mobile])->find();
$islogon = false;
$promote = M('promote_company', 'tab_')->where(['contact_phone' => $mobile])->select();
$partner = M('partner', 'tab_')->where(['link_phone' => $mobile,])->select();
$cp_auth = [
"mobile_phone"=>$mobile
];
if ($promote) {
/* 记录登录SESSION和COOKIES */
$cp_auth = array(
'link_man'=>$promote['settlement_contact'],
'mobile_phone' => $promote['contact_phone'],
'company_name' => $promote['company_name'],
'company_type'=>"promote",
'company_id' => $promote['id'],
);
$session_name = 'cp_user_auth';
if (I('auto_login')) {
$expireTime = 60*60*24*30;//自动登录一个月
ini_set('session.gc_maxlifetime', $expireTime);
ini_set('session.cookie_lifetime', $expireTime);
session($session_name, $cp_auth);
session($session_name.'_sign', data_auth_sign($cp_auth));
session($session_name.'_expire', time());
} else {
session($session_name, $cp_auth);
session($session_name.'_sign', data_auth_sign($cp_auth));
$cp_auth['promote_company_id'] = implode(",",array_column($promote,"id"));
$cp_auth['link_man'] = $promote[0]["settlement_contact"];
$islogon = true;
}
if ($partner) {
$cp_auth['partner_id'] = implode(",",array_column($partner,"id"));
if(!isset($cp_auth['link_man'])){
$cp_auth['link_man'] = $partner[0]["settlement_contact"];
}
$uid = $promote['id'];
} else {
$partner = M('partner', 'tab_')->where(['link_phone' => $mobile,])->find();
if ($partner) {
/* 记录登录SESSION和COOKIES */
$cp_auth = array(
'link_man'=>$partner['link_man'],
'mobile_phone' => $partner['link_phone'],
'company_name' => $partner['partner'],
'company_type'=>"cp",
'company_id' => $partner['id'],
);
$session_name = 'cp_user_auth';
if (I('auto_login')) {
$expireTime = 60*60*24*30;//自动登录一个月
ini_set('session.gc_maxlifetime', $expireTime);
ini_set('session.cookie_lifetime', $expireTime);
session($session_name, $cp_auth);
session($session_name.'_sign', data_auth_sign($cp_auth));
session($session_name.'_expire', time());
} else {
session($session_name, $cp_auth);
session($session_name.'_sign', data_auth_sign($cp_auth));
}
$uid = $partner['id'];
}
$islogon = true;
}
$session_name = 'cp_user_auth';
if (I('auto_login')) {
$expireTime = 60*60*24*30;//自动登录一个月
ini_set('session.gc_maxlifetime', $expireTime);
ini_set('session.cookie_lifetime', $expireTime);
session($session_name, $cp_auth);
session($session_name.'_sign', data_auth_sign($cp_auth));
session($session_name.'_expire', time());
} else {
session($session_name, $cp_auth);
session($session_name.'_sign', data_auth_sign($cp_auth));
}
if (0 < $uid) { //UC登录成功
if ($islogon) { //UC登录成功
/* 登录用户 */
$this->success('登录成功!', U('VerifyBill/index'));
} else { //登录失败

@ -34,21 +34,36 @@ class VerifyBillController extends Controller {
*/
public function index(){
$m_title = '对账单管理';
$map = [
"company_id"=>$this->companyinfo['company_id'],
"verify_status"=>['GT',1],
];
if($this->companyinfo['company_type'] == 'cp'){
$map['company_belong'] = 9;
}else{
$map['company_belong'] = ['NEQ',9];
$l = $this->companyinfo;
$list_data = [];
$field = "id,company_name,withdraw_type,company_name,company_belong,statement_begin_time,statement_end_time,statement_money,platform_amount,confirm_status,confirm_log,op_time";
if(isset($l['promote_company_id'])){
$map = [
"company_id"=>["in",$l['promote_company_id']],
"confirm_status"=>['NEQ',0],
"company_belong"=>['NEQ',9]
];
$list_data = DM('company_statement')
->field($field)
->where($map)
->order('op_time desc')
->select();
}
$list_data = DM('company_statement')
->field("id,withdraw_type,company_name,company_belong,statement_begin_time,statement_end_time,statement_money,platform_amount,verify_status,verify_log,op_time")
if(isset($l['partner_id'])){
$map = [
"company_id"=>["in",$l['partner_id']],
"confirm_status"=>['NEQ',0],
"company_belong"=>9
];
$partner_data = DM('company_statement')
->field($field)
->where($map)
->order('op_time desc')
->select();
$list_data = array_merge($list_data,$partner_data);
}
foreach ($list_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']);
@ -56,10 +71,11 @@ class VerifyBillController extends Controller {
$v["valid"] = "{$v['statement_begin_time']} ~ {$v['statement_end_time']}";
$v['withdraw_type_1'] = ($v['withdraw_type'] == 1 ? "月结" :"周结");
$v['withdraw_type_2'] = ($v['withdraw_type'] == 2 ? "补点" :"正常结算");
if ($v['verify_status'] == 2) {
if ($v['confirm_status'] == 1) {
$v['verify_status_str'] = '未确认';
}
if ($v['verify_status'] > 2) {
if ($v['confirm_status'] == 2) {
$v['verify_status_str'] = '已确认';
}
}
@ -116,21 +132,24 @@ class VerifyBillController extends Controller {
{
if(!isset($_REQUEST['id'])) $this->error("参数错误");
$id = $_REQUEST['id'];
$dbres = M("CompanyStatement","tab_")->field("id,verify_status,verify_log")->where("id='{$id}'")->find();
if($dbres['verify_status'] != 2) return;
$dbres['verify_log'] = json_decode($dbres['verify_log'],true);
$dbres['verify_log']['confirm_user']=$this->companyinfo['mobile_phone'];
$dbres['verify_log']['confirm_time']=date("Y-m-d H:i:s");
$dbres['verify_log'] = json_encode($dbres['verify_log']);
$dbres['verify_status']=3;
$dbres = M("CompanyStatement","tab_")->field("id,confirm_status,confirm_log")->where("id='{$id}'")->find();
if($dbres['confirm_status'] != 1){
$this->ajaxReturn(array(
'status' => 0,
"info"=>"已确认"
));
};
$dbres['confirm_log'] = json_decode($dbres['confirm_log'],true);
$dbres['confirm_log']['confirm_user']=$this->companyinfo['mobile_phone'];
$dbres['confirm_log']['confirm_time']=date("Y-m-d H:i:s");
$dbres['confirm_log'] = json_encode($dbres['confirm_log']);
$dbres['confirm_status']=2;
M("CompanyStatement","tab_")->save($dbres);
$this->ajaxReturn(array(
'status' => 1,
"info"=>"操作成功"
));
}
/**
*导出excell
* @param int id

@ -72,7 +72,7 @@
<li><a class="" href="{:U('public/cp_logout')}">退出</a></li>
</ul>
<div class="user">
<span>{:session('cp_user_auth.company_name')}</span>
<span>{:session('cp_user_auth.mobile_phone')}</span>
</div>
</div>
</div>

@ -50,6 +50,7 @@
<!-- 表头 -->
<thead>
<tr>
<th>公司名称</th>
<th>结算时间</th>
<th>结算周期</th>
<th>结算类型</th>
@ -70,6 +71,7 @@
<notemtpy name = "list_data">
<volist name="list_data" id="data">
<tr>
<td>{$data.company_name}</td>
<td>{$data.valid}</td>
<td>{$data.withdraw_type_1}</td>
<td>{$data.withdraw_type_2}</td>
@ -79,8 +81,8 @@
<td>
<a data-id="{$data.id}" class="view">查看</a>
<a data-id="{$data.id}" class="export">导出</a>
<if condition = "$data['verify_status'] eq 2">
<a data-id="{$data.id}" class="confirm">确认结算单</a>
<if condition = "$data['confirm_status'] eq 1">
<a data-id="{$data.id}" class="confirm_btn">确认结算单</a>
</if>
</td>
</tr>
@ -126,16 +128,17 @@
window.location.href = url;
});
$(".confirm").click(function(){
$(".confirm_btn").click(function(){
var id = $(this).data("id");
var opurl = "{:U('confirm')}";
var opurl = "{:U('VerifyBill/confirm')}";
console.log(id,opurl);
$.ajax({
type: "POST",
// type: "POST",
url: opurl,
dataType: 'json',
async: false,
// dataType: 'json',
data: {id:id},
success:function(data){
console.log(data)
if(data.status==1){
layer.msg("<font style='color:white'>" + data.info + "</font>");
setTimeout(function(){

Loading…
Cancel
Save