From 3008b7cf1d002346e5a080f7d8fe594ce39cf466 Mon Sep 17 00:00:00 2001 From: lccsw <805383944@qq.com> Date: Mon, 18 Jul 2022 15:46:13 +0800 Subject: [PATCH] edit-pay_log --- admin/controllers/receiver/orderv2/Orders.php | 48 +++++++- admin/views/receiver/orderv2/get/loaninfo.php | 109 ++++++++++++++---- api/controllers/wxapp/liche/Order.php | 4 +- api/controllers/wxapp/licheb/CusorderV2.php | 8 +- common/helpers/comm_helper.php | 17 +++ .../app/liche/App_liche_orders_model.php | 2 +- common/services/apporder/Payment_service.php | 6 +- 7 files changed, 157 insertions(+), 37 deletions(-) diff --git a/admin/controllers/receiver/orderv2/Orders.php b/admin/controllers/receiver/orderv2/Orders.php index 542f444e..7204819e 100644 --- a/admin/controllers/receiver/orderv2/Orders.php +++ b/admin/controllers/receiver/orderv2/Orders.php @@ -193,9 +193,8 @@ class Orders extends HD_Controller $fines = json_decode($row['fines'],true); $split = $fine_title = ''; foreach($fines as $key=>$val){ - $fine_title = $fine_title.$split.$val['txt'].$split; $price = number_format(floatval($val['price']),2); - $fine_title = $fine_title.$split."{$val['txt']}:{$price}"; + $fine_title .= $split."{$val['txt']}:{$price}"; $split = ' '; } } @@ -455,6 +454,7 @@ class Orders extends HD_Controller } $update = []; $update['company_id'] = $info['loan_info']['company_id']; + $price_loan = $info['loan_info']['price_loan']; if ($file) { //上传按揭通知函 $path = FCPATH . 'temp/'; if (!file_exists($path)) { @@ -485,7 +485,6 @@ class Orders extends HD_Controller strlen($params['status']) && $update['status'] = $params['status']; if ($params['status'] == 1) { //等待放款 $finance_id = $info['finance_id']; - $price_loan = $info['loan_info']['price_loan']; if (!$row['notify_file']) { return $this->show_json(SYS_CODE_FAIL, '请先上传按揭通知函!'); } @@ -510,6 +509,34 @@ class Orders extends HD_Controller } $update['loan_time'] = date('Y-m-d H:i:s', strtotime($loan_time)); $result = $this->orders_status_entity->set_status($oid,1,2); + //添加按揭收款记录 + if(!$this->app_liche_orders_model->get(['o_id'=>$row['o_id'],'type'=>7])){ + $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, 7); + $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_info']['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' => 7, + '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_loans_model->update($update, ['id' => $row['id']]); @@ -645,7 +672,8 @@ class Orders extends HD_Controller $where = [ 'o_id' => $oid, 'status' => 1, - 'pay_price>' => 0 + 'pay_price>' => 0, + 'type!=' => 7 ]; $sum = $this->app_liche_orders_model->sum('total_price', $where); //已收金额 $need_price = $this->orders_v2_entity->recevable_price($oid); //应收金额 @@ -698,13 +726,16 @@ class Orders extends HD_Controller ]; $count = $this->app_liche_orders_model->count($where); if ($count) { - $rows = $this->app_liche_orders_model->select($where, 'id desc', $page, $size, 'id,total_price,type,pay_time,mch_id,descrip,status,pid,img,admin_id'); + $rows = $this->app_liche_orders_model->select($where, 'id desc', $page, $size, 'id,total_price,type,pay_time,mch_id,descrip,status,pid,img,admin_id,company_id'); $type_arr = $this->app_liche_orders_model->get_type_arr(); foreach ($rows as $item) { $company = ''; if ($item['mch_id']) { $company = $this->sys_company_model->get(['wx_mchid' => $item['mch_id']], 'short'); } + if($item['company_id']){ + $company = $this->sys_company_model->get(['id' => $item['company_id']], 'short'); + } $opt_name = '用户'; if($item['admin_id']){ $admin_user = $this->sys_admin_model->get(array('id' => $item['admin_id']),'username'); @@ -733,6 +764,10 @@ class Orders extends HD_Controller 'vin' => '' ]; $row = $this->receiver_orders_v2_model->get(['id' => $params['id']]); + if(!$row['payway']){ //贷款 + $money_json = json_decode($row['money_json'],true); + $this->data['need_price'] += $money_json['price_loan']; + } $car_info['name'] = $row['owner_name']; //获取车信息 $brand = $this->auto_brand_model->get(['id' => $row['brand_id']], 'name'); @@ -833,7 +868,8 @@ class Orders extends HD_Controller $where = [ 'status'=>1, 'o_id'=>$row['id'], - 'pid>'=>0 + 'pid>'=>0, + 'type!=' => 7 ]; $last_p_row && $where['id <>'] = $last_p_row['id']; $is_pay = $this->app_liche_orders_model->sum('total_price',$where); //已支付金额 diff --git a/admin/views/receiver/orderv2/get/loaninfo.php b/admin/views/receiver/orderv2/get/loaninfo.php index ae7b538f..36bf6dd9 100644 --- a/admin/views/receiver/orderv2/get/loaninfo.php +++ b/admin/views/receiver/orderv2/get/loaninfo.php @@ -56,18 +56,31 @@
+ + +
- +
+
@@ -77,20 +90,31 @@
- - + + + +
+ +
+ +
@@ -113,3 +137,44 @@ + diff --git a/api/controllers/wxapp/liche/Order.php b/api/controllers/wxapp/liche/Order.php index 8c7c0935..d6ac5106 100644 --- a/api/controllers/wxapp/liche/Order.php +++ b/api/controllers/wxapp/liche/Order.php @@ -133,7 +133,7 @@ class Order extends Wxapp{ "(uid = {$uid} or entrust_uid={$uid})" => null, 'pid' => 0, 'status>=' => 0, - 'type <>' => 5 + 'type not in (5,7)' => null ]; $oid && $where['o_id'] = $oid; $total = $this->app_liche_orders_model->count($where); @@ -182,7 +182,7 @@ class Order extends Wxapp{ $cover = build_qiniu_image_url($jsondata['img']); } //获取子订单 - $sub_rows = $this->app_liche_orders_model->select(['pid'=>$val['id'],'status>='=>0],'id asc',0,0,'id,sid,total_price,pay_time,type,status'); + $sub_rows = $this->app_liche_orders_model->select(['pid'=>$val['id'],'status>='=>0,'type <>' => 7],'id asc',0,0,'id,sid,total_price,pay_time,type,status'); $sub_order = []; if($sub_rows){ foreach($sub_rows as $k => $v){ diff --git a/api/controllers/wxapp/licheb/CusorderV2.php b/api/controllers/wxapp/licheb/CusorderV2.php index bf25ad9b..61c999a1 100644 --- a/api/controllers/wxapp/licheb/CusorderV2.php +++ b/api/controllers/wxapp/licheb/CusorderV2.php @@ -119,8 +119,8 @@ class CusorderV2 extends Wxapp{ throw new Exception('一个客户只能享受一次国补,请联系管理员', ERR_PARAMS_ERROR); } } - if($deposit<2000){ - throw new Exception('定金不得少于2000', ERR_PARAMS_ERROR); + if($deposit<1000){ + throw new Exception('定金不得少于1000', ERR_PARAMS_ERROR); } $biz = $this->biz_model->get(['id'=>$row['biz_id']],'id,city_id,type'); @@ -373,8 +373,8 @@ class CusorderV2 extends Wxapp{ throw new Exception('参数错误', ERR_PARAMS_ERROR); } - if($deposit<2000){ - throw new Exception('定金不得少于2000', ERR_PARAMS_ERROR); + if($deposit<1000){ + throw new Exception('定金不得少于1000', ERR_PARAMS_ERROR); } $can_dis_money = $business_row['price_car'] - $business_row['price_floor']; //可优惠金额 if($can_dis_money>0){ diff --git a/common/helpers/comm_helper.php b/common/helpers/comm_helper.php index 40693a9f..e4d8aef2 100644 --- a/common/helpers/comm_helper.php +++ b/common/helpers/comm_helper.php @@ -1154,3 +1154,20 @@ if (!function_exists('is_product')) { } } } + +/** + * 判断文件是否图片 + */ +if (!function_exists('is_img')) { + function is_img($file_name) + { + $file_name_arr = explode('.',$file_name); + $ext = end($file_name_arr); + $filetype = ['jpg', 'jpeg', 'gif', 'bmp', 'png']; + if (in_array($ext, $filetype)) { + return true; + }else{ + return false; + } + } +} diff --git a/common/models/app/liche/App_liche_orders_model.php b/common/models/app/liche/App_liche_orders_model.php index 9ded4135..d1b7b986 100644 --- a/common/models/app/liche/App_liche_orders_model.php +++ b/common/models/app/liche/App_liche_orders_model.php @@ -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 => '车款']; + private $type_arr = [ 1 => '定金', 2 => '委托服务费' , 3 => '尾款' ,4 => '意向金' ,5 => '后台添加',6 => '车款',7 => '贷款']; public function __construct() { diff --git a/common/services/apporder/Payment_service.php b/common/services/apporder/Payment_service.php index cfda2aa7..1832f44c 100644 --- a/common/services/apporder/Payment_service.php +++ b/common/services/apporder/Payment_service.php @@ -202,7 +202,8 @@ class Payment_service extends HD_Service{ $where = [ 'status'=>1, 'o_id'=>$order['o_id'], - 'pid>'=>0 + 'pid>'=>0, + 'type <>' => 7 ]; $last_p_row && $where['id <>'] = $last_p_row['id']; $is_pay = $this->app_liche_orders_model->sum('total_price',$where); //已支付金额 @@ -284,7 +285,8 @@ class Payment_service extends HD_Service{ $where = [ 'status'=>1, 'o_id'=>$order['o_id'], - 'pid>'=>0 + 'pid>'=>0, + 'type <> ' => 7 ]; $last_p_row && $where['id <>'] = $last_p_row['id']; $is_pay = $this->app_liche_orders_model->sum('total_price',$where); //已支付金额