From a3901ced548bf04ba3f34727f163aca824bcff99 Mon Sep 17 00:00:00 2001 From: lccsw <1127794702@qq.com> Date: Tue, 9 Nov 2021 16:38:51 +0800 Subject: [PATCH] add-api-delivery --- api/controllers/wxapp/liche/Contract.php | 9 +++-- api/controllers/wxapp/liche/User.php | 4 +-- api/controllers/wxapp/licheb/Cusorder.php | 34 ++++++++++++++----- api/controllers/wxapp/licheb/Delivery.php | 33 ++++++++++++++++++ api/controllers/wxapp/licheb/Protocol.php | 2 ++ api/views/wxapp/licheb/html2pdf/car_fh.php | 6 ++-- api/views/wxapp/licheb/protocol/car_fh.php | 6 ++-- common/libraries/receiver/Orders_entity.php | 21 ++++++------ .../order/Receiver_order_deliverys_model.php | 17 +++++++++- .../receiver/order/Receiver_orders_model.php | 4 +-- home/controllers/h5/Toole.php | 2 +- home/views/h5/toole/detail.php | 2 +- sql/receiver/order.sql | 3 ++ 13 files changed, 111 insertions(+), 32 deletions(-) create mode 100644 api/controllers/wxapp/licheb/Delivery.php diff --git a/api/controllers/wxapp/liche/Contract.php b/api/controllers/wxapp/liche/Contract.php index 7f700d1d..3e916b37 100644 --- a/api/controllers/wxapp/liche/Contract.php +++ b/api/controllers/wxapp/liche/Contract.php @@ -200,7 +200,7 @@ class Contract extends Wxapp{ break; case 2: //确认信息 $sign_img = array_pop($imgs); - $height = $order['ifentrust'] ? 630 : 480; + $height = $order['ifentrust'] ? 670 : 480; $jsondata['c_cardid'] && $height += 30; $res = $sign_entity->merge($sign_img,$img,1050,$height,300); if(!$res){ @@ -226,7 +226,7 @@ class Contract extends Wxapp{ break; case 3: //车辆交接 $sign_img = array_pop($imgs); - $height = $order['ifentrust'] ? 1510 : 1350; + $height = $order['ifentrust'] ? 1510 : 1370; $res = $sign_entity->merge($sign_img,$img,1050,$height,350); if(!$res){ throw new Exception('签名失败', API_CODE_INVILD_PARAM); @@ -240,7 +240,10 @@ class Contract extends Wxapp{ ]; $result = $this->contracts_model->update($update,['id'=>$row['id']]); if($result){ - $this->deliverys_model->update(['status'=>1],['o_id'=>$id]); + $this->orders_model->update(['status'=>6],['id'=>$row['o_id']]); + //完成分销 + $this->load->library('entity/deal_entity',['app_id'=>1]); + $this->deal_entity->deal_log_finish($row['o_id']); $redis->delete($cache_key); throw new Exception('签名成功', API_CODE_SUCCESS); }else{ diff --git a/api/controllers/wxapp/liche/User.php b/api/controllers/wxapp/liche/User.php index 324e5258..0fdd2796 100644 --- a/api/controllers/wxapp/liche/User.php +++ b/api/controllers/wxapp/liche/User.php @@ -342,9 +342,9 @@ class User extends Wxapp{ break; case 5: //交付确认 $state = 2; - if($delivery_row['status']){ + if($delivery_row['status']==2){ $imgs = $this->orders_entity->get_sign_imgs($row['id'],[3]); - }else{ + }elseif($delivery_row['status']==1){ $progressOpt = ['title'=> '交接车辆','url'=>'/pages/mine/signContract/jiaoJie?id='.$row['id']]; } break; diff --git a/api/controllers/wxapp/licheb/Cusorder.php b/api/controllers/wxapp/licheb/Cusorder.php index 6acac433..fdfad81d 100644 --- a/api/controllers/wxapp/licheb/Cusorder.php +++ b/api/controllers/wxapp/licheb/Cusorder.php @@ -456,9 +456,14 @@ class Cusorder extends Wxapp{ $bill_status = $bill['status']==2 ? 2 : 1; } //确认车辆状态 - $delivery = $this->order_deliverys_model->get(['o_id'=>$row['id']],'status'); + $delivery = $this->order_deliverys_model->get(['o_id'=>$row['id']],'status,info,tool,remark'); $ckcar_status = 0; - if($row['status']==5&&$delivery['status']==1){ + $ckcar_data = [ + 'info' => $delivery['info'] ? explode(',',$delivery['info']) : [], + 'tool' => $delivery['tool'] ? explode(',',$delivery['tool']) : [], + 'remark' => $delivery['remark'] ? $delivery['remark'] : '' + ]; + if($row['status']==5&&in_array($delivery['status'],[0,1])){ $ckcar_status = 1; } $data = [ @@ -475,6 +480,7 @@ class Cusorder extends Wxapp{ 'bill_status' => $bill_status, 'bill_data' => $bill_data, 'ckcar_status' => $ckcar_status, + 'ckcar_data' => $ckcar_data, 'pack_id' => $row['pack_id'], 'brand_id' => $row['brand_id'], 'car_id' => $row['s_id'], @@ -498,16 +504,28 @@ class Cusorder extends Wxapp{ //确认交付 protected function put_ckcar(){ $id = $this->input_param('id'); + $remark = $this->input_param('remark'); + $info = $this->input_param('info'); + $tool = $this->input_param('tool'); + if(!count($info) || !count($tool)){ + throw new Exception('参数错误', ERR_PARAMS_ERROR); + } $row = $this->order_deliverys_model->get(['o_id'=>$id]); - if($row['status']!=1){ + if($row['status']>1){ throw new Exception('当前不可修改', ERR_PARAMS_ERROR); } - $result = $this->order_deliverys_model->update(['status'=>2],['id'=>$row['id']]); + $update = [ + 'status' => 1, + 'info' => implode(',',$info), + 'tool' => implode(',',$tool), + 'remark' => $remark ? $remark : '' + ]; + $result = $this->order_deliverys_model->update($update,['id'=>$row['id']]); if($result){ - $this->orders_model->update(['status'=>6],['id'=>$row['o_id']]); - //完成分销 - $this->load->library('entity/deal_entity',['app_id'=>1]); - $this->deal_entity->deal_log_finish($row['o_id']); + //$this->orders_model->update(['status'=>6],['id'=>$row['o_id']]); + ////完成分销 + //$this->load->library('entity/deal_entity',['app_id'=>1]); + //$this->deal_entity->deal_log_finish($row['o_id']); throw new Exception('修改成功', API_CODE_SUCCESS); }else{ throw new Exception('修改失败', ERR_PARAMS_ERROR); diff --git a/api/controllers/wxapp/licheb/Delivery.php b/api/controllers/wxapp/licheb/Delivery.php new file mode 100644 index 00000000..80448e87 --- /dev/null +++ b/api/controllers/wxapp/licheb/Delivery.php @@ -0,0 +1,33 @@ +login_white = array();//登录白名单 + $this->check_status = array();//用户状态校验 + $this->check_mobile = array();//需要手机号 + $this->check_headimg = array();//授权微信信息 + + $this->load->model('receiver/order/receiver_order_deliverys_model','order_deliverys_model'); + + } + + protected function get(){ + $data['info'] = $this->order_deliverys_model->get_cdata(); + $data['tool'] = $this->order_deliverys_model->get_cdata(1); + return $data; + } + +} diff --git a/api/controllers/wxapp/licheb/Protocol.php b/api/controllers/wxapp/licheb/Protocol.php index 87d355d5..f8830722 100644 --- a/api/controllers/wxapp/licheb/Protocol.php +++ b/api/controllers/wxapp/licheb/Protocol.php @@ -17,6 +17,7 @@ class Protocol extends CI_Controller{ $this->load->model('receiver/order/receiver_order_agents_model','agents_model'); $this->load->model('receiver/order/receiver_order_loans_model','loans_model'); $this->load->model('receiver/order/receiver_order_ckcars_model','ckcars_model'); + $this->load->model('receiver/order/receiver_order_deliverys_model','deliverys_model'); $this->load->model('receiver/order/receiver_order_oplogs_model'); $this->load->model('receiver/receiver_fine_model'); @@ -201,6 +202,7 @@ class Protocol extends CI_Controller{ $row['pay_price'] = $pay['total_price'] + $last_pay['total_price']; $this->load->library('receiver/orders_entity'); $srv_price = $this->orders_entity->order_srv_money($row['id']); + $row['delivery'] = $this->deliverys_model->get(['o_id'=>$row['id']],'info,tool,remark'); } $row['srv_price'] = $srv_price; $row['agent'] = $agent; diff --git a/api/views/wxapp/licheb/html2pdf/car_fh.php b/api/views/wxapp/licheb/html2pdf/car_fh.php index cf4edf8f..9048fc08 100644 --- a/api/views/wxapp/licheb/html2pdf/car_fh.php +++ b/api/views/wxapp/licheb/html2pdf/car_fh.php @@ -62,9 +62,11 @@
三、证件资料交接信息
-
行驶证原件、登记证原件、身份证原件、机动车销售发票发票联原件、机动车销售发票抵扣联原件、整车钥匙两把、随车物件(按品牌厂商随车附件内容)
+
随车资料:
+
随车工具:
+
补充说明:
四、车辆交付信息
甲方已向乙方做了详细的车辆介绍,介绍的内容包含但不限于车辆外部、行李箱、发动机舱、座椅、驾驶位置及各类仪表及显示屏介绍。
diff --git a/api/views/wxapp/licheb/protocol/car_fh.php b/api/views/wxapp/licheb/protocol/car_fh.php index 66018316..c536a54a 100644 --- a/api/views/wxapp/licheb/protocol/car_fh.php +++ b/api/views/wxapp/licheb/protocol/car_fh.php @@ -66,9 +66,11 @@
三、证件资料交接信息
-
行驶证原件、登记证原件、身份证原件、机动车销售发票发票联原件、机动车销售发票抵扣联原件、整车钥匙两把、随车物件(按品牌厂商随车附件内容)
+
随车资料:
+
随车工具:
+
补充说明:
四、车辆交付信息
甲方已向乙方做了详细的车辆介绍,介绍的内容包含但不限于车辆外部、行李箱、发动机舱、座椅、驾驶位置及各类仪表及显示屏介绍。
diff --git a/common/libraries/receiver/Orders_entity.php b/common/libraries/receiver/Orders_entity.php index dc61db6e..f6181372 100644 --- a/common/libraries/receiver/Orders_entity.php +++ b/common/libraries/receiver/Orders_entity.php @@ -510,7 +510,8 @@ class Orders_entity{ 2 => '需要提醒客户去狸车小程序确认车辆并签名', 3 => '需要上传客户身份证/营业执照', 4 => '整理上牌资料、国补资料发给客服', - 5 => '客户提完车,需要点击“确认交付”' + //5 => '客户提完车,需要点击“确认交付”' + 5 => '要交接车时,需要点击“确认交付”后让客户去狸车小程序签交接表完成交接' ]; return $config[$status] ? $config[$status] : ''; } @@ -520,6 +521,15 @@ class Orders_entity{ * @param array() $row 修改前数据 */ public function edit_order($new_data,$row,$uid,$uname){ + //更新购车订单车辆信息 + $up_data = [ + 'brand_id' => $new_data['brand_id'], + 's_id' => $new_data['s_id'], + 'v_id' => $new_data['v_id'], + 'cor_id' => $new_data['cor_id'], + 'incor_id' => $new_data['incor_id'], + ]; + $this->ci->app_liche_orders_model->update($up_data,['o_id'=>$row['id']]); $sign_row = $this->ci->signs_model->get(['o_id'=>$row['id']]); if($sign_row){ $diff_key_arr = ['s_id','v_id','cor_id','incor_id','payway','srv_ids']; //修改其中一项需要签补充协议 @@ -553,15 +563,6 @@ class Orders_entity{ } $this->ci->signs_model->update(['status'=>0],['id'=>$sign_row['id']]); $this->ci->orders_model->update(['status'=>0],['id'=>$row['id']]); - //更新购车订单车辆信息 - $up_data = [ - 'brand_id' => $new_data['brand_id'], - 's_id' => $new_data['s_id'], - 'v_id' => $new_data['v_id'], - 'cor_id' => $new_data['cor_id'], - 'incor_id' => $new_data['incor_id'], - ]; - $this->ci->app_liche_orders_model->update($up_data,['o_id'=>$row['id']]); } }else{ $this->ci->signs_model->add(['o_id'=>$row['id'],'c_time'=>time()]); diff --git a/common/models/receiver/order/Receiver_order_deliverys_model.php b/common/models/receiver/order/Receiver_order_deliverys_model.php index 7f0726f0..916f59d4 100644 --- a/common/models/receiver/order/Receiver_order_deliverys_model.php +++ b/common/models/receiver/order/Receiver_order_deliverys_model.php @@ -11,7 +11,9 @@ defined('BASEPATH') OR exit('No direct script access allowed'); class Receiver_order_deliverys_model extends HD_Model { private $table_name = 'lc_receiver_order_deliverys'; - private $status_arr = [ 0 => '待用户确认', 1 => '用户已确认',2=> '销售已确认']; + private $status_arr = [ 0 => '待销售确认', 1 => '销售已确认',2=> '用户已确认']; + private $car_data = ['行驶证','登记证','发票','保单','合格证','环保清单','一次性证书']; + private $car_tool = ['主钥匙','副钥匙','充电枪','补胎液','充气泵','反光背心','三角牌','轮胎扳手','拖车钩']; public function __construct() { @@ -51,4 +53,17 @@ class Receiver_order_deliverys_model extends HD_Model public function get_status(){ return $this->status_arr; } + + /** + * 获取随车物件 + * @param $type 类型(默认随车资料 1随车工具) + * return array() + */ + public function get_cdata($type=''){ + $data = $this->car_data; + if($type){ + $data = $this->car_tool; + } + return $data; + } } diff --git a/common/models/receiver/order/Receiver_orders_model.php b/common/models/receiver/order/Receiver_orders_model.php index f73d3e6f..1b750050 100644 --- a/common/models/receiver/order/Receiver_orders_model.php +++ b/common/models/receiver/order/Receiver_orders_model.php @@ -38,8 +38,8 @@ class Receiver_orders_model extends HD_Model 'menu_list' => array(1 => '待开票' ,0=>'待申请'), 'menu_default' => 0); $status_ary[4] = array('name' => '代办服务', 'show' => true, 'list' => array(0 => '代办中', 1 => '已完成代办'), 'menu_list' => array(0 => '代办中'), 'menu_default' => 0); - $status_ary[5] = array('name' => '交付车辆', 'show' => true, 'list' => array(0 => '待用户确认', 1 => '用户已确认', 2 => '销售已确认'), - 'menu_list' => array(0 => '待用户确认', 1 => '用户已确认', 2 => '销售已确认'), 'menu_default' => 0); + $status_ary[5] = array('name' => '交付车辆', 'show' => true, 'list' => array(0 => '待销售确认', 1 => '销售已确认', 2 => '用户已签约'), + 'menu_list' => array(0 => '待销售确认', 1 => '销售已确认', 2 => '用户已签约'), 'menu_default' => 0); $status_ary[6] = array('name' => '交易完成', 'show' => true, 'list' => array(), 'menu_list' => array()); $status_ary[7] = array('name' => '退款', 'show' => true, 'list' => array(), 'menu_list' => array()); if (strlen($status)) { diff --git a/home/controllers/h5/Toole.php b/home/controllers/h5/Toole.php index a8b100bf..35b9c4ba 100644 --- a/home/controllers/h5/Toole.php +++ b/home/controllers/h5/Toole.php @@ -130,7 +130,7 @@ class Toole extends CI_Controller { if($row['status']!=3){ $this->show_json(0,'修改失败,该订单不处于开票阶段'); } - $result = $this->order_bills_model->update(['status'=>1,'file'=>'liche/2021/08/1337ff6686152d45/f30b803379255919.jpeg'],['o_id'=>$id]); + $result = $this->order_bills_model->update(['status'=>2,'file'=>'liche/2021/08/1337ff6686152d45/f30b803379255919.jpeg'],['o_id'=>$id]); $this->orders_model->update(['status'=>4],['id'=>$row['id']]); if(!$this->order_agents_model->get(['o_id'=>$id])){ $this->order_agents_model->add(['o_id'=>$id,'c_time'=>time]); diff --git a/home/views/h5/toole/detail.php b/home/views/h5/toole/detail.php index 3c76c987..a37114a4 100644 --- a/home/views/h5/toole/detail.php +++ b/home/views/h5/toole/detail.php @@ -39,7 +39,7 @@ =3){?> - 0){?> + 1){?> diff --git a/sql/receiver/order.sql b/sql/receiver/order.sql index ef6a67ca..aa475610 100644 --- a/sql/receiver/order.sql +++ b/sql/receiver/order.sql @@ -92,6 +92,9 @@ create table lc_receiver_order_deliverys ( primary key (id), unique key o_id (o_id) ) ENGINE=INNODB DEFAULT CHARSET=UTF8MB4 COLLATE=UTF8MB4_0900_AI_CI COMMENT='交付确认订单'; +alter table lc_receiver_order_deliverys add info varchar(255) not null default '' comment '随车资料' after o_id; +alter table lc_receiver_order_deliverys add tool varchar(255) not null default '' comment '随车工具' after info; +alter table lc_receiver_order_deliverys add remark varchar(255) not null default '' comment '备注' after tool; -- ---------------------------- -- Title:订单贷款表