diff --git a/admin/controllers/receiver/Orders.php b/admin/controllers/receiver/Orders.php
index 613cf320..d0289dbb 100644
--- a/admin/controllers/receiver/Orders.php
+++ b/admin/controllers/receiver/Orders.php
@@ -52,8 +52,21 @@ class Orders extends HD_Controller
}
$result = $this->orderslist->lists($params['status_pid'], $params);
$this->data = $result;
+ //获取品牌
+ $brand_rows = $this->auto_brand_model->select(['status>'=>0], 'status desc, id asc', 0, 0, 'id,name');
+ $brands = [];
+ if($brand_rows){
+ foreach ($brand_rows as $v) {
+ $brands[] = array(
+ 'id' => $v['id'],
+ 'name' => $v['name'],
+ );
+ }
+ }
+ $this->data['brands'] = $brands;
$this->data['provinces'] = $this->province_ary();
$this->data['status_arr'] = $status_arr;
+ $this->data['cps_types'] = Receiver_orders_model::CPS_TYPES;
$this->data['_title'] = '订单列表';
return $this->show_view('receiver/order/lists', true);
}
diff --git a/admin/controllers/sys/cps/Brand.php b/admin/controllers/sys/cps/Brand.php
new file mode 100644
index 00000000..3789e223
--- /dev/null
+++ b/admin/controllers/sys/cps/Brand.php
@@ -0,0 +1,138 @@
+load->model("sys/sys_cps_model");
+ $this->load->model("auto/auto_brand_model");
+ }
+
+ public function index()
+ {
+ return $this->lists();
+ }
+
+ public function lists()
+ {
+ $params = $this->input->get();
+ $params['page'] = $params['page'] ? intval($params['page']) : 1;
+ $params['size'] = $params['size'] ? intval($params['size']) : 20;
+ !strlen($params['status']) && $params['status'] = '';
+ $lists = array();
+ $where = [];
+ strlen($params['status']) && $where['status'] = intval($params['status']);
+ $status_lists = Sys_cps_model::STATUS_LISTS;
+ $count = $this->sys_cps_model->count($where);
+ if ($count) {
+ $res = $this->sys_cps_model->select($where, "id desc", $params['page'], $params['size']);
+ foreach ($res as $key => $value) {
+ $brand = $this->auto_brand_model->get(['id' => $value['brand_id']]);
+ $value['brand_name'] = $brand['name'];
+ $value['type_name'] = Sys_cps_model::TYPES[$value['type']];
+ $value['status_name'] = $status_lists[$value['status']];
+ $lists[] = $value;
+ }
+ }
+ $this->data['lists'] = $lists;
+ $this->data['params'] = $params;
+ $this->data['status_lists'] = $status_lists;
+ $this->data['_title'] = 'cps列表';
+ $this->data['pager'] = array('count' => ceil($count / $params['size']), 'curr' => $params['page'], 'totle' => $count);
+ $this->show_view('sys/cps/lists', true);
+ }
+
+ public function get()
+ {
+ $id = intval($this->input->get('id'));
+ $info = ['brand_id' => '', 'type' => Sys_cps_model::TYPE_IMPORTANT];
+ if ($id) {
+ $info = $this->sys_cps_model->get(['id' => $id]);
+ }
+ $brand_rows = $this->auto_brand_model->select(['status' => 1], 'id asc', 0, 0, 'id,name');
+ $brands = [];
+ if ($brand_rows) {
+ foreach ($brand_rows as $v) {
+ $brands[] = array(
+ 'id' => $v['id'],
+ 'name' => $v['name'],
+ );
+ }
+ }
+ $this->data['brands'] = $brands;
+ $this->data['info'] = $info;
+ $this->data['types'] = Sys_cps_model::TYPES;
+ $this->data['_title'] = $id ? '编辑' : '新增';
+ return $this->show_view('sys/cps/edit', true);
+ }
+
+ public function add()
+ {
+ $info = $this->input->post();
+ if (!$info['brand_id'] || !$info['type'] || !$info['s_time'] || !$info['e_time']) {
+ return $this->show_json(SYS_CODE_FAIL, '参数错误');
+ }
+ $data = [
+ 'brand_id' => $info['brand_id'],
+ 'type' => $info['type'],
+ 's_time' => $info['s_time'],
+ 'e_time' => $info['e_time'],
+ ];
+ $res = $this->sys_cps_model->add($data);
+ if (!$res) {
+ return $this->show_json(SYS_CODE_FAIL, '保存失败');
+ }
+ return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
+ }
+
+ public function edit()
+ {
+ $info = $this->input->post();
+ $row = $this->sys_cps_model->get(['id' => $info['id']]);
+ if (!$row) return $this->show_json(SYS_CODE_FAIL, '数据不存在');
+ $up_data = [
+ 'brand_id' => $info['brand_id'],
+ 'type' => $info['type'],
+ 's_time' => $info['s_time'],
+ 'e_time' => $info['e_time'],
+ ];
+ $res = $this->sys_cps_model->update($up_data, ['id' => $info['id']]);
+ if (!$res) {
+ return $this->show_json(SYS_CODE_FAIL, '保存失败');
+ }
+ return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
+ }
+
+ public function del()
+ {
+
+ }
+
+ public function batch()
+ {
+ return false;
+ }
+
+ public function export()
+ {
+ return false;
+ }
+
+ public function edit_status()
+ {
+ $id = $this->input->post('id');
+ $row = $this->sys_cps_model->get(['id' => $id]);
+ if (!$row) return $this->show_json(SYS_CODE_FAIL, '数据不存在');
+ $status = $row['status'] ? 0 : 1;
+ $up_data = [
+ 'status' => $status
+ ];
+ $res = $this->sys_cps_model->update($up_data, ['id' => $id]);
+ if (!$res) {
+ return $this->show_json(SYS_CODE_FAIL, '保存失败');
+ }
+ return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
+ }
+}
diff --git a/admin/libraries/OrdersList.php b/admin/libraries/OrdersList.php
index 370333a4..840da43b 100644
--- a/admin/libraries/OrdersList.php
+++ b/admin/libraries/OrdersList.php
@@ -119,9 +119,9 @@ class OrdersList
$rows_od = $this->ci->mdOrderData->select($where_od, '', 0, 0, 'o_id');
$rows_od && $str_ids = implode(',', array_column($rows_od, 'o_id'));
- if($params['iscontract'] == 1){
+ if ($params['iscontract'] == 1) {
$where["id in({$str_ids})"] = null;
- }else{
+ } else {
$where["id not in({$str_ids})"] = null;
}
@@ -151,6 +151,10 @@ class OrdersList
$params['brand_id'] && $where['brand_id'] = $params['brand_id'];
$params['series_id'] && $where['series_id'] = $params['series_id'];
$params['car_id'] && $where['car_id'] = $params['car_id'];
+ !strlen($params['cps_type']) && $params['cps_type'] = '';
+ if (strlen($params['cps_type'])) {
+ $where['cps_type'] = intval($params['cps_type']);
+ }
//销售员筛选
if ($params['admin_id']) {
$where["sale_id"] = $params['admin_id'];
@@ -188,7 +192,7 @@ class OrdersList
if (strlen($params['status'])) {
$where['status'] = $params['status'];
}
- if($params['admin_biz_str']){
+ if ($params['admin_biz_str']) {
$where["biz_id in ({$params['admin_biz_str']})"] = null;
}
$orderby = "c_time desc";
@@ -291,6 +295,9 @@ class OrdersList
$sale = $this->ci->mdLichebUsers->get(['id' => $val['sale_id']], 'uname');
$fields['admin_name'] = $sale['uname'];
}
+ $fields['cps_type_name'] = Receiver_orders_model::CPS_TYPES[$val['cps_type']];
+ } else {
+ $fields['car_name'] .= "
" . Receiver_orders_model::CPS_TYPES[$val['cps_type']] . "";
}
$lists[] = $fields;
}
@@ -342,6 +349,7 @@ class OrdersList
!$fields['order_time'] && $fields['order_time'] = ['title' => '下定时间'];
!$fields['bill_time'] && $fields['bill_time'] = ['title' => '开票时间'];
!$fields['contract'] && $fields['contract'] = ['title' => '购车合同'];
+ $fields['cps_type_name'] = ['title' => 'CPS品牌'];
}
return $fields;
}
diff --git a/admin/views/index.php b/admin/views/index.php
index 43ee4cfb..be7f4587 100644
--- a/admin/views/index.php
+++ b/admin/views/index.php
@@ -20,6 +20,9 @@
+
+
+
@@ -154,7 +157,7 @@