diff --git a/admin/controllers/auto/Cars.php b/admin/controllers/auto/Cars.php index 9e98943d..51ad3978 100644 --- a/admin/controllers/auto/Cars.php +++ b/admin/controllers/auto/Cars.php @@ -69,14 +69,8 @@ class Cars extends HD_Controller{ $select = '*'; $rows = $this->auto_cars_model->select($where, $orderby, $page, $size, $select); if($rows){ - $s_ids = array(); - $attr_ids = array(); - foreach($rows as $v){ - !in_array($v['s_id'], $s_ids) && $s_ids[] = $v['s_id']; - $v['v_id'] && !in_array($v['v_id'], $attr_ids) && $attr_ids[] = $v['v_id']; - $v['cor_id'] && !in_array($v['cor_id'], $attr_ids) && $attr_ids[] = $v['cor_id']; - $v['incor_id'] && !in_array($v['incor_id'], $attr_ids) && $attr_ids[] = $v['incor_id']; - } + $s_ids = array_unique(array_column($rows,'s_id')); + $attr_ids = array_unique(array_column($rows,'v_id')); //获取车系列表 $map_sery = array(); if($s_ids){ @@ -90,22 +84,19 @@ class Cars extends HD_Controller{ $where_attr = array("id in ({$str_ids})" => null); $map_attr = $this->auto_attr_model->map('id', 'title', $where_attr, 'id desc', 0 , 0, 'id, title, type'); } - //属性按'车型-车身颜色-内饰颜色'排序 foreach($rows as $v){ - $attr_title = "{$map_attr[$v['v_id']]}-{$map_attr[$v['cor_id']]}-内饰{$map_attr[$v['incor_id']]}"; - $title = "{$map_brand[$v['brand_id']]} {$map_sery[$v['s_id']]} {$attr_title}"; + $title = "{$map_brand[$v['brand_id']]} {$map_sery[$v['s_id']]} {$map_attr[$v['v_id']]}"; $lists[] = array( 'id' => $v['id'], 'title' => $title, 'status' => $v['status'], 'price_car' => $v['price_car'] > 0 ? $v['price_car'] : '0.00', + 'price_floor' => $v['price_floor'] > 0 ? $v['price_floor'] : '0.00', 'price_book' => $v['price_book'] > 0 ? $v['price_book'] : '0.00', 'price_insure' => $v['price_insure'] > 0 ? $v['price_insure'] : '0.00', 'price_fine' => $v['price_fine'] > 0 ? $v['price_fine'] : '0.00', 'price_finance' => $v['price_finance'] > 0 ? $v['price_finance'] : '0.00', - 'first_pay' => $v['first_pay'] > 0 ? $v['first_pay'] : '0.00', - 'month_pay' => $v['month_pay'] > 0 ? $v['month_pay'] : '0.00', 'price_coplus' => $v['price_coplus'] > 0 ? $v['price_coplus'] : '0.00', 'brokerage_1' => $v['brokerage_1'] > 0 ? $v['brokerage_1'] : '0.00', 'brokerage_2' => $v['brokerage_2'] > 0 ? $v['brokerage_2'] : '0.00', @@ -152,12 +143,11 @@ class Cars extends HD_Controller{ 'sery_name' => $row_sery['name'], 'attr' => $attr, 'price_car' => $row['price_car'] > 0 ? $row['price_car'] : '', + 'price_floor' => $row['price_floor'] > 0 ? $row['price_floor'] : '', 'price_book' => $row['price_book'] > 0 ? $row['price_book'] : '', 'price_insure' => $row['price_insure'] > 0 ? $row['price_insure'] : '', 'price_fine' => $row['price_fine'] > 0 ? $row['price_fine'] : '', 'price_finance' => $row['price_finance'] > 0 ? $row['price_finance'] : '', - 'first_pay' => $row['first_pay'] > 0 ? $row['first_pay'] : '', - 'month_pay' => $row['month_pay'] > 0 ? $row['month_pay'] : '0.00', 'price_coplus' => $row['price_coplus'] > 0 ? $row['price_coplus'] : '', 'brokerage_1' => $row['brokerage_1'] > 0 ? $row['brokerage_1'] : '', 'brokerage_2' => $row['brokerage_2'] > 0 ? $row['brokerage_2'] : '', @@ -185,7 +175,7 @@ class Cars extends HD_Controller{ $brand_id = $info['brand_id']; $s_id = $info['s_id']; - $where = array('s_id' => $s_id); + $where = array('s_id' => $s_id,'type'=>1); $orderby = 'type asc, id asc'; $select = 'id,type'; $map = $this->auto_attr_model->map('type', '', $where, $orderby, 0, 0, $select); @@ -214,15 +204,13 @@ class Cars extends HD_Controller{ $rows_car = $this->auto_cars_model->select($where, 'id desc', 0, 0, 'id, v_id, cor_id, incor_id'); $map_cars = array(); foreach($rows_car as $v){ - $k = "{$v['cor_id']}_{$v['v_id']}_{$v['incor_id']}"; + $k = "{$v['v_id']}"; $map_cars[$k] = $v; } $adds = array(); foreach($attrs as $attr){ - $cor_id = $attr[0] ? $attr[0] : 0;//0-车身颜色 $v_id = $attr[1] ? $attr[1] : 0;//1-车型 - $incor_id = $attr[2] ? $attr[2] : 0;//2-内饰颜色 - $k = "{$cor_id}_{$v_id}_{$incor_id}"; + $k = "{$v_id}"; if($map_cars[$k]){ $map_cars[$k]['ok'] = 1;//保留 } else { @@ -230,8 +218,6 @@ class Cars extends HD_Controller{ 'brand_id' => $brand_id, 's_id' => $s_id, 'v_id' => $v_id, - 'cor_id' => $cor_id, - 'incor_id' => $incor_id, 'status' => 1, 'c_time' => time() ); @@ -273,12 +259,11 @@ class Cars extends HD_Controller{ $upd = array( 'price_car' => floatval($info['price_car']), + 'price_floor' => floatval($info['price_floor']), 'price_book' => floatval($info['price_book']), 'price_insure' => floatval($info['price_insure']), 'price_fine' => floatval($info['price_fine']), 'price_finance' => floatval($info['price_finance']), - 'first_pay' => floatval($info['first_pay']), - 'month_pay' => floatval($info['month_pay']), 'price_coplus' => floatval($info['price_coplus']), 'brokerage_1' => floatval($info['brokerage_1']), 'brokerage_2' => floatval($info['brokerage_2']), @@ -349,8 +334,6 @@ class Cars extends HD_Controller{ 'brand_id' => $brand_id, 's_id' => $s_id, 'v_id' => $v_id, - 'cor_id' => $cor_id, - 'incor_id' => $incor_id, ); $row = $this->auto_cars_model->get($where); @@ -392,4 +375,4 @@ class Cars extends HD_Controller{ exit("total:{$total}; count:{$count}; done:{$done};"); } -} \ No newline at end of file +} diff --git a/admin/controllers/receiver/Customer.php b/admin/controllers/receiver/Customer.php index 9f412c91..50356391 100644 --- a/admin/controllers/receiver/Customer.php +++ b/admin/controllers/receiver/Customer.php @@ -223,6 +223,7 @@ class Customer extends HD_Controller $this->load->model('auto/auto_brand_model'); $this->load->model('auto/auto_series_model'); + $this->load->model('auto/auto_attr_model'); $row = $this->customers_model->get(array('id' => $id)); if (!$row) { @@ -231,9 +232,11 @@ class Customer extends HD_Controller $if_driver = 1 == $row['if_driver'] ? '是' : '否'; $is_top = 1 == $row['is_top'] ? '是' : '否'; - $car_json = json_decode($row['car_json'], true); - $side = $car_json['version']['title'] ? $car_json['version']['title'] : ''; - $color = $car_json['color']['title'] ? $car_json['color']['title'] : ''; + $car_json = json_decode($row['car_json'],true); + $version = $this->auto_attr_model->get(['id'=>$car_json['v_id']],'title'); + $color = $this->auto_attr_model->get(['id'=>$car_json['c_id']],'title'); + $side = $version ? $version['title'] : ''; + $color = $color ? $color['title'] : ''; $row_biz = $this->biz_model->get(array('id' => $row['biz_id'])); $row_brand = $this->auto_brand_model->get(array('id' => $row['brand_id']), 'name'); diff --git a/admin/views/auto/cars/get.php b/admin/views/auto/cars/get.php index 232f182e..c71254a6 100644 --- a/admin/views/auto/cars/get.php +++ b/admin/views/auto/cars/get.php @@ -6,6 +6,13 @@ +
+ +
+ + +
+
@@ -34,20 +41,6 @@
-
- -
- - -
-
-
- -
- - -
-
@@ -132,4 +125,4 @@ watch:{} }); }); - \ No newline at end of file + diff --git a/admin/views/auto/cars/lists.php b/admin/views/auto/cars/lists.php index 8f857c61..79ade805 100644 --- a/admin/views/auto/cars/lists.php +++ b/admin/views/auto/cars/lists.php @@ -49,23 +49,22 @@ ID - 裸车报价 + 裸车报价 + 车辆底价 定金 保险报价 精品报价 金融报价 - 分期首付 - 月供金额 公司加价 - 一级分销佣金 - 二级分销佣金 + 一级分销佣金 + 二级分销佣金 操作