brand status about

This commit is contained in:
qianhy
2023-02-02 14:34:08 +08:00
committed by lccsw
parent f267233beb
commit c6b085ca32
22 changed files with 186 additions and 29 deletions
+1 -1
View File
@@ -141,7 +141,7 @@ class Main extends HD_Controller
);
$this->load->model('auto/auto_introduce_model', 'mdAutoIntroduce');
$value = $this->mdAutoIntroduce->count(["status<>-1" => null]);
$value = $this->mdAutoIntroduce->count(["status<>-1" => null, 'brand_id in (select id from lc_auto_brand where status > -1)' => null]);
$list[] = array(
'title' => '车型介绍(条)',
'value' => $value,
+3 -2
View File
@@ -32,6 +32,7 @@ class Attr extends HD_Controller
$where["status > -1"] = null;
$params['title'] && $where["title like '%{$params['title']}%'"] = null;
$where['s_id in (select id from lc_auto_series where brand_id in (select id from lc_auto_brand where status > -1))'] = null;
if ($params['s_id']) {
$where['s_id'] = $params['s_id'];
}
@@ -68,7 +69,7 @@ class Attr extends HD_Controller
//获取品牌map
$where_brand = array('status > -1' => null);
$map_brand = $this->auto_brand_model->map('id', 'name', $where_brand, 'id desc', 0, 0, 'id, name');
$map_brand = $this->auto_brand_model->map_brand($where_brand);
$list = [];
if ($rows) {
@@ -93,7 +94,7 @@ class Attr extends HD_Controller
$this->data['type_arr'] = $type_arr;
$this->data['lists'] = $list;
$this->data['params'] = $params;
$this->data['brandAry'] = $map_brand;
$this->data['brandAry'] = $this->auto_brand_model->map_brand_list($map_brand);
$this->data['pager'] = array('count' => ceil($count / $size), 'curr' => $page, 'totle' => $count);
$this->data['_title'] = '属性管理';
$this->show_view('auto/attr/lists', true);
+9 -4
View File
@@ -38,7 +38,7 @@ class Brand extends HD_Controller{
}
$count = $this->auto_brand_model->count($where);
$rows = $this->auto_brand_model->select($where, 'id desc', $page, $size);
$rows = $this->auto_brand_model->select($where, 'status desc, id asc', $page, $size);
$status_arr = $this->auto_brand_model->get_status();
$list = [];
if($rows){
@@ -184,7 +184,12 @@ class Brand extends HD_Controller{
$title && $where["name like '%{$title}%'"] = null;
$un_ids && $where["id not in({$un_ids})"] = null;
if(strlen($status) > 0){
$where['status'] = $status;
if (strpos($status,'>') !== false || strpos($status,'<') !== false || strpos($status,'in') !== false){
$where["status {$status}"] = null;
}
else{
$where['status'] = $status;
}
} else {
$where['status > -1'] = null;
}
@@ -193,13 +198,13 @@ class Brand extends HD_Controller{
$lists = array();
if($total){
$orderby = 'id desc';
$orderby = 'status desc, id asc';
$select = 'id, name';
$rows = $this->auto_brand_model->select($where, $orderby, $page, $size, $select);
foreach($rows as $v){
$lists[] = array(
'id' => $v['id'],
'id' => strlen($status) > 0 ? $v['id'] : " " . $v['id'],
'name' => $v['name'],
);
}
+4 -3
View File
@@ -25,6 +25,7 @@ class Business extends HD_Controller{
!isset($params['month']) && $params['month'] = '';
$where = array();
$where['brand_id in (select id from lc_auto_brand where status = 1)'] = null;
if($params['brand_id']){
$where['brand_id'] = $params['brand_id'];
} else{
@@ -70,8 +71,8 @@ class Business extends HD_Controller{
$size = !$size ? 20 : $size;
//获取品牌map
$where_brand = array('status > -1' => null);
$map_brand = $this->auto_brand_model->map('id', 'name', $where_brand, 'id desc', 0 , 0, 'id, name');
$where_brand = array('status = 1' => null);
$map_brand = $this->auto_brand_model->map_brand($where_brand);
//状态
$statusAry = array('0' => '关闭', '1' => '开启');
@@ -134,7 +135,7 @@ class Business extends HD_Controller{
$this->data['params'] = $params;
$this->data['lists'] = $lists;
$this->data['statusAry'] = $statusAry;
$this->data['brandAry'] = $map_brand;
$this->data['brandAry'] = $this->auto_brand_model->map_brand_list($map_brand);
$this->data['cityAry'] = $this->sys_city_model->select(['status'=>1],'id desc',0,0,'city_id,name');
$this->data['yearAry'] = $this->auto_business_model->year();
$this->data['monthAry'] = $this->auto_business_model->month();
+3 -2
View File
@@ -29,6 +29,7 @@ class Cars extends HD_Controller{
$params = $this->input->get();
$where = array();
$where['brand_id in (select id from lc_auto_brand where status > -1)'] = null;
if($params['brand_id']){
$where['brand_id'] = $params['brand_id'];
} else{
@@ -58,7 +59,7 @@ class Cars extends HD_Controller{
//获取品牌map
$where_brand = array('status > -1' => null);
$map_brand = $this->auto_brand_model->map('id', 'name', $where_brand, 'id desc', 0 , 0, 'id, name');
$map_brand = $this->auto_brand_model->map_brand($where_brand);
//状态
$statusAry = array('0' => '关闭', '1' => '开启');
@@ -109,7 +110,7 @@ class Cars extends HD_Controller{
$this->data['params'] = $params;
$this->data['lists'] = $lists;
$this->data['statusAry'] = $statusAry;
$this->data['brandAry'] = $map_brand;
$this->data['brandAry'] = $this->auto_brand_model->map_brand_list($map_brand);
$this->data['pager'] = array('count' => ceil($total / $size), 'curr' => $page, 'totle' => $total);
$this->data['_title'] = '车型库管理';
$this->show_view('auto/cars/lists',true);
+1
View File
@@ -35,6 +35,7 @@ class Introduce extends HD_Controller
if (strlen($params['status'])) {
$where['status'] = $params['status'];
}
$where['brand_id in (select id from lc_auto_brand where status > -1)'] = null;
$count = $this->mdAutoIntroduce->count($where);
if ($count) {
$res = $this->mdAutoIntroduce->select($where, "id desc", $params['page'], $params['size']);
+3 -2
View File
@@ -26,6 +26,7 @@ class Series extends HD_Controller{
$size = 20;
$where["status > -1"] = null;
$params['title'] && $where["name like '%{$params['title']}%'"] = null;
$where['brand_id in (select id from lc_auto_brand where status > -1)'] = null;
if($params['brand_id']){
$where['brand_id'] = $params['brand_id'];
} else {
@@ -48,7 +49,7 @@ class Series extends HD_Controller{
//获取品牌map
$where_brand = array('status > -1' => null);
$map_brand = $this->auto_brand_model->map('id', 'name', $where_brand, 'id desc', 0 , 0, 'id, name');
$map_brand = $this->auto_brand_model->map_brand($where_brand);
if($rows){
foreach($rows as $key=>$val){
@@ -68,7 +69,7 @@ class Series extends HD_Controller{
$this->data['status_arr'] = $status_arr_list;
$this->data['lists'] = $list;
$this->data['params'] = $params;
$this->data['brandAry'] = $map_brand;
$this->data['brandAry'] = $this->auto_brand_model->map_brand_list($map_brand);
$this->data['pager'] = array('count' => ceil($count / $size), 'curr' => $page, 'totle' => $count);
$this->data['_title'] = '车系列表';
$this->show_view('auto/series/lists', true);
+3 -1
View File
@@ -29,6 +29,7 @@ class Cost extends HD_Controller{
//lc_items
//品牌 车系 车型
$where_items = $where_items_default = '1 = 1';
$where["item_id in (select id from lc_items where brand_id in (select id from lc_auto_brand where status > -1))"] = null;
if ($params['brand_id']) {//品牌
//$where["brand_id"] = $params['brand_id'];
$where_items = $where_items." and brand_id = ".$params['brand_id'];
@@ -202,7 +203,8 @@ class Cost extends HD_Controller{
}
$show_info['bizTypeAry'] = $this->biz_model->type_ary();//门店类型
$this->data['show_info'] = $show_info;
$autoList[1] = $this->mdAutoBrand->select(array('status' => 1), 'id desc', 0, 0, 'id,name');
#$autoList[1] = $this->mdAutoBrand->select(array('status' => 1), 'id desc', 0, 0, 'id,name');
$autoList[1] = $this->mdAutoBrand->map_brand(array('status > -1' => null), false);
$this->data['lists'] = $lists;
$this->data['pager'] = array('count' => ceil($count / $size), 'curr' => $page, 'totle' => $count);
$this->data['autoList'] = $autoList;
+3 -1
View File
@@ -37,6 +37,7 @@ class Stock extends HD_Controller
} else {
$order = "id desc";
}
$where['brand_id in (select id from lc_auto_brand where status > -1)'] = null;
if ($params['brand_id']) {
$where['brand_id'] = $params['brand_id'];
}
@@ -69,7 +70,8 @@ class Stock extends HD_Controller
$time[0] && $where["log_date>="] = $time[0];
$time[1] && $where["log_date<="] = $time[1];
}
$autoList[1] = $this->mdAutoBrand->select(array('status' => 1), "id desc", 0, 0, 'id,name');
//$autoList[1] = $this->mdAutoBrand->select(array('status' => 1), "id desc", 0, 0, 'id,name');
$autoList[1] = $this->mdAutoBrand->map_brand(array('status > -1' => null), false);
if ($params['brand_id']) {
$autoList[2] = $this->mdAutoSeries->select(array('status' => 1, 'brand_id' => $params['brand_id']), 'id desc', 0, 0, 'id,name');
}
+3 -1
View File
@@ -39,7 +39,8 @@ class Transfer extends HD_Controller
$params['page'] = $params['page'] ? intval($params['page']) : 1;
$params['size'] = $params['size'] ? intval($params['size']) : 20;
$re = $this->dataSelect($params);
$autoList[1] = $this->mdAutoBrand->select(array('status' => 1), 'id desc', 0, 0, 'id,name');
//$autoList[1] = $this->mdAutoBrand->select(array('status' => 1), 'id desc', 0, 0, 'id,name');
$autoList[1] = $this->mdAutoBrand->map_brand(array('status > -1' => null), false);
if ($params['brand_id']) {
$autoList[2] = $this->mdAutoSeries->select(array('status' => 1, 'brand_id' => $params['brand_id']), 'id desc', 0, 0, 'id,name');
}
@@ -156,6 +157,7 @@ class Transfer extends HD_Controller
$c_time[0] && $where["c_time >="] = strtotime($c_time[0] . ' 00:00:00');
$c_time[1] && $where["c_time <="] = strtotime($c_time[1] . ' 23:59:59');
}
$where['item_id in (select id from lc_items where brand_id in (select id from lc_auto_brand where status > -1))'] = null;
$total = $this->mdTransfer->count($where);
$lists = array();
if ($total) {
+68 -4
View File
@@ -32,8 +32,16 @@ class Goods extends HD_Controller
public function lists()
{
$params = $this->input->get();
$page = $params['page'] = $params['page'] ? intval($params['page']) : 1;
$size = $params['size'] = $params['size'] ? intval($params['size']) : 20;
$params['page'] = $params['page'] ? intval($params['page']) : 1;
$params['size'] = $params['size'] ? intval($params['size']) : 20;
$this->data = $this->dataSelect($params);
$view = $this->data['view'];
return $this->show_view($view, true);
}
private function dataSelect($params){
$page = $params['page'];
$size = $params['size'];
$where = array('id<>1' => null, 'status>' => 0);
$where_1 = $where_2 = $where_3 = array('m.id<>1' => null);
$autoList = array();
@@ -148,6 +156,10 @@ class Goods extends HD_Controller
$where_3["m.bill_time<>'0000-00-00 00:00:00'"] = null;
$view = '/items/goods/lists_sold';
$_title = '已售车辆';
$where['brand_id in (select id from lc_auto_brand where status >- 1)'] = null;
$where_1['brand_id in (select id from lc_auto_brand where status >- 1)'] = null;
$where_2['m.brand_id in (select id from lc_auto_brand where status >- 1)'] = null;
$where_3['m.brand_id in (select id from lc_auto_brand where status >- 1)'] = null;
} else {
$where["bill_time"] = '0000-00-00 00:00:00';
$where_1["m.bill_time"] = '0000-00-00 00:00:00';
@@ -155,6 +167,10 @@ class Goods extends HD_Controller
$where_3["m.bill_time"] = '0000-00-00 00:00:00';
$view = '/items/goods/lists';
$_title = '库存车辆';
$where['brand_id in (select id from lc_auto_brand where status = 1)'] = null;
$where_1['brand_id in (select id from lc_auto_brand where status = 1)'] = null;
$where_2['m.brand_id in (select id from lc_auto_brand where status = 1)'] = null;
$where_3['m.brand_id in (select id from lc_auto_brand where status = 1)'] = null;
}
if ($params['vin']) {
@@ -223,7 +239,14 @@ class Goods extends HD_Controller
$params['sort'] = $sort;
}
$autoList[1] = $this->mdAutoBrand->select(array('status' => 1), 'id desc', 0, 0, 'id,name');
#$autoList[1] = $this->mdAutoBrand->select(array('status' => 1), 'id desc', 0, 0, 'id,name');
if (1 == $params['sold']){
$autoList[1] = $this->mdAutoBrand->map_brand(array('status > -1' => null), false);
}
else{
$autoList[1] = $this->mdAutoBrand->map_brand(array('status = 1' => null), false);
}
switch ($search_type) {
case 1://精品筛选
$count = $this->mdItems->count_fine($where_1);
@@ -387,7 +410,8 @@ class Goods extends HD_Controller
$this->data['autoList'] = $autoList;
$this->data['statusAry'] = $statusAry;
$this->data['_title'] = $_title;
return $this->show_view($view, true);
$this->data['view'] = $view;
return $this->data;
}
public function get()
@@ -849,6 +873,46 @@ class Goods extends HD_Controller
//导出数据列表
public function export()
{
$params = $this->input->get();
$params['page'] = 1;
$params['size'] = 10000;
$this->data = $this->dataSelect($params);
$fileName = "车辆明细";
$indexs = array(
'id' => 'ID',
'brand_name' => '品牌',
's_name' => '车系',
'v_name' => '车型',
'cor_name' => '车身颜色',
'incor_name' => '内饰颜色',
'ori_price' => '指导价',
'sale_price' => '售价',
'bill_price' => '开票金额',
'buy_price' => '采购成本',
'dis_price' => '折扣价',
'discount' => '折扣百分比',
'city_name' => '城市名',
'county_name' => '行政区',
'address' => '存放地址',
'vin' => '车架号',
'engine_num' => '发动机号',
'stdard_num' => '合格证号',
'bill_num' => '开票号',
'auto_fine' => '精品加装',
'company_name' => '公司归属',
'status' => '状态',
'in_time' => '入库时间',
'out_time' => '出库时间',
'bill_time' => '开票时间',
);
$lists = $this->data['lists'];
array_unshift($lists, $indexs);
$this->load->library('excel');
$this->excel->out_csv($lists, $indexs, $fileName . "_" . date('YmdHis'));
}
public function export_()
{
$params = $this->input->get();
$where = $where_1 = $where_2 = $where_3 = $autoList = array();
+3 -1
View File
@@ -43,6 +43,7 @@ class Logs extends HD_Controller
{
$lists = $autoList = array();
$where = array('id<>1' => null, 'status>' => 0);
$where['brand_id in (select id from lc_auto_brand where status > -1)'] = null;
if ($params['brand_id']) {
$where['brand_id'] = $params['brand_id'];
$autoList[2] = $this->mdAutoSeries->select(array('status' => 1, 'brand_id' => $params['brand_id']), 'id desc', 0, 0, 'id,name');
@@ -98,7 +99,8 @@ class Logs extends HD_Controller
} else {
$params['sold'] = '';
}
$autoList[1] = $this->mdAutoBrand->select(array('status' => 1), 'id desc', 0, 0, 'id,name');
//$autoList[1] = $this->mdAutoBrand->select(array('status' => 1), 'id desc', 0, 0, 'id,name');
$autoList[1] = $this->mdAutoBrand->map_brand(array('status > -1' => null), false);
$statusAry = $this->statusAry;
$soldAry = $this->soldAry;
$count = $this->mdItems->count($where);
+1
View File
@@ -97,6 +97,7 @@ class Owners extends HD_Controller
if ($params['sex']) {
$where["a.sex"] = $params['sex'];
}
$where['a.brand_id in (select id from lc_auto_brand where status > -1)'] = null;
if ($params['brand_id']) {
$where["a.brand_id"] = $params['brand_id'];
}
+1
View File
@@ -210,6 +210,7 @@ class Ordersv2List
$where["{$this->t1}.over_time<="] = date('Y-m-d',time()+$e_day*24*60*60);
}
}
$where["{$this->t1}.brand_id in (select id from lc_auto_brand where status > -1)"] = null;
if ($params['brand_id']) {//品牌
$where["{$this->t1}.brand_id"] = $params['brand_id'];
} else {
+2
View File
@@ -36,6 +36,7 @@
<table class="am-table am-table-bordered">
<thead>
<tr>
<th width="5%"><span>ID</span></th>
<th width="25%"><span>车型</span></th>
<th width="10%"><span>创建时间</span></th>
<th width="10%"><span>状态</span></th>
@@ -46,6 +47,7 @@
<?php if ($lists) {
foreach ($lists as $v) { ?>
<tr>
<td><?= $v['id'] ?></td>
<td><?= $v['title'] ?></td>
<td><?= $v['c_time'] ?></td>
<td><?= $v['status_name'] ?></td>
+1 -2
View File
@@ -106,9 +106,8 @@
methods:{},
watch:{}
});
<?php page_script($pager) ?>
});
<?php page_script($pager) ?>
</script>
+1 -1
View File
@@ -409,7 +409,7 @@
url: '/auto/brand/json_lists',
type: 'post',
dataType: 'json',
data: {status: 1},
data: {status: '> -1'}, // data: {status: 1},
beforeSend: function () {
},
success: function (data) {
+1 -1
View File
@@ -318,7 +318,7 @@
url: '/auto/brand/json_lists',
type: 'post',
dataType: 'json',
data: {status: 1},
data: {status: '> -1'}, // data: {status: 1},
beforeSend: function () {
},
success: function (data) {
+41 -1
View File
@@ -72,9 +72,13 @@ class Series extends Wxapp{
];
return $data;
}
//获取车型列表
protected function get_cars(){
if ($this->app_id == 1){
return $this->get_cars_by_brand_id(); // liche根据brand_id取数据
}
$uid = $this->session['uid'];
$id = $this->input_param('id'); //车系id
@@ -123,6 +127,42 @@ class Series extends Wxapp{
}
return $list;
}
protected function get_cars_by_brand_id(){
$id = $this->input_param('id');
$id = $id ? $id : 0;
$where = [
'status' => 1,
'brand_id' => $id
];
$rows = $this->auto_series_model->select($where,'',1,20,'id,brand_id,name');
$list = [];
if($rows){
$first = [];
$brand_arr = array_unique(array_column($rows,'brand_id'));
$brand_ids = implode(',',$brand_arr);
if($brand_ids){
$where = [
"id in ({$brand_ids})" => null,
];
$brand_rows = $this->auto_brand_model->map('id','',$where,'','','','id,name');
}
foreach($rows as $key=>$val){
$brand_name = isset($brand_rows[$val['brand_id']]) ? $brand_rows[$val['brand_id']][0]['name'] : '';
$temp = [
'id' => $val['id'],
'title' => $brand_name.$val['name'],
];
if($val['id']==$id){
$first[] = $temp;
}else{
$list[] = $temp;
}
}
$list = array_merge($first,$list);
}
return $list;
}
//获取车系属性
protected function get_attrs(){
$s_id = $this->input_param('id');
@@ -44,6 +44,7 @@ class Sub_cms extends Wxapp
);
if (is_numeric($position)) {
$where['position'] = $position;
$position == 2 && $where['target_id in (select id from lc_auto_brand where status = 1)'] = null;
} else {
$where["position in ({$position})"] = null;
}
+4 -2
View File
@@ -30,7 +30,8 @@ class Auto extends Wxapp
$this->load->model("biz/biz_model", 'mdBiz');
$id = intval($this->input_param('id'));
$biz_id = intval($this->input_param('biz_id'));
$re = $this->mdAutoIntroduce->get(array('id' => $id, 'status' => 1));
//$re = $this->mdAutoIntroduce->get(array('id' => $id, 'status' => 1));
$re = $this->mdAutoIntroduce->get(array('id' => $id, 'status' => 1, 'brand_id in (select id from lc_auto_brand where status = 1)' => null));
if (!$re || empty($re)) {
throw new Exception('车型介绍不存在!', API_CODE_FAIL);
}
@@ -74,7 +75,8 @@ class Auto extends Wxapp
$this->load->model('receiver/receiver_customers_model', 'mdCustomers');
$this->load->model("biz/biz_model", 'mdBiz');
$this->load->model('auto/auto_introduce_model', 'mdAutoIntroduce');
$re = $this->mdAutoIntroduce->get(array('id' => $id, 'status' => 1));
//$re = $this->mdAutoIntroduce->get(array('id' => $id, 'status' => 1));
$re = $this->mdAutoIntroduce->get(array('id' => $id, 'status' => 1, 'brand_id in (select id from lc_auto_brand where status = 1)' => null));
if (!$re || empty($re)) {
throw new Exception('车型介绍不存在!', API_CODE_SUCCESS);
}
+29
View File
@@ -38,6 +38,35 @@ class Auto_brand_model extends HD_Model
}
return $rows;
}
/**
* 品牌字典
* @param array
* @param bool
* @return array
*/
public function map_brand($where=array(), $map=true){
if ($map){
$map_brand = $this->map('id', 'name', $where, 'status desc, id asc', 0 , 0, 'id, name');
}
else{
$map_brand = $this->select($where, "status desc, id asc", 0, 0, 'id, name');
}
return $map_brand;
}
/**
* 品牌字典带排序,用于select控件
* @param array
* @return array
*/
public function map_brand_list($map_brand){
$map_brand_list = array();
foreach ($map_brand as $key=>$val){
$map_brand_list[" " . $key] = $val;
}
return $map_brand_list;
}
//获取状态
public function get_status(){
return $this->status_arr;