From 87511ece0772c8e15fd997f019c2bba9c56244cb Mon Sep 17 00:00:00 2001 From: qianhy Date: Tue, 31 Jan 2023 11:22:39 +0800 Subject: [PATCH] brand about add del --- admin/controllers/auto/Attr.php | 19 +++++++++++- admin/controllers/auto/Brand.php | 27 +++++++++++++++++ admin/controllers/auto/Series.php | 13 +++++++++ admin/views/auto/attr/lists.php | 48 ++++++++++++++++++++++++++----- admin/views/auto/brand/lists.php | 38 +++++++++++++++++------- admin/views/auto/series/lists.php | 32 ++++++++++++++++----- 6 files changed, 152 insertions(+), 25 deletions(-) diff --git a/admin/controllers/auto/Attr.php b/admin/controllers/auto/Attr.php index f9285755..452065eb 100644 --- a/admin/controllers/auto/Attr.php +++ b/admin/controllers/auto/Attr.php @@ -46,11 +46,23 @@ class Attr extends HD_Controller $where['s_id'] = -1; } } + strlen($params['type']) && $where['type'] = $params['type']; + if (!strlen($params['status'])){ + $params['status'] = $where['status'] = 1; + } + elseif ($params['status'] == -9){ + # pass + } + else{ + $where['status'] = $params['status']; + } + !$params['s_id'] && $params['s_id'] = ''; !$params['brand_id'] && $params['brand_id'] = ''; + !strlen($params['type']) && $params['type'] = ''; $count = $this->auto_attr_model->count($where); - $rows = $this->auto_attr_model->select($where, 'id desc', $page, $size); + $rows = $this->auto_attr_model->select($where, 'id desc', $page, $size, '*, (select brand_id from lc_auto_series where id=lc_auto_attr.s_id) as brand_id'); $type_arr = $this->auto_attr_model->get_type(); $status_arr = $this->auto_brand_model->get_status(); @@ -66,6 +78,7 @@ class Attr extends HD_Controller $list[] = [ 'id' => $val['id'], 'title' => $val['title'], + 'brand_name' => $map_brand[$val['brand_id']] ? $map_brand[$val['brand_id']] : '', 's_name' => $series_rows[$val['s_id']] ? $series_rows[$val['s_id']][0]['name'] : '', 'status_name' => $status_arr[$val['status']], 'status' => $val['status'], @@ -74,6 +87,10 @@ class Attr extends HD_Controller ]; } } + $status_arr_list = $status_arr; + unset($status_arr_list[-1]); + $this->data['status_arr'] = $status_arr_list; + $this->data['type_arr'] = $type_arr; $this->data['lists'] = $list; $this->data['params'] = $params; $this->data['brandAry'] = $map_brand; diff --git a/admin/controllers/auto/Brand.php b/admin/controllers/auto/Brand.php index 9919fa56..bbf1d6e7 100644 --- a/admin/controllers/auto/Brand.php +++ b/admin/controllers/auto/Brand.php @@ -27,6 +27,16 @@ class Brand extends HD_Controller{ $size = 20; $where["status > -1"] = null; $params['title'] && $where["name like '%{$params['title']}%'"] = null; + if (!strlen($params['status'])){ + $params['status'] = $where['status'] = 1; + } + elseif ($params['status'] == -9){ + # pass + } + else{ + $where['status'] = $params['status']; + } + $count = $this->auto_brand_model->count($where); $rows = $this->auto_brand_model->select($where, 'id desc', $page, $size); $status_arr = $this->auto_brand_model->get_status(); @@ -43,6 +53,9 @@ class Brand extends HD_Controller{ ]; } } + $status_arr_list = $status_arr; + unset($status_arr_list[-1]); + $this->data['status_arr'] = $status_arr_list; $this->data['lists'] = $list; $this->data['params'] = $params; $this->data['pager'] = array('count' => ceil($count / $size), 'curr' => $page, 'totle' => $count); @@ -129,6 +142,20 @@ class Brand extends HD_Controller{ $stauts = $this->input->post('status'); $where = array('id' => $id); $this->auto_brand_model->update(array('status' => $stauts), $where); + if ($stauts == -1){ + $this->load->model('auto/auto_cars_model'); + $this->load->model('auto/auto_series_model'); + $this->load->model('auto/auto_attr_model'); + # 车型库 + $this->auto_cars_model->update(array('status' => $stauts), array('brand_id' => $id)); + # 车系 + $this->auto_series_model->update(array('status' => $stauts), array('brand_id' => $id)); + # 车辆属性 + $this->auto_attr_model->update(array('status' => $stauts), array("s_id in (select id from lc_auto_series where brand_id = {$id})" => null)); + # 车型介绍 + $this->load->model('auto/auto_introduce_model', 'mdAutoIntroduce'); + $this->mdAutoIntroduce->update(array('status' => $stauts), array('brand_id' => $id)); + } return $this->show_json(SYS_CODE_SUCCESS, '操作成功'); } diff --git a/admin/controllers/auto/Series.php b/admin/controllers/auto/Series.php index 670617ec..7dc305f6 100644 --- a/admin/controllers/auto/Series.php +++ b/admin/controllers/auto/Series.php @@ -31,6 +31,16 @@ class Series extends HD_Controller{ } else { $params['brand_id'] = ''; } + if (!strlen($params['status'])){ + $params['status'] = $where['status'] = 1; + } + elseif ($params['status'] == -9){ + # pass + } + else{ + $where['status'] = $params['status']; + } + $count = $this->auto_series_model->count($where); $rows = $this->auto_series_model->select($where, 'id desc', $page, $size); $status_arr = $this->auto_series_model->get_status(); @@ -53,6 +63,9 @@ class Series extends HD_Controller{ ]; } } + $status_arr_list = $status_arr; + unset($status_arr_list[-1]); + $this->data['status_arr'] = $status_arr_list; $this->data['lists'] = $list; $this->data['params'] = $params; $this->data['brandAry'] = $map_brand; diff --git a/admin/views/auto/attr/lists.php b/admin/views/auto/attr/lists.php index fe452af4..29e149c2 100755 --- a/admin/views/auto/attr/lists.php +++ b/admin/views/auto/attr/lists.php @@ -8,7 +8,7 @@
- +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
@@ -44,6 +66,7 @@ ID 标题 + 品牌名称 车系名称 类型 状态 @@ -56,21 +79,28 @@ + + -1) { ?> | + class="am-text-primary"> + - 禁用 - - + | 恢复 + -1) { ?> + | 删除 + @@ -92,12 +122,16 @@ data: { params: [], brandAry: [], - seryAry: [] + seryAry: [], + type_arr: [], + status_arr: [], }, mounted: function () { var vm = this; vm.params = ; vm.brandAry = ; + vm.type_arr = ; + vm.status_arr = ; }, methods: {}, watch: { diff --git a/admin/views/auto/brand/lists.php b/admin/views/auto/brand/lists.php index c3ec2606..3df70e86 100755 --- a/admin/views/auto/brand/lists.php +++ b/admin/views/auto/brand/lists.php @@ -7,7 +7,19 @@
+
+ +
+ +
+
+
@@ -39,18 +51,24 @@ - | - - 禁用 - - 恢复 - | 授权门店 + -1) { ?> + | + + + | 禁用 + + | 恢复 + + -1) { ?> + | 删除 + diff --git a/admin/views/auto/series/lists.php b/admin/views/auto/series/lists.php index b26a3e1a..2b6b4cdd 100755 --- a/admin/views/auto/series/lists.php +++ b/admin/views/auto/series/lists.php @@ -8,7 +8,7 @@
- +
+
+ +
+ +
+
+
@@ -48,16 +58,22 @@ + -1) { ?> | + class="am-text-primary"> + - 禁用 - - + | 恢复 + -1) { ?> + | 删除 + @@ -78,12 +94,14 @@ el: '.coms-table-wrap', data: { params:[], - brandAry:[] + brandAry:[], + status_arr: [], }, mounted:function() { var vm = this; vm.params = ; vm.brandAry = ; + vm.status_arr = ; }, methods:{}, watch:{}