diff --git a/admin/controllers/biz/store/Store.php b/admin/controllers/biz/store/Store.php index f5958e06..d3770d70 100755 --- a/admin/controllers/biz/store/Store.php +++ b/admin/controllers/biz/store/Store.php @@ -869,6 +869,10 @@ class Store extends HD_Controller } else { $whre['status > -1'] = null; } + if($_SESSION['admin_info']['biz_id']){ + $biz_ids = implode(',',$_SESSION['admin_info']['biz_id']); + $where["id in ($biz_ids)"] = null; + } $province_id && $where['province_id'] = $province_id; $city_id && $where['city_id'] = $city_id; $county_id && $where['county_id'] = $county_id; diff --git a/admin/controllers/receiver/Customer.php b/admin/controllers/receiver/Customer.php index 754ba625..e63fe225 100644 --- a/admin/controllers/receiver/Customer.php +++ b/admin/controllers/receiver/Customer.php @@ -44,6 +44,10 @@ class Customer extends HD_Controller $size = $params['size'] = $params['size'] ? intval($params['size']) : 20; $where = array('status>=0' => null); + if($_SESSION['admin_info']['biz_id']){ + $biz_ids = implode(',',$_SESSION['admin_info']['biz_id']); + $where["biz_id in ($biz_ids)"] = null; + } if (false == strpos($_SERVER['HTTP_HOST'], 'dev')) {//dev时不限制 $where['biz_id<>'] = 1; } diff --git a/admin/controllers/sys/admin/Admin.php b/admin/controllers/sys/admin/Admin.php index 64e20b25..2aaf65a4 100755 --- a/admin/controllers/sys/admin/Admin.php +++ b/admin/controllers/sys/admin/Admin.php @@ -11,6 +11,7 @@ class Admin extends HD_Controller { $this->load->model('sys/Sys_category_model','sysCate'); $this->load->model('sys/Sys_city_model','sysCity'); $this->load->model('app/app_model'); + $this->load->model('biz/biz_model'); } public function index() @@ -83,6 +84,14 @@ class Admin extends HD_Controller { $this->data = $this->_get_info(); $data = $this->sysAdmin->get(['id' => $id]); $json = (array)json_decode($data['other_json']); + //获取已选门店 + if($json['biz_id']){ + $ids = implode(',',$json['biz_id']); + $where = [ + "id in ($ids)" => null + ]; + $this->data['selectBiz'] = $this->biz_model->select($where,'','','','id,biz_name as title'); + } $this->data['username'] = $data['username']; $this->data['role_id'] = $data['role_id']; $this->data['mobile'] = $data['mobile']; @@ -127,11 +136,13 @@ class Admin extends HD_Controller { } //输入流数据获取 $input = $this->_get_input(); + $other_json = []; + $input['biz_id'] && $other_json['biz_id'] = $input['biz_id']; $insert = [ 'username' => $input['username'], 'mobile' => $input['mobile'], 'role_id' => $input['role'], - 'other_json' => json_encode([]), + 'other_json' => json_encode($other_json,JSON_UNESCAPED_UNICODE), 'password' => password_hash($input['password1'],PASSWORD_BCRYPT), 'c_time' => time(), ]; @@ -148,11 +159,13 @@ class Admin extends HD_Controller { } //输入流数据获取 $input = $this->_get_input(); + $other_json = []; + $input['biz_id'] && $other_json['biz_id'] = $input['biz_id']; $upd = [ 'username' => $input['username'], 'mobile' => $input['mobile'], 'role_id' => $input['role'], - 'other_json' => json_encode([]), + 'other_json' => json_encode($other_json,JSON_UNESCAPED_UNICODE), ]; if($this->sysAdmin->update($upd,['id' => $input['id']])) { return $this->show_json(SYS_CODE_SUCCESS,'修改成功!'); @@ -242,6 +255,7 @@ class Admin extends HD_Controller { 'role' => $this->input->post('role'), 'password1' => trim($this->input->post('password1')), 'password2' => trim($this->input->post('password2')), + 'biz_id' => $this->input->post('biz_id'), ]; return $data; } diff --git a/admin/libraries/OrdersList.php b/admin/libraries/OrdersList.php index b73d4ad6..fa66ec4d 100644 --- a/admin/libraries/OrdersList.php +++ b/admin/libraries/OrdersList.php @@ -86,6 +86,10 @@ class OrdersList $view = 'receiver/orders/lists'; } $where['biz_id!='] = 1; + if($_SESSION['admin_info']['biz_id']){ + $biz_ids = implode(',',$_SESSION['admin_info']['biz_id']); + $where["biz_id in ($biz_ids)"] = null; + } if ($params['cf_title']) { $where['rid in (select id from lc_receiver_customers where cf_title = "' . $params['cf_title'] . '")'] = null; } @@ -242,6 +246,10 @@ class OrdersList "$t2.status>=" => 0, "$t2.biz_id!=" => 1, ]; + if($_SESSION['admin_info']['biz_id']){ + $biz_ids = implode(',',$_SESSION['admin_info']['biz_id']); + $where["$t2.biz_id in ($biz_ids)"] = null; + } if ($params['cf_title']) { $where[$t2.'.rid in (select id from lc_receiver_customers where cf_title = "' . $params['cf_title'] . '")'] = null; } @@ -437,6 +445,10 @@ class OrdersList "$t2.status>=" => 0, "$t2.biz_id!=" => 1, ]; + if($_SESSION['admin_info']['biz_id']){ + $biz_ids = implode(',',$_SESSION['admin_info']['biz_id']); + $where["$t2.biz_id in ($biz_ids)"] = null; + } if ($params['cf_title']) { $where[$t2.'.rid in (select id from lc_receiver_customers where cf_title = "' . $params['cf_title'] . '")'] = null; } @@ -586,6 +598,10 @@ class OrdersList "$t2.status>=" => 0, "$t2.biz_id!=" => 1, ]; + if($_SESSION['admin_info']['biz_id']){ + $biz_ids = implode(',',$_SESSION['admin_info']['biz_id']); + $where["$t2.biz_id in ($biz_ids)"] = null; + } if ($params['cf_title']) { $where[$t2.'.rid in (select id from lc_receiver_customers where cf_title = "' . $params['cf_title'] . '")'] = null; } @@ -753,6 +769,10 @@ class OrdersList "$t2.status>=" => 0, "$t2.biz_id!=" => 1, ]; + if($_SESSION['admin_info']['biz_id']){ + $biz_ids = implode(',',$_SESSION['admin_info']['biz_id']); + $where["$t2.biz_id in ($biz_ids)"] = null; + } if ($params['cf_title']) { $where[$t2.'.rid in (select id from lc_receiver_customers where cf_title = "' . $params['cf_title'] . '")'] = null; } @@ -920,6 +940,10 @@ class OrdersList "$t2.status>=" => 0, "$t2.biz_id!=" => 1, ]; + if($_SESSION['admin_info']['biz_id']){ + $biz_ids = implode(',',$_SESSION['admin_info']['biz_id']); + $where["$t2.biz_id in ($biz_ids)"] = null; + } if ($params['cf_title']) { $where[$t2.'.rid in (select id from lc_receiver_customers where cf_title = "' . $params['cf_title'] . '")'] = null; } @@ -1087,6 +1111,10 @@ class OrdersList "$t2.status>=" => 0, "$t2.biz_id!=" => 1, ]; + if($_SESSION['admin_info']['biz_id']){ + $biz_ids = implode(',',$_SESSION['admin_info']['biz_id']); + $where["$t2.biz_id in ($biz_ids)"] = null; + } if ($params['cf_title']) { $where[$t2.'.rid in (select id from lc_receiver_customers where cf_title = "' . $params['cf_title'] . '")'] = null; } diff --git a/admin/views/sys/admin/edit.php b/admin/views/sys/admin/edit.php index d94b4dca..730f5e27 100755 --- a/admin/views/sys/admin/edit.php +++ b/admin/views/sys/admin/edit.php @@ -53,6 +53,33 @@ +
+ +
+
+ + +
+
+ +
+
+ {{item.title}} + + +
+
+
+
+
@@ -63,17 +90,92 @@ data: { role_id: '', role: data['role'])?>, + city_id:'', + county_id: '', + cityAry:[], + countyAry:[], + bizAry:[], + selectBiz:, }, created: function(index) { if('edit' == '') { this.role_id = 'data['role_id']?>'; } }, + mounted: function () { + this.init_citys(); + }, methods: { + init_citys: function () { + var vm = this; + $.get('/common/area',{'id':350,'key':'city','type':1},function(response){ + if (response.code == 1) { + vm.cityAry = response.data; + } + }); + }, setCate: function(index) { }, setCity: function(index) { + }, + addBiz:function(index){ + var in_arr = false + var that = this + if(!that.bizAry[index]['selected']){ + that.bizAry[index]['selected'] = 1 + $.each(that.selectBiz,function(key,val){ + if(that.bizAry[index]['id']==val['id']){ + in_arr = true + } + }) + if(!in_arr){ + that.selectBiz.push(this.bizAry[index]); + } + } + }, + delBiz:function(index){ + var that = this + $.each(that.bizAry,function(key,val){ + if(val['id']==that.selectBiz[index]['id']){ + that.bizAry[key]['selected'] = '' + } + }) + this.selectBiz.splice(index,1) } }, + watch: { + 'city_id': function (nv, ov) { + var that = this; + if (nv == '') { + that.countyAry = []; + that.county_id = ''; + } else { + $.get('/common/area',{'id':nv,'key':'county','type':1},function(response){ + if (response.code == 1) { + that.countyAry = response.data; + } + }); + } + }, + 'county_id': function (nv, ov) { + var that = this; + $.post('/biz/store/store/json_lists',{city_id:that.city_id,county_id:that.county_id,status:1},function(response){ + if (response.code == 1) { + $.each(response.data.list,function(key,val){ + response.data.list[key]['selected'] = '' + if(that.selectBiz){ + $.each(that.selectBiz,function(k,v){ + if(v['id']==val['id']){ + response.data.list[key]['selected'] = 1 + return false + } + }); + } + }); + that.bizAry = response.data.list; + } + }); + }, + } }) diff --git a/sql/sys.sql b/sql/sys.sql index c35d3e88..26f9c814 100644 --- a/sql/sys.sql +++ b/sql/sys.sql @@ -4,7 +4,7 @@ -- Table:lc_sys_admin -- --------------------------- -- other_json:{"cate_id":[1,27], "city_id":["350200", "350500"], "platfrom_id":[0, 1], "app_id":[1,2]} --- cate_id:可操作行业,city_id:可操作城市,platfrom_id:可登录平台,app_id:可操作应用 +-- cate_id:可操作行业,city_id:可操作城市,platfrom_id:可登录平台,app_id:可操作应用,biz_id: 可操作门店 -- --------------------------- drop table if exists lc_sys_admin; create table lc_sys_admin(