|
|
|
@@ -40,6 +40,8 @@ class Cusorder extends Wxapp{
|
|
|
|
|
$this->load->model("biz/biz_model");
|
|
|
|
|
$this->load->model('sys/sys_city_model');
|
|
|
|
|
$this->load->model('sys/sys_finance_model');
|
|
|
|
|
|
|
|
|
|
$this->load->library('receiver/orders_entity');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected function get(){
|
|
|
|
@@ -53,6 +55,7 @@ class Cusorder extends Wxapp{
|
|
|
|
|
|
|
|
|
|
//创建订单
|
|
|
|
|
protected function post(){
|
|
|
|
|
|
|
|
|
|
$cus_id = $this->input_param('cus_id');
|
|
|
|
|
$car_id = $this->input_param('car_id');
|
|
|
|
|
$color_id = $this->input_param('color_id');
|
|
|
|
@@ -71,7 +74,7 @@ class Cusorder extends Wxapp{
|
|
|
|
|
$address = $this->input_param('address');
|
|
|
|
|
$cardid = $this->input_param('cardid');
|
|
|
|
|
$delry_time = $this->input_param('delry_time');
|
|
|
|
|
$fin_nums_id = $this->input_param('fin_nums_id');
|
|
|
|
|
$finance_id = $this->input_param('finance_id');
|
|
|
|
|
$inten_money = floatval($this->input_param('inten_money'));//意向金
|
|
|
|
|
|
|
|
|
|
$row = $this->customers_model->get(['id'=>$cus_id]);
|
|
|
|
@@ -97,7 +100,7 @@ class Cusorder extends Wxapp{
|
|
|
|
|
throw new Exception('参数错误', API_CODE_FAIL);
|
|
|
|
|
}
|
|
|
|
|
if(!$payway){ //分期
|
|
|
|
|
$finance_row = $this->auto_finance_model->get(['id'=>$fin_nums_id]);
|
|
|
|
|
$finance_row = $this->sys_finance_model->get(['id'=>$finance_id,'status'=>1]);
|
|
|
|
|
if(!$finance_row){
|
|
|
|
|
throw new Exception('参数错误', ERR_PARAMS_ERROR);
|
|
|
|
|
}
|
|
|
|
@@ -167,6 +170,11 @@ class Cusorder extends Wxapp{
|
|
|
|
|
'price_insure' => $car_row['price_insure'],
|
|
|
|
|
'price_fine' => $car_row['price_fine'],
|
|
|
|
|
];
|
|
|
|
|
!$payway && $money_json['price_finance'] = 1000;
|
|
|
|
|
if(!$payway){
|
|
|
|
|
$orders_entity = new Orders_entity();
|
|
|
|
|
$money_json['price_finance'] = $orders_entity::PRICE_FINANCE;
|
|
|
|
|
}
|
|
|
|
|
//获取挂牌价
|
|
|
|
|
if($series_row['brand_id']==3){ //狸车品牌写死挂牌费用0.01 测试用
|
|
|
|
|
$money_json['fee_carno'] = 0.01;
|
|
|
|
@@ -176,11 +184,6 @@ class Cusorder extends Wxapp{
|
|
|
|
|
$money_json['fee_carno'] = $city['fee_carno'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(!$payway){ //分期
|
|
|
|
|
$money_json['price_finance'] = $finance_row['srv_pay'];
|
|
|
|
|
$money_json['first_pay'] = $finance_row['first_pay'];
|
|
|
|
|
$money_json['month_pay'] = $finance_row['month_pay'];
|
|
|
|
|
}
|
|
|
|
|
$data['money_json'] = json_encode($money_json,JSON_UNESCAPED_UNICODE);
|
|
|
|
|
$o_id = $this->orders_model->add($data);
|
|
|
|
|
if($o_id){
|
|
|
|
@@ -191,7 +194,6 @@ class Cusorder extends Wxapp{
|
|
|
|
|
$this->order_signs_model->add($sign_data);
|
|
|
|
|
//意向金订单
|
|
|
|
|
if($inten_money){
|
|
|
|
|
$this->load->library('receiver/orders_entity');
|
|
|
|
|
$this->load->model('app/liche/app_liche_users_model');
|
|
|
|
|
$userinfo = $this->app_liche_users_model->get(['mobile'=>$mobile]);
|
|
|
|
|
$this->orders_entity->c_intention($o_id,$userinfo,$inten_money);
|
|
|
|
@@ -288,7 +290,6 @@ class Cusorder extends Wxapp{
|
|
|
|
|
$series = $this->auto_series_model->get_map_by_ids($series_arr,'id,name');
|
|
|
|
|
|
|
|
|
|
$status_arr = $this->orders_model->get_status();
|
|
|
|
|
$this->load->library('receiver/orders_entity');
|
|
|
|
|
foreach($rows as $key=>$val){
|
|
|
|
|
|
|
|
|
|
$car_json = json_decode($val['car_json'],true);
|
|
|
|
@@ -376,12 +377,8 @@ class Cusorder extends Wxapp{
|
|
|
|
|
$info_json['c_cardid'] && $car_data['身份证号'] = $info_json['c_cardid'];
|
|
|
|
|
if(!$row['payway']){
|
|
|
|
|
$money_json = json_decode($row['money_json'],true);
|
|
|
|
|
$auto_finance_row = $this->auto_finance_model->get(['id'=>$row['finance_id']],'fin_id,num');
|
|
|
|
|
$finance_row = $this->sys_finance_model->get(['id'=>$auto_finance_row['fin_id']],'title');
|
|
|
|
|
$finance_row = $this->sys_finance_model->get(['id'=>$row['finance_id']],'title');
|
|
|
|
|
$car_data['金融产品'] = $finance_row['title'];
|
|
|
|
|
$car_data['分期期数'] = $auto_finance_row['num'];
|
|
|
|
|
$car_data['贷款金额'] = $money_json['price_car'] - $money_json['first_pay'];
|
|
|
|
|
$car_data['月供'] = $money_json['month_pay'];
|
|
|
|
|
}
|
|
|
|
|
//开票信息
|
|
|
|
|
$bill_status = 0;
|
|
|
|
@@ -432,9 +429,6 @@ class Cusorder extends Wxapp{
|
|
|
|
|
$result = $this->order_deliverys_model->update(['status'=>2],['id'=>$row['id']]);
|
|
|
|
|
if($result){
|
|
|
|
|
$this->orders_model->update(['status'=>6],['id'=>$row['o_id']]);
|
|
|
|
|
//完成支付订单
|
|
|
|
|
//$this->load->library('receiver/orders_entity');
|
|
|
|
|
//$this->orders_entity->finish_after($row['o_id'],1);
|
|
|
|
|
throw new Exception('修改成功', API_CODE_SUCCESS);
|
|
|
|
|
}else{
|
|
|
|
|
throw new Exception('修改失败', ERR_PARAMS_ERROR);
|
|
|
|
|