loan0 about
This commit is contained in:
@@ -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',
|
||||
|
||||
@@ -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' => '其他合计',
|
||||
|
||||
@@ -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{
|
||||
|
||||
@@ -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' => '订单时间'];
|
||||
|
||||
@@ -138,9 +138,9 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group wp50">
|
||||
<label class="am-para-label w140">贷款毛利:</label>
|
||||
<label class="am-para-label w140">按揭毛利:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="text" placeholder="请输入贷款毛利" name="profix_loan" v-model="info.profix_loan" style="display: inline;width: 60%"/>
|
||||
<input type="text" placeholder="请输入按揭毛利" name="profix_loan" v-model="info.profix_loan" style="display: inline;width: 60%"/>
|
||||
<span>元</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -94,7 +94,7 @@
|
||||
<th width="6%"><span>品牌店单车毛利</span></th>
|
||||
<!--
|
||||
<th width="6%"><span>保险利润</span></th>
|
||||
<th width="6%"><span>贷款利润</span></th>
|
||||
<th width="6%"><span>按揭利润</span></th>
|
||||
<th width="6%"><span>挂牌利润</span></th>
|
||||
<th width="10%"><span>公司加价</span></th>
|
||||
<th width="10%"><span>颜色加价</span></th>
|
||||
|
||||
@@ -377,6 +377,104 @@
|
||||
</div>
|
||||
</div>
|
||||
<hr v-if="info.srv_json.srv_if_num=='1'" class="am-u-lg-12 wp90" style="margin: 10px">
|
||||
|
||||
<div v-if="info.payway=='0' && info.srv_json.srv_if_finance=='1' && info.srv_json.loan_price0" class="am-form-inline">
|
||||
<div class="am-form-group am-u-lg-12">
|
||||
首付按揭
|
||||
</div>
|
||||
|
||||
<div class="am-form-group am-u-lg-4">
|
||||
<label class="am-para-label label-width"><span class="span-bold">按揭银行:</span></label>
|
||||
<div class="am-para-input">
|
||||
<input type="text" v-model="info.srv_json.loan_product0" style="width: 200px;">
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group am-u-lg-8">
|
||||
<label class="am-para-label label-width"><span class="span-bold">按揭期数:</span></label>
|
||||
<div class="am-para-input">
|
||||
<input type="number" v-model="info.srv_json.loan_num0" style="width: 150px;">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group am-u-lg-4">
|
||||
<label class="am-para-label label-width"><span class="span-bold">按揭金额:</span></label>
|
||||
<div class="am-para-input">
|
||||
<input type="number" v-model="info.srv_json.loan_price0" style="width: 150px;">
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group am-u-lg-4">
|
||||
<label class="am-para-label label-width"><span class="span-bold">按揭返点:</span></label>
|
||||
<div class="am-para-input">
|
||||
<input type="number" v-model="info.srv_json.loan_fd0" style="width: 150px;">
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group am-u-lg-4">
|
||||
<label class="am-para-label label-width"><span class="span-bold">按揭佣金:</span></label>
|
||||
<div class="am-para-input">
|
||||
<input type="number" v-model="info.srv_json.loan_srv_price0" style="width: 150px;">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group am-u-lg-4">
|
||||
<label class="am-para-label label-width"><span class="span-bold">按揭手续费:</span></label>
|
||||
<div class="am-para-input">
|
||||
<input type="number" v-model="info.srv_json.loan_srv0" style="width: 150px;">
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group am-u-lg-4">
|
||||
<label class="am-para-label label-width"><span class="span-bold">解抵服务费:</span></label>
|
||||
<div class="am-para-input">
|
||||
<input type="number" v-model="info.srv_json.loan_offset_price0" style="width: 150px">
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group am-u-lg-4">
|
||||
<label class="am-para-label label-width"><span class="span-bold">利息补贴收入:</span></label>
|
||||
<div class="am-para-input">
|
||||
<input type="number" v-model="info.srv_json.loan_subsidy_price0" style="width: 150px">
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group am-u-lg-4">
|
||||
<label class="am-para-label label-width"><span class="span-bold">其他收入金额:</span></label>
|
||||
<div class="am-para-input">
|
||||
<input type="number" v-model="info.srv_json.loan_in_price0" style="width: 150px">
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group am-u-lg-4">
|
||||
<label class="am-para-label label-width"><span class="span-bold">其他支出金额:</span></label>
|
||||
<div class="am-para-input">
|
||||
<input type="number" v-model="info.srv_json.loan_out_price0" style="width: 150px">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group am-u-lg-4" style="display: none">
|
||||
<label class="am-para-label label-width"><span class="span-bold"> 贴息:</span></label>
|
||||
<div class="am-para-input">
|
||||
<label class="am-para-label-con" v-if="info.srv_json.loan_is_tiexi0==1">是</label>
|
||||
<label class="am-para-label-con" v-else>否</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group am-u-lg-4">
|
||||
<label class="am-para-label label-width"><span class="span-bold"> </span></label>
|
||||
<div class="am-para-input">
|
||||
<label class="am-para-label-con"></label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group am-u-lg-4">
|
||||
<label class="am-para-label label-width"><span class="span-bold">按揭手续费收入:</span></label>
|
||||
<div class="am-para-input">
|
||||
<input type="number" v-model="info.srv_json.commission_price0" style="width: 150px;">
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group am-u-lg-4">
|
||||
<label class="am-para-label label-width" style="width: 170px"><span class="span-bold" title="【首付按揭收入合计】(按揭佣金+按揭手续费+解抵服务费+利息补贴收入+按揭手续费收入+其他收入金额-其他支出金额)">首付按揭收入合计<a href="javascript:void(0)" class="fa fa-info-circle ml5"></a>:</span></label>
|
||||
<div class="am-para-input">
|
||||
<label class="am-para-label-con">{{info.row.loan_price0}}</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr v-if="info.payway=='0' && info.srv_json.srv_if_finance=='1' && info.srv_json.loan_price0" class="am-u-lg-12 wp90" style="margin: 10px">
|
||||
|
||||
<div v-if="info.payway=='0' && info.srv_json.srv_if_finance=='1'" class="am-form-inline">
|
||||
<div class="am-form-group am-u-lg-4">
|
||||
<label class="am-para-label label-width"><span class="span-bold">按揭银行:</span></label>
|
||||
@@ -454,18 +552,26 @@
|
||||
<input type="number" v-model="info.srv_json.commission_price" style="width: 150px;">
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group am-u-lg-4">
|
||||
<label class="am-para-label label-width"><span class="span-bold"> </span></label>
|
||||
<div class="am-para-input">
|
||||
<label class="am-para-label-con"></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group am-u-lg-4">
|
||||
<label class="am-para-label label-width"><span class="span-bold" title="【按揭收入合计】(按揭佣金+按揭手续费+解抵服务费+利息补贴收入+按揭手续费收入+其他收入金额-其他支出金额)">按揭收入合计<a href="javascript:void(0)" class="fa fa-info-circle ml5"></a>:</span></label>
|
||||
<div class="am-para-input">
|
||||
<label class="am-para-label-con">{{info.row.loan_price}}</label>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="am-form-group am-u-lg-4">-->
|
||||
<!-- <label class="am-para-label label-width"><span class="span-bold"> </span></label>-->
|
||||
<!-- <div class="am-para-input">-->
|
||||
<!-- <label class="am-para-label-con"></label>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
|
||||
<div v-if="info.srv_json.loan_price0" class="am-form-group am-u-lg-4">
|
||||
<label class="am-para-label label-width"><span class="span-bold" title="【按揭收入总合计】(首付按揭收入合计+按揭收入合计)">按揭收入总合计<a href="javascript:void(0)" class="fa fa-info-circle ml5"></a>:</span></label>
|
||||
<div class="am-para-input">
|
||||
<label class="am-para-label-con">{{info.row.loan_price_total}}</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<hr v-if="info.payway=='0' && info.srv_json.srv_if_finance=='1'" class="am-u-lg-12 wp90" style="margin: 10px">
|
||||
<div class="am-form-inline">
|
||||
@@ -529,6 +635,103 @@
|
||||
</span>
|
||||
</div>
|
||||
<div class="am-panel-bd am-g" style="margin-top: 10px;margin-bottom: 10px;">
|
||||
<div v-if="info.payway=='0' && info.srv_json.srv_if_finance=='1' && info.srv_json.loan_price0" class="am-form-inline">
|
||||
<div class="am-form-group am-u-lg-12">
|
||||
首付按揭
|
||||
</div>
|
||||
|
||||
<div class="am-form-group am-u-lg-4">
|
||||
<label class="am-para-label label-width"><span class="span-bold">按揭银行:</span></label>
|
||||
<div class="am-para-input">
|
||||
<input type="text" v-model="info.srv_json.loan_product0" style="width: 200px;">
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group am-u-lg-8">
|
||||
<label class="am-para-label label-width"><span class="span-bold">按揭期数:</span></label>
|
||||
<div class="am-para-input">
|
||||
<input type="number" v-model="info.srv_json.loan_num0" style="width: 150px;">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group am-u-lg-4">
|
||||
<label class="am-para-label label-width"><span class="span-bold">按揭金额:</span></label>
|
||||
<div class="am-para-input">
|
||||
<input type="number" v-model="info.srv_json.loan_price0" style="width: 150px;">
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group am-u-lg-4">
|
||||
<label class="am-para-label label-width"><span class="span-bold">按揭返点:</span></label>
|
||||
<div class="am-para-input">
|
||||
<input type="number" v-model="info.srv_json.loan_fd0" style="width: 150px;">
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group am-u-lg-4">
|
||||
<label class="am-para-label label-width"><span class="span-bold">按揭佣金:</span></label>
|
||||
<div class="am-para-input">
|
||||
<input type="number" v-model="info.srv_json.loan_srv_price0" style="width: 150px;">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group am-u-lg-4">
|
||||
<label class="am-para-label label-width"><span class="span-bold">按揭手续费:</span></label>
|
||||
<div class="am-para-input">
|
||||
<input type="number" v-model="info.srv_json.loan_srv0" style="width: 150px;">
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group am-u-lg-4">
|
||||
<label class="am-para-label label-width"><span class="span-bold">解抵服务费:</span></label>
|
||||
<div class="am-para-input">
|
||||
<input type="number" v-model="info.srv_json.loan_offset_price0" style="width: 150px">
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group am-u-lg-4">
|
||||
<label class="am-para-label label-width"><span class="span-bold">利息补贴收入:</span></label>
|
||||
<div class="am-para-input">
|
||||
<input type="number" v-model="info.srv_json.loan_subsidy_price0" style="width: 150px">
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group am-u-lg-4">
|
||||
<label class="am-para-label label-width"><span class="span-bold">其他收入金额:</span></label>
|
||||
<div class="am-para-input">
|
||||
<input type="number" v-model="info.srv_json.loan_in_price0" style="width: 150px">
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group am-u-lg-4">
|
||||
<label class="am-para-label label-width"><span class="span-bold">其他支出金额:</span></label>
|
||||
<div class="am-para-input">
|
||||
<input type="number" v-model="info.srv_json.loan_out_price0" style="width: 150px">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group am-u-lg-4" style="display: none">
|
||||
<label class="am-para-label label-width"><span class="span-bold"> 贴息:</span></label>
|
||||
<div class="am-para-input">
|
||||
<label class="am-para-label-con" v-if="info.srv_json.loan_is_tiexi0==1">是</label>
|
||||
<label class="am-para-label-con" v-else>否</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group am-u-lg-4">
|
||||
<label class="am-para-label label-width"><span class="span-bold"> </span></label>
|
||||
<div class="am-para-input">
|
||||
<label class="am-para-label-con"></label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group am-u-lg-4">
|
||||
<label class="am-para-label label-width"><span class="span-bold">按揭手续费收入:</span></label>
|
||||
<div class="am-para-input">
|
||||
<input type="number" v-model="info.srv_json.commission_price0" style="width: 150px;">
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group am-u-lg-4">
|
||||
<label class="am-para-label label-width" style="width: 170px"><span class="span-bold" title="【首付按揭收入合计】(按揭佣金+按揭手续费+解抵服务费+利息补贴收入+按揭手续费收入+其他收入金额-其他支出金额)">首付按揭收入合计<a href="javascript:void(0)" class="fa fa-info-circle ml5"></a>:</span></label>
|
||||
<div class="am-para-input">
|
||||
<label class="am-para-label-con">{{info.row.loan_price0}}</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr v-if="info.payway=='0' && info.srv_json.srv_if_finance=='1' && info.srv_json.loan_price0" class="am-u-lg-12 wp90" style="margin: 10px">
|
||||
|
||||
<div v-if="info.payway=='0' && info.srv_json.srv_if_finance=='1'" class="am-form-inline">
|
||||
<div class="am-form-group am-u-lg-4">
|
||||
<label class="am-para-label label-width"><span class="span-bold">按揭银行:</span></label>
|
||||
@@ -605,12 +808,25 @@
|
||||
<input type="number" v-model="info.srv_json.commission_price" style="width: 150px;">
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group am-u-lg-4">
|
||||
<label class="am-para-label label-width"><span class="span-bold"> </span></label>
|
||||
<div class="am-para-input">
|
||||
<label class="am-para-label-con"></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group am-u-lg-4">
|
||||
<label class="am-para-label label-width"><span class="span-bold" title="【按揭收入合计】(按揭服务费+解抵服务费+利息补贴收入+按揭手续费收入+其他收入金额-其他支出金额)">按揭收入合计<a href="javascript:void(0)" class="fa fa-info-circle ml5"></a>:</span></label>
|
||||
<div class="am-para-input">
|
||||
<label class="am-para-label-con">{{info.row.loan_price}}</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="info.srv_json.loan_price" class="am-form-group am-u-lg-4">
|
||||
<label class="am-para-label label-width"><span class="span-bold" title="【按揭收入总合计】(首付按揭收入合计+按揭收入合计)">按揭收入总合计<a href="javascript:void(0)" class="fa fa-info-circle ml5"></a>:</span></label>
|
||||
<div class="am-para-input">
|
||||
<label class="am-para-label-con">{{info.row.loan_price_total}}</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -157,7 +157,9 @@
|
||||
<th>整车采购毛利</th>
|
||||
<th>保险收入合计</th>
|
||||
<th>挂牌收入合计</th>
|
||||
<th>首付按揭收入合计</th>
|
||||
<th>按揭收入合计</th>
|
||||
<th>按揭收入总合计</th>
|
||||
<th>水平业务总毛利</th>
|
||||
<th>单车总毛利</th>
|
||||
<th>门店单车毛利</th>
|
||||
@@ -182,7 +184,9 @@
|
||||
<td>{{v.car_profit_price}}</td>
|
||||
<td>{{v.insurance_price}}</td>
|
||||
<td>{{v.fee_carno_price}}</td>
|
||||
<td>{{v.loan_price0}}</td>
|
||||
<td>{{v.loan_price}}</td>
|
||||
<td>{{v.loan_price_total}}</td>
|
||||
<td>{{v.srv_price}}</td>
|
||||
<td>{{v.car_price}}</td>
|
||||
<td>{{v.dl_car_price}}</td>
|
||||
|
||||
@@ -364,7 +364,9 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--贷款明细-->
|
||||
<!--首付按揭-->
|
||||
<? require_once "loaninfo0.php" ?>
|
||||
<!--按揭明细-->
|
||||
<? require_once "loaninfo.php" ?>
|
||||
<!--资料审核-->
|
||||
<? require_once "ckinfo.php" ?>
|
||||
@@ -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 () {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<div class="am-panel am-panel-default" v-if="!info.payway && info.loan_info">
|
||||
<div class="am-panel-hd">
|
||||
<span style="font-size: 20px">分期明细</span>
|
||||
<span style="font-size: 20px">按揭明细</span>
|
||||
<span style="float:right;margin-top:5px">
|
||||
</span>
|
||||
</div>
|
||||
@@ -15,7 +15,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group am-u-lg-6">
|
||||
<label class="am-para-label label-width"><span class="span-bold">贷款金额:</span></label>
|
||||
<label class="am-para-label label-width"><span class="span-bold">按揭金额:</span></label>
|
||||
<div class="am-para-input">
|
||||
<label class="am-para-label">
|
||||
<input type="text" v-model="info.loan_info.price_loan">
|
||||
|
||||
@@ -0,0 +1,163 @@
|
||||
<div class="am-panel am-panel-default" v-if="!info.payway && info.loan_info0">
|
||||
<div class="am-panel-hd">
|
||||
<span style="font-size: 20px">首付按揭明细</span>
|
||||
<span style="float:right;margin-top:5px">
|
||||
</span>
|
||||
</div>
|
||||
<div class="am-panel-bd am-g" style="margin-top: 10px;margin-bottom: 10px;" v-if="info.loan_info0.finance_rows">
|
||||
<div class="am-form-inline">
|
||||
<div class="am-form-group am-u-lg-6">
|
||||
<label class="am-para-label label-width"><span class="span-bold">金融机构:</span></label>
|
||||
<div class="am-para-input">
|
||||
<select style="width:150px" v-model="info.finance_id0">
|
||||
<option v-for="item in info.loan_info0.finance_rows" :value="item.id">{{item.title}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group am-u-lg-6">
|
||||
<label class="am-para-label label-width"><span class="span-bold">按揭金额:</span></label>
|
||||
<div class="am-para-input">
|
||||
<label class="am-para-label">
|
||||
<input type="text" v-model="info.loan_info0.price_loan">
|
||||
</label>
|
||||
</div>
|
||||
<label class="am-para-label label-width"><span class="span-bold">收款公司:</span></label>
|
||||
<div class="am-para-input">
|
||||
<label class="am-para-label w130">
|
||||
<select v-model="info.loan_info0.company_id">
|
||||
<option value="0">请选择</option>
|
||||
<option v-for="item in info.companys" :value="item.id">{{item.short}}</option>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-inline">
|
||||
<!--<div class="am-form-group am-u-lg-6">
|
||||
<label class="am-para-label label-width"><span class="span-bold">首付:</span></label>
|
||||
<div class="am-para-input">
|
||||
<label class="am-para-label-con">{{info.loan_info.first_pay}}</label>
|
||||
</div>
|
||||
</div>-->
|
||||
<div class="am-form-group am-u-lg-6">
|
||||
<label class="am-para-label label-width"><span class="span-bold"></span></label>
|
||||
<div class="am-para-input">
|
||||
<label class="am-para-label-con"></label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group am-u-lg-6">
|
||||
<? if ($info['loan_info0']['status_array'] && in_array(1, $info['loan_info0']['status_array'])) { ?>
|
||||
<label class="am-para-label label-width"><span class="span-bold">放款时间:</span></label>
|
||||
<div class="am-para-input">
|
||||
<label class="am-para-label">
|
||||
<input type="text" id="loan_time0" v-model="info.loan_info0.loan_time" autocomplete="off">
|
||||
</label>
|
||||
</div>
|
||||
<? } ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-inline" style="display: none">
|
||||
<div class="am-form-group am-u-lg-12">
|
||||
<label class="am-para-label label-width"><span class="span-bold">贴息:</span></label>
|
||||
<div class="am-para-input">
|
||||
<label class="am-para-label-con" v-if="info.loan_info0.is_tiexi==1">是</label>
|
||||
<label class="am-para-label-con" v-else>否</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-inline">
|
||||
<div class="am-form-group am-u-lg-12">
|
||||
<label class="am-para-label label-width"><span class="span-bold">期数:</span></label>
|
||||
<div class="am-para-input">
|
||||
<label class="am-para-label">
|
||||
<input type="text" v-model="info.loan_info0.num">
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-inline">
|
||||
<div class="am-form-group am-u-lg-12">
|
||||
<label class="am-para-label label-width"><span class="span-bold">按揭通知函:</span></label>
|
||||
<div class="am-para-input">
|
||||
<div class="am-form-group">
|
||||
<a href="javascript:void(0);" class="am-btn am-btn-default am-btn-sm" data-file="1"
|
||||
data-type="jpg,png,gif,png,jpeg"
|
||||
data-uptype="qiniu" data-field="loan_file0">
|
||||
<input type="hidden" class="loan_file0" name="loan_file0" data-type="0" value=""
|
||||
onchange="upLoanFile(2,this)">
|
||||
<i class="am-icon-cloud-upload"></i> 选择文件
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<ul id="viewer-notify_file" class="photopic-list clearfix mt10" v-if="info.loan_info0 && info.loan_info0.notify_file_list">
|
||||
<? foreach ($info['loan_info0']['notify_file_list'] as $key=>$val) {?>
|
||||
<li style="position:relative;">
|
||||
<div style="position:absolute;top:5px;right:0;padding:0 8px 2px 8px;line-height:22px; background-color:rgba(0,0,0,.5);font-size:14px;color:#fff;" onclick="del_img('load_info0','notify_file','<?=$key?>')">x
|
||||
</div>
|
||||
<a target="_blank" class="pic">
|
||||
<img alt="按揭通知函" onclick="showViewer('viewer-notify_file')" src="<?=$val?>"/>
|
||||
</a>
|
||||
<div class="f12 tc"></div>
|
||||
</li>
|
||||
<?}?>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group am-u-lg-6">
|
||||
<? if ($info['loan_info0']['status_array'] && in_array(1, $info['loan_info0']['status_array'])) { ?>
|
||||
<label class="am-para-label label-width"><span class="span-bold">按揭放款函:</span></label>
|
||||
<div class="am-para-input">
|
||||
<div class="am-form-inline">
|
||||
<? if (is_img($info['loan_info0']['lend_file_name'])) { ?>
|
||||
<ul id="viewer-lend_file" class="photopic-list ml30 clearfix">
|
||||
<li style="position:relative;">
|
||||
<div style="position:absolute;top:5px;right:0;padding:0 8px 2px 8px;line-height:22px; background-color:rgba(0,0,0,.5);font-size:14px;color:#fff;"
|
||||
onclick="del_img('load_info0','lend_file','')">x
|
||||
</div>
|
||||
<a target="_blank" class="pic">
|
||||
<img alt="按揭放款函" onclick="showViewer('viewer-lend_file')"
|
||||
:src="info.loan_info0.lend_file"/>
|
||||
</a>
|
||||
<div class="f12 tc"></div>
|
||||
</li>
|
||||
</ul>
|
||||
<? } else { ?>
|
||||
<div class="am-form-group">
|
||||
<a href="javascript:void(0);" class="am-btn am-btn-default am-btn-sm" data-file="1"
|
||||
data-type="jpg,png,gif,png,jpeg"
|
||||
data-uptype="qiniu" data-field="notify_file0">
|
||||
<input type="hidden" class="notify_file0" id="notify_file0" name="notify_file0" data-type="1" value=""
|
||||
onchange="upLoanFile(3,this)">
|
||||
<i class="am-icon-cloud-upload"></i> 选择文件
|
||||
</a>
|
||||
</div>
|
||||
<div class="am-form-group ml10" v-if="info.loan_info0.lend_file">
|
||||
<a :href="info.loan_info0.lend_file" target="_blank" class='mt5' title="查看文件">
|
||||
{{info.loan_info0.lend_file_name}}
|
||||
</a>
|
||||
</div>
|
||||
<? } ?>
|
||||
</div>
|
||||
</div>
|
||||
<? } ?>
|
||||
</div>
|
||||
<div class="am-form-group am-u-lg-12">
|
||||
<div class="am-form-group ml10">
|
||||
<? if (!$info['loan_info0']['status_array']) { ?>
|
||||
<a href='javascript:;' @click="finish_loan(3)"
|
||||
class='am-btn am-btn-primary am-btn-xs'>等待放款</a>
|
||||
<? } elseif ($info['loan_info0']['status_array'] && in_array(1, $info['loan_info0']['status_array']) && !in_array(2, $info['loan_info0']['status_array'])) { ?>
|
||||
<a href='javascript:;' @click="finish_loan(4)"
|
||||
class='am-btn am-btn-primary am-btn-xs'>按揭完成</a>
|
||||
<? } else { ?>
|
||||
<a href="javascript:"
|
||||
class="am-btn am-btn-default am-active am-btn-xs">已完成按揭</a>
|
||||
<? } ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -72,7 +72,7 @@
|
||||
<div class="am-para-input">
|
||||
<label class="am-para-label-con">
|
||||
<span v-if="info.payway">全款</span>
|
||||
<span v-else>贷款</span>
|
||||
<span v-else>按揭</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -63,8 +63,9 @@
|
||||
</nav>
|
||||
</div>
|
||||
<div class="align-r ml15" v-if="need_price">
|
||||
应收总额:{{need_price}},已收总额:{{pay_price}}
|
||||
<template v-if="price_loan">,贷款金额:{{price_loan}}</template>  
|
||||
应收总额:{{need_price}} , 已收总额:{{pay_price}}
|
||||
<template v-if="price_loan0">, 首付按揭金额:{{price_loan0}}</template>
|
||||
<template v-if="price_loan">, 按揭金额:{{price_loan}}</template>  
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -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;
|
||||
}
|
||||
});
|
||||
|
||||
+107
-10
@@ -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']}"."<br>";
|
||||
echo "finance_id0: {$item['finance_id0']}"."<br>";
|
||||
echo "biz_id: {$item['biz_id']}"."<br>";
|
||||
echo "status: {$item['status']}"."<br>";
|
||||
echo "if_usedcar: {$if_usedcar}"."<br>";
|
||||
@@ -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 贷款信息: <br>";
|
||||
echo "get 按揭信息: <br>";
|
||||
echo $this->order_loans_model->db->last_query()."<br>";
|
||||
var_dump($loan_row);
|
||||
echo "<br>";
|
||||
@@ -993,7 +995,7 @@ class Order extends CI_Controller{
|
||||
];
|
||||
$fd_row = $this->biz_settle_srv_model->get($where);
|
||||
if ($debug){
|
||||
echo "get 贷款配置 : <br>";
|
||||
echo "get 按揭配置 : <br>";
|
||||
echo $this->biz_settle_srv_model->db->last_query()."<br>";
|
||||
var_dump($fd_row);
|
||||
echo "<br><br>";
|
||||
@@ -1005,7 +1007,7 @@ class Order extends CI_Controller{
|
||||
"JSON_UNQUOTE(json_extract(jsondata, '$.rebate')) > 0" => null,
|
||||
]);
|
||||
if ($debug){
|
||||
echo "get 贷款配置(默认) : <br>";
|
||||
echo "get 按揭配置(默认) : <br>";
|
||||
echo $this->biz_settle_srv_model->db->last_query()."<br>";
|
||||
var_dump($fd_row);
|
||||
echo "<br><br>";
|
||||
@@ -1028,12 +1030,102 @@ class Order extends CI_Controller{
|
||||
}
|
||||
if ($debug){
|
||||
echo "是否贴息: is_tiexi: {$loan_row['is_tiexi']}"."<br>";
|
||||
echo "贷款返点: loan_fd: {$loan_fd}"."<br>";
|
||||
echo "贷款返点金额: profix_loan: {$profix_loan}"."<br>";
|
||||
echo "贷款手续费: srv_loan: {$srv_loan}"."<br>";
|
||||
echo "按揭返点: loan_fd: {$loan_fd}"."<br>";
|
||||
echo "按揭返点金额: profix_loan: {$profix_loan}"."<br>";
|
||||
echo "按揭手续费: srv_loan: {$srv_loan}"."<br>";
|
||||
echo "按揭综合服务费: loan_srv_price: {$srv_json['loan_srv_price']}"."<br>";
|
||||
echo "<br><br>";
|
||||
}
|
||||
|
||||
// 首付按揭
|
||||
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 首付按揭-按揭信息: <br>";
|
||||
echo $this->order_loans0_model->db->last_query()."<br>";
|
||||
var_dump($loan_row);
|
||||
echo "<br>";
|
||||
}
|
||||
$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()."<br>";
|
||||
var_dump($finance_row);
|
||||
echo "<br>";
|
||||
}
|
||||
echo "loan_price0 (money_json['price_loan0']): {$srv_json['loan_price0']}"."<br>";
|
||||
echo "loan_product0: {$srv_json['loan_product0']}"."<br>";
|
||||
echo "loan_num0: {$srv_json['loan_num0']}"."<br>";
|
||||
echo "is_tiexi0: {$loan_row['is_tiexi0']}"."<br>";
|
||||
echo "<br><br>";
|
||||
}
|
||||
|
||||
$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 首付按揭-按揭配置 : <br>";
|
||||
echo $this->biz_settle_srv_model->db->last_query()."<br>";
|
||||
var_dump($fd_row);
|
||||
echo "<br><br>";
|
||||
}
|
||||
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 首付按揭-按揭配置(默认) : <br>";
|
||||
echo $this->biz_settle_srv_model->db->last_query()."<br>";
|
||||
var_dump($fd_row);
|
||||
echo "<br><br>";
|
||||
}
|
||||
}
|
||||
$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']}"."<br>";
|
||||
}
|
||||
}
|
||||
if ($debug){
|
||||
echo "是否贴息: is_tiexi0: {$loan_row['is_tiexi']}"."<br>";
|
||||
echo "按揭返点: loan_fd0: {$loan_fd}"."<br>";
|
||||
echo "按揭返点金额: profix_loan0: {$profix_loan}"."<br>";
|
||||
echo "按揭手续费: srv_loan0: {$srv_loan}"."<br>";
|
||||
echo "按揭综合服务费: loan_srv_price0: {$srv_json['loan_srv_price0']}"."<br>";
|
||||
echo "<br><br>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$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 "------------------------------"."<br>";
|
||||
echo "pay_price: {$pay_price}"."<br>";
|
||||
echo "need_price: {$need_price}"."<br>";
|
||||
echo "if_pay(pay_price>=need_price ? 1 : 0): {$srv_json['if_pay']}"."<br>";
|
||||
@@ -1057,12 +1150,16 @@ class Order extends CI_Controller{
|
||||
if ($cost){
|
||||
echo "<br><br>get cost data:<br>";
|
||||
var_dump($cost);
|
||||
echo "<br>";
|
||||
echo "c_time: ".date("Y-m-d H:i:s",$cost['c_time'])."<br>";
|
||||
echo "<br><br>";
|
||||
echo "c_time: ".date("Y-m-d H:i:s",$cost['c_time'])."<br><br>";
|
||||
echo "srv_json:<br>";
|
||||
var_dump($srv_json_cost);
|
||||
}
|
||||
echo "<br><br>debug mode end<br><br>";
|
||||
|
||||
$fill_info = $this->orders_v2_entity->pdf_data($item);
|
||||
echo "<b>fill_info(pdf_data)</b>:<br>";
|
||||
var_dump($fill_info);
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
@@ -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' => '交付确认'],
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Receiver_order_loans0_model extends HD_Model
|
||||
{
|
||||
private $table_name = 'lc_receiver_order_loans0'; // 首付按揭相关,相关代码搜索"首付按揭"确保能搜索到
|
||||
|
||||
private $status_arr = [ 0 => '审核中',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;
|
||||
}
|
||||
}
|
||||
@@ -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 => '已开票'),
|
||||
|
||||
@@ -0,0 +1,417 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/*
|
||||
* 测试广告投放用
|
||||
*/
|
||||
|
||||
class Pop extends CI_Controller
|
||||
{
|
||||
private $cityid_default = 350100;
|
||||
private $cityid_arr = [350100, 350200];
|
||||
private $city_map = array(
|
||||
350100 => '福州',
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-cn">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<title>福州东风EV4S:XXX - 狸车</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<script type="text/javascript" src="https://qs.haodian.cn/web/javascript/jquery.3.4.1.min.js"></script>
|
||||
<script type="text/javascript" src="https://qs.haodian.cn/web/javascript/vue.2.6.10.min.js"></script>
|
||||
<script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="app">
|
||||
<form onsubmit="return false;" data-time="1" data-auto="true" action="/login/post" method="post">
|
||||
<input required pattern="^\S{1,}$" name="name" type="text" autofocus="autofocus" autocomplete="off" title="请输入姓名" placeholder="请输入姓名"><br>
|
||||
<input name="mobile" type="text" autofocus="autofocus" autocomplete="off" title="请输入手机号码" placeholder="请输入手机号码" maxlength="11">
|
||||
<button type="button" @click="getcode"/>获取验证码</button><br>
|
||||
<input required pattern="^\S{6}$" name="code" type="text" autofocus="autofocus" autocomplete="off" title="请输入验证码" placeholder="请输入验证码" maxlength="6"><br>
|
||||
<button type="button" @click='commit'>提交</button>
|
||||
</form>
|
||||
{{info.method}}
|
||||
{{params.cityid}}
|
||||
<div align="center" style="position:absolute; bottom:0;width: 98%;padding-bottom: 10px;">
|
||||
<a href="https://beian.miit.gov.cn" target="_blank" style="color: black">闽ICP备12013448号-3</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var app = new Vue({
|
||||
el: '#app',
|
||||
data: {
|
||||
params: [],
|
||||
info: [],
|
||||
},
|
||||
created(){
|
||||
},
|
||||
computed: {
|
||||
},
|
||||
mounted() {
|
||||
let vm = this;
|
||||
vm.params = <?=json_encode($params)?>;
|
||||
vm.info = <?=json_encode($info)?>;
|
||||
},
|
||||
methods: {
|
||||
commit: function () {
|
||||
let vm = this;
|
||||
$.ajax({
|
||||
url: './post',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
info: vm.info
|
||||
},
|
||||
success: function (data) {
|
||||
if (data.code) {
|
||||
alert(data.msg);
|
||||
}
|
||||
else {
|
||||
alert(data.msg);
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
getcode: function () {
|
||||
let vm = this;
|
||||
$.ajax({
|
||||
url: './get_code',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
info: vm.info
|
||||
},
|
||||
success: function (data) {
|
||||
if (data.code) {
|
||||
alert(data.msg);
|
||||
}
|
||||
else {
|
||||
alert(data.msg);
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<div style="display: none">
|
||||
<script></script>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,22 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-cn">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<title>福州东风EV4S:XXX - 狸车</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
</head>
|
||||
<body>
|
||||
h5
|
||||
<div>
|
||||
<div align="center" style="position:absolute; bottom:0;width: 98%;padding-bottom: 10px;">
|
||||
<a href="https://beian.miit.gov.cn" target="_blank" style="color: black">闽ICP备12013448号-3</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="display: none">
|
||||
<script></script>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Binary file not shown.
Reference in New Issue
Block a user