From 772923ffcec15f363a68b5613d450f10f848a485 Mon Sep 17 00:00:00 2001 From: qianhy Date: Wed, 17 May 2023 16:03:59 +0800 Subject: [PATCH] loan0 about --- admin/controllers/auto/Business.php | 2 +- admin/controllers/items/Cost.php | 70 ++- admin/controllers/receiver/orderv2/Orders.php | 285 +++++++++++- admin/libraries/Ordersv2List.php | 25 +- admin/views/auto/business/get.php | 4 +- admin/views/auto/business/lists.php | 2 +- admin/views/items/cost/get.php | 228 +++++++++- admin/views/items/cost/lists.php | 4 + admin/views/receiver/orderv2/get/index.php | 50 ++- admin/views/receiver/orderv2/get/loaninfo.php | 4 +- .../views/receiver/orderv2/get/loaninfo0.php | 163 +++++++ admin/views/receiver/orderv2/get/oinfo.php | 2 +- admin/views/receiver/orderv2/get/paylog.php | 7 +- api/controllers/plan/Order.php | 117 ++++- api/controllers/wxapp/licheb/CusorderV2.php | 107 ++++- api/controllers/wxapp/licheb/Loan.php | 80 ++++ .../libraries/receiver/Orders_v2_entity.php | 27 +- .../app/liche/App_liche_orders_model.php | 2 +- common/models/items/Items_cost_model.php | 20 +- .../order/Receiver_order_loans0_model.php | 24 + .../order/Receiver_order_status_model.php | 6 +- home/controllers/Pop.php | 417 ++++++++++++++++++ home/views/pop/dongfeng.php | 93 ++++ home/views/pop/dongfeng_h5.php | 22 + www/admin/temp/business.xlsx | Bin 10396 -> 10400 bytes 25 files changed, 1672 insertions(+), 89 deletions(-) create mode 100644 admin/views/receiver/orderv2/get/loaninfo0.php create mode 100644 common/models/receiver/order/Receiver_order_loans0_model.php create mode 100644 home/controllers/Pop.php create mode 100644 home/views/pop/dongfeng.php create mode 100644 home/views/pop/dongfeng_h5.php diff --git a/admin/controllers/auto/Business.php b/admin/controllers/auto/Business.php index 309314ea..287dc2c3 100644 --- a/admin/controllers/auto/Business.php +++ b/admin/controllers/auto/Business.php @@ -565,7 +565,7 @@ class Business extends HD_Controller{ 'profix_car' => '品牌店单车毛利', 'profix_carno' => '上牌毛利', 'profix_insure' => '保险毛利', - 'profix_loan' => '贷款毛利', # 以上次序与导入一致,方便导出后编辑再导入 + 'profix_loan' => '按揭毛利', # 以上次序与导入一致,方便导出后编辑再导入 'status_name' => '状态', 'effect_status' => '是否生效', 'id' => 'ID', diff --git a/admin/controllers/items/Cost.php b/admin/controllers/items/Cost.php index f9264f9f..0a538f9d 100644 --- a/admin/controllers/items/Cost.php +++ b/admin/controllers/items/Cost.php @@ -221,6 +221,8 @@ class Cost extends HD_Controller{ 'insurance_price' => $val['insurance_price'], 'fee_carno_price' => $val['fee_carno_price'], 'loan_price' => $val['loan_price'], + 'loan_price0' => $val['loan_price0'], // 首付按揭 + 'loan_price_total' => $val['loan_price_total'], 'srv_price' => $val['srv_price'], 'car_price' => $val['car_price'], 'dl_car_price' => $val['dl_car_price'], @@ -272,6 +274,14 @@ class Cost extends HD_Controller{ !$srv_json['loan_subsidy_price'] && $srv_json['loan_subsidy_price'] = 0; !$srv_json['loan_in_price'] && $srv_json['loan_in_price'] = 0; !$srv_json['loan_out_price'] && $srv_json['loan_out_price'] = 0; + !$srv_json['loan_srv0'] && $srv_json['loan_srv0'] = 0; // 首付按揭 // 按揭手续费 + !$srv_json['loan_fd0'] && $srv_json['loan_fd0'] = 0; // 返点 + !$srv_json['loan_srv_price0'] && $srv_json['loan_srv_price0'] = 0; // 按揭佣金 + !$srv_json['loan_offset_price0'] && $srv_json['loan_offset_price0'] = 0; // 解抵服务费 + !$srv_json['loan_subsidy_price0'] && $srv_json['loan_subsidy_price0'] = 0; // 利息补贴收入 其他收入金额 + !$srv_json['loan_in_price0'] && $srv_json['loan_in_price0'] = 0; // 其他收入金额 + !$srv_json['loan_out_price0'] && $srv_json['loan_out_price0'] = 0; // 其他支出金额 + !$srv_json['commission_price0'] && $srv_json['commission_price0'] = 0; // 按揭手续费收入 !$srv_json['other_out_price'] && $srv_json['other_out_price'] = 0; !$srv_json['other_in_price'] && $srv_json['other_in_price'] = 0; !$srv_json['ori_price'] && $srv_json['ori_price'] = 0; @@ -290,7 +300,7 @@ class Cost extends HD_Controller{ 'biz_type' => $biz['type'], 'biz_type_name' => $this->biz_model->type_ary($biz['type']), 'biz_name' => $biz['biz_name'], - 'biz_type_force' => $biz['type'] == 3 && in_array($biz['city_id'], $this->receiver_orders_v2_model->get_city_ids_force()) ? 1 : 0, # 23-04-03: 贷款, 350600 代理店按所在城市的品牌店处理; 23-04-04: 加多一个城市,宁德 + 'biz_type_force' => $biz['type'] == 3 && in_array($biz['city_id'], $this->receiver_orders_v2_model->get_city_ids_force()) ? 1 : 0, # 23-04-03: 按揭, 350600 代理店按所在城市的品牌店处理; 23-04-04: 加多一个城市,宁德 'admin_name' => $admin['uname'], 'order_time' => date('Y-m-d',$order_row['c_time']), 'promotion_json' => $promotion_json, @@ -560,7 +570,7 @@ class Cost extends HD_Controller{ if($o_ids){ $where = ["id in ($o_ids)" => null]; $fields = "id, name, mobile, owner_name, owner_mobile, c_time, biz_id, admin_id, - payway, if(payway=1,'全款','贷款') as payway_name, + payway, if(payway=1,'全款','按揭') as payway_name, if_usedcar, if(if_usedcar=1,'是','') as if_usedcar_name, (select type from lc_biz where id = lc_receiver_orders_v2.biz_id) as biz_type, (select biz_name from lc_biz where id = lc_receiver_orders_v2.biz_id) as biz_name, @@ -678,20 +688,36 @@ class Cost extends HD_Controller{ 'payway_name' => $order['payway_name'], + 'loan_product0' => $srv_json['loan_product0'], + 'loan_is_tiexi0' => $srv_json['loan_product0'] ? ($srv_json['loan_is_tiexi0'] ? '是' : '否') : '', + 'loan_price0' => $srv_json['loan_price0'], + 'loan_num0' => $srv_json['loan_num0'], + 'loan_srv_price0' => $srv_json['loan_srv_price0'], + 'loan_srv0' => $srv_json['loan_srv0'], + 'loan_fd0' => $srv_json['loan_fd0'], + 'loan_offset_price0' => $srv_json['loan_offset_price0'], + 'loan_subsidy_price' => $srv_json['loan_subsidy_price0'], + 'commission_price0' => $srv_json['commission_price0'], + 'loan_in_price0' => $srv_json['loan_in_price0'], + 'loan_out_price0' => $srv_json['loan_out_price0'], + 'loan_price_pure0' => $val['loan_price0'], + 'loan_product' => $srv_json['loan_product'], 'loan_is_tiexi' => $srv_json['loan_is_tiexi'] ? '是' : '否', - 'loan_price' => $srv_json['loan_price'], - 'loan_num' => $srv_json['loan_num'], - 'loan_srv_price' => $srv_json['loan_srv_price'], - 'loan_srv' => $srv_json['loan_srv'], - 'loan_fd' => $srv_json['loan_fd'], - 'loan_offset_price' => $srv_json['loan_offset_price'], - 'loan_subsidy_price' => $srv_json['loan_subsidy_price'], - 'commission_price' => $srv_json['commission_price'], - 'loan_in_price' => $srv_json['loan_in_price'], - 'loan_out_price' => $srv_json['loan_out_price'], + 'loan_price' => $srv_json['loan_price'], // 按揭金额 + 'loan_num' => $srv_json['loan_num'], // 期数 + 'loan_srv_price' => $srv_json['loan_srv_price'], // 按揭佣金 + 'loan_srv' => $srv_json['loan_srv'], // 按揭手续费 + 'loan_fd' => $srv_json['loan_fd'], // 返点 + 'loan_offset_price' => $srv_json['loan_offset_price'], // 解抵服务费 + 'loan_subsidy_price' => $srv_json['loan_subsidy_price'], // 利息补贴收入 + 'commission_price' => $srv_json['commission_price'], // 按揭手续费收入 + 'loan_in_price' => $srv_json['loan_in_price'], // 其他收入金额 + 'loan_out_price' => $srv_json['loan_out_price'], // 其他支出金额 'loan_price_pure' => $val['loan_price'], + 'loan_price_total' => $val['loan_price_total'], + 'other_in_price' => $srv_json['other_in_price'], 'other_out_price' => $srv_json['other_out_price'], 'other_price' => $srv_json['other_in_price'] - $srv_json['other_out_price'], @@ -715,7 +741,8 @@ class Cost extends HD_Controller{ 'promotion_sale_price' => array('title'=>'促销成本', 'column_num'=>3), 'business_product' => array('title'=>'保险收入', 'column_num'=>12), 'fee_carno' => array('title'=>'挂牌收入', 'column_num'=>3), - 'loan_product' => array('title'=>'分期付款业务', 'column_num'=>13), + 'loan_product0' => array('title'=>'首付按揭付款业务', 'column_num'=>12), // 首付按揭-表头, 首付按揭不需要贴息选项,所以少一列 + 'loan_product' => array('title'=>'按揭付款业务', 'column_num'=>13), 'other_in_price' => array('title'=>'其他收入及成本', 'column_num'=>3), 'need_price' => array('title'=>'收款核对', 'column_num'=>3), ]; @@ -779,6 +806,21 @@ class Cost extends HD_Controller{ 'payway_name' => '购车方式', + // 首付按揭-字段 + 'loan_product0' => '按揭银行', + //'loan_is_tiexi0' => '贴息', // 首付按揭不需要贴息选项 + 'loan_num0' => '期数', + 'loan_price0' => '按揭金额', + 'loan_fd0' => '按揭返点', + 'loan_srv_price0' => '按揭佣金', + 'loan_srv0' => '按揭手续费', + 'loan_offset_price0' => '解抵服务费', + 'loan_subsidy_price0' => '利息补贴收入', + 'commission_price0' => '按揭手续费收入', + 'loan_in_price0' => '其他收入金额', + 'loan_out_price0' => '其他支出金额', + 'loan_price_pure0' => '按揭收入合计', + 'loan_product' => '按揭银行', 'loan_is_tiexi' => '贴息', 'loan_num' => '期数', @@ -793,6 +835,8 @@ class Cost extends HD_Controller{ 'loan_out_price' => '其他支出金额', 'loan_price_pure' => '按揭收入合计', + 'loan_price_total' => '按揭收入总合计', + 'other_in_price' => '其他收入', 'other_out_price' => '其他支出', 'other_price' => '其他合计', diff --git a/admin/controllers/receiver/orderv2/Orders.php b/admin/controllers/receiver/orderv2/Orders.php index 3ef62a55..5c81a58d 100644 --- a/admin/controllers/receiver/orderv2/Orders.php +++ b/admin/controllers/receiver/orderv2/Orders.php @@ -11,6 +11,7 @@ class Orders extends HD_Controller $this->load->model('receiver/order/receiver_order_status_model'); $this->load->model('receiver/order/receiver_order_datas_model'); $this->load->model('receiver/order/receiver_order_loans_model', 'order_loans_model'); + $this->load->model('receiver/order/receiver_order_loans0_model', 'order_loans0_model'); $this->load->model('receiver/order/receiver_order_ckcars_model', 'order_ckcars_model'); $this->load->model('receiver/order/receiver_order_bills_model', 'order_bills_model'); $this->load->model('receiver/order/receiver_order_agents_model', 'order_agents_model'); @@ -76,7 +77,7 @@ class Orders extends HD_Controller } if($key2 && $key2<21){ $where_s = []; - $key==1 && $where_s["{$t1}.payway"] = 0;//分期 + $key==1 && $where_s["{$t1}.payway"] = 0;//按揭 $where_s["{$t1}.status <>"] = 2; //滤退款 if($key==4){ //交付需要开票后才显示 $where_s["{$t1}.id in (select o_id from lc_receiver_order_status where pid_status=3 and status=1)"] = null; @@ -418,7 +419,7 @@ class Orders extends HD_Controller } $srv_info['detail'] = $srv_detail; $row['srv_info'] = $srv_info; - //获取贷款信息 + //获取按揭信息 if (!$row['payway']) { $loan = $this->order_loans_model->get(['o_id' => $row['id']]); @@ -430,7 +431,7 @@ class Orders extends HD_Controller } } $loan['notify_file_list'] = $notify_file_list; -// $loan['notify_file_name'] = $loan['notify_file'] ? end(explode('/', $loan['notify_file'])) : ''; + //$loan['notify_file_name'] = $loan['notify_file'] ? end(explode('/', $loan['notify_file'])) : ''; $loan['lend_file'] = $loan['lend_file'] ? build_qiniu_image_url($loan['lend_file']) : ''; $loan['lend_file_name'] = $loan['lend_file'] ? end(explode('/', $loan['lend_file'])) : ''; @@ -440,6 +441,7 @@ class Orders extends HD_Controller $loan['first_pay'] = 0; if ($money_json['price_loan']) { $loan['first_pay'] = $sale_price - $money_json['price_loan']; + $money_json['price_loan0'] && $loan['first_pay'] -= $money_json['price_loan0']; // 首付按揭 } !$loan['num'] && $loan['num'] = 36; $loan['is_tiexi'] = intval($loan['is_tiexi']); @@ -448,6 +450,40 @@ class Orders extends HD_Controller $loan['status_array'] = array_column($status_array,'status'); $row['loan_info'] = $loan; } + + //获取按揭信息-首付按揭 + if (!$row['payway'] && $money_json['price_loan0']) { + $loan = $this->order_loans0_model->get(['o_id' => $row['id']]); + + $notify_file_list = []; + $file_list = $loan['notify_file'] ? explode(',',$loan['notify_file']) : array(); + if($file_list){ + foreach ($file_list as $item) { + $notify_file_list[] = build_qiniu_image_url($item); + } + } + $loan['notify_file_list'] = $notify_file_list; + $loan['lend_file'] = $loan['lend_file'] ? build_qiniu_image_url($loan['lend_file']) : ''; + $loan['lend_file_name'] = $loan['lend_file'] ? end(explode('/', $loan['lend_file'])) : ''; + + $loan['finance_rows'] = $this->sys_supplier_model->select(['status' => 1, 'type'=>3], '', 0, 0, 'id,title'); + $loan['price_loan'] = $money_json['price_loan0'] ? $money_json['price_loan0'] : ''; + $loan['first_pay'] = 0; // 不需要计算改值 + !$loan['num'] && $loan['num'] = 36; + $loan['is_tiexi'] = intval($loan['is_tiexi']); + $loan['loan_time'] = $loan['loan_time'] != '0000-00-00 00:00:00' ? date('Y-m-d', strtotime($loan['loan_time'])) : ''; + // 首付按揭的状态,根据记录值生成 + //$status_array = $this->receiver_order_status_model->select(['o_id'=>$row['id'],'pid_status'=>1],'','','id,status'); + //$loan['status_array'] = array_column($status_array,'status'); + $status_array = array(); + $row['finance_id0'] && $loan['notify_file'] && $status_array[] = 1; + if($this->app_liche_orders_model->get(['o_id'=>$row['id'],'type'=>8,'status'=>1])){ + $status_array[] = 2; + } + $loan['status_array'] = $status_array; + $row['loan_info0'] = $loan; + } + //获取审核资料信息 $img_data = $this->receiver_order_datas_model->get(['o_id'=>$row['id'],'status>='=>0]); $row['imgs_status'] = $this->order_datas_entity->data_ckinfo($img_data,$row['main_type']); @@ -699,7 +735,7 @@ class Orders extends HD_Controller return $this->excel->out_csv($data, $indexs, $fileName . "_" . date('YmdHis')); } - //修改分期图片 + //修改按揭图片 public function edit_loanfile() { $params = $this->input->post(); @@ -735,10 +771,51 @@ class Orders extends HD_Controller if($update){ $result = $this->order_loans_model->update($update, ['id' => $row['id']]); } + $this->order_status_check_after_edit_loan($row_order); return $result ? $this->show_json(SYS_CODE_SUCCESS, '保存成功') : $this->show_json(SYS_CODE_FAIL, '保存失败'); } - //修改分期 + //修改按揭图片-首付按揭 + public function edit_loanfile0() + { + $params = $this->input->post(); + $oid = $params['id']; + $file = $params['value']; + + $row_order = $this->receiver_orders_v2_model->get(array('id' => $oid)); + if(!$file || !$row_order){ + return $this->show_json(SYS_CODE_FAIL, '参数错误'); + } + + $row = $this->order_loans0_model->get(['o_id' => $oid]); + if (!$row) { + $this->order_loans0_model->add(['o_id' => $oid, 'c_time' => time()]); + $row = $this->order_loans0_model->get(['o_id' => $oid]); + } + $notify_file_list = $row['notify_file'] ? explode(',',$row['notify_file']) : []; + $update = []; + if ($file) { //上传按揭通知函 + if ($params['type']) { + $update['lend_file'] = $file; + # 此处不检查load_time为空的情况,最后做“按揭完成”时也会检查 + $loan_time = $params['loan_time']; + if ($loan_time) { + $update['loan_time'] = date('Y-m-d H:i:s', strtotime($loan_time)); + } + } else { + $notify_file_list[] = $file; + $update['notify_file'] = implode(',',$notify_file_list); + } + $this->data['file_url'] = build_qiniu_image_url($file); + } + if($update){ + $result = $this->order_loans0_model->update($update, ['id' => $row['id']]); + } + $this->order_status_check_after_edit_loan($row_order); + return $result ? $this->show_json(SYS_CODE_SUCCESS, '保存成功') : $this->show_json(SYS_CODE_FAIL, '保存失败'); + } + + //修改按揭 public function edit_loan() { $params = $this->input->post(); @@ -784,14 +861,14 @@ class Orders extends HD_Controller $this->data['file_url'] = build_qiniu_image_url($res['file']); } strlen($params['status']) && $update['status'] = $params['status']; + $finance_id = $info['finance_id']; + if (!$finance_id || !$price_loan) { + return $this->show_json(SYS_CODE_FAIL, '请填写完整信息!'); + } if ($params['status'] == 1) { //等待放款 - $finance_id = $info['finance_id']; if (!$row['notify_file']) { return $this->show_json(SYS_CODE_FAIL, '请先上传按揭通知函!'); } - if (!$finance_id || !$price_loan) { - return $this->show_json(SYS_CODE_FAIL, '请填写完整信息!'); - } $order_row = $this->receiver_orders_v2_model->get(['id' => $row['o_id']], 'id,mobile,money_json'); $money_json = json_decode($order_row['money_json'], true); $money_json['price_loan'] = $price_loan; @@ -809,6 +886,18 @@ class Orders extends HD_Controller return $this->show_json(SYS_CODE_FAIL, '请先上传按揭放款函!'); } $update['loan_time'] = date('Y-m-d H:i:s', strtotime($loan_time)); + + $order_row = $this->receiver_orders_v2_model->get(['id' => $row['o_id']], 'id,mobile,money_json'); + $money_json = json_decode($order_row['money_json'], true); + // 不考虑-首付按揭要先完成才能 set_status($oid,1,2) + /* if ($money_json['price_loan0']){ + if(!$this->app_liche_orders_model->get(['o_id'=>$row['id'],'type'=>8,'status'=>1])){ + return $this->show_json(SYS_CODE_FAIL, '请先完成首付按揭!'); + } + }*/ + // 防止此页面有修改,同时更新price_loan与finance_id + $money_json['price_loan'] = $price_loan; + $this->receiver_orders_v2_model->update(['finance_id' => $finance_id, 'money_json' => json_encode($money_json, JSON_UNESCAPED_UNICODE)], ['id' => $row['o_id']]); $result = $this->orders_status_entity->set_status($oid,1,2); //添加按揭收款记录 if(!$this->app_liche_orders_model->get(['o_id'=>$row['o_id'],'type'=>7])){ @@ -845,6 +934,121 @@ class Orders extends HD_Controller return $result ? $this->show_json(SYS_CODE_SUCCESS, '保存成功') : $this->show_json(SYS_CODE_FAIL, '保存失败'); } + //修改按揭-首付按揭 + public function edit_loan0() + { + $params = $this->input->post(); + $info = $params['info']; + $oid = $params['id'] ? $params['id'] : $info['id']; + $file = $_FILES['file']; + $row = $this->order_loans0_model->get(['o_id' => $oid]); + if (!$row) { + $this->order_loans0_model->add(['o_id' => $oid, 'c_time' => time()]); + $row = $this->order_loans0_model->get(['o_id' => $oid]); + } + $notify_file_list = $row['notify_file'] ? explode(',',$row['notify_file']) : []; + $update = []; + $update['company_id'] = $info['loan_info0']['company_id']; + $update['num'] = $info['loan_info0']['num']; + $price_loan = $info['loan_info0']['price_loan']; + if ($file) { //上传按揭通知函 + $path = FCPATH . 'temp/'; + if (!file_exists($path)) { + $oldumask = umask(0); + mkdir($path, 0777, true); + umask($oldumask); + } + $file_name = md5($file['name'] . uniqid()) . '.' . end(explode('.', $file['name'])); + $tmp = $path . $file_name; + move_uploaded_file($file['tmp_name'], $tmp); + + if (!filesize($tmp)) { + return $this->show_json(SYS_CODE_FAIL, '上传文件失败!'); + } + $this->load->library('qiniu'); + $res = $this->qiniu->save($file_name, file_get_contents($tmp)); + unlink($tmp); + if (!$res) { + return $this->show_json(SYS_CODE_FAIL, '上传文件失败!'); + } + if ($params['type']) { + $update['lend_file'] = $res['file']; + } else { + $notify_file_list[] = $res['file']; + $update['notify_file'] = implode(',',$notify_file_list); + } + $this->data['file_url'] = build_qiniu_image_url($res['file']); + } + strlen($params['status']) && $update['status'] = $params['status']; + $finance_id = $info['finance_id0']; + if (!$finance_id || !$price_loan) { + return $this->show_json(SYS_CODE_FAIL, '请填写完整信息!'); + } + if ($params['status'] == 1) { //等待放款 + if (!$row['notify_file']) { + return $this->show_json(SYS_CODE_FAIL, '请先上传按揭通知函!'); + } + $order_row = $this->receiver_orders_v2_model->get(['id' => $row['o_id']], 'id,mobile,money_json'); + $money_json = json_decode($order_row['money_json'], true); + $money_json['price_loan0'] = $price_loan; + $this->receiver_orders_v2_model->update(['finance_id0' => $finance_id, 'money_json' => json_encode($money_json, JSON_UNESCAPED_UNICODE)], ['id' => $row['o_id']]); + //生成购车订单 + $userinfo = $this->app_liche_users_model->get(['mobile'=>$order_row['mobile']]); + $this->orders_v2_entity->add_order($order_row['id'],$userinfo['id']); + //$result = $this->orders_status_entity->set_status($oid,1,1); // 首付按揭不改订单状态 + $result = true; + }elseif($params['status'] == 2){ //完成按揭 + $loan_time = $info['loan_info0']['loan_time']; + if (!$loan_time) { + return $this->show_json(SYS_CODE_FAIL, '请选择放款时间!'); + } + if (!$row['notify_file']) { + return $this->show_json(SYS_CODE_FAIL, '请先上传按揭通知函!'); + } + if (!$row['lend_file']) { + return $this->show_json(SYS_CODE_FAIL, '请先上传按揭放款函!'); + } + $update['loan_time'] = date('Y-m-d H:i:s', strtotime($loan_time)); + $order_row = $this->receiver_orders_v2_model->get(['id' => $row['o_id']], 'id,mobile,money_json'); + $money_json = json_decode($order_row['money_json'], true); + $money_json['price_loan0'] = $price_loan; + $this->receiver_orders_v2_model->update(['finance_id0' => $finance_id, 'money_json' => json_encode($money_json, JSON_UNESCAPED_UNICODE)], ['id' => $row['o_id']]); + //$result = $this->orders_status_entity->set_status($oid,1,2); // 首付按揭不改订单状态 + //添加按揭收款记录 + if(!$this->app_liche_orders_model->get(['o_id'=>$row['o_id'],'type'=>8])){ + $p_row = $this->app_liche_orders_model->get(['o_id'=>$row['o_id'],'pid'=>0,'status>='=>0]); + $order_row = $this->receiver_orders_v2_model->get(['id' => $row['o_id']]); + $this->load->helper('order'); + $sid = create_order_no(350200, 'liche', 1, 8); + $pay_log = [ + 'o_id' => $order_row['id'], + 'sid' => $sid, + 'pid' => $p_row['id'], + 'admin_id' => $this->uid, + 'brand_id' => $order_row['brand_id'], + 'company_id' => $info['loan_info0']['company_id'], + 's_id' => $order_row['s_id'], + 'v_id' => $order_row['v_id'], + 'cor_id' => $order_row['cor_id'], + 'incor_id' => $order_row['incor_id'], + 'total_price' => $price_loan, + 'pay_price' => $price_loan, + 'type' => 8, + 'status' => 1, + 'pay_time' => date('Y-m-d H:i:s'), + 'c_time' => time() + ]; + $p_row['uid'] && $pay_log['uid'] = $p_row['uid']; + $p_row['entrust_uid'] && $pay_log['entrust_uid'] = $p_row['entrust_uid']; + $this->app_liche_orders_model->add($pay_log); + } + } + if($update){ + $result = $this->order_loans0_model->update($update, ['id' => $row['id']]); + } + return $result ? $this->show_json(SYS_CODE_SUCCESS, '保存成功') : $this->show_json(SYS_CODE_FAIL, '保存失败'); + } + public function edit_item() { $this->load->model("items/items_model"); @@ -1114,6 +1318,12 @@ class Orders extends HD_Controller if(!$row['payway']){ //贷款 $this->data['need_price'] += $money_json['price_loan']; $this->data['price_loan'] = $money_json['price_loan']; + + // 首付按揭 + if ($money_json['price_loan0']){ + $this->data['need_price'] += $money_json['price_loan0']; + $this->data['price_loan0'] = $money_json['price_loan0']; + } } $car_info['name'] = $row['owner_name']; //获取车信息 @@ -1550,7 +1760,7 @@ class Orders extends HD_Controller 'o_id' => $id, 'status' => 1, 'pay_price>' => 0, - 'type!=' => 7 + 'type not in (7, 8)', // 'type!=' => 7 // 8为首付按揭 ]; $sum = $this->app_liche_orders_model->sum('total_price', $where); //已收金额 $total_price = $sum['total_price']; @@ -1573,6 +1783,40 @@ class Orders extends HD_Controller }*/ } + // 0首付下状态处理:非首付按揭有通知函 / 首付按揭时两个按揭的通知函都有,就可以设置 pid_status = 0 status = 2 + private function order_status_check_after_edit_loan($order_row){ + if (!$order_row){ + return false; + } + + $money_json = json_decode($order_row['money_json'], true); + $payway = $order_row['payway']; + $deposit = $money_json['price_book']; + $if_zero_firstpay = $payway == 0 && !$deposit ? 1 : 0; + if (!$if_zero_firstpay){ + return false; + } + + $oid = $order_row['id']; + + $row = $this->order_loans_model->get(['o_id' => $oid]); + $if_loans_notify_file = $row && $row['notify_file'] ? 1 : 0; + + if ($money_json['price_loan0']){ + $row0 = $this->order_loans0_model->get(['o_id' => $oid]); + $if_loans0_notify_file = $row0 && $row0['notify_file'] ? 1 : 0; + } + else{ + $if_loans0_notify_file = 1; + } + + if ($if_loans_notify_file && $if_loans0_notify_file){ + $this->orders_status_entity->set_status($oid,0,2); + return true; + } + return false; + } + public function edit_price(){ $id = $this->input->get_post('id'); $row = $this->receiver_orders_v2_model->get(['id' => $id]); @@ -1665,7 +1909,7 @@ class Orders extends HD_Controller ['id'=>1,'key'=>'price_insure','title'=>'代办保险'], ['id'=>2,'key'=>'fee_carno','title'=>'代办上牌'] ]; - !$row['payway'] && $lists[] = ['id'=>4,'key'=>'price_finance','title'=>'代办分期']; + !$row['payway'] && $lists[] = ['id'=>4,'key'=>'price_finance','title'=>'代办按揭']; $srv_ids = is_array($services) ? array_column($services,'id') : []; foreach($lists as $key=>$val){ $lists[$key]['money'] = $money_json[$val['key']] ? $money_json[$val['key']] : 0; @@ -1778,7 +2022,26 @@ class Orders extends HD_Controller ]; } $res = $this->order_loans_model->update($update,['o_id'=>$info['id']]); + }elseif($info['type']=='load_info0'){ + // 首付按揭 + $row = $this->order_loans0_model->get(['o_id'=>$info['id']]); + if(!$row){ + return $this->show_json(SYS_CODE_FAIL, '参数错误'); + } + if($info['field']=='notify_file'){ + $notify_file_lists = explode(',',$row['notify_file']); + unset($notify_file_lists[$info['value']]); + $update = [ + $info['field'] => implode(',',$notify_file_lists) + ]; + }else{ + $update = [ + $info['field'] => '' + ]; + } + $res = $this->order_loans0_model->update($update,['o_id'=>$info['id']]); } + if($res){ return $this->show_json(SYS_CODE_SUCCESS, '保存成功'); }else{ diff --git a/admin/libraries/Ordersv2List.php b/admin/libraries/Ordersv2List.php index b6067393..3f1dd9ff 100644 --- a/admin/libraries/Ordersv2List.php +++ b/admin/libraries/Ordersv2List.php @@ -7,7 +7,7 @@ class Ordersv2List { private $ci; private $searchTpAry = array('owner_name' => '车主姓名', 'owner_mobile' => '车主手机号', 'name' => '客户姓名', 'mobile' => '客户手机号', 'sid' => '订单号'); - private $paywayAry = array(0 => '贷款', 1 => '全款'); + private $paywayAry = array(0 => '按揭', 1 => '全款'); private $overAry = array(0 => '7天内', 1 => '14天内', 2=> '30天内', 3=> '大于30天'); private $t1 = 'lc_receiver_orders_v2'; private $t2 = 'lc_receiver_order_status'; @@ -18,9 +18,11 @@ class Ordersv2List $this->ci->load->model('receiver/order/receiver_orders_v2_model', 'mdOrders'); $this->ci->load->model('receiver/order/receiver_order_status_model'); $this->ci->load->model('receiver/order/receiver_order_loans_model', 'order_loans_model'); + $this->ci->load->model('receiver/order/receiver_order_loans0_model', 'order_loans0_model'); $this->ci->load->model('receiver/order/receiver_order_agents_model', 'order_agents_model'); $this->ci->load->model('app/licheb/app_licheb_users_model', 'mdLichebUsers'); $this->ci->load->model('app/licheb/app_licheb_channel_biz_model'); + $this->ci->load->model('app/liche/app_liche_orders_model'); $this->ci->load->model('receiver/receiver_customers_model', 'mdCustomers'); $this->ci->load->model('receiver/receiver_clues_cfrom_model', 'mdCluesCfrom'); $this->ci->load->model("biz/biz_model"); @@ -279,7 +281,7 @@ class Ordersv2List $fileds = "{$this->t1}.id,{$this->t1}.name,{$this->t1}.mobile,{$this->t1}.brand_id,{$this->t1}.s_id,{$this->t1}.v_id,{$this->t1}.if_usedcar, {$this->t1}.cor_id,{$this->t1}.incor_id,{$this->t1}.money_json,{$this->t1}.payway,{$this->t1}.status,{$this->t1}.c_time,{$this->t1}.fines, {$this->t1}.biz_id,{$this->t1}.bill_time,{$this->t1}.customer_id,{$this->t1}.owner_name,{$this->t1}.owner_mobile,{$this->t1}.main_type,{$this->t1}.info_json, - {$this->t1}.order_time,{$this->t1}.bill_time,{$this->t1}.item_id,{$this->t1}.over_time,{$this->t1}.sale_id,{$this->t1}.finance_id,{$this->t1}.refund_time, + {$this->t1}.order_time,{$this->t1}.bill_time,{$this->t1}.item_id,{$this->t1}.over_time,{$this->t1}.sale_id,{$this->t1}.finance_id,{$this->t1}.finance_id0,{$this->t1}.refund_time, {$this->t1}.ck_time,{$this->t1}.admin_id"; if(strlen($params['status_pid'])){ $where["{$this->t1}.brand_id>"] = 0; @@ -483,7 +485,7 @@ class Ordersv2List } $fields['address'] = $info_json['c_address']; } - if(!$val['payway']){ //分期 + if(!$val['payway']){ //按揭 //$finance_row = $this->ci->sys_finance_model->get(['id' => $val['finance_id']], 'id,title'); $finance_row = $this->ci->sys_supplier_model->get(['id' => $val['finance_id'], 'type'=>3], 'id,title'); $is_sure = $this->ci->receiver_order_status_model->count(['o_id'=>$val['id'],'pid_status'=>1,'status'=>2]); @@ -493,6 +495,15 @@ class Ordersv2List $fields['is_sure'] = $is_sure ? '是':'否'; $loan = $this->ci->order_loans_model->get(['o_id' => $val['id']]); $fields['is_tiexi'] = intval($loan['is_tiexi']) ? '是': ''; + + // 首付按揭 + $finance_row0 = $this->ci->sys_supplier_model->get(['id' => $val['finance_id0'], 'type'=>3], 'id,title'); + $is_sure0 = $this->ci->app_liche_orders_model->count(['o_id'=>$val['id'],'type'=>8,'status'=>1]); + $fields['pro_loan0'] = $finance_row0['title']; + $fields['price_loan0'] = $money_json['price_loan0']; + $fields['is_sure0'] = $is_sure0 ? '是':'否'; + $loan0 = $this->ci->order_loans0_model->get(['o_id' => $val['id']]); + $fields['is_tiexi'] = intval($loan0['is_tiexi']) ? '是': ''; } $srv_info = $this->get_srv_info($val); $fields['srv_info_total'] = $srv_info['total'] > 0 ? $srv_info['total'] : ''; @@ -722,14 +733,18 @@ class Ordersv2List if ($export) { unset($fields['price'],$fields['c_time'],$fields['car_name'],$fields['of_title']); $fields['payway_name'] = ['title'=>'付款方式']; + $fields['pro_loan0'] = ['title'=>'首付按揭-金融机构']; + //$fields['is_tiexi0'] = ['title'=>'首付按揭-贴息']; // 首付按揭不需要贴息选项 + $fields['price_loan0'] = ['title'=>'首付按揭-金额']; + $fields['is_sure0'] = ['title'=>'首付按揭-确认到款(是/否)']; $fields['pro_loan'] = ['title'=>'金融机构']; $fields['is_tiexi'] = ['title'=>'贴息']; - $fields['price_loan'] = ['title'=>'贷款金额']; + $fields['price_loan'] = ['title'=>'按揭金额']; $fields['is_sure'] = ['title'=>'确认到款(是/否)']; $fields['price_car'] = ['title'=>'最终售价']; $fields['srv_info_total'] = ['title'=>'手续费']; $fields['srv_info_fee_carno'] = ['title'=>'手续费-上牌']; - $fields['srv_info_price_finance'] = ['title'=>'手续费-金融']; + $fields['srv_info_price_finance'] = ['title'=>'手续费-按揭']; $fields['srv_info_price_fine_select'] = ['title'=>'手续费-精品选装']; $fields['srv_info_price_fine_select_detail'] = ['title'=>'精品选装内容']; !$fields['c_time'] && $fields['c_time'] = ['title' => '订单时间']; diff --git a/admin/views/auto/business/get.php b/admin/views/auto/business/get.php index 6a21607c..cd4b9f39 100644 --- a/admin/views/auto/business/get.php +++ b/admin/views/auto/business/get.php @@ -138,9 +138,9 @@
- +
- +
diff --git a/admin/views/auto/business/lists.php b/admin/views/auto/business/lists.php index 2e37b33f..f7081019 100644 --- a/admin/views/auto/business/lists.php +++ b/admin/views/auto/business/lists.php @@ -94,7 +94,7 @@ 品牌店单车毛利 - - - - - + +
+ +
+ +
+
+
@@ -529,6 +635,103 @@
+
+
+ 首付按揭 +
+ +
+ +
+ +
+
+
+ +
+ +
+
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+
+
@@ -605,12 +808,25 @@
+
+ +
+ +
+
+ +
+ +
+ +
+
diff --git a/admin/views/items/cost/lists.php b/admin/views/items/cost/lists.php index 6ab57f98..63e20e80 100644 --- a/admin/views/items/cost/lists.php +++ b/admin/views/items/cost/lists.php @@ -157,7 +157,9 @@ 整车采购毛利 保险收入合计 挂牌收入合计 + 首付按揭收入合计 按揭收入合计 + 按揭收入总合计 水平业务总毛利 单车总毛利 门店单车毛利 @@ -182,7 +184,9 @@ {{v.car_profit_price}} {{v.insurance_price}} {{v.fee_carno_price}} + {{v.loan_price0}} {{v.loan_price}} + {{v.loan_price_total}} {{v.srv_price}} {{v.car_price}} {{v.dl_car_price}} diff --git a/admin/views/receiver/orderv2/get/index.php b/admin/views/receiver/orderv2/get/index.php index 834b9971..2e60dbc2 100644 --- a/admin/views/receiver/orderv2/get/index.php +++ b/admin/views/receiver/orderv2/get/index.php @@ -364,7 +364,9 @@ - + + + @@ -379,6 +381,10 @@ elem: '#loan_time' , type: 'date' }); + laydate.render({ + elem: '#loan_time0' + , type: 'date' + }); laydate.render({ elem: '#ins_time' , type: 'date' @@ -533,6 +539,8 @@ }, finish_loan: function (status) { var that = this; + var url = '/receiver/orderv2/orders/edit_loan'; + var if_loan0 = false; // 首付按揭 if (status == 2) { var loan_time = $('#loan_time').val(); // if (!loan_time) { @@ -541,7 +549,23 @@ // } this.info.loan_info.loan_time = loan_time; } - $.post("/receiver/orderv2/orders/edit_loan", { + else if (status == 3){ + if_loan0 = true; + } + else if (status == 4){ + if_loan0 = true; + var loan_time = $('#loan_time0').val(); + // if (!loan_time) { + // layer.msg("请填写放款时间"); + // return; + // } + this.info.loan_info0.loan_time = loan_time; + } + if (if_loan0){ + status = status - 2; + url = '/receiver/orderv2/orders/edit_loan0'; + } + $.post(url, { 'info': this.info, 'status': status }, function (data) { @@ -723,7 +747,9 @@ 'value': $(obj).val(), 'type': type }; - if (type) { + var url = '/receiver/orderv2/orders/edit_loanfile'; + var if_loan0 = false; // 首付按揭 + if (type == 1) { var loan_time = $('#loan_time').val(); if (!loan_time) { layer.msg("请填写放款时间"); @@ -731,7 +757,23 @@ } params['loan_time'] = loan_time; } - $.post("/receiver/orderv2/orders/edit_loanfile", params, function (data) { + else if (type == 2){ + if_loan0 = true; + } + else if (type == 3){ + if_loan0 = true; + var loan_time = $('#loan_time0').val(); + if (!loan_time) { + layer.msg("请填写首付放款时间"); + return; + } + params['loan_time'] = loan_time; + } + if (if_loan0){ + params['type'] = type - 2; + url = '/receiver/orderv2/orders/edit_loanfile0'; + } + $.post(url, params, function (data) { layer.closeAll() if (data.code==1) { layer.msg(data.msg, {time: 2000, icon: 1}, function () { diff --git a/admin/views/receiver/orderv2/get/loaninfo.php b/admin/views/receiver/orderv2/get/loaninfo.php index bfc80162..5f360be6 100644 --- a/admin/views/receiver/orderv2/get/loaninfo.php +++ b/admin/views/receiver/orderv2/get/loaninfo.php @@ -1,6 +1,6 @@
- 分期明细 + 按揭明细
@@ -15,7 +15,7 @@
- +
diff --git a/admin/views/receiver/orderv2/get/paylog.php b/admin/views/receiver/orderv2/get/paylog.php index 5034046a..75638874 100644 --- a/admin/views/receiver/orderv2/get/paylog.php +++ b/admin/views/receiver/orderv2/get/paylog.php @@ -63,8 +63,9 @@
- 应收总额:{{need_price}},已收总额:{{pay_price}} -    + 应收总额:{{need_price}} , 已收总额:{{pay_price}} + +   
@@ -82,6 +83,7 @@ pay_price: '', need_price: '', price_loan: '', + price_loan0: '', car_info : [], }, mounted: function () { @@ -97,6 +99,7 @@ that.pay_price = result.data.pay_price; that.need_price = result.data.need_price; that.price_loan = result.data.price_loan; + that.price_loan0 = result.data.price_loan0; that.car_info = result.data.car_info; } }); diff --git a/api/controllers/plan/Order.php b/api/controllers/plan/Order.php index 0933eabd..7732bb26 100644 --- a/api/controllers/plan/Order.php +++ b/api/controllers/plan/Order.php @@ -445,6 +445,7 @@ class Order extends CI_Controller{ public function cost(){ $this->load->model('receiver/order/receiver_order_bills_model', 'order_bills_model'); $this->load->model('receiver/order/receiver_order_loans_model','order_loans_model'); + $this->load->model('receiver/order/receiver_order_loans0_model','order_loans0_model'); $this->load->model('receiver/order/receiver_order_datas_model'); $this->load->model("biz/biz_model"); $this->load->model('biz/biz_settle_srv_model'); @@ -543,6 +544,7 @@ class Order extends CI_Controller{ if ($debug){ echo "finance_id: {$item['finance_id']}"."
"; + echo "finance_id0: {$item['finance_id0']}"."
"; echo "biz_id: {$item['biz_id']}"."
"; echo "status: {$item['status']}"."
"; echo "if_usedcar: {$if_usedcar}"."
"; @@ -925,10 +927,10 @@ class Order extends CI_Controller{ } } - //贷款信息 + //按揭信息 $srv_json['loan_product'] = ''; $srv_json['loan_srv_price'] = $srv_json['loan_num'] = $srv_json['loan_price'] = 0; - # 23-04-03: 贷款, 350600 代理店按所在城市的品牌店处理; 23-04-04: 加多一个城市,宁德 + # 23-04-03: 按揭, 350600 代理店按所在城市的品牌店处理; 23-04-04: 加多一个城市,宁德 $biz_type_force = $biz_id_force = 0; $city_ids_force = $this->receiver_orders_v2_model->get_city_ids_force(); # 要同步修改 Items_cost_model.php 中相关代码, Cost.php 相关代码 if ($biz['type']==3 and in_array($biz['city_id'], $city_ids_force)){ @@ -951,7 +953,7 @@ class Order extends CI_Controller{ $srv_json['loan_price'] = $money_json['price_loan'] ? $money_json['price_loan'] : 0; $loan_row = $this->order_loans_model->get(['o_id'=>$item['id']]); if ($debug){ - echo "get 贷款信息:
"; + echo "get 按揭信息:
"; echo $this->order_loans_model->db->last_query()."
"; var_dump($loan_row); echo "
"; @@ -993,7 +995,7 @@ class Order extends CI_Controller{ ]; $fd_row = $this->biz_settle_srv_model->get($where); if ($debug){ - echo "get 贷款配置 :
"; + echo "get 按揭配置 :
"; echo $this->biz_settle_srv_model->db->last_query()."
"; var_dump($fd_row); echo "

"; @@ -1005,7 +1007,7 @@ class Order extends CI_Controller{ "JSON_UNQUOTE(json_extract(jsondata, '$.rebate')) > 0" => null, ]); if ($debug){ - echo "get 贷款配置(默认) :
"; + echo "get 按揭配置(默认) :
"; echo $this->biz_settle_srv_model->db->last_query()."
"; var_dump($fd_row); echo "

"; @@ -1028,12 +1030,102 @@ class Order extends CI_Controller{ } if ($debug){ echo "是否贴息: is_tiexi: {$loan_row['is_tiexi']}"."
"; - echo "贷款返点: loan_fd: {$loan_fd}"."
"; - echo "贷款返点金额: profix_loan: {$profix_loan}"."
"; - echo "贷款手续费: srv_loan: {$srv_loan}"."
"; + echo "按揭返点: loan_fd: {$loan_fd}"."
"; + echo "按揭返点金额: profix_loan: {$profix_loan}"."
"; + echo "按揭手续费: srv_loan: {$srv_loan}"."
"; echo "按揭综合服务费: loan_srv_price: {$srv_json['loan_srv_price']}"."
"; echo "

"; } + + // 首付按揭 + if ($money_json['price_loan0']){ + $srv_json['loan_price0'] = $money_json['price_loan0'] ? $money_json['price_loan0'] : 0; + $loan_row = $this->order_loans0_model->get(['o_id'=>$item['id']]); + if ($debug){ + echo "get 首付按揭-按揭信息:
"; + echo $this->order_loans0_model->db->last_query()."
"; + var_dump($loan_row); + echo "
"; + } + $finance_id = $item['finance_id0']; + $srv_json['loan_product0'] = ''; + $srv_json['loan_is_tiexi0'] = $loan_row['is_tiexi']; + if ($finance_id){ + $finance_row = $this->sys_supplier_model->get(array('id'=>$finance_id),'title'); + $srv_json['loan_product0'] = $finance_row ? $finance_row['title'] : ''; + } + $srv_json['loan_num0'] = $finance_num = $loan_row['num'] ? $loan_row['num'] : 36; + $srv_json['loan_num0'] = $srv_json['loan_product0'] ? $srv_json['loan_num0'] : 0; + if ($debug){ + if ($finance_id){ + echo $this->sys_supplier_model->db->last_query()."
"; + var_dump($finance_row); + echo "
"; + } + echo "loan_price0 (money_json['price_loan0']): {$srv_json['loan_price0']}"."
"; + echo "loan_product0: {$srv_json['loan_product0']}"."
"; + echo "loan_num0: {$srv_json['loan_num0']}"."
"; + echo "is_tiexi0: {$loan_row['is_tiexi0']}"."
"; + echo "

"; + } + + $profix_loan = $loan_fd = 0; + if (!$loan_row['is_tiexi']){ + $biz_id_param = $biz_id_force ? $biz_id_force : $item['biz_id']; + $where = [ + 'biz_id' => $biz_id_param, + 'type' => 3, + 'status' => 1, + 's_effect_time<=' => date('Y-m-d',strtotime($item['bill_time'])), + "JSON_UNQUOTE(json_extract(jsondata, '$.supplier_id')) = '{$finance_id}'" => null, + "JSON_UNQUOTE(json_extract(jsondata, '$.finance_num')) = '{$finance_num}'" => null, + "JSON_UNQUOTE(json_extract(jsondata, '$.rebate')) > 0" => null, + ]; + $fd_row = $this->biz_settle_srv_model->get($where); + if ($debug){ + echo "get 首付按揭-按揭配置 :
"; + echo $this->biz_settle_srv_model->db->last_query()."
"; + var_dump($fd_row); + echo "

"; + } + if(!$fd_row){ + $fd_row = $this->biz_settle_srv_model->get(['biz_id'=>$biz_id_param,'is_def'=>1,'status'=>1,'type'=>3, + "JSON_UNQUOTE(json_extract(jsondata, '$.supplier_id')) = '{$finance_id}'" => null, + "JSON_UNQUOTE(json_extract(jsondata, '$.finance_num')) = '{$finance_num}'" => null, + "JSON_UNQUOTE(json_extract(jsondata, '$.rebate')) > 0" => null, + ]); + if ($debug){ + echo "get 首付按揭-按揭配置(默认) :
"; + echo $this->biz_settle_srv_model->db->last_query()."
"; + var_dump($fd_row); + echo "

"; + } + } + $fd_jsondata = json_decode($fd_row['jsondata'],true); + $loan_fd = $fd_jsondata['rebate'] && $money_json['price_loan0'] ? $fd_jsondata['rebate']:0; + $profix_loan = round($money_json['price_loan0']*$loan_fd/100, 2); + } + + $srv_loan = 0; // 暂不支持“首付按揭”手续费 + $srv_json['loan_srv_price0'] = $profix_loan + $srv_loan; + # 23-04-04: 手续费 跟 服务费 分开 + if (date('Y-m-d',strtotime($item['bill_time'])) >= date('Y-m-d',strtotime('2023-04-01'))){ + $srv_json['loan_srv_price0'] = $profix_loan; + $srv_json['loan_fd0'] = $loan_fd; + $srv_json['loan_srv0'] = $srv_loan; + if ($debug){ + echo "是否大于2023-04-01: yes,{$item['bill_time']}"."
"; + } + } + if ($debug){ + echo "是否贴息: is_tiexi0: {$loan_row['is_tiexi']}"."
"; + echo "按揭返点: loan_fd0: {$loan_fd}"."
"; + echo "按揭返点金额: profix_loan0: {$profix_loan}"."
"; + echo "按揭手续费: srv_loan0: {$srv_loan}"."
"; + echo "按揭综合服务费: loan_srv_price0: {$srv_json['loan_srv_price0']}"."
"; + echo "

"; + } + } } $sum = $this->app_liche_orders_model->sum('total_price', ['o_id'=>$item['id'],'status'=>1,'pay_price <>'=>0]); @@ -1046,6 +1138,7 @@ class Order extends CI_Controller{ } $add_data['srv_json'] = json_encode($srv_json,JSON_UNESCAPED_UNICODE); if ($debug){ + echo "------------------------------"."
"; echo "pay_price: {$pay_price}"."
"; echo "need_price: {$need_price}"."
"; echo "if_pay(pay_price>=need_price ? 1 : 0): {$srv_json['if_pay']}"."
"; @@ -1057,12 +1150,16 @@ class Order extends CI_Controller{ if ($cost){ echo "

get cost data:
"; var_dump($cost); - echo "
"; - echo "c_time: ".date("Y-m-d H:i:s",$cost['c_time'])."
"; + echo "

"; + echo "c_time: ".date("Y-m-d H:i:s",$cost['c_time'])."

"; echo "srv_json:
"; var_dump($srv_json_cost); } echo "

debug mode end

"; + + $fill_info = $this->orders_v2_entity->pdf_data($item); + echo "fill_info(pdf_data):
"; + var_dump($fill_info); exit(); } diff --git a/api/controllers/wxapp/licheb/CusorderV2.php b/api/controllers/wxapp/licheb/CusorderV2.php index 786bb7d6..f75df3b3 100644 --- a/api/controllers/wxapp/licheb/CusorderV2.php +++ b/api/controllers/wxapp/licheb/CusorderV2.php @@ -154,7 +154,7 @@ class CusorderV2 extends Wxapp if ($disc_money) throw new Exception('当前车型没有优惠额度', API_CODE_FAIL); } } - if (!$payway && $finance_id) { //分期 + if (!$payway && $finance_id) { //按揭 //$finance_row = $this->sys_finance_model->get(['id' => $finance_id, 'status' => 1]); $finance_row = $this->sys_supplier_model->get(['id' => $finance_id, 'status' => 1]); if (!$finance_row) { @@ -229,6 +229,16 @@ class CusorderV2 extends Wxapp 'price_coplus' => $price_coplus, 'price_options' => 0 ]; + + // 首付按揭 + $price_loan0 = $this->input_param('price_loan0'); + if ($if_zero_firstpay && $price_loan0){ + $money_json['price_loan0'] = $price_loan0; + } + else{ + $money_json['price_loan0'] = 0; + } + if ($srv_arr) { foreach ($srv_arr as $item) { $money_json[$item['key']] = $item['price']; @@ -442,7 +452,7 @@ class CusorderV2 extends Wxapp if ($disc_money) throw new Exception('当前车型没有优惠额度', API_CODE_FAIL); } } - if (!$payway && $finance_id) { //分期 + if (!$payway && $finance_id) { //按揭 //$finance_row = $this->sys_finance_model->get(['id' => $finance_id, 'status' => 1]); $finance_row = $this->sys_supplier_model->get(['id' => $finance_id, 'status' => 1]); if (!$finance_row) { @@ -501,6 +511,21 @@ class CusorderV2 extends Wxapp $money_json['price_fine_discount'] = $disc_fine_money; $money_json['price_color'] = in_array($color_id, $color_arr) ? $business_row['price_color'] : 0; $money_json['price_coplus'] = $main_type ? $business_row['price_coplus'] : 0; + + // 首付按揭 + $price_loan0 = $this->input_param('price_loan0'); + if ($if_zero_firstpay && $price_loan0){ + $money_json['price_loan0'] = $price_loan0; + } + else{ + $money_json['price_loan0'] = 0; + } + + // 全款下如有按揭金额,要重置 + if ($payway && $money_json['price_loan']){ + $money_json['price_loan'] = 0; + } + if ($srv_arr) { $money_json['price_finance'] = $money_json['fee_carno'] = 0; foreach ($srv_arr as $item) { @@ -581,6 +606,8 @@ class CusorderV2 extends Wxapp $money_json['price_color'] && $car_data['颜色加价'] = sprintf("%.2f", $money_json['price_color']); $if_zero_firstpay && $car_data['零首付'] = '是'; !$if_zero_firstpay && $car_data['定金'] = sprintf("%.2f", $money_json['price_book']); + !$row['payway'] && $money_json['price_loan0'] && $car_data['首付按揭'] = $money_json['price_loan0']; + !$row['payway'] && $money_json['price_loan'] && $car_data['按揭'] = $money_json['price_loan']; $car_price_list = []; $money_json['price_discount'] && $car_price_list['优惠'] = sprintf("%.2f", $money_json['price_discount']); $car_data['最终售价'] = [ @@ -593,6 +620,7 @@ class CusorderV2 extends Wxapp $car_data['委托代办']['value'] = sprintf("%.2f", $srv_data['total']); foreach ($srv_data['list'] as $val) { $car_data['委托代办']['list'][$val['title']] = is_numeric($val['money']) ? sprintf("%.2f", $val['money']) : ''; + #is_numeric($val['money']) && $val['money'] > 0 && $car_data['委托代办']['list'][$val['title']] = is_numeric($val['money']) ? sprintf("%.2f", $val['money']) : ''; } } $optinos_ids_str = $row['option_ids'] ? implode(',',json_decode($row['option_ids'],true)) : ''; @@ -618,6 +646,12 @@ class CusorderV2 extends Wxapp //$finance_row = $this->sys_finance_model->get(['id' => $row['finance_id']], 'title'); $finance_row = $this->sys_supplier_model->get(['id' => $row['finance_id']], 'title'); $car_data['按揭信息'] = $finance_row['title'] ? $finance_row['title'] : ''; + + // 首付按揭:同时显示机构 + if ($money_json['price_loan0'] && $row['finance_id0']){ + $finance0_row = $this->sys_supplier_model->get(['id' => $row['finance_id0']], 'title'); + $finance0_row['title'] && $car_data['按揭信息'] = $finance0_row['title'] .', '. $car_data['按揭信息']; + } } //是否存在意向金订单 $inten_row = $this->app_liche_orders_model->get(['o_id' => $row['id'], 'type' => 4, 'status>=' => 0]); @@ -692,8 +726,13 @@ class CusorderV2 extends Wxapp ]; $data['ckcar_status'] = $ckcar_status; $data['ckcar_data'] = $ckcar_data; - $price_book = $this->app_liche_orders_model->count(['o_id' => $row['id'], 'type' => 1, 'status' => 1]); //定金是否支付 + //$price_book = $this->app_liche_orders_model->count(['o_id' => $row['id'], 'type' => 1, 'status' => 1]); //定金是否支付 + $price_book = $this->app_liche_orders_model->count(['o_id' => $row['id'], 'type' => 1, 'status' => 1, 'descrip !=' => '零首付']); //定金是否支付 $data['price_book_status'] = $price_book ? true : false; + $price_loan0 = $this->app_liche_orders_model->count(['o_id' => $row['id'], 'type' => 8, 'status' => 1]); //首付按揭按是否支付 + $data['price_loan0_status'] = $price_loan0 ? true : false; + $price_loan = $this->app_liche_orders_model->count(['o_id' => $row['id'], 'type' => 7, 'status' => 1]); //按揭按是否支付 + $data['price_loan_status'] = $price_loan ? true : false; $price_srv = $this->app_liche_orders_model->count(['o_id' => $row['id'], 'type' => 2, 'status' => 1]); //服务费是否支付 $data['price_srv_status'] = $price_srv ? true : false; $price_last = $this->app_liche_orders_model->count(['o_id' => $row['id'], 'type' => 3, 'status' => 1]); //尾款是否支付 @@ -725,6 +764,41 @@ class CusorderV2 extends Wxapp $admin_row = $this->app_user_model->get(['id' => $row['admin_id']], 'uname'); $data['admin_name'] = $admin_row['uname']; } + + // 首付按揭 + if (!$row['payway'] && $money_json['price_loan0']){ + $this->load->model('receiver/order/receiver_order_loans0_model', 'order_loans0_model'); + $loan_row = $this->order_loans0_model->get(['o_id' => $row['id']]); + $notify_file_list = []; + $notify_file = $loan_row['notify_file'] ? explode(',',$loan_row['notify_file']) : ''; + if($notify_file){ + foreach ($notify_file as $item) { + $notify_file_list[] = [ + 'src' => build_qiniu_image_url($item), + 'value' => $item + ]; + } + } + $data_loan0['notify_file'] = $notify_file_list; + $data_loan0['lend_file'] = [ + 'src' => $loan_row['lend_file'] ? build_qiniu_image_url($loan_row['lend_file']) : '', + 'value' => $loan_row['lend_file'] ? $loan_row['lend_file'] : '' + ]; + $data_loan0['price_loan'] = $money_json['price_loan0'] ? $money_json['price_loan0'] : 0.00; + $data_loan0['num'] = $loan_row['num'] ? $loan_row['num'] : 0; + $data_loan0['is_tiexi'] = intval($loan_row['is_tiexi']); + $data_loan0['admin_name'] = ''; + if ($row['admin_id']) { + $admin_row = $this->app_user_model->get(['id' => $row['admin_id']], 'uname'); + $data_loan0['admin_name'] = $admin_row['uname']; + } + $data_loan0['finance_id'] = $row['finance_id0']; + + $data['finance_id0'] = $row['finance_id0']; + $data['price_loan0'] = $money_json['price_loan0'] ? $money_json['price_loan0'] : 0.00; + $data['price_loan0_data'] = $data_loan0; + } + //获取补充协议 $order_data = $this->receiver_order_datas_model->get(['o_id' => $row['id']], 'sa'); $data['sa'] = $order_data['sa'] ? $order_data['sa'] : ''; @@ -884,9 +958,10 @@ class CusorderV2 extends Wxapp $other_data = [ '品牌车型' => ['type' => 'text', 'value' => $title, 'bg_color' => ''], - '付款方式' => ['type' => 'text', 'value' => $val['payway'] ? '全款' : '分期', 'bg_color' => ''], + '付款方式' => ['type' => 'text', 'value' => $val['payway'] ? '全款' : '按揭', 'bg_color' => ''], ]; - $book_is_pay = $this->app_liche_orders_model->get(['o_id' => $val['id'], 'type' => 1, 'status>=' => 0]); //定金 + //$book_is_pay = $this->app_liche_orders_model->get(['o_id' => $val['id'], 'type' => 1, 'status>=' => 0]); //定金 + $book_is_pay = $this->app_liche_orders_model->get(['o_id' => $val['id'], 'type' => 1, 'status>=' => 0, 'descrip !=' => '零首付']); //定金 $srv_is_pay = $this->app_liche_orders_model->get(['o_id' => $val['id'], 'type' => 2, 'status>=' => 0]); //服务费 $int_is_pay = $this->app_liche_orders_model->get(['o_id' => $val['id'], 'type' => 4, 'status>=' => 0]); //意向金 $p_row = $this->app_liche_orders_model->get(['o_id' => $val['id'], 'pid' => 0], 'id'); //父订单 @@ -905,15 +980,25 @@ class CusorderV2 extends Wxapp $price_book_text = number_format($int_is_pay['total_price'], 2) . "(已支付)"; $other_data['意向金金额'] = ['type' => 'text', 'value' => $price_book_text, 'bg_color' => '']; } + $payway = $val['payway']; + $deposit = $money_json['price_book']; + $if_zero_firstpay = $payway == 0 && !$deposit ? 1 : 0; if ($book_is_pay) { - $payway = $val['payway']; - $deposit = $money_json['price_book']; - $if_zero_firstpay = $payway == 0 && !$deposit ? 1 : 0; $if_zero_firstpay && $other_data['零首付'] = ['type' => 'text', 'value' => '是', 'bg_color' => '']; $book_is_pay_text = $book_is_pay['status'] ? '已支付' : '未支付'; $price_book_text = number_format($money_json['price_book'], 2) . "($book_is_pay_text)"; !$if_zero_firstpay && $other_data['定金金额'] = ['type' => 'text', 'value' => $price_book_text, 'bg_color' => '']; } + if ($if_zero_firstpay && $money_json['price_loan0']){ + $loan0_pay = $this->app_liche_orders_model->sum('total_price', ['pid' => $p_row['id'], 'o_id' => $val['id'], 'status' => 1, 'type' => 8]); + $loan0_pay_text = $loan0_pay['total_price'] ? '已支付': '未支付'; + $other_data['首付按揭'] = ['type' => 'text', 'value' => $money_json['price_loan0']."($loan0_pay_text)", 'bg_color' => '']; + } + if (!$payway && $money_json['price_loan']){ + $loan_pay = $this->app_liche_orders_model->sum('total_price', ['pid' => $p_row['id'], 'o_id' => $val['id'], 'status' => 1, 'type' => 7]); + $loan_pay_text = $loan_pay['total_price'] ? '已支付': '未支付'; + $other_data['按揭'] = ['type' => 'text', 'value' => $money_json['price_loan']."($loan_pay_text)", 'bg_color' => '']; + } if ($ht_pay['total_price']) { $ht_price = number_format($ht_pay['total_price'], 2); $other_data['车款金额'] = ['type' => 'text', 'value' => "{$ht_price}(已支付)", 'bg_color' => '']; @@ -931,7 +1016,7 @@ class CusorderV2 extends Wxapp } if ($int_is_pay['status'] || $book_is_pay['status'] || $this->app_liche_orders_model->count(['o_id' => $val['id'], 'type' => 6, 'status' => 1])) { if (!$val['payway']) { - $other_data['分期办理'] = ['type' => 'text', 'value' => $this->orders_status_entity->status_cn($val['id'], 1), 'bg_color' => '']; + $other_data['按揭办理'] = ['type' => 'text', 'value' => $this->orders_status_entity->status_cn($val['id'], 1), 'bg_color' => '']; } $pc_cn = '待分配'; if ($this->orders_status_entity->get_finish($val['id'], 2, 1)) { //已配车 @@ -988,7 +1073,7 @@ class CusorderV2 extends Wxapp $other_data = [ '品牌车型' => "{$brand_name}{$serie_name}-{$color}-{$version}", - '付款方式' => $val['payway'] ? '全款' : '分期', + '付款方式' => $val['payway'] ? '全款' : '按揭', '代办车牌' => $db_title, '定金金额' => $money_json['price_book'], '订单日期' => date('Y-m-d', $val['c_time']), @@ -1092,7 +1177,7 @@ class CusorderV2 extends Wxapp ]; $data['filters'] = [ 'type' => [ - ['key' => 'fq', 'name' => '分期办理'], + ['key' => 'fq', 'name' => '按揭办理'], ['key' => 'pc', 'name' => '车辆匹配'], ['key' => 'kp', 'name' => '发票开具'], ['key' => 'jf', 'name' => '交付确认'], diff --git a/api/controllers/wxapp/licheb/Loan.php b/api/controllers/wxapp/licheb/Loan.php index 3a94c761..30b4037a 100644 --- a/api/controllers/wxapp/licheb/Loan.php +++ b/api/controllers/wxapp/licheb/Loan.php @@ -22,6 +22,7 @@ class Loan extends Wxapp{ $this->load->model('receiver/order/receiver_orders_v2_model'); $this->load->model('receiver/order/receiver_order_loans_model', 'order_loans_model'); + $this->load->model('receiver/order/receiver_order_loans0_model', 'order_loans0_model'); $this->load->library('receiver/orders_v2_entity'); $this->load->library('receiver/orders_status_entity'); @@ -35,6 +36,12 @@ class Loan extends Wxapp{ } protected function put(){ + $if_loan0 = $this->input_param('if_loan0'); + //$if_loan0 = 1; // 模拟首付按揭 + if ($if_loan0){ + $this->put_loan0(); + } + $oid = $this->input_param('o_id'); $finance_id = $this->input_param('finance_id'); $notify_file = $this->input_param('notify_file'); @@ -79,6 +86,79 @@ class Loan extends Wxapp{ $num && $update['num'] = $num; $update['is_tiexi'] = $is_tiexi; $update && $result = $this->order_loans_model->update($update, ['id' => $row['id']]); + $this->order_status_check_after_edit_loan($order_row); throw new Exception('保存成功', API_CODE_SUCCESS); } + + // 首付按揭:功能参考put,操作对象有差异,更新 money_json['price_loan0'] 与 finance_id0 + protected function put_loan0(){ + $oid = $this->input_param('o_id'); + $finance_id = $this->input_param('finance_id'); + $notify_file = $this->input_param('notify_file'); + $lend_file = $this->input_param('lend_file'); + $price_loan = $this->input_param('price_loan'); + $num = $this->input_param('num'); + $is_tiexi = intval($this->input_param('is_tiexi')); + + $order_row = $this->receiver_orders_v2_model->get(['id' => $oid], 'id,mobile,money_json,payway'); + if(!$finance_id || !$notify_file || !$price_loan || !$order_row || $order_row['payway']){ + throw new Exception('参数错误', ERR_PARAMS_ERROR); + } + + $row = $this->order_loans0_model->get(['o_id' => $oid]); + if(!$row){ + $row['id'] = $this->order_loans0_model->add(['c_time'=>time(),'o_id'=>$oid]); + } + + $money_json = json_decode($order_row['money_json'], true); + $money_json['price_loan0'] = $price_loan; + $this->receiver_orders_v2_model->update(['finance_id0' => $finance_id, 'money_json' => json_encode($money_json, JSON_UNESCAPED_UNICODE)], ['id' => $order_row['id']]); + //生成购车订单 + $userinfo = $this->app_liche_users_model->get(['mobile'=>$order_row['mobile']]); + $this->orders_v2_entity->add_order($order_row['id'],$userinfo['id']); + //$this->orders_status_entity->set_status($oid,1,1); // 首付按揭不改订单状态 + $update = [ + 'notify_file' => implode(',',$notify_file) + ]; + $lend_file && $update['lend_file'] = $lend_file; + $num && $update['num'] = $num; + $update['is_tiexi'] = $is_tiexi; + $update && $result = $this->order_loans0_model->update($update, ['id' => $row['id']]); + $this->order_status_check_after_edit_loan($order_row); + throw new Exception('保存成功', API_CODE_SUCCESS); + } + + // 0首付下状态处理:非首付按揭有通知函 / 首付按揭时两个按揭的通知函都有,就可以设置 pid_status = 0 status = 2 + private function order_status_check_after_edit_loan($order_row){ + if (!$order_row){ + return false; + } + + $money_json = json_decode($order_row['money_json'], true); + $payway = $order_row['payway']; + $deposit = $money_json['price_book']; + $if_zero_firstpay = $payway == 0 && !$deposit ? 1 : 0; + if (!$if_zero_firstpay){ + return false; + } + + $oid = $order_row['id']; + + $row = $this->order_loans_model->get(['o_id' => $oid]); + $if_loans_notify_file = $row && $row['notify_file'] ? 1 : 0; + + if ($money_json['price_loan0']){ + $row0 = $this->order_loans0_model->get(['o_id' => $oid]); + $if_loans0_notify_file = $row0 && $row0['notify_file'] ? 1 : 0; + } + else{ + $if_loans0_notify_file = 1; + } + + if ($if_loans_notify_file && $if_loans0_notify_file){ + $this->orders_status_entity->set_status($oid,0,2); + return true; + } + return false; + } } diff --git a/common/libraries/receiver/Orders_v2_entity.php b/common/libraries/receiver/Orders_v2_entity.php index 87957e44..e92f357c 100644 --- a/common/libraries/receiver/Orders_v2_entity.php +++ b/common/libraries/receiver/Orders_v2_entity.php @@ -345,22 +345,24 @@ class Orders_v2_entity{ $srv_money = $this->order_srv_money($oid); //服务费 $money_json = json_decode($this->order_row['money_json'],true); $total_price = $this->total_price($oid); - if(!$this->order_row['payway'] && !$money_json['price_loan']){//贷款未填写首付 + if(!$this->order_row['payway'] && !$money_json['price_loan']){//按揭金额未填写首付 return false; } $to_srv_price = $srv_money; //后台添加车款 $pay_row = $this->ci->app_liche_orders_model->sum('pay_price',['status'=>1,'type'=>6,'o_id'=>$oid]); if($pay_row['pay_price']>=0 && $pay_row['pay_price']>=$money_json['price_book']){ - if(!$this->order_row['payway']){ //贷款 + if(!$this->order_row['payway']){ //按揭 $total_price = $total_price - $money_json['price_loan']; + $money_json['price_loan0'] && $total_price -= $money_json['price_loan0']; // 首付按揭 } $to_com_price = $total_price - $pay_row['pay_price']; }else{ if($this->order_row['payway']){ //全款 $to_com_price = $total_price - $money_json['price_book']; - }else{ //分期 + }else{ //按揭 $to_com_price = $total_price-$money_json['price_loan'] - $money_json['price_book']; + $money_json['price_loan0'] && $to_com_price -= $money_json['price_loan0']; // 首付按揭 } } $to_com_price = $to_com_price>0 ? $to_com_price : 0; @@ -431,7 +433,7 @@ class Orders_v2_entity{ * 计算订单应收金额 * @param $oid int 订单id * @param $srv_price boolean 是否包含服务费 - * @param $price_loan boolean 是否包含分期(230220 成本-应收款不要扣掉按揭部分) + * @param $price_loan boolean 是否包含按揭(230220 成本-应收款不要扣掉按揭部分) * @return float */ public function recevable_price($oid,$srv_price=true,$price_loan=true){ @@ -447,8 +449,9 @@ class Orders_v2_entity{ }else{ $recevable_price = $total_price; } - if($price_loan && !$this->order_row['payway']){ //分期 + if($price_loan && !$this->order_row['payway']){ //按揭 $recevable_price -= $money_json['price_loan']; + $money_json['price_loan0'] && $recevable_price -= $money_json['price_loan0']; // 首付按揭 } return $recevable_price; } @@ -503,14 +506,20 @@ class Orders_v2_entity{ $this->ci->app_liche_orders_model->update($up_data,['o_id'=>$row['id']]); //删除未支付订单 $this->ci->app_liche_orders_model->delete(['o_id'=>$row['id'],'status'=>0,'pid!='=>0]); + + $payway = $new_data['payway']; + $money_json = json_decode($new_data['money_json'],true); + $deposit = $money_json['price_book']; + $if_zero_firstpay = $payway == 0 && !$deposit ? 1 : 0; + if (!$if_zero_firstpay){ + //删除已支付的零首付订单 + $this->ci->app_liche_orders_model->update(array('status'=>-1), ['o_id'=>$row['id'],'type'=>1,'status'=>1,'descrip'=>'零首付']); + } + $userinfo = $this->ci->app_liche_users_model->get(['mobile'=>$row['mobile']],'id'); if(!$this->ci->app_liche_orders_model->count(['o_id'=>$row['id'],'type'=>1,'status'=>1])){ //不存在定金订单 $pay_row= $this->ci->app_liche_orders_model->sum('pay_price',['o_id'=>$row['id'],'type'=>6,'status'=>1]);//后台添加车款 - $money_json = json_decode($new_data['money_json'],true); //if($pay_row['pay_price']<$money_json['price_book']){ - $payway = $new_data['payway']; - $deposit = $money_json['price_book']; - $if_zero_firstpay = $payway == 0 && !$deposit ? 1 : 0; if($if_zero_firstpay || $pay_row['pay_price']<$money_json['price_book']){ $int_order = $this->ci->app_liche_orders_model->get(['o_id'=>$row['id'],'type'=>4,'status'=>1]); //意向金订单 //if($int_order['pay_price']==$money_json['price_book']){ //意向金订单转支付订单、推送并且生成pfd diff --git a/common/models/app/liche/App_liche_orders_model.php b/common/models/app/liche/App_liche_orders_model.php index d1b7b986..e833ee0d 100644 --- a/common/models/app/liche/App_liche_orders_model.php +++ b/common/models/app/liche/App_liche_orders_model.php @@ -9,7 +9,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); class App_liche_orders_model extends HD_Model{ private $table_name = 'lc_app_liche_orders'; - private $type_arr = [ 1 => '定金', 2 => '委托服务费' , 3 => '尾款' ,4 => '意向金' ,5 => '后台添加',6 => '车款',7 => '贷款']; + private $type_arr = [ 1 => '定金', 2 => '委托服务费' , 3 => '尾款' ,4 => '意向金' ,5 => '后台添加',6 => '车款',7 => '按揭', 8 => '首付按揭']; public function __construct() { diff --git a/common/models/items/Items_cost_model.php b/common/models/items/Items_cost_model.php index 5b7fbf1e..65507665 100644 --- a/common/models/items/Items_cost_model.php +++ b/common/models/items/Items_cost_model.php @@ -40,7 +40,7 @@ class Items_cost_model extends HD_Model //【促销成本合计】(销售佣金+其他) $promotion_price = $promotion_json['sale_price'] + $promotion_json['other']; #if ($biz_type == 3 && $business_row && $business_row['proxy_type'] == 1){ # 23-4-04: 不用区分是否票折 - # 三个土豆: 代理店:【促销成本合计】=(销售佣金+其他);那非代理店,怎么计算? + # 代理店:【促销成本合计】=(销售佣金+其他);那非代理店,怎么计算? # 0fun:都一样,默认是0; 可以手工填写 /*if ($biz_type == 3){ $promotion_price = $promotion_json['other']; @@ -56,7 +56,7 @@ class Items_cost_model extends HD_Model 合伙店取商务政策的固定值 (2) 代理店没有水平业务 (3) */ - $insurance_price = $fee_carno_price = $loan_price = $srv_price = 0; + $insurance_price = $fee_carno_price = $loan_price = $loan_price0 = $srv_price = 0; if ($biz_type == 1){ //【保险收入合计】 $insurance_price = $srv_json['business_ins_price']+$srv_json['insurance_ins_price']+$srv_json['accident_ins_price']-$srv_json['back_price']; @@ -64,8 +64,10 @@ class Items_cost_model extends HD_Model $fee_carno_price = $srv_json['fee_carno'] - $srv_json['cb_fee_carno']; //【按揭收入合计】(按揭综合服务费+按揭解抵服务费+利息补贴收入+金融公司手续费收入+其他收入-其他支出) # 23-04-04: 手续费 跟 服务费 分开 $loan_price = $srv_json['loan_srv_price']+$srv_json['loan_srv']+$srv_json['loan_offset_price']+$srv_json['loan_subsidy_price']+$srv_json['commission_price']+$srv_json['loan_in_price']-$srv_json['loan_out_price']; - //【水平业务总毛利】(保险收入合计+挂牌收入合计+按揭收入合计+其他收入-其他支出) - $srv_price = $insurance_price+$fee_carno_price+$loan_price+$srv_json['other_in_price']-$srv_json['other_out_price']; + // 首付按揭收入合计 + $loan_price0 = $srv_json['loan_srv_price0']+$srv_json['loan_srv0']+$srv_json['loan_offset_price0']+$srv_json['loan_subsidy_price0']+$srv_json['commission_price0']+$srv_json['loan_in_price0']-$srv_json['loan_out_price0']; + //【水平业务总毛利】(保险收入合计+挂牌收入合计+按揭收入合计+首付按揭收入合计+其他收入-其他支出) + $srv_price = $insurance_price+$fee_carno_price+$loan_price+$loan_price0+$srv_json['other_in_price']-$srv_json['other_out_price']; } elseif ($biz_type == 2){ $insurance_price = $row['insurance_price']; @@ -74,7 +76,7 @@ class Items_cost_model extends HD_Model $srv_price = $insurance_price+$fee_carno_price+$loan_price; } elseif ($biz_type == 3){ - # 23-04-03: 贷款, 350600 代理店按所在城市的品牌店处理; 23-04-04: 加多一个城市,宁德 + # 23-04-03: 按揭, 350600 代理店按所在城市的品牌店处理; 23-04-04: 加多一个城市,宁德 $biz = $this->biz_model->get(['id'=>$order_row['biz_id']]); $city_ids_force = $this->receiver_orders_v2_model->get_city_ids_force(); if (in_array($biz['city_id'], $city_ids_force)){ @@ -82,8 +84,10 @@ class Items_cost_model extends HD_Model if ($biz_force){ //【按揭收入合计】(按揭综合服务费+按揭解抵服务费+利息补贴收入+金融公司手续费收入+其他收入-其他支出) $loan_price = $srv_json['loan_srv_price']+$srv_json['loan_srv']+$srv_json['loan_offset_price']+$srv_json['loan_subsidy_price']+$srv_json['commission_price']+$srv_json['loan_in_price']-$srv_json['loan_out_price']; - //【水平业务总毛利】(保险收入合计+挂牌收入合计+按揭收入合计+其他收入-其他支出) - $srv_price = $insurance_price+$fee_carno_price+$loan_price+$srv_json['other_in_price']-$srv_json['other_out_price']; + // 首付按揭收入合计 + $loan_price0 = $srv_json['loan_srv_price0']+$srv_json['loan_srv0']+$srv_json['loan_offset_price0']+$srv_json['loan_subsidy_price0']+$srv_json['commission_price0']+$srv_json['loan_in_price0']-$srv_json['loan_out_price0']; + //【水平业务总毛利】(保险收入合计+挂牌收入合计+按揭收入合计+首付按揭收入合计+其他收入-其他支出) + $srv_price = $insurance_price+$fee_carno_price+$loan_price+$loan_price0+$srv_json['other_in_price']-$srv_json['other_out_price']; } } } @@ -103,6 +107,8 @@ class Items_cost_model extends HD_Model 'insurance_price' => $insurance_price, 'fee_carno_price' => $fee_carno_price, 'loan_price' => $loan_price, + 'loan_price0' => $loan_price0, + 'loan_price_total' => $loan_price + $loan_price0, 'srv_price' => $srv_price, 'car_price' => $car_price, 'dl_car_price' => $dl_car_price, diff --git a/common/models/receiver/order/Receiver_order_loans0_model.php b/common/models/receiver/order/Receiver_order_loans0_model.php new file mode 100644 index 00000000..a8471c39 --- /dev/null +++ b/common/models/receiver/order/Receiver_order_loans0_model.php @@ -0,0 +1,24 @@ + '审核中',1 => '已通过',2 => '等待放款', 3 => '按揭完成']; + + public function __construct() + { + parent::__construct($this->table_name, 'default'); + } + + public function count_order($where){ + return $this->select_order($where,'','','','',1); + } + + //获取状态 + public function get_status(){ + return $this->status_arr; + } +} diff --git a/common/models/receiver/order/Receiver_order_status_model.php b/common/models/receiver/order/Receiver_order_status_model.php index 901d9842..a9c7f16f 100644 --- a/common/models/receiver/order/Receiver_order_status_model.php +++ b/common/models/receiver/order/Receiver_order_status_model.php @@ -14,7 +14,7 @@ class Receiver_order_status_model extends HD_Model private $status_arr = [ 0 => [0 => '待付款', 1=>'已下定', 2 => '已付款'], //付款 - 1 => [0 => '分期办理中', 1 => '等待放款',2 => '完成按揭'], //分期 + 1 => [0 => '按揭办理中', 1 => '等待放款',2 => '完成按揭'], //按揭 2 => [0 => '待分配', 1 => '已配车' ], //配车 3 => [0 => '待开票', 1 => '已开票'], //开票 4 => [0 => '待销售确认', 1 => '销售已确认',2 => '用户已确认'],//车辆交付 @@ -40,8 +40,8 @@ class Receiver_order_status_model extends HD_Model $status_ary[0] = array('name' => '付款', 'show' => true, 'list' => array(0 => '未付款', 1 => '已下定',21=>'未付尾款', 2 => '已付款'), 'menu_list' => array(0 => '未付款', 1 => '已付款'), 'menu_default' => 0,'pid_status'=>0); - $status_ary[1] = array('name' => '分期办理', 'show' => true, 'list' => array(0 => '分期办理中', 1 => '等待放款' , 2 => '完成按揭'), - 'menu_list' => array(0 => '分期办理中', 1 => '等待放款' , 2 => '完成按揭'), 'menu_default' => 0,'pid_status'=>1); + $status_ary[1] = array('name' => '按揭办理', 'show' => true, 'list' => array(0 => '按揭办理中', 1 => '等待放款' , 2 => '完成按揭'), + 'menu_list' => array(0 => '按揭办理中', 1 => '等待放款' , 2 => '完成按揭'), 'menu_default' => 0,'pid_status'=>1); $status_ary[2] = array('name' => '车辆分配', 'show' => true, 'list' => array(0 => '车辆分配中', 1 => '已配车'), 'menu_list' => array(0 => '待分配', 1 => '已配车'), 'menu_default' => 0,'pid_status'=>2); $status_ary[3] = array('name' => '开票相关', 'show' => true, 'list' => array(0 => '待开票', 1 => '已开票'), diff --git a/home/controllers/Pop.php b/home/controllers/Pop.php new file mode 100644 index 00000000..67a001a7 --- /dev/null +++ b/home/controllers/Pop.php @@ -0,0 +1,417 @@ + '福州', + 350200 => '厦门', + 350300 => '莆田', + 350500 => '晋江', + 350600 => '漳州', + 350900 => '宁德', + ); + private $redis_key = 'pop_mobile_'; + private $of_id = 6; + private $of2_id_default = 69; + private $tag_map = array( + 'dongfeng' => array('t_id'=>2, 't_name'=>'东风EV'), + 'hozon' => array('t_id'=>3, 't_name'=>'哪吒'), + 'leap' => array('t_id'=>4, 't_name'=>'零跑'), + ); + private $referer_deault = 'domian'; + private $referer_arr = array( + 'baidu.com' => array('of2_id'=>61, 'name'=>'百度'), + 'weixin' => array('of2_id'=>68, 'name'=>'官网加微信'), + 'domain' => array('of2_id'=>69, 'name'=>'官网'), + ); + # $arr[6] = ['name' => '官网/SEM', 'list' => [' 61' => '百度', ' 68' => '官网加微信', ' 69' => '官网']; + # 保留: 62 搜狗, 63 神马, 64 360, 65 头条, + + private $dongfeng_data = array( + 350100 => array( + 'method' => 'dongfeng', + 'act_img' => '', // 活动图 + 'dian_map_img' => '', // 门店地图 + 'dian_wx_code_img' => '', // 门店微信二维码 + 'dian_img' => '', // 门店图片 + 'imgs' => array(), //其他图片 + 'tuan_arr' => array( + array('id' => 1, 'title' => 'title', 'img' => '', 'url' => ''), + array('id' => 2, 'title' => 'title', 'img' => ''), + ), + 'seo_title' => '', //seo_title 公共配置,各cityid可独立配置 + 'seo_keyword' => '',//seo_keyword 公共配置,各cityid可独立配置 + 'seo_desc' =>'', //seo_desc 公共配置,各cityid可独立配置 + 'wx_code_img' => '',//微信二维码 公共配置 + ), + 350200 => array(), + ); + + private $hozon_data = array( + ); + + + public function __construct(){ + parent::__construct(); + + } + + public function index(){ + var_dump('pop index'); + //var_dump($this->input->request_headers()); + //var_dump($_SERVER); + + /*if($this->checkrobot()){ + echo '蜘蛛'; + }else{ + echo '人类'; + } + var_dump($this->get_spider()); + if($this->is_mobile()){ + echo 'mobile'; + }else{ + echo 'pc'; + } + var_dump($this->get_referer()); + */ + + $referer = $this->get_referer(); + $referer = $referer ? $this->referer_arr[$referer] : array(); + !$referer && $referer = $this->referer_arr[$this->referer_deault]; + $of2_id = $this->of2_id_default; + $cf_clues = '官网'; + if ($referer){ + $of2_id = $referer['of2_id']; + $cf_clues = $referer['name']; + } + $cf_clues .= $this->is_mobile() ? 'H5' : 'PC'; + # 如何区分seo还是sem? + var_dump($of2_id);var_dump($cf_clues);var_dump(date('Y-m-d H:i:s', time()));var_dump(get_client_ip());var_dump(strtotime(date('Y-m-d') . ' 00:00:00')); + //header("Location: ./pop/dongfeng"); + } + + public function dongfeng(){ + $params = $this->input->get(); + $cityid = $this->get_cityid($params); var_dump('pop dongfeng');var_dump($params);var_dump($cityid); + $params['cityid'] = $cityid; + $data['params'] = $params; + $data['info'] = $this->dongfeng_data[$cityid]; + $view = $this->is_mobile() ? '/pop/dongfeng_h5' : '/pop/dongfeng'; + $this->load->view($view, $data); + } + + public function hozon(){ + $params = $this->input->get(); + $cityid = $this->get_cityid($params); var_dump('pop hozon');var_dump($params);var_dump($cityid); + $params['cityid'] = $cityid; + $data['params'] = $params; + $data['info'] = $this->dongfeng_data[$cityid]; + $view = $this->is_mobile() ? '/pop/dongfeng_h5' : '/pop/dongfeng'; + $this->load->view($view, $data); + } + + private function get_cityid($params){ + $cityid = $params['cityid'] ? intval($params['cityid']) : $this->cityid_default; + !in_array($cityid, $this->cityid_arr) && $cityid = $this->cityid_default; + return $cityid; + } + + public function post(){ + if ($this->input->method() != 'post') { + return $this->show_json(0, '参数错误'); + } + $params = $this->input->post(); var_dump('pop post');var_dump($params); + $method = $params['method']; // dongfeng, hozon + $cityid = $this->get_cityid($params); + $mobile = $params['mobile']; + $code = $params['code']; + $name = $params['name']; + #$method = 'dongfeng';$cityid=$this->cityid_default;$mobile='13959279487';$code='123456';$name='三个土豆'; + + if (!$name) { + return $this->show_json(0, '请输入姓名'); + } + if (!$mobile) { + return $this->show_json(0, '请输入手机号'); + } + if (!$code) { + return $this->show_json(0, '请输入验证码'); + } + +// $redis = &load_cache('redis'); +// $key = $this->redis_key.$mobile; +// $code_redis = $redis->get($key); +// if (!$code_redis) { +// return $this->show_json(0, '验证码已过期'); +// } +// if ($code_redis != $code) { +// return $this->show_json(0, '验证码错误'); +// } + + # tag + $t_id = 0; + $t_name = ''; + if ($tag = $this->tag_map[$method]) { + $t_id = $tag['t_id']; + $t_name = $tag['t_name']; + } + + $referer = $this->get_referer(); + $referer = $referer ? $this->referer_arr[$referer] : array(); + !$referer && $referer = $this->referer_arr[$this->referer_deault]; + $of2_id = $this->of2_id_default; + $cf_clues = '官网'; + if ($referer){ + $of2_id = $referer['of2_id']; + $cf_clues = $referer['name']; + } + $cf_clues .= $this->is_mobile() ? 'PC' : 'H5'; + + $city_name = $this->city_map[$cityid] ? $this->city_map[$cityid] : ''; + $c_time = time(); + + # 用户的那些信息要记录? ip... + $ip = get_client_ip(); + + $this->load->model('receiver/receiver_customers_model', 'customers_model'); + $this->load->model('receiver/receiver_customer_oplogs_model', 'customer_oplogs_model'); + $this->load->model('receiver/receiver_customer_tagdata_model', 'mdCustomerTagdata'); + + if ($cus = $this->customers_model->get(['mobile'=>$mobile])){ + $c_id = $cus['id']; + $jsondata = json_decode($cus['jsondata'],true); + $jsondata['sem'] = date('Y-m-d H:i:s', $c_time)."通过 {$cf_clues} 报名购买 {$t_name}"; + $jsondata['sem_last'] = date('Y-m-d H:i:s', $c_time); + $jsondata['sem_ip'] = $ip; + $jsondata['sem_city_name'] = $city_name; + $jsondata['sem_cf_clues'] = $cf_clues; + $jsondata['sem_t_name'] = $t_name; + $update = array( + 'jsondata' => json_encode($jsondata,JSON_UNESCAPED_UNICODE), + ); + if (in_array($cus['status'], array(-1, 3))){ + $update['status'] = 0; + } + #$cus['name'] != $name && $update['name'] = $name; + $this->customers_model->update($update, array('id'=>$c_id)); + + # 检查今日是否报名过 + $alert = ""; + if (!$this->customer_oplogs_model->get(array('customer_id' => $c_id, 'cf_platform' => 'pop', 'c_time >' => strtotime(date('Y-m-d') . ' 00:00:00')))){ + $alert = "{$city_name} {$name} ({$mobile}) 通过 {$cf_clues} 报名购买 {$t_name}"; + $alert = trim($alert); + } + + $logdata = array( + 'customer_id' => $c_id, + 'uid' => 0, + 'uname' => '', + 'type' => 0, + 'log' => "通过 {$cf_clues} 报名购买 {$t_name}", + 'cf_platform' => 'pop', + 'c_time' => $c_time + ); + $this->customer_oplogs_model->add($logdata); + } + else{ + $jsondata = array(); + $jsondata['sem'] = date('Y-m-d H:i:s', $c_time)."通过 {$cf_clues} 报名购买 {$t_name}"; + $jsondata['sem_last'] = date('Y-m-d H:i:s', $c_time); + $jsondata['sem_ip'] = $ip; + $jsondata['sem_city_name'] = $city_name; + $jsondata['sem_cf_clues'] = $cf_clues; + $jsondata['sem_t_name'] = $t_name; + $adddata = array( + 'rid' => 0, + 'name' => $name, + 'mobile' => $mobile, + 'biz_id' => 0, + 'sales_id' => 0, + 'level' => 'H', + 'cf_title' => 'SEM', + 'cf_clues' => $cf_clues, + 'of_id' => $this->of_id, + 'of2_id' => $of2_id, + 'city_id' => $cityid, + 'jsondata' => json_encode($jsondata,JSON_UNESCAPED_UNICODE), + 'c_time' => $c_time + ); + $c_id = $this->customers_model->add($adddata); + + $logdata = array( + 'customer_id' => $c_id, + 'uid' => 0, + 'uname' => '', + 'type' => 3, + 'log' => "创建客户档案, 通过 {$cf_clues} 报名购买 {$t_name}", + 'cf_platform' => 'pop', + 'c_time' => $c_time + ); + $this->customer_oplogs_model->add($logdata); + $alert = "新客户 {$city_name} {$name} ({$mobile}) 通过 {$cf_clues} 报名购买 {$t_name}"; + } + + # 写tagdata + if ($t_id && !$this->mdCustomerTagdata->get(array('c_id'=>$c_id, 't_id'=>$t_id))){ + $tagdata = array( + 'c_id' => $c_id, + 't_id' => $t_id, + 'c_time' => $c_time + ); + $this->mdCustomerTagdata->add($tagdata); + } + +// $redis->delete($key); + + # 报名成功后,如何通知到客服/销售,确保尽快与客户沟通 + if ($alert){ + var_dump($alert); + } + + return $this->show_json(1, '报名成功'); + } + + //获取验证码 + public function get_code(){ + if ($this->input->method() != 'post') { + return $this->show_json(0, '参数错误'); + } + + $mobile = $this->input->post('mobile', true); + if (!$mobile){ + return $this->show_json(0, '请输入手机号'); + } + + $redis = &load_cache('redis'); + $key = $this->redis_key.$mobile; + $code = $redis->get($key); + if (!$code){ + $code = rand(100000, 999999); + $redis->save($key, $code, 60*5*24); + } + + send_sms($mobile, $code); + return $this->show_json(1, '请查收验证码'); + } + + // 判断设备类型 + private function is_mobile(){ + // 如果有HTTP_X_WAP_PROFILE则一定是移动设备 + if (isset($_SERVER['HTTP_X_WAP_PROFILE'])) { + return true; + } + // 如果via信息含有wap则一定是移动设备,部分服务商会屏蔽该信息 + if (isset($_SERVER['HTTP_VIA'])) { + // 找不到为flase,否则为true + return stristr($_SERVER['HTTP_VIA'], "wap") ? true : false; + } + // 脑残法,判断手机发送的客户端标志,兼容性有待提高。其中'MicroMessenger'是电脑微信 + if (isset($_SERVER['HTTP_USER_AGENT'])) { + $clientkeywords = array('nokia','sony','ericsson','mot','samsung','htc','sgh','lg','sharp','sie-','philips','panasonic','alcatel','lenovo','iphone','ipod','blackberry','meizu','android','netfront','symbian','ucweb','windowsce','palm','operamini','operamobi','openwave','nexusone','cldc','midp','wap','mobile','MicroMessenger'); + // 从HTTP_USER_AGENT中查找手机浏览器的关键字 + if (preg_match("/(" . implode('|', $clientkeywords) . ")/i", strtolower($_SERVER['HTTP_USER_AGENT']))) { + return true; + } + } + // 协议法,因为有可能不准确,放到最后判断 + if (isset ($_SERVER['HTTP_ACCEPT'])) { + // 如果只支持wml并且不支持html那一定是移动设备 + // 如果支持wml和html但是wml在html之前则是移动设备 + if ((strpos($_SERVER['HTTP_ACCEPT'], 'vnd.wap.wml') !== false) && (strpos($_SERVER['HTTP_ACCEPT'], 'text/html') === false || (strpos($_SERVER['HTTP_ACCEPT'], 'vnd.wap.wml') < strpos($_SERVER['HTTP_ACCEPT'], 'text/html')))) { + return true; + } + } + return false; + } + + // 获取referer + private function get_referer() { + $referer = strtolower($_SERVER['Referer']); + $referer = strtolower($referer); + $referer = 'https://www.baidu.com/link?url=GBiyUtphXCoxbtEa7bBKLUXZj4PRhfHZ3rLLMJDiNWa&wd=&eqid=9f100bf80008f3f1000000066462ee90'; + $referers = array( + 'baidu.com' => '百度', + 'sogou.com' => '搜狗', + 'sm.cn' => '神马', + 'so.com' => '360', + 'toutiao.com' => '头条', + ); + + foreach ($referers as $key => $val) { + if (strpos($referer, $key) !== false) { + return $key; + } + } + return null; + } + + protected function show_json($code = 0, $msg = 'success', $url = '', $wait = 0){ + header('Content-Type:application/json; charset=utf-8'); + echo json_encode(array('data' => $this->data, 'code' => $code, 'msg' => $msg, 'url' => $url, 'wait' => $wait), JSON_UNESCAPED_UNICODE); + return false; + } + + // 是否蜘蛛访问 + private function checkrobot($useragent='') { + static $kw_spiders = array('bot', 'crawl', 'spider', 'slurp', 'sohu-search', 'lycos', 'robozilla'); + static $kw_browsers = array('msie', 'netscape', 'opera', 'konqueror', 'mozilla'); + + $useragent = strtolower(empty($useragent) ? $_SERVER['HTTP_USER_AGENT'] : $useragent); + if (strpos($useragent, 'http://') === false && $this->dstrpos($useragent, $kw_browsers)) + return false; + if ($this->dstrpos($useragent, $kw_spiders)) + return true; + return false; + } + private function dstrpos($string, $arr, $returnvalue = false) { + if (empty($string)) + return false; + foreach ((array) $arr as $v) { + if (strpos($string, $v) !== false) { + $return = $returnvalue ? $v : true; + return $return; + } + } + return false; + } + + // 蜘蛛类型 + private function get_spider() { + $userAgent = strtolower($_SERVER['HTTP_USER_AGENT']); + $spiders = array( + 'Baiduspider', // 百度 baidu.com + 'Sogou', // 搜狗 sogou.com + 'YisouSpider', // 神马 (UC浏览器默认搜索sm.cn的蜘蛛) + '360Spider', // 360 so.com + 'HaosouSpider', // 360 so.com + 'Bytespider', // 头条 toutiao.com + 'AspiegelBot', // 华为 + + 'EasouSpider', // 宜搜 + 'YoudaoBot', // 有道 + 'YodaoBot', // 有道 + + 'Googlebot', // google + 'bingbot', // 必应 + 'msnbot', // msn + 'Yahoo', // Yahoo + 'YandexBot', // Yandex + ); + + foreach ($spiders as $spider) { + $spider = strtolower($spider); + if (strpos($userAgent, $spider) !== false) { + return $spider; + } + } + return null; + } + +} diff --git a/home/views/pop/dongfeng.php b/home/views/pop/dongfeng.php new file mode 100644 index 00000000..a146e07a --- /dev/null +++ b/home/views/pop/dongfeng.php @@ -0,0 +1,93 @@ + + + + + + 福州东风EV4S:XXX - 狸车 + + + + + + + +
+
+
+ +
+
+ +
+ {{info.method}} + {{params.cityid}} +
+ 闽ICP备12013448号-3 +
+
+ + + +
+ +
+ + + diff --git a/home/views/pop/dongfeng_h5.php b/home/views/pop/dongfeng_h5.php new file mode 100644 index 00000000..40b77e23 --- /dev/null +++ b/home/views/pop/dongfeng_h5.php @@ -0,0 +1,22 @@ + + + + + + 福州东风EV4S:XXX - 狸车 + + + +h5 +
+
+ 闽ICP备12013448号-3 +
+
+ +
+ +
+ + + diff --git a/www/admin/temp/business.xlsx b/www/admin/temp/business.xlsx index 010444d53bc96c16bca03966afe26ee1797cb22c..7fcedc58e6b6bd7fa17b69d098d5fcff46ae9fd4 100644 GIT binary patch delta 2197 zcmV;G2x|A7QJ_(<+6I59b!kE50ssKO1^@sL0001ZY%h0ja%*C5Z)+}iZEUPn+is&U z5Pe^1{{i`(g1O{^N~)wJ+DP41)OOpKNRq>n&ze3E&>l`;P}kU z@o;%nr-}AVMZtLHBYa^Zjbop5$z{4`7nQTD>O^5{gMa=S|LrcStz@Q%a4G*kD z?~|;02dv%^44Yp@!yv6jD;^~8lW6XNn}tS~YnIT5R=OI=^Is%Yl}eD7kU~x)CTZlO zK1_K4~PyMU1YOt?k4kFfW z>7SAb3VR161mVC)LXWJ91(C5tQi>%_K@LWBExa03ayBhQe2C~~ylopZ=9wx6<4c=+kX zo(%@>#Daf@Von|18CsS;91H^89y``}7`Q`wI(vm+M9&L3DP_E`tb+ED17$pO{Umkg z!KPQT=t$$m+#kBK?}pCzssdI$?19m$IBGymwfd1|5wCotV-tGd?sQr;&PNu>7(`@S zE~u(~_Jgub42-em_SFUwmSX0k6GlPHXa zz_Bg;+6kS)w? zYdc+@9bPLe@jUu@1fcQea}qo|!dQ<}>rN7(g|!x}0J-fVL8 z{oB)QfgEi}Q;=FVEJr7%(ZlNfyX8Tut*#g|4lp!2N0l*c=6RY{Oc3qLmNl?bN+pPa zSAVtfbgLLCEJ)N|;QO&B2yal&kf~cZWLa{`9wprg)|j3|v6>k0Ust@@K6gh%s&znXnvaTWSBaR4ljtcGoo^X`0>laFbQzf-5jSI|P@AGB& zsh4_$PE42a-$a8WPq97k3V5ap-sTdXPk&s&nJj!GSv-+-=~CH_7diUv57!K4+ztMD z82A35)w1AF;Vvpiu`)*=aP|cwZ?&}j^MkX4{>OF+kk(QY7R32^pl4!S`;&om)w;7h z50MH5IH~owjg!(DB7aT-F%ZY^CceX_Cp}2fgBr6e2NDx+9`pe=P+$|bUAM)^Q4a5L0 zCPOy?spBFuMw19JI|WyQ!BuFR76w|Bq%o84t^qBLt-Umg{2v%PwG5pZymaX23OZzl z?j)rKW<|GMElx1oipfl%v5X^yVG<$uw-5jg9Zs`<2;RVtADF-MD=}AZ7=a&dj=Fy%PRTW=*s4ZeA63r6#Fy&Jm&q1BFF1LNIksM z^oBL*w2Gw3eQlh3<@q~RNrQ%eE=#NO)5_GVmusGFDNW+{KFtv5b@OsT)rEPZo5@vc z2An^~{6WbZHpE4be-szSqp}R3-+U7J%SENpFXTk=SqDWYl%J>Z1(Trz6tj*SdISY9 z{dGfLvkf3J0RwTI(33(TI0K01Ba?k0Nq>Rwk8uu$31%2>fNt3n(H1Fqk1QWl)&c~_ zkURm8mu;*`CW%-5(K+w_b+&j@|O<_45+p?4=Pb)e^uLb3cOkFLMM)ru;$_nEZvsgSe3B+6w6f|YaTc% z{_JQjlv%{Lz_isVdm^<@yYo>v^D6JOsCr>?Ms{Prp?8`ud+u&_gSE%(45qr!_u^gq zl#ro|9^1GiRRstVM+_p{DQGyu0bL#*UM4xDz<1(e^ts;c;>_Bn@=VoT+%ng4@$*(* z2^FHPPJPf#x~pF28A&u|h_k$}zFVOcz3Vd|hj<^;+Pl=;1|ylQ;Vzh6b=3!xFbldK z{EF3<-<46Rtl%~`$9W@G*PzUx0QzG(nivD56{iDrltjZ+IUGNiX@PuRibQiFu>lFQ zWiFBV@xvnFEyBZAl-({9u(JnDunsTAhwXTfsOQjZqknOh_x&+Qogzq7@WpJy*9FM3 zr}O%@(&`TcP1P`!qP`w?x|iWt$Jh!(YgU>3cnZsvKBcX0)Q}1gGIpYDYp7V=pQM7L zx17Fu`n=k2)1nvE)2kN#tU`EqJ2pXBknbkv;$5O^4u4L+SP1vfj<}%)t~k&0Ww_b0 z!yfj;IFe?ycKSq@xHcciNER9Y7svb;Il0by!VC)9F5iQBe1jkjhDZ(TCpkoYON-S^ z2~opzg*fCUi6f;Zb2L=8mYQDkE)z$+wiLG5i)!65Z>PcV9H_it$I1X_42#gCzs9zE z4&Xu8*s!lto}vX5hE5v39J~5N*J`=UkhjlG_PZ}M`v#nqGW`a*_5Mr*`}p%_xn=x| z%2#Zv*8BnM7iL|zcu7^vQevIuyr_kI2ak>tZuM+Luzf@r`fbdc%I(aqnnE0l4fV+Q z&>TEyH+(x6)ko4bFuQ7HTOTdk9j?rkSh(>ZZW=B0Dn4L5$LfIjs929Je8`is9+|7M zP0OWFU)l^)$shag&(zNe^(~QV&y+?+(U4kBa{F~Z!hCZ1c{Xh3Jy?o}{tbd|&=fy9 zx(?y~+~yfwHQE^f;Pey(Ae4hx8>vtgI@YEaVb^Lv06-!X0N?`<(h&kUqSbU-fg*c! z?HEokhRsEo{Yw9{4Zrbd|Io3`#iuPH_SQcRSy!@hif?2+;QZe6RnxmyrLO%# z%G9Jv*^2;dg40>eYEr}eAOel-Ko0QqzfV-9uk?I_{qkD1?OOD4o%Y4%ahQ8A@UHP{ zh4Rxu?aQMn&|;^_2FM)~TqRg(*EUdlM%tLkl(U(a7PAR`4Ih*7*brc`&m}fQUJAvl zJ>|8iMnD!Ru%Lqq#F`owU$OQ4vBf!u47>gO0$!OEK~!U(xfslzl5xm^PS8Tr&jDf< zeB3F+L~yx@pS=KY_AA|${V!J)4j3P25AAoFK+uJ5k+ZN}aTu;$L0r422~V)2Vd}#; zsn1P4FI-<}^C+P)h%daVY^$hm1DfB0vn@)!#=KzxGnpvf)vc? zqvrmO5kS-#gic-D^S3)Yp~EIC%eE5tu+1Vt3<)V{OmbkP8^9bRHYXH%!@?V`Fph2atl7obY!LF z`cl5Gz~=6~H71u7+8}n(qZE+$@5;W^$?$kY3-FY1lT`({LMUTRy#VXn+GRMxfe&ti}4h?L6BURm~3OBXH+#h}!*wQObc6}No4@Lr-O zj?q^uJ%E5nimz*b%Sk!^h@n-O0BRC#`IzFf zu+ueC>A5yApHoxOUT)yEhPm$NViPer-T-baOC10UOy4S1G~;1BIS1A=xK}hemq5mG z>3rpe9=qAz?V>WYzpT+udUo4F2HJTJhi_v-(=LNLb-IhD4W1-DDP8t2ktq;s_nM$e zeU*%vUQkdo!qBjC2fG-RO@&YX`w zJSvEC5}8XoeW=0Y$Vrat6c%BDN-V^ZLE?eiKaiPGpkLQE7K@sJpnm{>a43NRkNr$P z!gr_ufh@@m|9>R@go8iDKuALv0XGO^2tAe}p5N3Eaw|N*GlW2r;D-NpHxK}bqz3@F z|7d