edit-pay_log

This commit is contained in:
lccsw
2022-07-18 15:46:13 +08:00
parent 203a33a7cf
commit 3008b7cf1d
7 changed files with 157 additions and 37 deletions
+42 -6
View File
@@ -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); //已支付金额
+87 -22
View File
@@ -56,18 +56,31 @@
<label class="am-para-label label-width"><span class="span-bold">按揭通知函:</span></label>
<div class="am-para-input">
<div class="am-form-inline">
<?if(is_img($info['loan_info']['notify_file_name'])){?>
<ul class="photopic-list ml30 clearfix">
<li>
<a href="javascript:void(0);" class="pic" data-file="1" data-type="jpg,png,gif,png,jpeg"
data-uptype="qiniu" data-field="business_licence" data-mark="compalbum">
<input type="hidden" class="" name="business_licence" data-type="1" value="" onchange="upLoan(0,this)">
<img :src="info.loan_info.notify_file" />
</a>
<div class="tc f12"></div>
</li>
</ul>
<?}else{?>
<div class="am-form-group">
<label class="input-group-btn" style="width: 50px;"><span
class="am-btn am-btn-default am-btn-sm">
<i class="am-icon-cloud-upload"></i> 选择文件
<input type="file" style="display: none;" accept="jpg,png,gif,png,jpeg" @change="upTz(0,$event)"></span>
</label>
<label class="input-group-btn" style="width: 50px;">
<span class="am-btn am-btn-default am-btn-sm">
<i class="am-icon-cloud-upload"></i> 选择文件
<input type="file" style="display: none;" accept="jpg,png,gif,png,jpeg" @change="upTz(0,$event)"></span>
</label>
</div>
<div class="am-form-group ml10" v-if="info.loan_info.notify_file">
<a :href="info.loan_info.notify_file" target="_blank" class='mt5' title="查看文件">
{{info.loan_info.notify_file_name}}
</a>
<a :href="info.loan_info.notify_file" target="_blank" class='mt5' title="查看文件">
{{info.loan_info.notify_file_name}}
</a>
</div>
<?}?>
</div>
</div>
</div>
@@ -77,20 +90,31 @@
<label class="am-para-label label-width"><span class="span-bold">按揭放款函:</span></label>
<div class="am-para-input">
<div class="am-form-inline">
<template>
<div class="am-form-group">
<label class="input-group-btn" style="width: 50px;"><span
class="am-btn am-btn-default am-btn-sm">
<i class="am-icon-cloud-upload"></i> 选择文件
<input type="file" style="display: none;" accept="jpg,png,gif,png,jpeg" @change="upTz(1,$event)"></span>
</label>
</div>
</template>
<div class="am-form-group ml10" v-if="info.loan_info.lend_file">
<a :href="info.loan_info.lend_file" target="_blank" class='mt5' title="查看文件">
{{info.loan_info.lend_file_name}}
</a>
</div>
<?if(is_img($info['loan_info']['lend_file_name'])){?>
<ul class="photopic-list ml30 clearfix">
<li>
<a href="javascript:void(0);" class="pic" data-file="1" data-type="jpg,png,gif,png,jpeg"
data-uptype="qiniu" data-field="business_licence" data-mark="compalbum">
<input type="hidden" class="" name="business_licence" data-type="1" value="" onchange="upLoan(1,this)">
<img :src="info.loan_info.lend_file" />
</a>
<div class="tc f12"></div>
</li>
</ul>
<?}else{?>
<div class="am-form-group">
<label class="input-group-btn" style="width: 50px;">
<span class="am-btn am-btn-default am-btn-sm">
<i class="am-icon-cloud-upload"></i> 选择文件
<input type="file" style="display: none;" accept="jpg,png,gif,png,jpeg" @change="upTz(1,$event)"></span>
</label>
</div>
<div class="am-form-group ml10" v-if="info.loan_info.lend_file">
<a :href="info.loan_info.lend_file" target="_blank" class='mt5' title="查看文件">
{{info.loan_info.lend_file_name}}
</a>
</div>
<?}?>
</div>
</div>
<?}?>
@@ -113,3 +137,44 @@
</div>
</div>
</div>
<script>
function upLoan(type,obj) {
var that = this;
var formData = new FormData();
formData.append("file", $(obj).val()); //上传一个files对象
formData.append('id', <?=$info['id']?>);
formData.append('type', type);
if (type) {
var loan_time = $('#loan_time').val();
if (!loan_time) {
layer.msg("请填写放款时间");
return;
}
formData.append('loan_time', loan_time);
}
$.ajax({//jQuery方法,此处可以换成其它请求方式
url: '/receiver/orderv2/orders/edit_loan',
dataType: "json",
type: "post",
data: formData,
processData: false,//不去处理发送的数据
contentType: false,//不去设置Content-Type请求头
error: function (res) {
layer.msg('上传失败')
return;
},
success: function (res) {
console.dir(res)
if (res.code) {
layer.msg(res.msg, function () {
$.form.reload();
});
} else {
layer.msg(res.msg);
}
return;
}
})
}
</script>
+2 -2
View File
@@ -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){
+4 -4
View File
@@ -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){
+17
View File
@@ -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;
}
}
}
@@ -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()
{
+4 -2
View File
@@ -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); //已支付金额