diff --git a/api/controllers/wxapp/app/Series.php b/api/controllers/wxapp/app/Series.php index f725e9ff..809a601e 100644 --- a/api/controllers/wxapp/app/Series.php +++ b/api/controllers/wxapp/app/Series.php @@ -128,32 +128,47 @@ class Series extends Wxapp{ $type = $this->input_param('type'); $page = $this->input_param('page'); $size = $this->input_param('size'); + $v_id = $this->input_param('v_id'); + $cor_id = $this->input_param('color_id'); !$page && $page = 1; !$size && $size = 20; + $this->load->model('auto/auto_cars_model'); $this->load->model('auto/auto_attr_model'); $where = [ - 's_id' => $s_id + 's_id' => $s_id, + 'status' => 1 ]; - strlen($type) && $where['type'] = $type; - $count = $this->auto_attr_model->count($where); - $rows = $this->auto_attr_model->select($where,'id desc',$page,$size,'id,title,type,jsondata'); + if($type==2){ //内饰颜色 + $where['v_id'] = $v_id; + $where['cor_id'] = $cor_id; + $groupby = "incor_id"; + }elseif($type==1){ //颜色 + $where['v_id'] = $v_id; + $groupby = "cor_id"; + }else{ //车辆级别 + $groupby = "v_id"; + } $lists = []; + $rows = $this->auto_cars_model->select_groupby($groupby,$where,'',$page,$size,'id,s_id,v_id,cor_id,incor_id'); if($rows){ - foreach($rows as $key=>$val){ - $jsodnata = json_decode($val['jsondata'],true); - $temp = [ - 'id' => $val['id'], - 'title' => $val['title'] - ]; - $lists[] = $temp; + $target_arr = array_column($rows,$groupby); + $attrs = $this->auto_attr_model->get_map_by_ids($target_arr,'id,title'); + foreach($rows as $key => $val){ + $attr_id = $val[$groupby]; + if($attrs[$attr_id]){ + $lists[] = [ + 'id' => $attr_id, + 'title' => $attrs[$attr_id][0]['title'] + ]; + } } } $data = [ 'list' => $lists, - 'total' => $count + 'total' => count($lists) ]; return $data; } @@ -174,9 +189,13 @@ class Series extends Wxapp{ 's_id'=>$s_id, 'v_id' => $v_id, 'cor_id' => $color_id, - 'incor_id' => $incolor_id + 'incor_id' => $incolor_id, + 'status' => 1 ); $car = $this->auto_cars_model->get($where_car); + if(!$car){ + throw new Exception('当前车型暂无库存', ERR_PARAMS_ERROR); + } $data = [ 'price' => $car['price_car'] ? $car['price_car'] : 0, 'deposit' => $car['price_book'] ? $car['price_book'] : 0 diff --git a/api/controllers/wxapp/licheb/Cusorder.php b/api/controllers/wxapp/licheb/Cusorder.php index d8c742bf..38276de6 100644 --- a/api/controllers/wxapp/licheb/Cusorder.php +++ b/api/controllers/wxapp/licheb/Cusorder.php @@ -238,16 +238,10 @@ class Cusorder extends Wxapp{ //订单列表头部 protected function get_tabs(){ - $rows = $this->orders_model->get_status(); - $lists = []; - if($rows){ - foreach($rows as $key=>$val){ - $lists[] = [ - 'key' => $key, - 'name' => $val - ]; - } - } + $lists = [ + ['key' =>0 ,'name' => '进行中'], + ['key' =>1 ,'name' => '已完成'], + ]; return $lists; } @@ -260,7 +254,6 @@ class Cusorder extends Wxapp{ $biz_id = $this->session['new_biz_id'] ? $this->session['new_biz_id'] : intval($this->session['biz_id']); $keyword = $this->input_param('keyword'); $status = $this->input_param('status'); - //$ismy = $this->input_param('ismy'); //是否只显示自己 $page = $this->input_param('page'); $size = $this->input_param('size'); @@ -276,7 +269,12 @@ class Cusorder extends Wxapp{ if($keyword){ $where["(name='{$keyword}' or mobile='{$keyword}')"] = null; } - strlen($status) && $where['status'] = $status; + if($status){ //已完成 + $where['status'] = 6; + }else{ //进行中 + $where['status>='] = 0; + $where['status!='] = 6; + } $fileds = 'id,name,mobile,car_json,brand_id,s_id,deposit,payway,status,c_time'; $count = $this->orders_model->count($where); $lists = []; @@ -290,6 +288,7 @@ 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); @@ -312,6 +311,7 @@ class Cusorder extends Wxapp{ 'mobile' => mobile_asterisk($val['mobile']), 'status_name' => $status_arr[$val['status']], 'other_data' => $other_data, + 'remark' => $this->orders_entity->get_remark($val['status']) ]; } } diff --git a/api/views/wxapp/licheb/html2pdf/agent.php b/api/views/wxapp/licheb/html2pdf/agent.php index 9edd5ce4..98c6bb4a 100644 --- a/api/views/wxapp/licheb/html2pdf/agent.php +++ b/api/views/wxapp/licheb/html2pdf/agent.php @@ -64,7 +64,7 @@