From 19ffa3c6182faedc7dcf85c751dadf133590fbaf Mon Sep 17 00:00:00 2001 From: qianhy Date: Wed, 8 Mar 2023 15:42:47 +0800 Subject: [PATCH] loan add is_tiexi about --- admin/controllers/items/Cost.php | 4 +- admin/controllers/receiver/orderv2/Orders.php | 1 + admin/views/items/cost/get.php | 4 +- admin/views/receiver/orderv2/get/loaninfo.php | 9 +++ api/controllers/plan/Order.php | 68 +++++++++++-------- api/controllers/wxapp/licheb/CusorderV2.php | 1 + api/controllers/wxapp/licheb/Loan.php | 3 +- 7 files changed, 58 insertions(+), 32 deletions(-) diff --git a/admin/controllers/items/Cost.php b/admin/controllers/items/Cost.php index e04e59ba..0ac777f8 100644 --- a/admin/controllers/items/Cost.php +++ b/admin/controllers/items/Cost.php @@ -617,6 +617,7 @@ class Cost extends HD_Controller{ 'payway_name' => $order['payway_name'], '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'], @@ -650,7 +651,7 @@ class Cost extends HD_Controller{ 'promotion_sale_price' => array('title'=>'促销成本', 'column_num'=>3), 'business_product' => array('title'=>'保险收入', 'column_num'=>9), 'fee_carno' => array('title'=>'挂牌收入', 'column_num'=>3), - 'loan_product' => array('title'=>'分期付款业务', 'column_num'=>10), + 'loan_product' => array('title'=>'分期付款业务', 'column_num'=>11), 'other_in_price' => array('title'=>'其他收入及成本', 'column_num'=>3), 'need_price' => array('title'=>'收款核对', 'column_num'=>3), ]; @@ -711,6 +712,7 @@ class Cost extends HD_Controller{ 'payway_name' => '购车方式', 'loan_product' => '按揭银行', + 'loan_is_tiexi' => '贴息', 'loan_price' => '按揭金额', 'loan_num' => '期数', 'loan_srv_price' => '按揭服务费', diff --git a/admin/controllers/receiver/orderv2/Orders.php b/admin/controllers/receiver/orderv2/Orders.php index fef5eefb..31275332 100644 --- a/admin/controllers/receiver/orderv2/Orders.php +++ b/admin/controllers/receiver/orderv2/Orders.php @@ -441,6 +441,7 @@ class Orders extends HD_Controller $loan['first_pay'] = $sale_price - $money_json['price_loan']; } !$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'); diff --git a/admin/views/items/cost/get.php b/admin/views/items/cost/get.php index f81e4744..19eb3c6d 100644 --- a/admin/views/items/cost/get.php +++ b/admin/views/items/cost/get.php @@ -411,8 +411,10 @@
- +
+ +
diff --git a/admin/views/receiver/orderv2/get/loaninfo.php b/admin/views/receiver/orderv2/get/loaninfo.php index 0ebe5521..dd1c3c6d 100644 --- a/admin/views/receiver/orderv2/get/loaninfo.php +++ b/admin/views/receiver/orderv2/get/loaninfo.php @@ -52,6 +52,15 @@
+
+
+ +
+ + +
+
+
diff --git a/api/controllers/plan/Order.php b/api/controllers/plan/Order.php index 8b4146c2..b7be6fe2 100644 --- a/api/controllers/plan/Order.php +++ b/api/controllers/plan/Order.php @@ -872,6 +872,7 @@ class Order extends CI_Controller{ } $finance_id = $item['finance_id']; $srv_json['loan_product'] = ''; + $srv_json['loan_is_tiexi'] = $loan_row['is_tiexi']; if ($finance_id){ //$finance_row = $this->sys_finance_model->get(array('id'=>$finance_id),'title'); $finance_row = $this->sys_supplier_model->get(array('id'=>$finance_id),'title'); @@ -890,43 +891,52 @@ class Order extends CI_Controller{ echo "

"; } - /*$where = [ - 'biz_id' => $item['biz_id'], - 'type' => 3, - 's_effect_time' => $bill_time_month, - "json_extract(jsondata, '$.finance_id') = '{$finance_id}'" => null, - "json_extract(jsondata, '$.finance_num') = '{$finance_num}'" => null, - ];*/ - $where = [ - 'biz_id' => $item['biz_id'], - '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, - ]; - $fd_row = $this->biz_settle_srv_model->get($where); - if ($debug){ - echo "get 贷款配置 :
"; - echo $this->biz_settle_srv_model->db->last_query()."
"; - var_dump($fd_row); - echo "

"; - } - if(!$fd_row){ - $fd_row = $this->biz_settle_srv_model->get(['biz_id'=>$item['biz_id'],'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]); + $profix_loan = $loan_fd = 0; + if (!$loan_row['is_tiexi']){ + /*$where = [ + 'biz_id' => $item['biz_id'], + 'type' => 3, + 's_effect_time' => $bill_time_month, + "json_extract(jsondata, '$.finance_id') = '{$finance_id}'" => null, + "json_extract(jsondata, '$.finance_num') = '{$finance_num}'" => null, + ];*/ + $where = [ + 'biz_id' => $item['biz_id'], + 'type' => 3, + 'status' => 1, + 's_effect_time<=' => date('Y-m-d',strtotime($item['bill_time'])), + "JSON_UNQUOTE(json_extract(jsondata, '$.supplier_id')) = '{$finance_id}'" => null, + "JSON_UNQUOTE(json_extract(jsondata, '$.finance_num')) = '{$finance_num}'" => null, + "JSON_UNQUOTE(json_extract(jsondata, '$.rebate')) > 0" => null, + ]; + $fd_row = $this->biz_settle_srv_model->get($where); if ($debug){ - echo "get 贷款配置(默认) :
"; + echo "get 贷款配置 :
"; echo $this->biz_settle_srv_model->db->last_query()."
"; var_dump($fd_row); echo "

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

"; + } + } + $fd_jsondata = json_decode($fd_row['jsondata'],true); + $loan_fd = $fd_jsondata['rebate'] ? $fd_jsondata['rebate']/100:0; + $profix_loan = $money_json['price_loan']*$loan_fd; } - $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; + $srv_json['loan_srv_price'] = $profix_loan + $srv_loan; if ($debug){ + echo "是否贴息: is_tiexi: {$loan_row['is_tiexi']}"."
"; echo "贷款返点: loan_fd: {$loan_fd}"."
"; echo "贷款返点金额: profix_loan: {$profix_loan}"."
"; echo "贷款手续费: srv_loan: {$srv_loan}"."
"; diff --git a/api/controllers/wxapp/licheb/CusorderV2.php b/api/controllers/wxapp/licheb/CusorderV2.php index 9fc2e6b6..e0442a84 100644 --- a/api/controllers/wxapp/licheb/CusorderV2.php +++ b/api/controllers/wxapp/licheb/CusorderV2.php @@ -649,6 +649,7 @@ class CusorderV2 extends Wxapp ]; $data['price_loan'] = $money_json['price_loan'] ? $money_json['price_loan'] : 0.00; $data['num'] = $loan_row['num'] ? $loan_row['num'] : 0; + $data['is_tiexi'] = intval($loan_row['is_tiexi']); $data['admin_name'] = ''; if ($row['admin_id']) { $admin_row = $this->app_user_model->get(['id' => $row['admin_id']], 'uname'); diff --git a/api/controllers/wxapp/licheb/Loan.php b/api/controllers/wxapp/licheb/Loan.php index 964d67d4..3a94c761 100644 --- a/api/controllers/wxapp/licheb/Loan.php +++ b/api/controllers/wxapp/licheb/Loan.php @@ -41,7 +41,7 @@ class Loan extends Wxapp{ $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'); $row = $this->order_loans_model->get(['o_id' => $oid]); @@ -77,6 +77,7 @@ class Loan extends Wxapp{ ]; $lend_file && $update['lend_file'] = $lend_file; $num && $update['num'] = $num; + $update['is_tiexi'] = $is_tiexi; $update && $result = $this->order_loans_model->update($update, ['id' => $row['id']]); throw new Exception('保存成功', API_CODE_SUCCESS); }