edit-admin-srv_money

This commit is contained in:
lccsw
2021-09-29 15:53:15 +08:00
parent a92f4455a8
commit 5049863033
4 changed files with 45 additions and 7 deletions
+12 -2
View File
@@ -21,6 +21,8 @@ class Orders extends HD_Controller
$this->load->model('auto/auto_attr_model');
$this->load->model('auto/auto_finance_model');
$this->load->model('sys/sys_finance_model');
$this->load->library('receiver/orders_entity');
}
public function index()
@@ -142,7 +144,15 @@ class Orders extends HD_Controller
$loan['finance_rows'] = $this->sys_finance_model->select(['status' => 1],'',0,0,'id,title');
$loan['finance_rows_nums'] = $this->sys_finance_model->get_nums();
$loan['price_loan'] = $money_json['price_loan'] ? $money_json['price_loan'] : '';
$loan['first_pay'] = $money_json['price_car'] - $money_json['price_loan'];
$loan['first_pay'] = 0;
if($money_json['price_loan']){
$srv_money = $this->orders_entity->order_srv_money($row['id']);
if($srv_money>$row['deposit']){
$loan['first_pay'] = $money_json['price_car']-$money_json['price_loan'];
}else{
$loan['first_pay'] = $money_json['price_car']-$money_json['price_loan']-$row['deposit'];
}
}
!$loan['num'] && $loan['num'] = 12;
$loan['loan_time'] = $loan['loan_time']!='0000-00-00 00:00:00' ? date('Y-m-d',strtotime($loan['loan_time'])) : '';
@@ -659,7 +669,7 @@ class Orders extends HD_Controller
'o_id' => $params['id'],
'status' => 1,
'pid>' => 0,
'total_price>' => 0
'pay_price>' => 0
];
$count = $this->app_liche_orders_model->count($where);
if($count){
+1 -1
View File
@@ -162,7 +162,7 @@ class Protocol extends CI_Controller{
$where = [
'o_id' => $row['id'],
'status' => 1,
'type in (1,2,4)' => null
'type in (1,2,4,5)' => null
];
$pay = $this->app_liche_orders_model->sum('total_price',$where);
//尾款
+4 -4
View File
@@ -399,10 +399,10 @@ class Orders_entity{
}else{ //分期
if($srv_money < $this->order_row['deposit']){ //服务费小于定金
$to_srv_price = $srv_money;
$to_com_price = $money_json['first_pay'] - $this->order_row['deposit'];
$to_com_price = $money_json['price_car']-$money_json['price_loan'] - $this->order_row['deposit'];
$to_com_price = $to_com_price>0 ? $to_com_price : 0;
}else{
$to_com_price = $money_json['first_pay']; //给销售公司金额
$to_com_price = $money_json['price_car']-$money_json['price_loan']; //给销售公司金额
$to_srv_price = $srv_money - $this->order_row['deposit']; //给服务公司的金额 服务费-定金
$to_srv_price = $to_srv_price>0 ? $to_srv_price : 0;
}
@@ -526,10 +526,10 @@ class Orders_entity{
}else{ //分期
if($srv_money < $this->order_row['deposit']){ //服务费小于定金
$to_srv_price = $srv_money;
$to_com_price = $money_json['first_pay'] - $this->order_row['deposit'];
$to_com_price = $money_json['price_car']-$money_json['price_loan'] - $this->order_row['deposit'];
$to_com_price = $to_com_price>0 ? $to_com_price : 0;
}else{
$to_com_price = $money_json['first_pay']; //给销售公司金额
$to_com_price = $money_json['price_car']-$money_json['price_loan']; //给销售公司金额
$to_srv_price = $srv_money - $this->order_row['deposit']; //给服务公司的金额 服务费-定金
$to_srv_price = $to_srv_price>0 ? $to_srv_price : 0;
}
+28
View File
@@ -66,3 +66,31 @@ create table lc_app_liche_udata (
primary key (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='狸车用户数据表';
alter table lc_app_liche_udata add app_uid int(10) unsigned not null default 0 comment '用户id' after cf_id;
-- ----------------------------
-- Title:用户购车订单
-- Author:lcc
-- Table:lc_app_liche_orders
-- ---------------------------
create table lc_app_liche_orders (
id int(10) unsigned not null auto_increment comment '自增id',
o_id int(10) unsigned not null default '0' comment '订单表id',
uid int(10) unsigned not null default '0' comment '用户id',
sid varchar(32) not null default '' comment '订单号',
mch_id varchar(30) not null default '' comment '支付商户号',
pid int(10) unsigned not null default '0' comment '父订单id',
brand_id int(10) not null default '0' comment '品牌id',
s_id int(10) unsigned not null default '0' comment '车系id',
v_id int(10) unsigned not null default '0' comment '车型号',
cor_id int(10) not null default '0' comment '车身颜色id',
incor_id int(10) unsigned not null default '0' comment '内饰颜色id',
total_price decimal(12,2) not null default '0.00' comment '订单价格',
pay_price decimal(12,2) not null default '0.00' comment '实付金额',
type tinyint(2) unsigned not null default '0' comment '订单类型 1定金 2服务费 3尾款 4意向金 5后台添加',
status tinyint(1) not null default '0' comment '支付状态 0未支付 1已支付',
pay_time timestamp not null default '0000-00-00 00:00:00' comment '付款时间',
c_time int(10) unsigned not null default '0' comment '创建时间',
u_time timestamp null default current_timestamp on update current_timestamp,
primary key (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='用户购车订单';