From 3e62791c7b556c56b9d4c43598fa8d3f85a92ead Mon Sep 17 00:00:00 2001
From: lccsw <805383944@qq.com>
Date: Wed, 10 Aug 2022 17:31:52 +0800
Subject: [PATCH] edit-api-pdf
---
admin/controllers/receiver/orderv2/Orders.php | 6 ++
admin/views/receiver/orderv2/get/index.php | 4 +-
api/controllers/plan/Biz.php | 101 +++++++++++-------
api/controllers/wxapp/liche/Protocol.php | 1 +
4 files changed, 70 insertions(+), 42 deletions(-)
diff --git a/admin/controllers/receiver/orderv2/Orders.php b/admin/controllers/receiver/orderv2/Orders.php
index 18949f97..c0ad036c 100644
--- a/admin/controllers/receiver/orderv2/Orders.php
+++ b/admin/controllers/receiver/orderv2/Orders.php
@@ -316,6 +316,12 @@ class Orders extends HD_Controller
$admin_name = $row_admin ? "{$row_biz['biz_name']} {$row_admin['uname']}" : "";
$row['admin_name'] = $admin_name;
}
+ //订单状态
+ if($id>Orders_v2_entity::V2_START_ID){
+ $status_name = $this->orders_status_entity->last_status_cn($id);
+ !$status_name && $status_name = '未下定';
+ }
+ $row['status_name'] = $status_name;
//日志
$where = [
'order_id' => $row['id']
diff --git a/admin/views/receiver/orderv2/get/index.php b/admin/views/receiver/orderv2/get/index.php
index b2739f6d..c7f96093 100644
--- a/admin/views/receiver/orderv2/get/index.php
+++ b/admin/views/receiver/orderv2/get/index.php
@@ -109,14 +109,12 @@
-
diff --git a/api/controllers/plan/Biz.php b/api/controllers/plan/Biz.php
index 78739f07..0b0fe26d 100644
--- a/api/controllers/plan/Biz.php
+++ b/api/controllers/plan/Biz.php
@@ -8,6 +8,7 @@ class Biz extends HD_Controller
parent::__construct();
$this->load->model('receiver/order/receiver_orders_v2_model','orders_model');
$this->load->model('receiver/order/receiver_order_agents_model', 'order_agents_model');
+ $this->load->model('receiver/order/receiver_order_datas_model');
$this->load->model('receiver/receiver_fine_model');
$this->load->model('auto/auto_business_model');
$this->load->model('biz/biz_model');
@@ -217,6 +218,7 @@ class Biz extends HD_Controller
foreach($rows as $key=>$val){
$info_json = json_decode($val['info_json'],true);
$money_json = json_decode($val['money_json'],true);
+ $bill_time_month = date('Y-m-d',strtotime($val['bill_time']));
$settle_money_json = [];
$settle_money_json['in'] = [ //收入
'profix_car' => 0, //整车
@@ -253,28 +255,61 @@ class Biz extends HD_Controller
// $profix_carno = $money_json['fee_carno'] - $cb_fee_carno;
// }
//保险利润 = 金额(是否含税) * 返点百分比(保险类型):保险生效日
- $agent_row = $this->order_agents_model->get(['o_id'=>$val['id']]);
- $agent_json = json_decode($agent_row['jsondata'],true);
- //强险
- $where = [
- 'biz_id' => $val['biz_id'],
- 'type' => 2,
- "json_extract(jsondata, '$.type') = '1'" => null
- ];
- $fd_row = $this->biz_settle_srv_model->get($where);
- $fd_jsondata = json_decode($fd_row['jsondata'],true);
- $qx_fd = $fd_jsondata['rebate']/100;
- $profix_insuer_ins = floatval($agent_json['ins_risk']) * $qx_fd;
- //商业险
- $where = [
- 'biz_id' => $val['biz_id'],
- 'type' => 2,
- "json_extract(jsondata, '$.type') = '2'" => null
- ];
- $bis_fd_row = $this->biz_settle_srv_model->get($where);
- $bis_fd_jsondata = json_decode($bis_fd_row['jsondata'],true);
- $bis_fd = $bis_fd_jsondata['rebate']/100;
- $profix_insuer_bis = floatval($money_json['business_risk'])*$bis_fd;
+ $data_row = $this->receiver_order_datas_model->get(['o_id'=>$val['id']]);
+ $insurance_img = json_decode($data_row['insurance_img'],true);
+ $business_img = json_decode($data_row['business_img'],true);
+ if($insurance_img){
+ //强险
+ $time = strtotime($insurance_img['date']);
+ $where = [
+ 'biz_id' => $val['biz_id'],
+ 'title' => $insurance_img['product'],
+ 'type' => 2,
+ "json_extract(jsondata, '$.type') = '1'" => null,
+ "json_extract(jsondata, '$.s_time') >= '{$time}'" => null,
+ "json_extract(jsondata, '$.e_time') <= '{$time}'" => null
+ ];
+ $fd_row = $this->biz_settle_srv_model->get($where);
+ if(!$fd_row){
+ $where = [
+ 'biz_id' => $val['biz_id'],
+ 'title' => $insurance_img['product'],
+ 'type' => 2,
+ 'is_def' => 1,
+ "json_extract(jsondata, '$.type') = '1'" => null,
+ ];
+ $fd_row = $this->biz_settle_srv_model->get($where);
+ }
+ $fd_jsondata = json_decode($fd_row['jsondata'],true);
+ $qx_fd = $fd_jsondata['rebate']/100;
+ $profix_insuer_ins = floatval($insurance_img['price']) * $qx_fd;
+ }
+ if($business_img){
+ //商业险
+ $time = strtotime($business_img['date']);
+ $where = [
+ 'biz_id' => $val['biz_id'],
+ 'title' => $business_img['product'],
+ 'type' => 2,
+ "json_extract(jsondata, '$.type') = '2'" => null,
+ "json_extract(jsondata, '$.s_time') >= '{$time}'" => null,
+ "json_extract(jsondata, '$.e_time') <= '{$time}'" => null
+ ];
+ $bis_fd_row = $this->biz_settle_srv_model->get($where);
+ if(!$bis_fd_row){
+ $where = [
+ 'biz_id' => $val['biz_id'],
+ 'title' => $business_img['product'],
+ 'type' => 2,
+ 'is_def' => 1,
+ "json_extract(jsondata, '$.type') = '2'" => null,
+ ];
+ $bis_fd_row = $this->biz_settle_srv_model->get($where);
+ }
+ $bis_fd_jsondata = json_decode($bis_fd_row['jsondata'],true);
+ $bis_fd = $bis_fd_jsondata['rebate']/100;
+ $profix_insuer_bis = floatval($business_img['price'])*$bis_fd;
+ }
$profix_insuer = $profix_insuer_ins + $profix_insuer_bis;
//贷款利润 = 手续费 + 贷款金额 * 返点(对应产品)
// $profix_loan = floatval($money_json['price_finance']);
@@ -287,6 +322,7 @@ class Biz extends HD_Controller
$where = [
'biz_id' => $val['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,
];
@@ -299,7 +335,7 @@ class Biz extends HD_Controller
$profix_loan = $money_json['price_loan']*$loan_fd;
}
$settle_money_json['in']['commission'] = $profix_loan+$profix_insuer;
- //实收 - 成本(赠送的也要算)
+ //精品成本(赠送的也要算)
$profix_fine = 0;
$fines = json_decode($val['fines'],true);
$fines_ids = array_column($fines,'id');
@@ -310,23 +346,9 @@ class Biz extends HD_Controller
];
$fines_ids && $cb_sum = $this->receiver_fine_model->sum('price',$where);
$cb = $cb_sum['price'] ? $cb_sum['price'] : 0; //成本
-// $sh = 0; //实收
-// foreach ($fines as $f_val) {
-// $sh += floatval($f_val['price']);
-// }
$profix_fine = $cb;
}
$settle_money_json['out']['biz_price'] = $profix_fine;
-// $biz_price = 0;//门店成本
-// $p_where = [
-// 'biz_id' => $val['biz_id'],
-// 'status' => 1,
-// 'year' => date('Y',$val['c_time']),
-// 'month' => date('m',$val['c_time']),
-// ];
-// $price_row = $this->biz_settle_price_model->get($p_where);
-// $price_row && $biz_price = $this->biz_settle_price_model->sum_jsondata($price_row['jsondata']);
-// $settle_money_json['out']['biz_price'] = $biz_price;
$add_data = [
'biz_id' => $val['biz_id'],
'o_id' => $val['id'],
@@ -336,8 +358,8 @@ class Biz extends HD_Controller
// 'profix_carno' => $profix_carno,
// 'profix_fine' => $profix_fine,
'money_json' => json_encode($settle_money_json,JSON_UNESCAPED_UNICODE),
- 'year' => date('Y'),
- 'month' => intval(date('m')),
+ 'year' => date('Y',strtotime($val['bill_time'])),
+ 'month' => intval(date('m',strtotime($val['bill_time']))),
'c_time' => time()
];
if($money_json['price_car']>$b_row_one['price_floor']){
@@ -455,4 +477,5 @@ class Biz extends HD_Controller
}
}
}
+
}
diff --git a/api/controllers/wxapp/liche/Protocol.php b/api/controllers/wxapp/liche/Protocol.php
index 4105a3e0..6913669a 100755
--- a/api/controllers/wxapp/liche/Protocol.php
+++ b/api/controllers/wxapp/liche/Protocol.php
@@ -93,6 +93,7 @@ require_once APPPATH.'controllers/wxapp/Wxapp.php';
补贴约定
鉴于新能源汽车购车补贴在您购车时已作扣除,为便于狸车公司能够从相关主管部门获得该等补贴或保障狸车公司在无法获得该等补贴时权益不受损害,您应按照狸车公司不时要求的必要行动以及提供狸车公司不时要求的信息和文件。另外,鉴于国家和地方关于新能源汽车购车补贴的法律法规及政策可能不时发生变化,狸车公司会在其发生变化的同时相应调整实际购车总价、尾款;因此,您最终需支付的实际购车总价、尾款应以交付通知中列明的金额为准。
+
若您所购车辆为公户车,需确保购买车辆自行驶证注册日期起1年之内行驶2万公里,且自车辆注册之日起2年内不得过户,如因违反此条约使狸车公司在申领国补过程中造成的损失,一切责任及后果由您承担。
适用法律
本协议应受中华人民共和国法律管辖并据其进行解释。因本协议引起的以及与本协议有关的一切争议,首先应由双方通过友好协商解决。如果双方未能通过协商解决该等争议,则任何一方有权向狸车公司所在地有管辖权的人民法院提起诉讼。如需仲裁,双方另行协商签订相关补充条款。
协议生效