From 495ef25dce2c0d005d1240d3910c42b55e8789ed Mon Sep 17 00:00:00 2001 From: qianhy Date: Tue, 4 Apr 2023 15:44:00 +0800 Subject: [PATCH] cost adjust loan about --- admin/controllers/items/Cost.php | 22 +++++-- admin/libraries/Ordersv2List.php | 12 ++-- admin/views/items/cost/get.php | 62 ++++++++++++------- admin/views/receiver/orderv2/get/oinfo.php | 4 +- api/controllers/plan/Order.php | 21 +++++-- common/models/items/Items_cost_model.php | 12 ++-- .../order/Receiver_orders_v2_model.php | 7 +++ 7 files changed, 97 insertions(+), 43 deletions(-) diff --git a/admin/controllers/items/Cost.php b/admin/controllers/items/Cost.php index 119eaded..ad9b3a2e 100644 --- a/admin/controllers/items/Cost.php +++ b/admin/controllers/items/Cost.php @@ -264,6 +264,8 @@ class Cost extends HD_Controller{ $srv_json = json_decode($row['srv_json'],true); !$srv_json['commission_price'] && $srv_json['commission_price'] = 0; !$srv_json['back_price'] && $srv_json['back_price'] = 0; + !$srv_json['loan_srv'] && $srv_json['loan_srv'] = 0; + !$srv_json['loan_fd'] && $srv_json['loan_fd'] = 0; !$srv_json['loan_offset_price'] && $srv_json['loan_offset_price'] = 0; !$srv_json['loan_subsidy_price'] && $srv_json['loan_subsidy_price'] = 0; !$srv_json['loan_in_price'] && $srv_json['loan_in_price'] = 0; @@ -286,7 +288,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 && $biz['city_id'] == 350600 ? 1 : 0, # 23-04-03: 贷款, 350600 代理店按所在城市的品牌店处理 + '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, @@ -611,6 +613,9 @@ class Cost extends HD_Controller{ "insurance_price" => $srv_json['insurance_price'], "insurance_fd" => $srv_json['insurance_fd'], "insurance_ins_price" => $srv_json['insurance_ins_price'], + "accident_price" => $srv_json['accident_price'], + "accident_fd" => $srv_json['accident_fd'], + "accident_ins_price" => $srv_json['accident_ins_price'], "back_price" => $srv_json['back_price'], "insurance_price_pure" => $val['insurance_price'], @@ -625,6 +630,8 @@ class Cost extends HD_Controller{ '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'], @@ -653,9 +660,9 @@ class Cost extends HD_Controller{ 'price_floor' => array('title'=>'销售政策', 'column_num'=>3), 'company_name' => array('title'=>'采购成本', 'column_num'=>5), 'promotion_sale_price' => array('title'=>'促销成本', 'column_num'=>3), - 'business_product' => array('title'=>'保险收入', 'column_num'=>9), + 'business_product' => array('title'=>'保险收入', 'column_num'=>12), 'fee_carno' => array('title'=>'挂牌收入', 'column_num'=>3), - 'loan_product' => array('title'=>'分期付款业务', 'column_num'=>11), + 'loan_product' => array('title'=>'分期付款业务', 'column_num'=>13), 'other_in_price' => array('title'=>'其他收入及成本', 'column_num'=>3), 'need_price' => array('title'=>'收款核对', 'column_num'=>3), ]; @@ -706,6 +713,9 @@ class Cost extends HD_Controller{ "insurance_price" => "交强险金额", "insurance_fd" => "交强险返点", "insurance_ins_price" => "交强险佣金", + "accident_price" => "意外险金额", + "accident_fd" => "意外险返点", + "accident_ins_price" => "意外险佣金", "back_price" => "客户退点金额", // 退客户保险退点 "insurance_price_pure" => "保险收入合计", // 保险净收入 @@ -717,9 +727,11 @@ class Cost extends HD_Controller{ 'loan_product' => '按揭银行', 'loan_is_tiexi' => '贴息', - 'loan_price' => '按揭金额', 'loan_num' => '期数', - 'loan_srv_price' => '按揭服务费', + 'loan_price' => '按揭金额', + 'loan_fd' => '按揭返点', + 'loan_srv_price' => '按揭佣金', + 'loan_srv' => '按揭手续费', 'loan_offset_price' => '解抵服务费', 'loan_subsidy_price' => '利息补贴收入', 'commission_price' => '按揭手续费收入', diff --git a/admin/libraries/Ordersv2List.php b/admin/libraries/Ordersv2List.php index 2b31f49f..cdd86a2b 100644 --- a/admin/libraries/Ordersv2List.php +++ b/admin/libraries/Ordersv2List.php @@ -17,6 +17,7 @@ class Ordersv2List $this->ci = &get_instance(); $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_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'); @@ -482,6 +483,8 @@ class Ordersv2List $fields['pro_loan'] = $finance_row['title']; $fields['price_loan'] = $money_json['price_loan']; $fields['is_sure'] = $is_sure ? '是':'否'; + $loan = $this->ci->order_loans_model->get(['o_id' => $val['id']]); + $fields['is_tiexi'] = intval($loan['is_tiexi']) ? '是': ''; } $srv_info = $this->get_srv_info($val); $fields['srv_info_total'] = $srv_info['total'] > 0 ? $srv_info['total'] : ''; @@ -711,13 +714,14 @@ class Ordersv2List unset($fields['price'],$fields['c_time'],$fields['car_name'],$fields['of_title']); $fields['payway_name'] = ['title'=>'付款方式']; $fields['pro_loan'] = ['title'=>'金融机构']; + $fields['is_tiexi'] = ['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_fine_select'] = ['title'=>'服务-精品选装']; + $fields['srv_info_total'] = ['title'=>'手续费']; + $fields['srv_info_fee_carno'] = ['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' => '订单时间']; !$fields['over_time'] && $fields['over_time'] = ['title' => '止交付时间']; diff --git a/admin/views/items/cost/get.php b/admin/views/items/cost/get.php index ff4c8cc1..16194516 100644 --- a/admin/views/items/cost/get.php +++ b/admin/views/items/cost/get.php @@ -340,7 +340,6 @@ -
@@ -386,27 +385,38 @@
+
+ +
+ +
+
+
-
- +
- - +
- +
-
+ +
+ +
+ +
+
@@ -450,12 +460,12 @@
-
- -
- -
-
+ + + + + +
@@ -526,6 +536,13 @@
+
+ +
+ +
+
+
@@ -533,17 +550,24 @@
- +
- +
- +
+ +
+ +
+ +
+
@@ -587,12 +611,6 @@
-
- -
- -
-
diff --git a/admin/views/receiver/orderv2/get/oinfo.php b/admin/views/receiver/orderv2/get/oinfo.php index 525762b7..843ad69c 100644 --- a/admin/views/receiver/orderv2/get/oinfo.php +++ b/admin/views/receiver/orderv2/get/oinfo.php @@ -56,7 +56,7 @@
- +
- 修改 + 修改
diff --git a/api/controllers/plan/Order.php b/api/controllers/plan/Order.php index 96ab0faf..ec90c5a3 100644 --- a/api/controllers/plan/Order.php +++ b/api/controllers/plan/Order.php @@ -597,6 +597,7 @@ class Order extends CI_Controller{ $bill_info['二手车市场'] && $add_data['bill_name'] = $bill_info['二手车市场']; $bill_info['车价合计(小写)'] && $add_data['bill_price'] = str_replace('¥','',$bill_info['车价合计(小写)']); } + $add_data['price'] = $add_data['bill_price']; #23-04-04: 这个实际售价可以改成默认开票价,不能默认成指导价 if ($debug){ echo "get bill_info:
"; echo $this->order_bills_model->db->last_query()."
"; @@ -906,14 +907,15 @@ 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-03: 贷款, 350600 代理店按所在城市的品牌店处理; 23-04-04: 加多一个城市,宁德 $biz_type_force = $biz_id_force = 0; - if ($biz['type']==3 and $biz['city_id']==350600){ + $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)){ $biz_force = $this->biz_model->get(['city_id'=>$biz['city_id'], 'type'=>1, 'status'=>1]); $biz_force && $biz_type_force = 1; $biz_force && $biz_id_force = $biz_force['id']; if ($debug){ - echo "350600 代理店按所在城市的品牌店处理:
"; + echo "{$biz['city_id']} 代理店按所在城市的品牌店处理:
"; echo $this->biz_model->db->last_query()."
"; var_dump($biz_force); echo "biz_type_force: {$biz_type_force}"."
"; @@ -986,11 +988,20 @@ class Order extends CI_Controller{ } } $fd_jsondata = json_decode($fd_row['jsondata'],true); - $loan_fd = $fd_jsondata['rebate'] ? $fd_jsondata['rebate']/100:0; - $profix_loan = $money_json['price_loan']*$loan_fd; + $loan_fd = $fd_jsondata['rebate'] ? $fd_jsondata['rebate']:0; + $profix_loan = $money_json['price_loan']*$loan_fd/100; } $srv_json['loan_srv_price'] = $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_price'] = $profix_loan; + $srv_json['loan_fd'] = $loan_fd; + $srv_json['loan_srv'] = $srv_loan; + if ($debug){ + echo "是否大于2023-04-01: yes,{$item['bill_time']}"."
"; + } + } if ($debug){ echo "是否贴息: is_tiexi: {$loan_row['is_tiexi']}"."
"; echo "贷款返点: loan_fd: {$loan_fd}"."
"; diff --git a/common/models/items/Items_cost_model.php b/common/models/items/Items_cost_model.php index 4b6939a9..dd15df89 100644 --- a/common/models/items/Items_cost_model.php +++ b/common/models/items/Items_cost_model.php @@ -39,7 +39,8 @@ class Items_cost_model extends HD_Model $buy_price = $item_row['buy_price'] + $cost_json['select_price'] + $cost_json['labor_price']; //【促销成本合计】(销售佣金+其他) $promotion_price = $promotion_json['sale_price'] + $promotion_json['other']; - if ($biz_type == 3 && $business_row && $business_row['proxy_type'] == 1){ + #if ($biz_type == 3 && $business_row && $business_row['proxy_type'] == 1){ # 23-4-04: 不用区分是否票折 + if ($biz_type == 3){ $promotion_price = $promotion_json['other']; } //【整车采购成本】(采购成本-厂家补贴) @@ -59,8 +60,8 @@ class Items_cost_model extends HD_Model $insurance_price = $srv_json['business_ins_price']+$srv_json['insurance_ins_price']+$srv_json['accident_ins_price']-$srv_json['back_price']; //【挂牌收入合计】 $fee_carno_price = $srv_json['fee_carno'] - $srv_json['cb_fee_carno']; - //【按揭收入合计】(按揭综合服务费+按揭解抵服务费+利息补贴收入+金融公司手续费收入+其他收入-其他支出) - $loan_price = $srv_json['loan_srv_price']+$srv_json['loan_offset_price']+$srv_json['loan_subsidy_price']+$srv_json['commission_price']+$srv_json['loan_in_price']-$srv_json['loan_out_price']; + //【按揭收入合计】(按揭综合服务费+按揭解抵服务费+利息补贴收入+金融公司手续费收入+其他收入-其他支出) # 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']; } @@ -71,9 +72,10 @@ 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-03: 贷款, 350600 代理店按所在城市的品牌店处理; 23-04-04: 加多一个城市,宁德 $biz = $this->biz_model->get(['id'=>$order_row['biz_id']]); - if ($biz['city_id']==350600){ + $city_ids_force = $this->receiver_orders_v2_model->get_city_ids_force(); + if (in_array($biz['city_id'], $city_ids_force)){ $biz_force = $this->biz_model->get(['city_id'=>$biz['city_id'], 'type'=>1, 'status'=>1]); if ($biz_force){ //【按揭收入合计】(按揭综合服务费+按揭解抵服务费+利息补贴收入+金融公司手续费收入+其他收入-其他支出) diff --git a/common/models/receiver/order/Receiver_orders_v2_model.php b/common/models/receiver/order/Receiver_orders_v2_model.php index edc1011a..f519f08f 100644 --- a/common/models/receiver/order/Receiver_orders_v2_model.php +++ b/common/models/receiver/order/Receiver_orders_v2_model.php @@ -24,6 +24,13 @@ class Receiver_orders_v2_model extends HD_Model return $this->status_arr; } + /** + * 代理店贷款返点同所在城市的品牌店 + */ + public function get_city_ids_force(){ + return array(350600, 350900); + } + public function selectOrders($where = array(), $order = '', $page = 0, $page_size = 20, $count = 0,$fileds="lc_receiver_orders_v2.*",$having="total=1") { $this->db->select($fileds.",count(lc_receiver_order_status.status) as total");